}
-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();
}
-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 == "scale") {
lex.next();
}
// 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();