From e3978fd3ee3a01aedb353ffa01d9f4a1cbc64245 Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Tue, 9 Jul 2002 13:39:46 +0000 Subject: [PATCH] Herbert's work-around to xforms image width for xforms <= 0.89.6. 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 | 5 +++++ src/frontends/xforms/xformsImage.C | 17 ++++++++++++----- src/graphics/ChangeLog | 4 +++- src/graphics/GraphicsImageXPM.C | 11 ++++++----- 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index 1d6bd7243c..88eb946d13 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,8 @@ +2002-07-09 Angus Leeming + + * xformsImage.C (scale): use boost::tie. + (statusCB): fudge to fix bug in image width for xforms <= 0.89.6. + 2002-07-08 Angus Leeming * forms/fdfix.sh: whitespace. diff --git a/src/frontends/xforms/xformsImage.C b/src/frontends/xforms/xformsImage.C index 4c5847f293..785143c6c1 100644 --- a/src/frontends/xforms/xformsImage.C +++ b/src/frontends/xforms/xformsImage.C @@ -30,6 +30,8 @@ # endif #endif +#include + 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 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 diff --git a/src/graphics/ChangeLog b/src/graphics/ChangeLog index 2f065086c0..785c90dc13 100644 --- a/src/graphics/ChangeLog +++ b/src/graphics/ChangeLog @@ -1,4 +1,4 @@ -2002-07-08 Angus Leeming +2002-07-09 Angus Leeming * 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 * PreviewLoader.C: use of preview_size_factor to get the right diff --git a/src/graphics/GraphicsImageXPM.C b/src/graphics/GraphicsImageXPM.C index 9bdef0b368..f2a8572ce0 100644 --- a/src/graphics/GraphicsImageXPM.C +++ b/src/graphics/GraphicsImageXPM.C @@ -24,6 +24,8 @@ #include // cos, sin #include // malloc, free +#include + #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 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; -- 2.39.2