]> git.lyx.org Git - features.git/commitdiff
J�rgen S's activation of intelligent code rather than my dumb attempt.
authorAngus Leeming <leeming@lyx.org>
Mon, 11 Feb 2002 18:57:30 +0000 (18:57 +0000)
committerAngus Leeming <leeming@lyx.org>
Mon, 11 Feb 2002 18:57:30 +0000 (18:57 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3524 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/xforms/ChangeLog
src/frontends/xforms/FormParagraph.C
src/frontends/xforms/xforms_helpers.C

index 40fd0667f136b80af8027a707f2d184d90c80383..40eeea08f480763e0b594512ad2800616f06c241 100644 (file)
@@ -3,6 +3,14 @@
        * FormMinipage.C: return SMI_VALID on other form changes
  
 2002-02-10  Rob Lahaye  <lahaye@users.sourceforge.net>
+2002-02-11  Juergen Spitzmueller  <j.spitzmueller@gmx.de>
+
+       * FormParagraph.C (update): [VSpace:] Delete the special method
+       for gluelengths...
+       * xforms_helpers.C: ...and move it here.
+       Activate JMarcs new (shorter) code for updateWidgetsFromLengthString
+       and updateWidgetsFromLength.
+
  
        * forms/form_external.fd:
        * form_external.C: change color2 of a few buttons into the
index 91943ac01b3c6a3edac4ccaf8660edb19f4b0fe2..c4fa2e4489588e66e9dcf7bbdf5d397b2261c068 100644 (file)
@@ -412,14 +412,9 @@ void FormParagraph::update()
         bool const metric = lyxrc.default_papersize > 3;
         string const default_unit = metric ? "cm" : "in";
         string const length = par_->params().spaceTop().length().asString();
-       //check if there's a stretch or shrink factor
-       if (!isValidLength(length) && !isStrDbl(length))
-               fl_set_input(dialog_->input_space_above, length.c_str());
-       else {
-               updateWidgetsFromLengthString(dialog_->input_space_above,
+       updateWidgetsFromLengthString(dialog_->input_space_above,
                                              dialog_->choice_value_space_above,
                                              length, default_unit);
-       }
        break;
     }
     }
@@ -458,14 +453,9 @@ void FormParagraph::update()
         string const default_unit = metric ? "cm" : "in";
         string const length =
                par_->params().spaceBottom().length().asString();
-       //check if there's a stretch or shrink factor
-       if (!isValidLength(length) && !isStrDbl(length))
-               fl_set_input(dialog_->input_space_below, length.c_str());
-       else {
-               updateWidgetsFromLengthString(dialog_->input_space_below,
+       updateWidgetsFromLengthString(dialog_->input_space_below,
                                              dialog_->choice_value_space_below,
                                              length, default_unit);
-       }
        break;
     }
     }
index c2c47902f46e28e6018f641f76d70e563783c6e8..39dfd00a0e4a167fe117632c208d55e1f19e9bbc 100644 (file)
@@ -170,7 +170,9 @@ string getLengthFromWidgets(FL_OBJECT * input, FL_OBJECT * choice)
 }
        
 
-#if 1
+#if 0
+// old code which can be deleted if the new one, now enabled,
+// works satisfyingly (JSpitzm, 11/02/2002)
 // this should definitely be the other way around!!!
 void updateWidgetsFromLength(FL_OBJECT * input, FL_OBJECT * choice,
                             LyXLength const & len,
@@ -179,6 +181,11 @@ void updateWidgetsFromLength(FL_OBJECT * input, FL_OBJECT * choice,
        if (len.zero())
                updateWidgetsFromLengthString(input, choice,
                                              string(), default_unit);
+       // use input field only for gluelengths
+       else if (!isValidLength(len) && !isStrDbl(len)) {
+               fl_set_input(input, len.c_str());
+               fl_set_choice_text(choice, default_unit.c_str());
+       }
        else
                updateWidgetsFromLengthString(input, choice,
                                              len.asString(), default_unit);
@@ -252,8 +259,14 @@ void updateWidgetsFromLengthString(FL_OBJECT * input, FL_OBJECT * choice,
                                   string const & str,
                                   string const & default_unit)
 {
-       updateWidgetsFromLength(input, choice,
+       // use input field only for gluelengths
+       if (!isValidLength(str) && !isStrDbl(str)) {
+               fl_set_input(input, str.c_str());
+               fl_set_choice_text(choice, default_unit.c_str());
+       } else {
+               updateWidgetsFromLength(input, choice,
                                LyXLength(str), default_unit);
+       }
 }