]> git.lyx.org Git - features.git/commitdiff
(Rob Lahaye): changes to the xforms paragraph dialog.
authorAngus Leeming <leeming@lyx.org>
Wed, 30 Oct 2002 13:57:01 +0000 (13:57 +0000)
committerAngus Leeming <leeming@lyx.org>
Wed, 30 Oct 2002 13:57:01 +0000 (13:57 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5554 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/controllers/ChangeLog
src/frontends/controllers/ControlParagraph.C
src/frontends/controllers/ControlParagraph.h
src/frontends/xforms/ChangeLog
src/frontends/xforms/FormParagraph.C
src/frontends/xforms/FormParagraph.h
src/frontends/xforms/forms/form_paragraph.fd

index 3402448b6a5faedd9a29e87bc2bf0281cf0a3c35..c12e693fc0b1cc6a6a5838eae3c21a0e8562eaa8 100644 (file)
@@ -1,3 +1,8 @@
+2002-10-29  Rob Lahaye  <lahaye@snu.ac.kr>
+
+       * ControlParagraph.[Ch] (alignDefault): new method, returning the
+       default alignment (block, left, right, center) of this paragraph.
+
 2002-10-25  John Levon  <levon@movementarian.org>
 
        * ControlPrint.C: using endl
index 958da3e2d9f83515891c0b77388f3cb620132fa5..447029d07bad73c24faa4df63ec9f390791e467f 100644 (file)
@@ -27,7 +27,6 @@
 #include "ParagraphParameters.h"
 
 #include "frontends/LyXView.h"
-
 #include "support/LAssert.h"
 
 
@@ -55,7 +54,13 @@ bool ControlParagraph::inInset() const
 
 LyXAlignment ControlParagraph::alignPossible() const
 {
-       return alignpos_;
+       return alignpossible_;
+}
+
+
+LyXAlignment ControlParagraph::alignDefault() const
+{
+       return aligndefault_;
 }
 
 
@@ -111,7 +116,10 @@ void ControlParagraph::setParams()
                pp_->align(layout->align);
 
        /// is alignment possible
-       alignpos_ = layout->alignpossible;
+       alignpossible_ = layout->alignpossible;
+
+       /// set default alignment
+       aligndefault_ = layout->align;
 
        /// is paragraph in inset
        ininset_ = par_->inInset();
index aba83416412bd4b90315c57f375dca728e08d858..af9ec9fa394b74bdf798bebb4a7d95b59444cf64 100644 (file)
@@ -40,6 +40,8 @@ public:
        ///
        LyXAlignment alignPossible() const;
        ///
+       LyXAlignment alignDefault() const;
+       ///
        void changedParagraph();
 private:
        /// Get changed parameters and Dispatch them to the kernel.
@@ -52,7 +54,9 @@ private:
        ///
        bool ininset_;
        ///
-       LyXAlignment alignpos_;
+       LyXAlignment alignpossible_;
+       ///
+       LyXAlignment aligndefault_;
 };
 
 #endif // CONTROLPARAGRAPH_H
index 162cf11a3ef341099c243257707a48d7e563e206..380460268b89f4c11d1b745167f1d9bf1b842a26 100644 (file)
@@ -1,3 +1,10 @@
+2002-10-29  Rob Lahaye  <lahaye@snu.ac.kr>
+
+       * FormParagraph.[Ch]:
+       * forms/form_paragraph.fd: a large-scale reorganisation and clean-up
+       of the code to make it more transparent. Use RadioButtonGroup and
+       ChaekedGlueLength for the same reason. Add tooltips.
+
 2002-10-28  Angus Leeming  <leeming@lyx.org>
 
        * FeedbackController.C (PrehandlerCB): show tooltips for browser
index 61c814a96ec74865ef504b64afb3a40c9d4d61e0..a7aa28c2aa5303e68a9b102870af313b3ffeec10 100644 (file)
@@ -4,6 +4,7 @@
  * Licence details can be found in the file COPYING.
  *
  * \author Jürgen Vigna
+ * \author Rob Lahaye
  *
  * Full author contact details are available in file CREDITS
  */
 #pragma implementation
 #endif
 
-#include FORMS_H_LOCATION
-
+#include "ControlParagraph.h"
 #include "FormParagraph.h"
 #include "forms/form_paragraph.h"
-#include "ControlParagraph.h"
+#include "Tooltips.h"
+
 #include "ParagraphParameters.h"
+
 #include "xforms_helpers.h"
 #include "lyxrc.h" // to set the deafult length values
 #include "input_validators.h"
 #include "helper_funcs.h"
+#include "checkedwidgets.h"
 #include "gettext.h"
 #include "xformsBC.h"
 #include "layout.h" // LyXAlignment
 
 #include "support/lstrings.h"
 #include "support/LAssert.h"
+
 #include FORMS_H_LOCATION
 
 #include <functional>
@@ -38,54 +42,39 @@ using std::vector;
 using std::bind2nd;
 using std::remove_if;
 
-typedef FormCB<ControlParagraph, FormDB<FD_paragraph> > base_class;
-
-FormParagraph::FormParagraph()
-       : base_class(_("Paragraph Layout"), false)
-{}
 
-void FormParagraph::build()
+namespace 
 {
-       // the tabbed folder
-       dialog_.reset(build_paragraph(this));
 
-       // Allow the base class to control messages
-       setMessageWidget(dialog_->text_warning);
+string defaultUnit("cm");
 
-       fl_addto_choice(dialog_->choice_space_above,
-                       _(" None | Defskip | Smallskip "
-                         "| Medskip | Bigskip | VFill | Length "));
-       fl_addto_choice(dialog_->choice_space_below,
-                       _(" None | Defskip | Smallskip "
-                         "| Medskip | Bigskip | VFill | Length "));
+void validateVSpaceWidgets(FL_OBJECT * choice_type, FL_OBJECT * input_length);
 
-       fl_addto_choice(dialog_->choice_linespacing,
-                       _(" Default | Single | OneHalf | Double | Custom "));
+VSpace const setVSpaceFromWidgets(FL_OBJECT * choice_type,
+                                 FL_OBJECT * input_length,
+                                 FL_OBJECT * choice_length,
+                                 FL_OBJECT * check_keep);
 
-       fl_set_input_return(dialog_->input_space_above, FL_RETURN_CHANGED);
-       fl_set_input_return(dialog_->input_space_below, FL_RETURN_CHANGED);
-       fl_set_input_return(dialog_->input_labelwidth,  FL_RETURN_CHANGED);
-       fl_set_input_return(dialog_->input_linespacing, FL_RETURN_CHANGED);
-       fl_set_input_filter(dialog_->input_linespacing, fl_unsigned_float_filter);
+void setWidgetsFromVSpace(VSpace const & space,
+                         FL_OBJECT * choice_type,
+                         FL_OBJECT * input_length,
+                         FL_OBJECT * choice_length,
+                         FL_OBJECT * check_keep);
 
-       setPrehandler(dialog_->input_space_above);
-       setPrehandler(dialog_->input_space_below);
-       setPrehandler(dialog_->input_labelwidth);
-       setPrehandler(dialog_->input_linespacing);
+} // namespace anon
 
-       // Create the contents of the unit choices
-       // Don't include the "%" terms...
-       vector<string> units_vec = getLatexUnits();
 
-       vector<string>::iterator del =
-               remove_if(units_vec.begin(), units_vec.end(),
-                         bind2nd(contains_functor(), "%"));
-       units_vec.erase(del, units_vec.end());
+typedef FormCB<ControlParagraph, FormDB<FD_paragraph> > base_class;
+
+FormParagraph::FormParagraph()
+       : base_class(_("Paragraph Layout"))
+{}
 
-       string units = getStringFromVector(units_vec, "|");
 
-       fl_addto_choice(dialog_->choice_value_space_above, units.c_str());
-       fl_addto_choice(dialog_->choice_value_space_below, units.c_str());
+void FormParagraph::build()
+{
+       // the tabbed folder
+       dialog_.reset(build_paragraph(this));
 
        // Manage the ok, apply, restore and cancel/close buttons
        bc().setOK(dialog_->button_ok);
@@ -93,158 +82,168 @@ void FormParagraph::build()
        bc().setCancel(dialog_->button_close);
        bc().setRestore(dialog_->button_restore);
 
-       bc().addReadOnly(dialog_->radio_align_right);
-       bc().addReadOnly(dialog_->radio_align_left);
-       bc().addReadOnly(dialog_->radio_align_block);
-       bc().addReadOnly(dialog_->radio_align_center);
-       bc().addReadOnly(dialog_->check_lines_top);
-       bc().addReadOnly(dialog_->check_lines_bottom);
-       bc().addReadOnly(dialog_->check_pagebreaks_top);
-       bc().addReadOnly(dialog_->check_pagebreaks_bottom);
+       // disable for read-only documents
+       bc().addReadOnly(dialog_->check_line_above);
+       bc().addReadOnly(dialog_->check_pagebreak_above);
        bc().addReadOnly(dialog_->choice_space_above);
        bc().addReadOnly(dialog_->input_space_above);
        bc().addReadOnly(dialog_->check_space_above);
+
+       bc().addReadOnly(dialog_->check_noindent);
+       bc().addReadOnly(dialog_->choice_linespacing);
+       bc().addReadOnly(dialog_->input_linespacing);
+
+       bc().addReadOnly(dialog_->check_line_below);
+       bc().addReadOnly(dialog_->check_pagebreak_below);
        bc().addReadOnly(dialog_->choice_space_below);
        bc().addReadOnly(dialog_->input_space_below);
        bc().addReadOnly(dialog_->check_space_below);
-       bc().addReadOnly(dialog_->choice_linespacing);
-       bc().addReadOnly(dialog_->input_linespacing);
-       bc().addReadOnly(dialog_->check_noindent);
+
        bc().addReadOnly(dialog_->input_labelwidth);
-}
 
-namespace {
+       // check validity of "length + unit" input
+       addCheckedGlueLength(bc(),
+                            dialog_->input_space_above,
+                            dialog_->choice_space_above);
+       addCheckedGlueLength(bc(),
+                            dialog_->input_space_below,
+                            dialog_->choice_space_below);
 
-VSpace setVSpaceFromWidgets(FL_OBJECT * choice_type,
-                           FL_OBJECT * input_length,
-                           FL_OBJECT * choice_length,
-                           FL_OBJECT * check_keep)
-{
-       // Paranoia check!
-       lyx::Assert(choice_type   && choice_type->objclass   == FL_CHOICE &&
-                   input_length  && input_length->objclass  == FL_INPUT &&
-                   choice_length && choice_length->objclass == FL_CHOICE &&
-                   check_keep    && check_keep->objclass    == FL_CHECKBUTTON);
+       // trigger an input event for cut&paste with middle mouse button.
+       setPrehandler(dialog_->input_space_above);
+       setPrehandler(dialog_->input_space_below);
+       setPrehandler(dialog_->input_linespacing);
+       setPrehandler(dialog_->input_labelwidth);
 
-       VSpace space;
+       fl_set_input_return(dialog_->input_space_above, FL_RETURN_CHANGED);
+       fl_set_input_return(dialog_->input_space_below, FL_RETURN_CHANGED);
+       fl_set_input_return(dialog_->input_labelwidth,  FL_RETURN_CHANGED);
+       fl_set_input_return(dialog_->input_linespacing, FL_RETURN_CHANGED);
 
-       switch (fl_get_choice(choice_type)) {
-       case 1:
-               space = VSpace(VSpace::NONE);
-               break;
-       case 2:
-               space = VSpace(VSpace::DEFSKIP);
-               break;
-       case 3:
-               space = VSpace(VSpace::SMALLSKIP);
-               break;
-       case 4:
-               space = VSpace(VSpace::MEDSKIP);
-               break;
-       case 5:
-               space = VSpace(VSpace::BIGSKIP);
-               break;
-       case 6:
-               space = VSpace(VSpace::VFILL);
-               break;
-       case 7:
-       {
-               string const length =
-                       getLengthFromWidgets(input_length, choice_length);
-               space = VSpace(LyXGlueLength(length));
-               break;
-       }
-       }
+       // limit these inputs to unsigned floats
+       fl_set_input_filter(dialog_->input_linespacing, fl_unsigned_float_filter);
 
-       if (fl_get_button(check_keep))
-               space.setKeep(true);
+       // add alignment radio buttons
+       alignment_.init(dialog_->radio_align_left,   LYX_ALIGN_LEFT);
+       alignment_.init(dialog_->radio_align_right,  LYX_ALIGN_RIGHT);
+       alignment_.init(dialog_->radio_align_block,  LYX_ALIGN_BLOCK);
+       alignment_.init(dialog_->radio_align_center, LYX_ALIGN_CENTER);
 
-       return space;
-}
+       string const parspacing = _("None|Defskip|Smallskip|Medskip|Bigskip|VFill|Length");
+       fl_addto_choice(dialog_->choice_space_above, parspacing.c_str());
+       fl_addto_choice(dialog_->choice_space_below, parspacing.c_str());
 
-void validateVSpaceWidgets(FL_OBJECT * choice_type, FL_OBJECT * input_length)
-{
-       // Paranoia check!
-       lyx::Assert(choice_type  && choice_type->objclass   == FL_CHOICE &&
-                   input_length && input_length->objclass  == FL_INPUT);
+       string const linespacing = _("Default|Single|OneHalf|Double|Custom");
+       fl_addto_choice(dialog_->choice_linespacing, linespacing.c_str());
 
-       if (fl_get_choice(choice_type) != 7)
-               return;
+       // Create the contents of the unit choices; don't include the "%" terms.
+       vector<string> units_vec = getLatexUnits();
+       vector<string>::iterator del =
+               remove_if(units_vec.begin(), units_vec.end(),
+                         bind2nd(contains_functor(), "%"));
+       units_vec.erase(del, units_vec.end());
 
-       // If a vspace kind is "Length" but there's no text in
-       // the input field, reset the kind to "None".
-       string const input = rtrim(getString(input_length));
-       if (input.empty())
-               fl_set_choice(choice_type, 1);
+       string const units = getStringFromVector(units_vec, "|");
+       fl_addto_choice(dialog_->choice_unit_space_above, units.c_str());
+       fl_addto_choice(dialog_->choice_unit_space_below, units.c_str());
+
+       // set up the tooltips
+       string str = _("Add a separator line above this paragraph.");
+       tooltips().init(dialog_->check_line_above, str);
+       str = _("Enforce a page break above this paragraph.");
+       tooltips().init(dialog_->check_pagebreak_above, str);
+       str = _("Add additional space above this paragraph.");
+       tooltips().init(dialog_->choice_space_above, str);
+       str = _("Never suppress space (e.g. at top of page or new page).");
+       tooltips().init(dialog_->check_space_above, str);
+
+       str = _("Add a separator line below this paragraph.");
+       tooltips().init(dialog_->check_line_below, str);
+       str = _("Enforce a page break below this paragraph.");
+       tooltips().init(dialog_->check_pagebreak_below, str);
+       str = _("Add additional space below this paragraph.");
+       tooltips().init(dialog_->choice_space_below, str);
+       str = _("Never suppress space (e.g. at bottom of page or new page).");
+       tooltips().init(dialog_->check_space_below, str);
+
+       // set default unit for custom length
+       switch (lyxrc.default_papersize) {
+               case BufferParams::PAPER_DEFAULT:
+               case BufferParams::PAPER_USLETTER:
+               case BufferParams::PAPER_LEGALPAPER:
+               case BufferParams::PAPER_EXECUTIVEPAPER:
+                       defaultUnit = "in";
+                       break;
+               case BufferParams::PAPER_A3PAPER:
+               case BufferParams::PAPER_A4PAPER:
+               case BufferParams::PAPER_A5PAPER:
+               case BufferParams::PAPER_B5PAPER:
+                       defaultUnit = "cm";
+                       break;
+       }
 }
 
-} // namespace anon
 
 void FormParagraph::apply()
 {
        if (!form()) return;
 
-       /* spacing */
-       // If a vspace kind is "Length" but there's no text in
-       // the input field, reset the kind to "None".
+       // spacing
+       // If a vspace choice is "Length" but there's no text in
+       // the input field, reset the choice to "None".
        validateVSpaceWidgets(dialog_->choice_space_above,
                              dialog_->input_space_above);
 
-       VSpace const space_top =
+       VSpace const space_above =
                setVSpaceFromWidgets(dialog_->choice_space_above,
                                     dialog_->input_space_above,
-                                    dialog_->choice_value_space_above,
+                                    dialog_->choice_unit_space_above,
                                     dialog_->check_space_above);
 
-       controller().params().spaceTop(space_top);
+       controller().params().spaceTop(space_above);
 
        validateVSpaceWidgets(dialog_->choice_space_below,
                              dialog_->input_space_below);
 
-       VSpace const space_bottom =
+       VSpace const space_below =
                setVSpaceFromWidgets(dialog_->choice_space_below,
                                     dialog_->input_space_below,
-                                    dialog_->choice_value_space_below,
+                                    dialog_->choice_unit_space_below,
                                     dialog_->check_space_below);
 
-       controller().params().spaceBottom(space_bottom);
+       controller().params().spaceBottom(space_below);
 
-       /* lines and pagebreaks */
-       bool const line_top = fl_get_button(dialog_->check_lines_top);
-       controller().params().lineTop(line_top);
+       // lines and pagebreaks
+       bool const line_above = fl_get_button(dialog_->check_line_above);
+       controller().params().lineTop(line_above);
 
-       bool const line_bottom = fl_get_button(dialog_->check_lines_bottom);
-       controller().params().lineBottom(line_bottom);
+       bool const line_below = fl_get_button(dialog_->check_line_below);
+       controller().params().lineBottom(line_below);
 
-       bool const pagebreak_top = fl_get_button(dialog_->check_pagebreaks_top);
-       controller().params().pagebreakTop(pagebreak_top);
+       bool const pagebreak_above =
+               fl_get_button(dialog_->check_pagebreak_above);
+       controller().params().pagebreakTop(pagebreak_above);
 
-       bool const pagebreak_bottom = fl_get_button(dialog_->check_pagebreaks_bottom);
-       controller().params().pagebreakBottom(pagebreak_bottom);
+       bool const pagebreak_below =
+               fl_get_button(dialog_->check_pagebreak_below);
+       controller().params().pagebreakBottom(pagebreak_below);
 
 
-       /* alignment */
-       LyXAlignment align;
-       if (fl_get_button(dialog_->radio_align_left))
-               align = LYX_ALIGN_LEFT;
-       else if (fl_get_button(dialog_->radio_align_right))
-               align = LYX_ALIGN_RIGHT;
-       else if (fl_get_button(dialog_->radio_align_center))
-               align = LYX_ALIGN_CENTER;
-       else
-               align = LYX_ALIGN_BLOCK;
-       controller().params().align(align);
+       // alignment
+       LyXAlignment const alignment =
+               static_cast<LyXAlignment>(alignment_.get());
+       controller().params().align(alignment);
 
-       /* label width */
+       // label width
        string const labelwidthstring =
                getString(dialog_->input_labelwidth);
        controller().params().labelWidthString(labelwidthstring);
 
-       /* indendation */
+       // indendation
        bool const noindent = fl_get_button(dialog_->check_noindent);
        controller().params().noindent(noindent);
 
-       /* get spacing */
+       // get spacing
        Spacing::Space linespacing = Spacing::Default;
        string other;
        switch (fl_get_choice(dialog_->choice_linespacing)) {
@@ -261,267 +260,303 @@ void FormParagraph::apply()
                linespacing = Spacing::Double;
                break;
        case 5:
-               linespacing = Spacing::Other;
+               // reset to default if input is empty
                other = getString(dialog_->input_linespacing);
+               if (!other.empty()) {
+                       linespacing = Spacing::Other;
+               } else {
+                       linespacing = Spacing::Default;
+                       fl_set_choice(dialog_->choice_linespacing, 1);
+               }
                break;
        }
-
        Spacing const spacing(linespacing, other);
        controller().params().spacing(spacing);
-
 }
 
-namespace {
-
-void setWidgetsFromVSpace(VSpace const & space,
-                         FL_OBJECT * choice_type,
-                         FL_OBJECT * input_length,
-                         FL_OBJECT * choice_length,
-                         FL_OBJECT * check_keep)
-{
-       // Paranoia check!
-       lyx::Assert(choice_type   && choice_type->objclass   == FL_CHOICE &&
-                   input_length  && input_length->objclass  == FL_INPUT &&
-                   choice_length && choice_length->objclass == FL_CHOICE &&
-                   check_keep    && check_keep->objclass    == FL_CHECKBUTTON);
-
-       fl_set_input(input_length, "");
-       setEnabled(input_length,  false);
-       setEnabled(choice_length, false);
-
-       switch (space.kind()) {
-       case VSpace::NONE:
-               fl_set_choice(choice_type, 1);
-               break;
-       case VSpace::DEFSKIP:
-               fl_set_choice(choice_type, 2);
-               break;
-       case VSpace::SMALLSKIP:
-               fl_set_choice(choice_type, 3);
-               break;
-       case VSpace::MEDSKIP:
-               fl_set_choice(choice_type, 4);
-               break;
-       case VSpace::BIGSKIP:
-               fl_set_choice(choice_type, 5);
-               break;
-       case VSpace::VFILL:
-               fl_set_choice(choice_type, 6);
-               break;
-       case VSpace::LENGTH:
-       {
-               fl_set_choice(choice_type, 7);
-
-               setEnabled(input_length,  true);
-               setEnabled(choice_length, true);
-
-               bool const metric = lyxrc.default_papersize > 3;
-               string const default_unit = metric ? "cm" : "in";
-               string const length = space.length().asString();
-
-               updateWidgetsFromLengthString(input_length, choice_length,
-                                             length, default_unit);
-               break;
-       }
-       }
-
-       fl_set_button(check_keep, space.keep());
-}
-
-} // namespace anon
 
 void FormParagraph::update()
 {
        if (!dialog_.get())
                return;
 
-       /* label width */
-       string labelwidth = controller().params().labelWidthString();
+       // label width
+       string const labelwidth = controller().params().labelWidthString();
        fl_set_input(dialog_->input_labelwidth, labelwidth.c_str());
        setEnabled(dialog_->input_labelwidth,
                   labelwidth != _("Senseless with this layout!"));
 
-       /* alignment */
-       fl_set_button(dialog_->radio_align_right, 0);
-       fl_set_button(dialog_->radio_align_left, 0);
-       fl_set_button(dialog_->radio_align_center, 0);
-       fl_set_button(dialog_->radio_align_block, 0);
+       // alignment
+       alignment_.set(controller().params().align());
 
-       LyXAlignment align = controller().params().align();
+       // mark default alignment
+       LyXAlignment const default_alignment = controller().alignDefault();
 
-       switch (align) {
-       case LYX_ALIGN_RIGHT:
-               fl_set_button(dialog_->radio_align_right, 1);
-               break;
-       case LYX_ALIGN_LEFT:
-               fl_set_button(dialog_->radio_align_left, 1);
-               break;
-       case LYX_ALIGN_CENTER:
-               fl_set_button(dialog_->radio_align_center, 1);
-               break;
-       default:
-               fl_set_button(dialog_->radio_align_block, 1);
-               break;
+       string label = _("Block");
+       if (default_alignment == LYX_ALIGN_BLOCK) {
+               label += _(" (default)");
        }
+       fl_set_object_label(dialog_->radio_align_block, label.c_str());
+       fl_set_button_shortcut(dialog_->radio_align_block, "#B", 1);
 
-       LyXAlignment alignpos = controller().alignPossible();
+       label = _("Center");
+       if (default_alignment == LYX_ALIGN_CENTER) {
+               label += _(" (default)");
+       }
+       fl_set_object_label(dialog_->radio_align_center, label.c_str());
+       fl_set_button_shortcut(dialog_->radio_align_center, "#C", 1);
+
+       label = _("Left");
+       if (default_alignment == LYX_ALIGN_LEFT) {
+               label += _(" (default)");
+       }
+       fl_set_object_label(dialog_->radio_align_left, label.c_str());
+       fl_set_button_shortcut(dialog_->radio_align_left, "#L", 1);
+
+       label = _("Right");
+       if (default_alignment == LYX_ALIGN_RIGHT) {
+               label = _(" (default)");
+       }
+       fl_set_object_label(dialog_->radio_align_right, label.c_str());
+       fl_set_button_shortcut(dialog_->radio_align_right, "#R", 1);
 
-       setEnabled(dialog_->radio_align_block,  bool(alignpos & LYX_ALIGN_BLOCK));
-       setEnabled(dialog_->radio_align_center, bool(alignpos & LYX_ALIGN_CENTER));
-       setEnabled(dialog_->radio_align_left,   bool(alignpos & LYX_ALIGN_LEFT));
-       setEnabled(dialog_->radio_align_right,  bool(alignpos & LYX_ALIGN_RIGHT));
+       // Ensure that there's no crud left on the screen from this change
+       // of labels.
+       fl_redraw_form(form());
+
+       LyXAlignment alignpos = controller().alignPossible();
+       setEnabled(dialog_->radio_align_block,
+                  bool(alignpos & LYX_ALIGN_BLOCK));
+       setEnabled(dialog_->radio_align_center,
+                  bool(alignpos & LYX_ALIGN_CENTER));
+       setEnabled(dialog_->radio_align_left,
+                  bool(alignpos & LYX_ALIGN_LEFT));
+       setEnabled(dialog_->radio_align_right,
+                  bool(alignpos & LYX_ALIGN_RIGHT));
 
        // no inset-text-owned paragraph may have pagebreaks
        bool ininset = controller().inInset();
-       setEnabled(dialog_->check_pagebreaks_top, !ininset);
-       setEnabled(dialog_->check_pagebreaks_bottom, !ininset);
+       setEnabled(dialog_->check_pagebreak_above, !ininset);
+       setEnabled(dialog_->check_pagebreak_below, !ininset);
 
-       /* lines, pagebreaks and indent */
-       fl_set_button(dialog_->check_lines_top,
+       // lines, pagebreaks and indent
+       fl_set_button(dialog_->check_line_above,
                      controller().params().lineTop());
-       fl_set_button(dialog_->check_lines_bottom,
+       fl_set_button(dialog_->check_line_below,
                      controller().params().lineBottom());
-       fl_set_button(dialog_->check_pagebreaks_top,
+       fl_set_button(dialog_->check_pagebreak_above,
                      controller().params().pagebreakTop());
-       fl_set_button(dialog_->check_pagebreaks_bottom,
+       fl_set_button(dialog_->check_pagebreak_below,
                      controller().params().pagebreakBottom());
        fl_set_button(dialog_->check_noindent,
                      controller().params().noindent());
 
-       /* linespacing */
-       int linespacing;
+       // linespacing
        Spacing const space = controller().params().spacing();
 
+       int pos;
        switch (space.getSpace()) {
-       default: linespacing = 1; break;
-       case Spacing::Single: linespacing = 2; break;
-       case Spacing::Onehalf: linespacing = 3; break;
-       case Spacing::Double: linespacing = 4; break;
-       case Spacing::Other: linespacing = 5; break;
+       case Spacing::Other:
+               pos = 5;
+               break;
+       case Spacing::Double:
+               pos = 4;
+               break;
+       case Spacing::Onehalf:
+               pos = 3;
+               break;
+       case Spacing::Single:
+               pos = 2;
+               break;
+       case Spacing::Default:
+       default:
+               pos = 1;
+               break;
        }
+       fl_set_choice(dialog_->choice_linespacing, pos);
 
-       fl_set_choice(dialog_->choice_linespacing, linespacing);
-       if (space.getSpace() == Spacing::Other) {
+       bool const spacing_other = space.getSpace() == Spacing::Other;
+       setEnabled(dialog_->input_linespacing, spacing_other);
+       if (spacing_other) {
                string const sp = tostr(space.getValue());
                fl_set_input(dialog_->input_linespacing, sp.c_str());
-               setEnabled(dialog_->input_linespacing, true);
        } else {
                fl_set_input(dialog_->input_linespacing, "");
-               setEnabled(dialog_->input_linespacing, false);
        }
 
-       /* vspace top */
+       // vspace top
        setWidgetsFromVSpace(controller().params().spaceTop(),
                             dialog_->choice_space_above,
                             dialog_->input_space_above,
-                            dialog_->choice_value_space_above,
+                            dialog_->choice_unit_space_above,
                             dialog_->check_space_above);
 
-       /* vspace bottom */
+       // vspace bottom
        setWidgetsFromVSpace(controller().params().spaceBottom(),
                             dialog_->choice_space_below,
                             dialog_->input_space_below,
-                            dialog_->choice_value_space_below,
+                            dialog_->choice_unit_space_below,
                             dialog_->check_space_below);
 
-       /* no indent */
+       // no indent
        fl_set_button(dialog_->check_noindent,
                      controller().params().noindent());
 }
 
-namespace {
 
-void synchronizeSpaceWidgets(FL_OBJECT * choice_type,
-                            FL_OBJECT * input_length,
-                            FL_OBJECT * choice_length)
+ButtonPolicy::SMInput FormParagraph::input(FL_OBJECT * ob, long)
 {
-       // Paranoia check!
-       lyx::Assert(choice_type   && choice_type->objclass   == FL_CHOICE &&
-                   input_length  && input_length->objclass  == FL_INPUT &&
-                   choice_length && choice_length->objclass == FL_CHOICE);
-
-       if (fl_get_choice(choice_type) != 7) {
-               fl_set_input(input_length, "");
-               setEnabled(input_length, false);
-               setEnabled(choice_length, false);
-
-       } else {
-               setEnabled(input_length, true);
-               setEnabled(choice_length, true);
+       // Enable input when custum length is choosen,
+       // disable 'keep' when no space is choosen
+       if (ob == dialog_->choice_space_above) {
+               bool const custom_length =
+                       fl_get_choice(dialog_->choice_space_above) == 7;        
+               setEnabled(dialog_->input_space_above, custom_length);
+               setEnabled(dialog_->choice_unit_space_above, custom_length);
+
+               bool const space =
+                       fl_get_choice(dialog_->choice_space_above) != 1;
+               setEnabled(dialog_->check_space_above, space);
+
+       } else if (ob == dialog_->choice_space_below) {
+               bool const custom_length =
+                       fl_get_choice(dialog_->choice_space_below) == 7;        
+               setEnabled(dialog_->input_space_below, custom_length);
+               setEnabled(dialog_->choice_unit_space_below, custom_length);
+
+               bool const space =
+                       fl_get_choice(dialog_->choice_space_below) != 1;
+               setEnabled(dialog_->check_space_below, space);
+
+       } else if (ob == dialog_->choice_linespacing) {
+               bool const custom_spacing =
+                       fl_get_choice(dialog_->choice_linespacing) == 5;
+               setEnabled(dialog_->input_linespacing, custom_spacing);
+       }
 
-               string const length = getString(input_length);
+       return ButtonPolicy::SMI_VALID;
+}
 
-               if (rtrim(length).empty()) {
-                       bool const metric = lyxrc.default_papersize > 3;
-                       int const default_unit = metric ? 8 : 9;
 
-                       fl_set_choice(choice_length, default_unit);
-               }
-       }
-}
+namespace {
 
-bool validSpaceWidgets(FL_OBJECT * choice_type, FL_OBJECT * input_length)
+void validateVSpaceWidgets(FL_OBJECT * choice_type, FL_OBJECT * input_length)
 {
        // Paranoia check!
-       lyx::Assert(choice_type  && choice_type->objclass   == FL_CHOICE &&
-                   input_length && input_length->objclass  == FL_INPUT);
+       lyx::Assert(choice_type  && choice_type->objclass  == FL_CHOICE &&
+                   input_length && input_length->objclass == FL_INPUT);
 
        if (fl_get_choice(choice_type) != 7)
-               return true;
+               return;
 
-       string const input = getString(input_length);
-       return (input.empty() ||
-               isValidGlueLength(input) ||
-               isStrDbl(input));
+       // If a vspace kind is "Length" but there's no text in
+       // the input field, reset the kind to "None".
+       string const input = rtrim(getString(input_length));
+       if (input.empty())
+               fl_set_choice(choice_type, 1);
 }
 
-} // namespace anon
 
-ButtonPolicy::SMInput FormParagraph::input(FL_OBJECT * ob, long)
+VSpace const setVSpaceFromWidgets(FL_OBJECT * choice_type,
+                                 FL_OBJECT * input_length,
+                                 FL_OBJECT * choice_length,
+                                 FL_OBJECT * check_keep)
 {
-       clearMessage();
-
-       // First check the buttons which are exclusive and you have to
-       // check only the actuall de/activated button.
-       //
-       // "Synchronize" the choices and input fields, making it
-       // impossible to commit senseless data.
-       if (ob == dialog_->choice_space_above) {
-               synchronizeSpaceWidgets(dialog_->choice_space_above,
-                                       dialog_->input_space_above,
-                                       dialog_->choice_value_space_above);
-       }
+       // Paranoia check!
+       lyx::Assert(choice_type   && choice_type->objclass   == FL_CHOICE &&
+                   input_length  && input_length->objclass  == FL_INPUT &&
+                   choice_length && choice_length->objclass == FL_CHOICE &&
+                   check_keep    && check_keep->objclass    == FL_CHECKBUTTON);
 
-       if (ob == dialog_->choice_space_below) {
-               synchronizeSpaceWidgets(dialog_->choice_space_below,
-                                       dialog_->input_space_below,
-                                       dialog_->choice_value_space_below);
+       VSpace space;
+       switch (fl_get_choice(choice_type)) {
+       case 1:
+               space = VSpace(VSpace::NONE);
+               break;
+       case 2:
+               space = VSpace(VSpace::DEFSKIP);
+               break;
+       case 3:
+               space = VSpace(VSpace::SMALLSKIP);
+               break;
+       case 4:
+               space = VSpace(VSpace::MEDSKIP);
+               break;
+       case 5:
+               space = VSpace(VSpace::BIGSKIP);
+               break;
+       case 6:
+               space = VSpace(VSpace::VFILL);
+               break;
+       case 7:
+               {
+               string const length =
+                       getLengthFromWidgets(input_length, choice_length);
+               space = VSpace(LyXGlueLength(length));
+               break;
+               }
        }
 
-       // Display a warning if the input is senseless
-       bool valid = (validSpaceWidgets(dialog_->choice_space_above,
-                                       dialog_->input_space_above) &&
-                     validSpaceWidgets(dialog_->choice_space_below,
-                                       dialog_->input_space_below));
+       if (fl_get_button(check_keep))
+               space.setKeep(true);
 
-       if (!valid) {
-               postWarning(_("Invalid Length (valid example: 10mm)"));
-       }
+       return space;
+}
 
-       int const choice_spacing = fl_get_choice(dialog_->choice_linespacing);
 
-       if (choice_spacing == 5)
-               setEnabled(dialog_->input_linespacing, true);
-       else {
-               fl_set_input(dialog_->input_linespacing, "");
-               setEnabled(dialog_->input_linespacing, false);
-       }
+void setWidgetsFromVSpace(VSpace const & space,
+                         FL_OBJECT * choice_type,
+                         FL_OBJECT * input_length,
+                         FL_OBJECT * choice_length,
+                         FL_OBJECT * check_keep)
+{
+       // Paranoia check!
+       lyx::Assert(choice_type   && choice_type->objclass   == FL_CHOICE &&
+                   input_length  && input_length->objclass  == FL_INPUT &&
+                   choice_length && choice_length->objclass == FL_CHOICE &&
+                   check_keep    && check_keep->objclass    == FL_CHECKBUTTON);
 
-       double const spacing =
-               strToDbl(getString(dialog_->input_linespacing));
+       fl_set_button(check_keep, space.keep());
 
-       if (choice_spacing == 5 && int(spacing) == 0)
-               valid = false;
+       int pos = 1;
+       switch (space.kind()) {
+       case VSpace::NONE:
+               pos = 1;
+               break;
+       case VSpace::DEFSKIP:
+               pos = 2;
+               break;
+       case VSpace::SMALLSKIP:
+               pos = 3;
+               break;
+       case VSpace::MEDSKIP:
+               pos = 4;
+               break;
+       case VSpace::BIGSKIP:
+               pos = 5;
+               break;
+       case VSpace::VFILL:
+               pos = 6;
+               break;
+       case VSpace::LENGTH:
+               pos = 7;
+               break;
+       }
+       fl_set_choice(choice_type, pos);
 
-       return ButtonPolicy::SMI_VALID;
+       bool const custom_vspace = space.kind() == VSpace::LENGTH;
+       setEnabled(input_length, custom_vspace);
+       setEnabled(choice_length, custom_vspace);
+       if (custom_vspace) {
+               string const length = space.length().asString();
+               updateWidgetsFromLengthString(input_length, choice_length,
+                                             length, defaultUnit);
+       } else {
+               bool const no_vspace = space.kind() == VSpace::NONE;
+               setEnabled(check_keep, !no_vspace);
+               fl_set_input(input_length, "");
+               fl_set_choice_text(choice_length, defaultUnit.c_str());
+       }
 }
+
+} // namespace anon
index 7c46e3c1b4d2528f7a80c30c07d003f32c4355c3..c6caf228b1ac7fa9147e3a355eff8513ada3137a 100644 (file)
@@ -17,6 +17,7 @@
 #endif
 
 #include "FormBase.h"
+#include "RadioButtonGroup.h"
 
 struct FD_paragraph;
 class ControlParagraph;
@@ -38,6 +39,9 @@ private:
 
        /// Filter the inputs on callback from xforms
        virtual ButtonPolicy::SMInput input(FL_OBJECT *, long);
+
+       /// alignment radio buttons
+       RadioButtonGroup alignment_;
 };
 
 #endif
index b0b4ad7e91d03de271818b01e018945ac50db195..425729705a15885b640f0069723e0535ddf896e9 100644 (file)
@@ -9,19 +9,19 @@ SnapGrid: 5
 
 =============== FORM ===============
 Name: form_paragraph
-Width: 500
-Height: 450
-Number of Objects: 36
+Width: 395
+Height: 405
+Number of Objects: 31
 
 --------------------
 class: FL_BOX
-type: UP_BOX
-box: 0 0 500 450
-boxtype: FL_UP_BOX
+type: FLAT_BOX
+box: 0 0 395 405
+boxtype: FL_FLAT_BOX
 colors: FL_COL1 FL_COL1
 alignment: FL_ALIGN_CENTER
 style: FL_NORMAL_STYLE
-size: FL_DEFAULT_SIZE
+size: FL_NORMAL_SIZE
 lcol: FL_BLACK
 label: 
 shortcut: 
@@ -34,122 +34,50 @@ argument:
 --------------------
 class: FL_LABELFRAME
 type: ENGRAVED_FRAME
-box: 10 20 220 75
+box: 205 110 185 115
 boxtype: FL_NO_BOX
 colors: FL_BLACK FL_COL1
 alignment: FL_ALIGN_TOP_LEFT
-style: FL_BOLD_STYLE
+style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
 label: Alignment
 shortcut: 
 resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
+gravity: FL_East FL_East
 name: 
 callback: 
 argument: 
 
 --------------------
-class: FL_BEGIN_GROUP
-type: 0
-box: 0 0 0 0
+class: FL_LABELFRAME
+type: ENGRAVED_FRAME
+box: 5 110 200 115
 boxtype: FL_NO_BOX
-colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_CENTER
+colors: FL_BLACK FL_COL1
+alignment: FL_ALIGN_TOP_LEFT
 style: FL_NORMAL_STYLE
-size: FL_DEFAULT_SIZE
+size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: 
+label: Text
 shortcut: 
 resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
+gravity: FL_West FL_East
 name: 
 callback: 
 argument: 
 
 --------------------
-class: FL_ROUND3DBUTTON
-type: RADIO_BUTTON
-box: 15 30 80 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Right|#R
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: radio_align_right
-callback: C_FormBaseInputCB
-argument: 0
-
---------------------
-class: FL_ROUND3DBUTTON
-type: RADIO_BUTTON
-box: 15 60 80 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Left|#f
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: radio_align_left
-callback: C_FormBaseInputCB
-argument: 0
-
---------------------
-class: FL_ROUND3DBUTTON
-type: RADIO_BUTTON
-box: 115 30 80 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Block|#c
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: radio_align_block
-callback: C_FormBaseInputCB
-argument: 0
-
---------------------
-class: FL_ROUND3DBUTTON
-type: RADIO_BUTTON
-box: 115 60 80 30
+class: FL_LABELFRAME
+type: ENGRAVED_FRAME
+box: 5 235 385 90
 boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_CENTER
+colors: FL_BLACK FL_COL1
+alignment: FL_ALIGN_TOP_LEFT
 style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: Center|#n
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: radio_align_center
-callback: C_FormBaseInputCB
-argument: 0
-
---------------------
-class: FL_END_GROUP
-type: 0
-box: 0 0 0 0
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_DEFAULT_SIZE
-lcol: FL_BLACK
-label: 
+label: Below
 shortcut: 
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
@@ -160,14 +88,14 @@ argument:
 --------------------
 class: FL_LABELFRAME
 type: ENGRAVED_FRAME
-box: 240 20 120 75
+box: 5 10 385 90
 boxtype: FL_NO_BOX
 colors: FL_BLACK FL_COL1
 alignment: FL_ALIGN_TOP_LEFT
-style: FL_BOLD_STYLE
+style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: Lines
+label: Above
 shortcut: 
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
@@ -178,125 +106,89 @@ argument:
 --------------------
 class: FL_CHECKBUTTON
 type: PUSH_BUTTON
-box: 245 30 120 30
+box: 20 25 100 25
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_YELLOW
 alignment: FL_ALIGN_CENTER
 style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: Above|#b
+label: Line|#i
 shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: check_lines_top
+resize: FL_RESIZE_NONE
+gravity: FL_West FL_West
+name: check_line_above
 callback: C_FormBaseInputCB
 argument: 0
 
 --------------------
 class: FL_CHECKBUTTON
 type: PUSH_BUTTON
-box: 245 60 120 30
+box: 20 250 100 25
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_YELLOW
 alignment: FL_ALIGN_CENTER
 style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: Below|#E
+label: Line|#n
 shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: check_lines_bottom
+resize: FL_RESIZE_NONE
+gravity: FL_West FL_West
+name: check_line_below
 callback: C_FormBaseInputCB
 argument: 0
 
---------------------
-class: FL_LABELFRAME
-type: ENGRAVED_FRAME
-box: 370 20 120 75
-boxtype: FL_NO_BOX
-colors: FL_BLACK FL_COL1
-alignment: FL_ALIGN_TOP_LEFT
-style: FL_BOLD_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Page breaks
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: 
-callback: 
-argument: 
-
 --------------------
 class: FL_CHECKBUTTON
 type: PUSH_BUTTON
-box: 375 30 120 30
+box: 20 65 105 25
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_YELLOW
 alignment: FL_ALIGN_CENTER
 style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: Above|#o
+label: Page break|#g
 shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: check_pagebreaks_top
+resize: FL_RESIZE_NONE
+gravity: FL_West FL_West
+name: check_pagebreak_above
 callback: C_FormBaseInputCB
 argument: 0
 
 --------------------
 class: FL_CHECKBUTTON
 type: PUSH_BUTTON
-box: 375 60 120 30
+box: 20 290 100 25
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_YELLOW
 alignment: FL_ALIGN_CENTER
 style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: Below|#l
+label: Page break|#b
 shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: check_pagebreaks_bottom
+resize: FL_RESIZE_NONE
+gravity: FL_West FL_West
+name: check_pagebreak_below
 callback: C_FormBaseInputCB
 argument: 0
 
---------------------
-class: FL_LABELFRAME
-type: ENGRAVED_FRAME
-box: 10 110 480 105
-boxtype: FL_NO_BOX
-colors: FL_BLACK FL_COL1
-alignment: FL_ALIGN_TOP_LEFT
-style: FL_BOLD_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Vertical spaces
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: 
-callback: 
-argument: 
-
 --------------------
 class: FL_CHOICE
 type: NORMAL_CHOICE
-box: 80 130 100 30
+box: 230 20 120 25
 boxtype: FL_FRAME_BOX
 colors: FL_COL1 FL_BLACK
 alignment: FL_ALIGN_LEFT
 style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: Above:|#v
+label: Vertical space:|#V
 shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
+resize: FL_RESIZE_X
+gravity: FL_West FL_East
 name: choice_space_above
 callback: C_FormBaseInputCB
 argument: 0
@@ -304,7 +196,7 @@ argument: 0
 --------------------
 class: FL_INPUT
 type: NORMAL_INPUT
-box: 190 130 90 30
+box: 230 45 70 25
 boxtype: FL_DOWN_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_LEFT
@@ -313,8 +205,8 @@ size: FL_NORMAL_SIZE
 lcol: FL_BLACK
 label: 
 shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
+resize: FL_RESIZE_NONE
+gravity: FL_West FL_East
 name: input_space_above
 callback: C_FormBaseInputCB
 argument: 0
@@ -322,7 +214,7 @@ argument: 0
 --------------------
 class: FL_CHECKBUTTON
 type: PUSH_BUTTON
-box: 375 130 40 30
+box: 230 70 80 25
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_YELLOW
 alignment: FL_ALIGN_CENTER
@@ -331,8 +223,8 @@ size: FL_NORMAL_SIZE
 lcol: FL_BLACK
 label: Keep|#K
 shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
+resize: FL_RESIZE_NONE
+gravity: FL_West FL_West
 name: check_space_above
 callback: C_FormBaseInputCB
 argument: 0
@@ -340,17 +232,17 @@ argument: 0
 --------------------
 class: FL_CHOICE
 type: NORMAL_CHOICE
-box: 80 170 100 30
+box: 230 245 120 25
 boxtype: FL_FRAME_BOX
 colors: FL_COL1 FL_BLACK
 alignment: FL_ALIGN_LEFT
 style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: Below:|#w
+label: Vertical space:|#e
 shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
+resize: FL_RESIZE_X
+gravity: FL_West FL_East
 name: choice_space_below
 callback: C_FormBaseInputCB
 argument: 0
@@ -358,7 +250,7 @@ argument: 0
 --------------------
 class: FL_INPUT
 type: NORMAL_INPUT
-box: 190 170 90 30
+box: 230 270 70 25
 boxtype: FL_DOWN_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_LEFT
@@ -367,8 +259,8 @@ size: FL_NORMAL_SIZE
 lcol: FL_BLACK
 label: 
 shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
+resize: FL_RESIZE_X
+gravity: FL_West FL_East
 name: input_space_below
 callback: C_FormBaseInputCB
 argument: 0
@@ -376,7 +268,7 @@ argument: 0
 --------------------
 class: FL_CHECKBUTTON
 type: PUSH_BUTTON
-box: 375 170 40 30
+box: 230 295 80 25
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_YELLOW
 alignment: FL_ALIGN_CENTER
@@ -385,44 +277,26 @@ size: FL_NORMAL_SIZE
 lcol: FL_BLACK
 label: Keep|#p
 shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
+resize: FL_RESIZE_NONE
+gravity: FL_West FL_West
 name: check_space_below
 callback: C_FormBaseInputCB
 argument: 0
 
---------------------
-class: FL_LABELFRAME
-type: ENGRAVED_FRAME
-box: 10 230 345 55
-boxtype: FL_NO_BOX
-colors: FL_BLACK FL_COL1
-alignment: FL_ALIGN_TOP_LEFT
-style: FL_BOLD_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Line spacing
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: 
-callback: 
-argument: 
-
 --------------------
 class: FL_CHOICE
 type: NORMAL_CHOICE
-box: 80 245 100 30
+box: 20 185 90 25
 boxtype: FL_FRAME_BOX
 colors: FL_COL1 FL_BLACK
-alignment: FL_ALIGN_LEFT
+alignment: FL_ALIGN_TOP
 style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: Spacing:|#S
+label: Line spacing:|#s
 shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
+resize: FL_RESIZE_X
+gravity: FL_West FL_NoGravity
 name: choice_linespacing
 callback: C_FormBaseInputCB
 argument: 0
@@ -430,50 +304,32 @@ argument: 0
 --------------------
 class: FL_INPUT
 type: NORMAL_INPUT
-box: 190 245 155 30
+box: 110 185 60 25
 boxtype: FL_DOWN_BOX
 colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_LEFT
+alignment: FL_ALIGN_CENTER
 style: FL_NORMAL_STYLE
 size: FL_DEFAULT_SIZE
 lcol: FL_BLACK
 label: 
 shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
+resize: FL_RESIZE_X
+gravity: FL_NoGravity FL_East
 name: input_linespacing
 callback: C_FormBaseInputCB
 argument: 0
 
---------------------
-class: FL_LABELFRAME
-type: ENGRAVED_FRAME
-box: 10 300 480 50
-boxtype: FL_NO_BOX
-colors: FL_BLACK FL_COL1
-alignment: FL_ALIGN_TOP_LEFT
-style: FL_BOLD_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Label Width
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: 
-callback: 
-argument: 
-
 --------------------
 class: FL_INPUT
 type: NORMAL_INPUT
-box: 125 310 355 30
+box: 150 340 235 25
 boxtype: FL_DOWN_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_LEFT
 style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: Longest Label:|#g
+label: Maximum  label width:|#M
 shortcut: 
 resize: FL_RESIZE_X
 gravity: FL_West FL_East
@@ -481,38 +337,20 @@ name: input_labelwidth
 callback: C_FormBaseInputCB
 argument: 0
 
---------------------
-class: FL_LABELFRAME
-type: ENGRAVED_FRAME
-box: 365 230 125 55
-boxtype: FL_NO_BOX
-colors: FL_BLACK FL_COL1
-alignment: FL_ALIGN_TOP_LEFT
-style: FL_BOLD_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Indent
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: 
-callback: 
-argument: 
-
 --------------------
 class: FL_CHECKBUTTON
 type: PUSH_BUTTON
-box: 375 245 115 30
+box: 20 125 110 25
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_YELLOW
 alignment: FL_ALIGN_CENTER
 style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: No Indent|#I
+label: No Indent|#d
 shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
+resize: FL_RESIZE_NONE
+gravity: FL_West FL_West
 name: check_noindent
 callback: C_FormBaseInputCB
 argument: 0
@@ -520,7 +358,7 @@ argument: 0
 --------------------
 class: FL_BUTTON
 type: NORMAL_BUTTON
-box: 10 360 100 30
+box: 5 375 90 25
 boxtype: FL_UP_BOX
 colors: FL_COL1 FL_COL1
 alignment: FL_ALIGN_CENTER
@@ -529,8 +367,8 @@ size: FL_NORMAL_SIZE
 lcol: FL_BLACK
 label: Restore|#R
 shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
+resize: FL_RESIZE_NONE
+gravity: FL_SouthWest FL_SouthWest
 name: button_restore
 callback: C_FormBaseRestoreCB
 argument: 0
@@ -538,7 +376,7 @@ argument: 0
 --------------------
 class: FL_BUTTON
 type: RETURN_BUTTON
-box: 200 360 90 30
+box: 110 375 90 25
 boxtype: FL_UP_BOX
 colors: FL_COL1 FL_COL1
 alignment: FL_ALIGN_CENTER
@@ -547,8 +385,8 @@ size: FL_NORMAL_SIZE
 lcol: FL_BLACK
 label: OK
 shortcut: ^M
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
+resize: FL_RESIZE_NONE
+gravity: FL_SouthEast FL_SouthEast
 name: button_ok
 callback: C_FormBaseOKCB
 argument: 0
@@ -556,7 +394,7 @@ argument: 0
 --------------------
 class: FL_BUTTON
 type: NORMAL_BUTTON
-box: 300 360 90 30
+box: 205 375 90 25
 boxtype: FL_UP_BOX
 colors: FL_COL1 FL_COL1
 alignment: FL_ALIGN_CENTER
@@ -565,8 +403,8 @@ size: FL_NORMAL_SIZE
 lcol: FL_BLACK
 label: Apply|#A
 shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
+resize: FL_RESIZE_NONE
+gravity: FL_SouthEast FL_SouthEast
 name: button_apply
 callback: C_FormBaseApplyCB
 argument: 0
@@ -574,7 +412,7 @@ argument: 0
 --------------------
 class: FL_BUTTON
 type: NORMAL_BUTTON
-box: 400 360 90 30
+box: 300 375 90 25
 boxtype: FL_UP_BOX
 colors: FL_COL1 FL_COL1
 alignment: FL_ALIGN_CENTER
@@ -583,18 +421,54 @@ size: FL_NORMAL_SIZE
 lcol: FL_BLACK
 label: Cancel|^[
 shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
+resize: FL_RESIZE_NONE
+gravity: FL_SouthEast FL_SouthEast
 name: button_close
 callback: C_FormBaseCancelCB
 argument: 0
 
 --------------------
-class: FL_FRAME
-type: ENGRAVED_FRAME
-box: 10 395 480 1
+class: FL_CHOICE
+type: NORMAL_CHOICE
+box: 300 45 50 25
+boxtype: FL_FRAME_BOX
+colors: FL_COL1 FL_BLACK
+alignment: FL_ALIGN_LEFT
+style: FL_NORMAL_STYLE
+size: FL_DEFAULT_SIZE
+lcol: FL_BLACK
+label: 
+shortcut: 
+resize: FL_RESIZE_NONE
+gravity: FL_East FL_East
+name: choice_unit_space_above
+callback: C_FormBaseInputCB
+argument: 0
+
+--------------------
+class: FL_CHOICE
+type: NORMAL_CHOICE
+box: 300 270 50 25
+boxtype: FL_FRAME_BOX
+colors: FL_COL1 FL_BLACK
+alignment: FL_ALIGN_LEFT
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: 
+shortcut: 
+resize: FL_RESIZE_NONE
+gravity: FL_East FL_East
+name: choice_unit_space_below
+callback: C_FormBaseInputCB
+argument: 0
+
+--------------------
+class: FL_BEGIN_GROUP
+type: 0
+box: 0 10 10 0
 boxtype: FL_NO_BOX
-colors: FL_BLACK FL_COL1
+colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_CENTER
 style: FL_NORMAL_STYLE
 size: FL_DEFAULT_SIZE
@@ -608,48 +482,84 @@ callback:
 argument: 
 
 --------------------
-class: FL_TEXT
-type: NORMAL_TEXT
-box: 10 405 480 35
+class: FL_ROUND3DBUTTON
+type: RADIO_BUTTON
+box: 215 170 170 25
 boxtype: FL_NO_BOX
-colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
-style: FL_BOLD_STYLE
+colors: FL_COL1 FL_YELLOW
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: 
+label: Right|#R
 shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: text_warning
-callback: 
-argument: 
+resize: FL_RESIZE_NONE
+gravity: FL_East FL_East
+name: radio_align_right
+callback: C_FormBaseInputCB
+argument: 0
 
 --------------------
-class: FL_CHOICE
-type: NORMAL_CHOICE
-box: 290 130 65 30
-boxtype: FL_FRAME_BOX
-colors: FL_COL1 FL_BLACK
-alignment: FL_ALIGN_LEFT
+class: FL_ROUND3DBUTTON
+type: RADIO_BUTTON
+box: 215 145 170 25
+boxtype: FL_NO_BOX
+colors: FL_COL1 FL_YELLOW
+alignment: FL_ALIGN_CENTER
 style: FL_NORMAL_STYLE
-size: FL_DEFAULT_SIZE
+size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: 
+label: Left|#L
 shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: choice_value_space_above
+resize: FL_RESIZE_NONE
+gravity: FL_East FL_East
+name: radio_align_left
 callback: C_FormBaseInputCB
 argument: 0
 
 --------------------
-class: FL_CHOICE
-type: NORMAL_CHOICE
-box: 290 170 65 30
-boxtype: FL_FRAME_BOX
-colors: FL_COL1 FL_BLACK
-alignment: FL_ALIGN_LEFT
+class: FL_ROUND3DBUTTON
+type: RADIO_BUTTON
+box: 215 120 170 25
+boxtype: FL_NO_BOX
+colors: FL_COL1 FL_YELLOW
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Block|#B
+shortcut: 
+resize: FL_RESIZE_NONE
+gravity: FL_East FL_East
+name: radio_align_block
+callback: C_FormBaseInputCB
+argument: 0
+
+--------------------
+class: FL_ROUND3DBUTTON
+type: RADIO_BUTTON
+box: 215 195 170 25
+boxtype: FL_NO_BOX
+colors: FL_COL1 FL_YELLOW
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Centered|#C
+shortcut: 
+resize: FL_RESIZE_NONE
+gravity: FL_East FL_East
+name: radio_align_center
+callback: C_FormBaseInputCB
+argument: 0
+
+--------------------
+class: FL_END_GROUP
+type: 0
+box: 0 0 0 0
+boxtype: FL_NO_BOX
+colors: FL_COL1 FL_MCOL
+alignment: FL_ALIGN_CENTER
 style: FL_NORMAL_STYLE
 size: FL_DEFAULT_SIZE
 lcol: FL_BLACK
@@ -657,9 +567,9 @@ label:
 shortcut: 
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
-name: choice_value_space_below
-callback: C_FormBaseInputCB
-argument: 0
+name: 
+callback: 
+argument: 
 
 ==============================
 create_the_forms