The patch removes VSPACE::NONE from both the qt and the xforms dialog. I haven't touched the inset (and won't). One problem left (in both frontends): what do I have to do to let the ok/apply buttons be enabled if I insert a *new* inset? Currently I have to change sth in the dialog to be able to apply. And a question: does the "Restore" button make any sense in this dialog?
Thanks, Jürgen.
? src/frontends/qt2/QBox.C ? src/frontends/qt2/QBox.h ? src/frontends/qt2/ui/QBoxDialogBase.ui Index: src/frontends/qt2/QVSpace.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QVSpace.C,v retrieving revision 1.3 diff -u -r1.3 QVSpace.C --- src/frontends/qt2/QVSpace.C 1 Dec 2003 07:54:02 -0000 1.3 +++ src/frontends/qt2/QVSpace.C 1 Dec 2003 10:10:23 -0000 @@ -50,26 +50,23 @@ { int item = 0; switch (space.kind()) { - case VSpace::NONE: - item = 0; - break; case VSpace::DEFSKIP: - item = 1; + item = 0; break; case VSpace::SMALLSKIP: - item = 2; + item = 1; break; case VSpace::MEDSKIP: - item = 3; + item = 2; break; case VSpace::BIGSKIP: - item = 4; + item = 3; break; case VSpace::VFILL: - item = 5; + item = 4; break; case VSpace::LENGTH: - item = 6; + item = 5; break; } spacing->setCurrentItem(item); @@ -96,28 +93,25 @@ LengthCombo * unit, bool keep) { - VSpace space = VSpace(VSpace::NONE); + VSpace space = VSpace(VSpace::DEFSKIP); switch (spacing) { case 0: - space = VSpace(VSpace::NONE); - break; - case 1: space = VSpace(VSpace::DEFSKIP); break; - case 2: + case 1: space = VSpace(VSpace::SMALLSKIP); break; - case 3: + case 2: space = VSpace(VSpace::MEDSKIP); break; - case 4: + case 3: space = VSpace(VSpace::BIGSKIP); break; - case 5: + case 4: space = VSpace(VSpace::VFILL); break; - case 6: + case 5: space = VSpace(LyXGlueLength( widgetsToLength(value, unit))); break; @@ -163,10 +157,10 @@ { // spacing // If a vspace choice is "Length" but there's no text in - // the input field, reset the choice to "None". + // the input field, do not insert a vspace at all. if (dialog_->spacingCO->currentItem() == 6 && dialog_->valueLE->text().isEmpty()) - dialog_->spacingCO->setCurrentItem(0); + return; VSpace const space = setVSpaceFromWidgets(dialog_->spacingCO->currentItem(), Index: src/frontends/qt2/QVSpaceDialog.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QVSpaceDialog.C,v retrieving revision 1.2 diff -u -r1.2 QVSpaceDialog.C --- src/frontends/qt2/QVSpaceDialog.C 29 Nov 2003 17:25:30 -0000 1.2 +++ src/frontends/qt2/QVSpaceDialog.C 1 Dec 2003 10:10:23 -0000 @@ -52,7 +52,7 @@ void QVSpaceDialog::enableCustom(int) { - bool const enable = spacingCO->currentItem()==6; + bool const enable = spacingCO->currentItem()==5; valueLE->setEnabled(enable); unitCO->setEnabled(enable); } Index: src/frontends/qt2/ui/QVSpaceDialogBase.ui =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/ui/QVSpaceDialogBase.ui,v retrieving revision 1.2 diff -u -r1.2 QVSpaceDialogBase.ui --- src/frontends/qt2/ui/QVSpaceDialogBase.ui 29 Nov 2003 17:25:31 -0000 1.2 +++ src/frontends/qt2/ui/QVSpaceDialogBase.ui 1 Dec 2003 10:10:24 -0000 @@ -13,7 +13,7 @@ <rect> <x>0</x> <y>0</y> - <width>335</width> + <width>331</width> <height>140</height> </rect> </property> @@ -115,12 +115,6 @@ </widget> <widget row="0" column="1" > <class>QComboBox</class> - <item> - <property> - <name>text</name> - <string>None</string> - </property> - </item> <item> <property> <name>text</name> Index: src/frontends/xforms/FormVSpace.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FormVSpace.C,v retrieving revision 1.3 diff -u -r1.3 FormVSpace.C --- src/frontends/xforms/FormVSpace.C 29 Nov 2003 20:13:50 -0000 1.3 +++ src/frontends/xforms/FormVSpace.C 1 Dec 2003 10:10:25 -0000 @@ -54,14 +54,14 @@ BOOST_ASSERT(choice_type && choice_type->objclass == FL_CHOICE && input_length && input_length->objclass == FL_INPUT); - if (fl_get_choice(choice_type) != 7) + if (fl_get_choice(choice_type) != 6) return; // If a vspace kind is "Length" but there's no text in - // the input field, reset the kind to "None". + // the input field, insert nothing. string const input = rtrim(getString(input_length)); if (input.empty()) - fl_set_choice(choice_type, 1); + return; } @@ -75,28 +75,25 @@ input_length && input_length->objclass == FL_INPUT && choice_length && choice_length->objclass == FL_CHOICE); - VSpace space = VSpace(VSpace::NONE); + VSpace space = VSpace(VSpace::DEFSKIP); switch (fl_get_choice(choice_type)) { case 1: - space = VSpace(VSpace::NONE); - break; - case 2: space = VSpace(VSpace::DEFSKIP); break; - case 3: + case 2: space = VSpace(VSpace::SMALLSKIP); break; - case 4: + case 3: space = VSpace(VSpace::MEDSKIP); break; - case 5: + case 4: space = VSpace(VSpace::BIGSKIP); break; - case 6: + case 5: space = VSpace(VSpace::VFILL); break; - case 7: + case 6: space = VSpace(LyXGlueLength( getLengthFromWidgets(input_length, choice_length))); break; @@ -121,26 +118,23 @@ int pos = 1; switch (space.kind()) { - case VSpace::NONE: - pos = 1; - break; case VSpace::DEFSKIP: - pos = 2; + pos = 1; break; case VSpace::SMALLSKIP: - pos = 3; + pos = 2; break; case VSpace::MEDSKIP: - pos = 4; + pos = 3; break; case VSpace::BIGSKIP: - pos = 5; + pos = 4; break; case VSpace::VFILL: - pos = 6; + pos = 5; break; case VSpace::LENGTH: - pos = 7; + pos = 6; break; } fl_set_choice(choice_type, pos); @@ -195,7 +189,7 @@ fl_set_input_return(dialog_->input_space, FL_RETURN_CHANGED); string const spacing = - _("None|DefSkip|SmallSkip|MedSkip|BigSkip|VFill|Length"); + _("DefSkip|SmallSkip|MedSkip|BigSkip|VFill|Length"); fl_addto_choice(dialog_->choice_space, spacing.c_str()); // Create the contents of the unit choices; don't include the "%" terms. @@ -237,7 +231,7 @@ // spacing // If a vspace choice is "Length" but there's no text in - // the input field, reset the choice to "None". + // the input field, insert nothing. validateVSpaceWidgets(dialog_->choice_space, dialog_->input_space); VSpace const space = @@ -259,7 +253,7 @@ dialog_->check_keep); bool const custom_length = - fl_get_choice(dialog_->choice_space) == 7; + fl_get_choice(dialog_->choice_space) == 6; setEnabled(dialog_->input_space, custom_length); setEnabled(dialog_->choice_unit_space, custom_length); } @@ -271,7 +265,7 @@ // disable 'keep' when no space is choosen if (ob == dialog_->choice_space) { bool const custom_length = - fl_get_choice(dialog_->choice_space) == 7; + fl_get_choice(dialog_->choice_space) == 6; setEnabled(dialog_->input_space, custom_length); setEnabled(dialog_->choice_unit_space, custom_length); }