}
-void InsetGraphicsParams::operator=(InsetGraphicsParams const & params)
+InsetGraphicsParams & InsetGraphicsParams::operator=(InsetGraphicsParams const & params)
{
// Are we assigning the object into itself?
if (this == ¶ms)
- return;
+ return *this;
copy(params);
+ return *this;
}
{
filename.erase();
lyxscale = 100; // lyx scaling in percentage
- display = true; // may be overriden by display mode in preferences
+ display = true; // may be overridden by display mode in preferences
scale = string("100"); // output scaling in percentage
width = Length();
height = Length();
bbox = graphics::BoundingBox(); // bounding box
clip = false; // clip image
+ darkModeSensitive = false; // dark mode dependency
rotateAngle = "0"; // angle of rotation in degrees
rotateOrigin.erase(); // Origin of rotation
}
-void InsetGraphicsParams::copy(InsetGraphicsParams const & igp)
+void InsetGraphicsParams::copy(InsetGraphicsParams const & params)
{
- filename = igp.filename;
- lyxscale = igp.lyxscale;
- display = igp.display;
- scale = igp.scale;
- width = igp.width;
- height = igp.height;
- keepAspectRatio = igp.keepAspectRatio;
- draft = igp.draft;
- scaleBeforeRotation = igp.scaleBeforeRotation;
-
- bbox = igp.bbox;
- clip = igp.clip;
-
- rotateAngle = igp.rotateAngle;
- rotateOrigin = igp.rotateOrigin;
- special = igp.special;
- groupId = igp.groupId;
+ filename = params.filename;
+ lyxscale = params.lyxscale;
+ display = params.display;
+ scale = params.scale;
+ width = params.width;
+ height = params.height;
+ keepAspectRatio = params.keepAspectRatio;
+ draft = params.draft;
+ scaleBeforeRotation = params.scaleBeforeRotation;
+
+ bbox = params.bbox;
+ clip = params.clip;
+ darkModeSensitive = params.darkModeSensitive;
+
+ rotateAngle = params.rotateAngle;
+ rotateOrigin = params.rotateOrigin;
+ special = params.special;
+ groupId = params.groupId;
}
left.bbox == right.bbox &&
left.clip == right.clip &&
+ left.darkModeSensitive == right.darkModeSensitive &&
left.rotateAngle == right.rotateAngle &&
left.rotateOrigin == right.rotateOrigin &&
os << "\tlyxscale " << lyxscale << '\n';
if (!display)
os << "\tdisplay false\n";
+ if (darkModeSensitive)
+ os << "\tdarkModeSensitive\n";
if (!scale.empty() && !float_equal(convert<double>(scale), 0.0, 0.05)) {
if (!float_equal(convert<double>(scale), 100.0, 0.05))
os << "\tscale " << scale << '\n';
}
-bool InsetGraphicsParams::Read(Lexer & lex, string const & token, string const & bufpath)
+bool InsetGraphicsParams::Read(Lexer & lex, string const & token,
+ Buffer const & buf, bool allowOrigin)
{
if (token == "filename") {
lex.eatLine();
- filename.set(lex.getString(), bufpath);
+ if (allowOrigin)
+ filename = buf.getReferencedFileName(lex.getString());
+ else
+ filename.set(lex.getString(), buf.filePath());
} else if (token == "lyxscale") {
lex.next();
lyxscale = lex.getInteger();
} else if (token == "display") {
lex.next();
- string const type = lex.getString();
display = lex.getString() != "false";
+ } else if (token == "darkModeSensitive") {
+ darkModeSensitive = true;
} else if (token == "scale") {
lex.next();
scale = lex.getString();
}
// Paranoia check.
- int const width = pars.bb.xr.inBP() - pars.bb.xl.inBP();
- int const height = pars.bb.yt.inBP() - pars.bb.yb.inBP();
-
- if (width < 0 || height < 0) {
+ if (pars.bb.xr.inBP() < pars.bb.xl.inBP()
+ || pars.bb.yt.inBP() < pars.bb.yb.inBP()) {
pars.bb.xl = Length();
pars.bb.xr = Length();
pars.bb.yb = Length();