+2003-12-04 Angus Leeming <leeming@lyx.org>
+
+ * insetexternal.C (draw): update the xo_, yo_ cache.
+
+ * ExternalTransforms.[Ch] (ResizeData): add a usingScale member function.
+ (RotationDataType): new helper struct wrapping the
+ RotationData::OriginType enum.
2003-12-03 André Pönitz <poenitz@gmx.net>
bool ResizeData::no_resize() const
{
- return float_equal(scale, 0.0, 0.05) &&
- width.zero() && height.zero();
+ return !usingScale() && width.zero() && height.zero();
+}
+
+
+bool ResizeData::usingScale() const
+{
+ return !float_equal(scale, 0.0, 0.05);
}
return string();
std::ostringstream os;
- if (!float_equal(data.scale, 0.0, 0.05)) {
+ if (data.usingScale()) {
double const scl = data.scale / 100.0;
os << "\\scalebox{" << scl << "}{" << scl << "}{";
} else {
+ string width = "!";
+ string height = "!";
+ if (data.keepAspectRatio) {
+ if (data.width.inPixels(10) > data.height.inPixels(10))
+ width = data.width.asLatexString();
+ else
+ height = data.height.asLatexString();
+ } else {
+ if (!data.width.zero())
+ width = data.width.asLatexString();
+ if (!data.height.zero())
+ height = data.height.asLatexString();
+ }
+
os << "\\resizebox{"
- << (data.width.zero() ?
- "!" : data.width.asLatexString()) << "}{"
- << (data.height.zero() ?
- "!" : data.height.asLatexString()) << "}{";
+ << width << "}{"
+ << height << "}{";
}
return os.str();
}
return string();
std::ostringstream os;
- if (!float_equal(data.scale, 0.0, 0.05)) {
+ if (data.usingScale()) {
if (!float_equal(data.scale, 100.0, 0.05))
os << "scale=" << data.scale / 100.0 << ',';
return os.str();
ResizeData() : scale(0), keepAspectRatio(false) {}
bool no_resize() const;
+ bool usingScale() const;
+
float scale;
LyXLength width;
LyXLength height;
};
+/** \c RotationDataType is a wrapper for RotationData::OriginType
+ * It can be forward-declared and passed as a function argument without
+ * having to expose this header file.
+ */
+class RotationDataType {
+ RotationData::OriginType val_;
+public:
+ RotationDataType(RotationData::OriginType val) : val_(val) {}
+ operator RotationData::OriginType() const { return val_; }
+};
+
+
/*
* Transformers generating commands
*/