]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiHSpace.cpp
* fix spelling in comments to please John.
[lyx.git] / src / frontends / qt4 / GuiHSpace.cpp
index 63bccc5ff1c7412d19db9682cb217514036e6f96..07b98aee23b6064f0734e0a9d6f7bf30fe52215c 100644 (file)
@@ -57,7 +57,10 @@ GuiHSpace::GuiHSpace(GuiView & lv, bool math)
        connect(fillPatternCO, SIGNAL(activated(int)),
                this, SLOT(patternChanged()));
 
-       valueLE->setValidator(unsignedLengthValidator(valueLE));
+       if (params_.math)
+               valueLE->setValidator(unsignedLengthValidator(valueLE));
+       else
+               valueLE->setValidator(unsignedGlueLengthValidator(valueLE));
 
        // Manage the ok, apply, restore and cancel/close buttons
        bc().setPolicy(ButtonPolicy::OkApplyCancelReadOnlyPolicy);
@@ -74,9 +77,6 @@ GuiHSpace::GuiHSpace(GuiView & lv, bool math)
 
        // initialize the length validator
        bc().addCheckedLineEdit(valueLE, valueL);
-
-       // remove the %-items from the unit choice
-       unitCO->noPercents();
 }
 
 
@@ -248,9 +248,10 @@ static void setWidgetsFromHSpace(InsetSpaceParams const & params,
        keep->setChecked(protect);
 
        Length::UNIT const default_unit = Length::defaultUnit();
-       if (item == (params.math ? 9 : 7))
-               lengthToWidgets(value, unit, params.length, default_unit);
-       else
+       if (item == (params.math ? 9 : 7)) {
+               string length = params.length.asString();
+               lengthToWidgets(value, unit, length, default_unit);
+       } else
                lengthToWidgets(value, unit, "", default_unit);
 }
 
@@ -272,7 +273,7 @@ static InsetSpaceParams setHSpaceFromWidgets(int spacing,
                case 8: params.kind = InsetSpaceParams::QQUAD;     break;
                case 9:
                        params.kind = InsetSpaceParams::CUSTOM;
-                       params.length = Length(widgetsToLength(value, unit));
+                       params.length = GlueLength(widgetsToLength(value, unit));
                        break;
                }
                return params;
@@ -326,7 +327,7 @@ static InsetSpaceParams setHSpaceFromWidgets(int spacing,
                                params.kind = InsetSpaceParams::CUSTOM_PROTECTED;
                        else
                                params.kind = InsetSpaceParams::CUSTOM;
-                       params.length = Length(widgetsToLength(value, unit));
+                       params.length = GlueLength(widgetsToLength(value, unit));
                        break;
        }
        return params;