]> git.lyx.org Git - features.git/commitdiff
Use lyx::float_equal with floats.
authorAngus Leeming <leeming@lyx.org>
Thu, 31 Oct 2002 11:25:02 +0000 (11:25 +0000)
committerAngus Leeming <leeming@lyx.org>
Thu, 31 Oct 2002 11:25:02 +0000 (11:25 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5561 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/xforms/ChangeLog
src/frontends/xforms/FormGraphics.C

index a9d0db9a9cb6abddcc3b0a42d5e2b1044603bf17..b05c6bb7d8d327648428b4e2f43065f2ec93df98 100644 (file)
@@ -2,6 +2,8 @@
 
        * xformsImage.C (clip): fix crash caused by uint -> int nastiness.
 
+       * FormGraphics.C: use lyx::float_equal.
+
 2002-10-29  Rob Lahaye  <lahaye@snu.ac.kr>
 
        * FormParagraph.[Ch]:
index ba500569d255a1bdda0ba32a9b0dc4444db0c243..a87b169a327e6ec0e6744d86502525886036f21c 100644 (file)
@@ -111,10 +111,10 @@ void FormGraphics::build()
        fl_set_input_return(file_->input_height, FL_RETURN_CHANGED);
 
        fl_set_input_maxchars(file_->input_filename, FILENAME_MAXCHARS);
-       fl_set_input_filter(file_->input_lyxscale, fl_unsigned_float_filter);
+       fl_set_input_filter(file_->input_lyxscale, fl_unsigned_int_filter);
 
-       // width default is scaling, thus unsigned integer input
-       fl_set_input_filter(file_->input_width, fl_unsigned_int_filter);
+       // width default is scaling: use unsigned float filter
+       fl_set_input_filter(file_->input_width, fl_unsigned_float_filter);
        fl_set_input_maxchars(file_->input_height, SIZE_MAXDIGITS);
        
        string const display_List =
@@ -433,7 +433,7 @@ void FormGraphics::update() {
        }
 
        // set width input fields according to scaling or width/height input
-       if (igp.scale) {
+       if (!lyx::float_equal(igp.scale, 0.0, 0.05)) {
                fl_set_input_filter(file_->input_width, fl_unsigned_float_filter);
                fl_set_input_maxchars(file_->input_width, 0);
                fl_set_input(file_->input_width, tostr(igp.scale).c_str());
@@ -449,7 +449,7 @@ void FormGraphics::update() {
                                igp.height, defaultUnit);
 
        // disable height input in case of scaling
-       bool const disable_height = igp.scale != 0.0;
+       bool const disable_height = !lyx::float_equal(igp.scale, 0.0, 0.05);
        setEnabled(file_->input_height, !disable_height);
        setEnabled(file_->choice_height, !disable_height);
        
@@ -582,7 +582,7 @@ ButtonPolicy::SMInput FormGraphics::input(FL_OBJECT * ob, long)
                
                // allow only integer intput for scaling; float otherwise
                if (scaling) {
-                       fl_set_input_filter(file_->input_width, fl_unsigned_int_filter);
+                       fl_set_input_filter(file_->input_width, fl_unsigned_float_filter);
                        fl_set_input_maxchars(file_->input_width, 0);
                } else {
                        fl_set_input_filter(file_->input_width, NULL);