]> git.lyx.org Git - lyx.git/commitdiff
Herbert's work-around to xforms image width for xforms <= 0.89.6.
authorAngus Leeming <leeming@lyx.org>
Tue, 9 Jul 2002 13:39:46 +0000 (13:39 +0000)
committerAngus Leeming <leeming@lyx.org>
Tue, 9 Jul 2002 13:39:46 +0000 (13:39 +0000)
Use boost::tie now that I've upgraded my compiler ;-)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4568 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/xforms/ChangeLog
src/frontends/xforms/xformsImage.C
src/graphics/ChangeLog
src/graphics/GraphicsImageXPM.C

index 1d6bd7243cc217f22c09795c561b41ae627bfbc5..88eb946d134060cfa13ddedc809099e3efcdefbc 100644 (file)
@@ -1,3 +1,8 @@
+2002-07-09  Angus Leeming  <leeming@lyx.org>
+
+       * xformsImage.C (scale): use boost::tie.
+       (statusCB): fudge to fix bug in image width for xforms <= 0.89.6.
+
 2002-07-08  Angus Leeming  <leeming@lyx.org>
 
        * forms/fdfix.sh: whitespace.
index 4c5847f293ff41762bad61c7b4918da5cd22af2c..785143c6c11e9f40acc438839ac4cb4bc1310402 100644 (file)
@@ -30,6 +30,8 @@
 # endif
 #endif
 
+#include <boost/tuple/tuple.hpp>
+
 using std::find_if;
 
 namespace {
@@ -150,7 +152,14 @@ unsigned int xformsImage::getWidth() const
 {
        if (!image_)
                return 0;
+
+#if FL_VERSION == 0 && FL_REVISION == 89 && FL_FIXLEVEL <= 6
+       // Used to fix a bug in xforms <= 0.89.6 which 
+       // crops the image unnecessarily.
+       return image_->w + 5;
+#else
        return image_->w;
+#endif
 }
 
 
@@ -305,11 +314,9 @@ void xformsImage::scale(Params const & params)
        if (!image_)
                return;
 
-       // boost::tie produces horrible compilation errors on my machine
-       // Angus 25 Feb 2002
-       std::pair<unsigned int, unsigned int> d = getScaledDimensions(params);
-       unsigned int const width  = d.first;
-       unsigned int const height = d.second;
+       unsigned int width;
+       unsigned int height;
+       boost::tie(width, height) = getScaledDimensions(params);
 
        if (width == getWidth() && height == getHeight())
                // No scaling needed
index 2f065086c0864512cabd9ef69d1b4d4fbdb05e0c..785c90dc1354f19549b95ccf0f28fa5b6f097d02 100644 (file)
@@ -1,4 +1,4 @@
-2002-07-08  Angus Leeming  <leeming@lyx.org>
+2002-07-09  Angus Leeming  <leeming@lyx.org>
 
        * PreviewLoader.C: Further refactoring of the code. Should now be
        pretty clean.
@@ -7,6 +7,8 @@
        past its sell-by date. The code to read the metrics file is now found
        as a helper function in PreviewLoader.C.
 
+       * GraphicsImageXPM.C (scale): use boost::tie.
+
 2002-07-08  Herbert Voss  <voss@lyx.org>
 
        * PreviewLoader.C: use of preview_size_factor to get the right
index 9bdef0b368616ebf5d2212a120911b40052a453e..f2a8572ce0b267caa895b2a8593f95afefcc8f29 100644 (file)
@@ -24,6 +24,8 @@
 #include <cmath>                  // cos, sin
 #include <cstdlib>                // malloc, free
 
+#include <boost/tuple/tuple.hpp>
+
 #include FORMS_H_LOCATION
  
 #ifndef CXX_GLOBAL_CSTD
@@ -356,11 +358,10 @@ void ImageXPM::scale(Params const & params)
 
        typedef unsigned int dimension;
 
-       // boost::tie produces horrible compilation errors on my machine
-       // Angus 25 Feb 2002
-       std::pair<dimension, dimension> d = getScaledDimensions(params);
-       dimension const new_width  = d.first;
-       dimension const new_height = d.second;
+       dimension new_width;
+       dimension new_height;
+       boost::tie(new_width, new_height) = getScaledDimensions(params);
+
        if (new_width == getWidth() && new_height == getHeight())
                // No scaling needed
                return;