X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt4%2FGuiHSpace.cpp;h=07b98aee23b6064f0734e0a9d6f7bf30fe52215c;hb=425d092204118ea6c24c28e85fdf03fcf2bb51a4;hp=1967c2431d75e3015a04cb4cf989daf5f192bb4d;hpb=ac1fd9b37fde92d2411de11c2e63581e9ab17470;p=lyx.git diff --git a/src/frontends/qt4/GuiHSpace.cpp b/src/frontends/qt4/GuiHSpace.cpp index 1967c2431d..07b98aee23 100644 --- a/src/frontends/qt4/GuiHSpace.cpp +++ b/src/frontends/qt4/GuiHSpace.cpp @@ -16,7 +16,6 @@ #include "qt_helpers.h" #include "Validator.h" -#include "LyXRC.h" #include "Spacing.h" #include "FuncRequest.h" @@ -58,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); @@ -75,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,11 +247,11 @@ static void setWidgetsFromHSpace(InsetSpaceParams const & params, fillPattern->setCurrentIndex(pattern); keep->setChecked(protect); - Length::UNIT default_unit = - (lyxrc.default_papersize > 3) ? Length::CM : Length::IN; - if (item == (params.math ? 9 : 7)) - lengthToWidgets(value, unit, params.length, default_unit); - else + Length::UNIT const default_unit = Length::defaultUnit(); + if (item == (params.math ? 9 : 7)) { + string length = params.length.asString(); + lengthToWidgets(value, unit, length, default_unit); + } else lengthToWidgets(value, unit, "", default_unit); } @@ -274,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; @@ -328,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;