]> git.lyx.org Git - lyx.git/blobdiff - src/graphics/GraphicsParams.C
Herbert's and my fixes to the graphics inset.
[lyx.git] / src / graphics / GraphicsParams.C
index 0ddcff4ba67e42fe02f7d5055da31afaebab872e..5a84963f0dc668ffb6e31ad042df1a076f81950f 100644 (file)
@@ -114,25 +114,16 @@ BoundingBox::BoundingBox(string const & bb)
        if (bb.empty())
                return;
 
-       string tmp1;
-       string tmp2 = split(bb, tmp1, ' ');
-       if (!isValidLength(tmp1))
-               return;
-
-       LyXLength const length_xl(tmp1);
-
-       tmp2 = split(tmp2, tmp1, ' ');
-       if (!isValidLength(tmp1))
-               return;
-
-       LyXLength const length_yb(tmp1);
-
-       tmp2 = split(tmp2, tmp1, ' ');
-       if (!isValidLength(tmp1) || !isValidLength(tmp2))
-               return;
+       std::istringstream is(bb.c_str());
+       string a, b, c, d;
+       is >> a >> b >> c >> d;
 
-       LyXLength const length_xr(tmp1);
-       LyXLength const length_yt(tmp2);
+       // Don't need to check that the strings are valid LyXLength's
+       // because this is done in the LyXLength c-tor.
+       LyXLength const length_xl(a);
+       LyXLength const length_yb(b);
+       LyXLength const length_xr(c);
+       LyXLength const length_yt(d);
 
        // inPixels returns the length in inches, scaled by
        // lyxrc.dpi and lyxrc.zoom.
@@ -149,7 +140,7 @@ BoundingBox::BoundingBox(string const & bb)
        unsigned int const yt_tmp =
                uint(scaling_factor * length_yt.inPixels(1, 1));
 
-       if (xr <= xl || yt <= yb)
+       if (xr_tmp <= xl_tmp || yt_tmp <= yb_tmp)
                return;
 
        xl = xl_tmp;