From: Angus Leeming Date: Thu, 31 Oct 2002 11:33:49 +0000 (+0000) Subject: (Rob Lahaye): read and write latex height data of graphic correctly. X-Git-Tag: 1.6.10~18042 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=b3e2ee2a8d2117d7a23f8d504f05c1a47510d8ea;p=lyx.git (Rob Lahaye): read and write latex height data of graphic correctly. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5562 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 8dd5971294..a70f289dc5 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,9 @@ +2002-10-31 Rob Lahaye + + * insetgraphicsParams.C (Write): use lyx::float_equal. + Write height data correctly. + (Read): zero scale when reading height data. + 2002-10-30 John Levon * insetfloat.C (addToTOC): recursively traverse all diff --git a/src/insets/insetgraphics.C b/src/insets/insetgraphics.C index dbaf7813e4..dd92daaba0 100644 --- a/src/insets/insetgraphics.C +++ b/src/insets/insetgraphics.C @@ -18,7 +18,6 @@ TODO * Add a way to roll the image file into the file format. * When loading, if the image is not found in the expected place, try to find it in the clipart, or in the same directory with the image. - * Keep a tab on the image file, if it changes, update the lyx view. * The image choosing dialog could show thumbnails of the image formats it knows of, thus selection based on the image instead of based on filename. diff --git a/src/insets/insetgraphicsParams.C b/src/insets/insetgraphicsParams.C index 2a4c0b0040..ad012fd9fe 100644 --- a/src/insets/insetgraphicsParams.C +++ b/src/insets/insetgraphicsParams.C @@ -142,16 +142,16 @@ void InsetGraphicsParams::Write(ostream & os) const os << "\tlyxscale " << lyxscale << '\n'; if (display != grfx::DefaultDisplay) os << "\tdisplay " << grfx::displayTranslator.find(display) << '\n'; - if (scale) { + if (!lyx::float_equal(scale, 0.0, 0.05)) { if (!lyx::float_equal(scale, 100.0, 0.05)) os << "\tscale " << scale << '\n'; } else { if (!width.zero()) os << "\twidth " << width.asString() << '\n'; + if (!height.zero()) + os << "\theight " << height.asString() << '\n'; } - if (!height.zero()) - os << "\theight " << height.asString() << '\n'; if (keepAspectRatio) os << "\tkeepAspectRatio\n"; if (draft) // draft mode @@ -199,6 +199,7 @@ bool InsetGraphicsParams::Read(LyXLex & lex, string const & token) } else if (token == "height") { lex.next(); height = LyXLength(lex.getString()); + scale = 0.0; } else if (token == "keepAspectRatio") { keepAspectRatio = true; } else if (token == "draft") { @@ -206,9 +207,12 @@ bool InsetGraphicsParams::Read(LyXLex & lex, string const & token) } else if (token == "noUnzip") { noUnzip = true; } else if (token == "BoundingBox") { - for (int i=0; i<4 ;i++) { + bb.erase(); + for (int i = 0; i < 4; ++i) { + if (i != 0) + bb += " "; lex.next(); - bb += (lex.getString()+" "); + bb += lex.getString(); } } else if (token == "clip") { clip = true;