]> git.lyx.org Git - features.git/commitdiff
Further improvements to the paper tab of the document dialog.
authorAngus Leeming <leeming@lyx.org>
Tue, 9 Oct 2001 12:36:36 +0000 (12:36 +0000)
committerAngus Leeming <leeming@lyx.org>
Tue, 9 Oct 2001 12:36:36 +0000 (12:36 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2849 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/xforms/ChangeLog
src/frontends/xforms/FormDocument.C
src/frontends/xforms/form_document.C
src/frontends/xforms/form_document.h
src/frontends/xforms/forms/form_document.fd
src/frontends/xforms/xforms_helpers.C
src/frontends/xforms/xforms_helpers.h

index 750e6b62cf7c9a4d2ee4fb6aab0a59b0b73231d1..ffa4a9e57238a357a72954a0e6f90ad9f0c272e1 100644 (file)
@@ -1,3 +1,14 @@
+2001-10-09  Angus Leeming  <a.leeming@ic.ac.uk>
+
+       * xforms_helpers.[Ch] (getLengthFromWidgets): new function.
+       Given input and choice widgets, create a string such as "1cm".
+       (updateWidgetsFromLengthString): new function.
+       Given a string such as "1cm", set the input and choice widgets.
+
+       * FormDocument.C:
+       * forms/form_document.fd: improve the GUI of the paper tab using these
+       new helper functions.
+
 2001-10-07  Adrien Rebollo  <adrien.rebollo@gmx.fr>
 
        * FormDocument.C (build): support latin4
index 30af0d07812af625501130573e7a7b8ba6a2f64f..c952be85144891f9238c601d281e6d508ed598bb 100644 (file)
@@ -43,6 +43,7 @@
 #include "bufferview_funcs.h"
 #include "xforms_helpers.h" 
 #include "debug.h"
+#include "input_validators.h" // fl_unsigned_float_filter
 
 using Liason::setMinibuffer;
 using SigC::slot;
@@ -96,7 +97,7 @@ void FormDocument::build()
 
        // the document paper form
        paper_.reset(build_doc_paper());
-       fl_addto_choice(paper_->choice_papersize2,
+       fl_addto_choice(paper_->choice_papersize,
                        _(" Default | Custom | USletter | USlegal "
                          "| USexecutive | A3 | A4 | A5 | B3 | B4 | B5 "));
        fl_addto_choice(paper_->choice_paperpackage,
@@ -115,12 +116,46 @@ void FormDocument::build()
        fl_set_input_return(paper_->input_head_sep, FL_RETURN_CHANGED);
        fl_set_input_return(paper_->input_foot_skip, FL_RETURN_CHANGED);
 
+       // Set input filters on width and height to make them accept only
+       // unsigned numbers.
+       fl_set_input_filter(paper_->input_custom_width,
+                           fl_unsigned_float_filter);
+       fl_set_input_filter(paper_->input_custom_height,
+                           fl_unsigned_float_filter);
+       fl_set_input_filter(paper_->input_top_margin,
+                           fl_unsigned_float_filter);
+       fl_set_input_filter(paper_->input_bottom_margin,
+                           fl_unsigned_float_filter);
+       fl_set_input_filter(paper_->input_left_margin,
+                           fl_unsigned_float_filter);
+       fl_set_input_filter(paper_->input_right_margin,
+                           fl_unsigned_float_filter);
+       fl_set_input_filter(paper_->input_head_height,
+                           fl_unsigned_float_filter);
+       fl_set_input_filter(paper_->input_head_sep,
+                           fl_unsigned_float_filter);
+       fl_set_input_filter(paper_->input_foot_skip,
+                           fl_unsigned_float_filter);
+
+       // Create the contents of the unit choices
+       string const units = " cm | inch ";
+
+       fl_addto_choice(paper_->choice_custom_width_units,  units.c_str());
+       fl_addto_choice(paper_->choice_custom_height_units, units.c_str());
+       fl_addto_choice(paper_->choice_top_margin_units,    units.c_str());
+       fl_addto_choice(paper_->choice_bottom_margin_units, units.c_str());
+       fl_addto_choice(paper_->choice_left_margin_units,   units.c_str());
+       fl_addto_choice(paper_->choice_right_margin_units,  units.c_str());
+       fl_addto_choice(paper_->choice_head_height_units,   units.c_str());
+       fl_addto_choice(paper_->choice_head_sep_units,      units.c_str());
+       fl_addto_choice(paper_->choice_foot_skip_units,     units.c_str());
+
        bc().addReadOnly (paper_->choice_paperpackage);
-       bc().addReadOnly (paper_->greoup_radio_orientation);
+       bc().addReadOnly (paper_->group_radio_orientation);
        bc().addReadOnly (paper_->radio_portrait);
        bc().addReadOnly (paper_->radio_landscape);
-       bc().addReadOnly (paper_->choice_papersize2);
-       bc().addReadOnly (paper_->push_use_geometry);
+       bc().addReadOnly (paper_->choice_papersize);
+       bc().addReadOnly (paper_->check_use_geometry);
        bc().addReadOnly (paper_->input_custom_width);
        bc().addReadOnly (paper_->input_custom_height);
        bc().addReadOnly (paper_->input_top_margin);
@@ -380,70 +415,75 @@ bool FormDocument::input( FL_OBJECT * ob, long data )
                fl_set_choice(paper_->choice_paperpackage,
                BufferParams::PACKAGE_NONE + 1);
 
-       if (ob == paper_->choice_papersize2) {
-               if (fl_get_choice(paper_->choice_papersize2) == 2)
+       if (ob == paper_->choice_papersize) {
+               if (fl_get_choice(paper_->choice_papersize) == 2)
                        fl_set_button(paper_->radio_portrait, 1);
-               setEnabled(paper_->input_custom_width,
-                       fl_get_choice(paper_->choice_papersize2) == 2);
-               setEnabled(paper_->input_custom_height,
-                       fl_get_choice(paper_->choice_papersize2) == 2);
-               setEnabled(paper_->radio_portrait,
-                       fl_get_choice(paper_->choice_papersize2) != 2);
-               setEnabled(paper_->radio_landscape,
-                       fl_get_choice(paper_->choice_papersize2) != 2);
+               bool const custom =
+                       fl_get_choice(paper_->choice_papersize) == 2;
+               setEnabled(paper_->input_custom_width,  custom);
+               setEnabled(paper_->input_custom_height, custom);
+               setEnabled(paper_->choice_custom_width_units,  custom);
+               setEnabled(paper_->choice_custom_height_units, custom);
+               setEnabled(paper_->radio_portrait,  !custom);
+               setEnabled(paper_->radio_landscape, !custom);
        }
 
-       if (ob == paper_->choice_papersize2
-               || paper_->radio_portrait
-               || paper_->radio_landscape)
+       if (ob == paper_->choice_papersize
+           || paper_->radio_portrait
+           || paper_->radio_landscape) {
+
                setEnabled(paper_->choice_paperpackage,
                           //either default papersize (preferences)
                           //or document papersize has to be A4
-                          (fl_get_choice(paper_->choice_papersize2) == 7
-                           || fl_get_choice(paper_->choice_papersize2) == 1
+                          (fl_get_choice(paper_->choice_papersize) == 7
+                           || fl_get_choice(paper_->choice_papersize) == 1
                            && lyxrc.default_papersize == 5)
                           && fl_get_button(paper_->radio_portrait));
+       }
 
        if (ob == paper_->choice_paperpackage) {
                if (fl_get_choice(paper_->choice_paperpackage) != 1) {
-                       fl_set_button(paper_->push_use_geometry, 0);
-                       setEnabled(paper_->input_top_margin,
-                                  fl_get_button(paper_->push_use_geometry));
-                       setEnabled(paper_->input_bottom_margin,
-                                  fl_get_button(paper_->push_use_geometry));
-                       setEnabled(paper_->input_left_margin,
-                                  fl_get_button(paper_->push_use_geometry));
-                       setEnabled(paper_->input_right_margin,
-                                  fl_get_button(paper_->push_use_geometry));
-                       setEnabled(paper_->input_head_height,
-                                  fl_get_button(paper_->push_use_geometry));
-                       setEnabled(paper_->input_head_sep,
-                                  fl_get_button(paper_->push_use_geometry));
-                       setEnabled(paper_->input_foot_skip,
-                                  fl_get_button(paper_->push_use_geometry));
+                       fl_set_button(paper_->check_use_geometry, 0);
+
+                       setEnabled(paper_->input_top_margin,    false);
+                       setEnabled(paper_->input_bottom_margin, false);
+                       setEnabled(paper_->input_left_margin,   false);
+                       setEnabled(paper_->input_right_margin,  false);
+                       setEnabled(paper_->input_head_height,   false);
+                       setEnabled(paper_->input_head_sep,      false);
+                       setEnabled(paper_->input_foot_skip,     false);
+                       setEnabled(paper_->choice_top_margin_units,    false);
+                       setEnabled(paper_->choice_bottom_margin_units, false);
+                       setEnabled(paper_->choice_left_margin_units,   false);
+                       setEnabled(paper_->choice_right_margin_units,  false);
+                       setEnabled(paper_->choice_head_height_units,   false);
+                       setEnabled(paper_->choice_head_sep_units,      false);
+                       setEnabled(paper_->choice_foot_skip_units,     false);
                }
        }
 
-       if (ob == paper_->push_use_geometry) {
+       if (ob == paper_->check_use_geometry) {
                //don't allow switching geometry off in custom papersize mode
-               if (fl_get_choice(paper_->choice_papersize2) == 2)
-                       fl_set_button(paper_->push_use_geometry, 1);
+               if (fl_get_choice(paper_->choice_papersize) == 2)
+                       fl_set_button(paper_->check_use_geometry, 1);
                fl_set_choice(paper_->choice_paperpackage,
                              BufferParams::PACKAGE_NONE + 1);
-               setEnabled(paper_->input_top_margin,
-                          fl_get_button(paper_->push_use_geometry));
-               setEnabled(paper_->input_bottom_margin,
-                          fl_get_button(paper_->push_use_geometry));
-               setEnabled(paper_->input_left_margin,
-                          fl_get_button(paper_->push_use_geometry));
-               setEnabled(paper_->input_right_margin,
-                          fl_get_button(paper_->push_use_geometry));
-               setEnabled(paper_->input_head_height,
-                          fl_get_button(paper_->push_use_geometry));
-               setEnabled(paper_->input_head_sep,
-                          fl_get_button(paper_->push_use_geometry));
-               setEnabled(paper_->input_foot_skip,
-                          fl_get_button(paper_->push_use_geometry));
+
+               bool const use_geom = fl_get_button(paper_->check_use_geometry);
+               setEnabled(paper_->input_top_margin,    use_geom);
+               setEnabled(paper_->input_bottom_margin, use_geom);
+               setEnabled(paper_->input_left_margin,   use_geom);
+               setEnabled(paper_->input_right_margin,  use_geom);
+               setEnabled(paper_->input_head_height,   use_geom);
+               setEnabled(paper_->input_head_sep,      use_geom);
+               setEnabled(paper_->input_foot_skip,     use_geom);
+               setEnabled(paper_->choice_top_margin_units,    use_geom);
+               setEnabled(paper_->choice_bottom_margin_units, use_geom);
+               setEnabled(paper_->choice_left_margin_units,   use_geom);
+               setEnabled(paper_->choice_right_margin_units,  use_geom);
+               setEnabled(paper_->choice_head_height_units,   use_geom);
+               setEnabled(paper_->choice_head_sep_units,      use_geom);
+               setEnabled(paper_->choice_foot_skip_units,     use_geom);
        }
 
        setEnabled(dialog_->button_reset_defaults,
@@ -593,25 +633,56 @@ void FormDocument::paper_apply()
 {
        BufferParams & params = lv_->buffer()->params;
 
-       params.papersize2 =
-               static_cast<char>(fl_get_choice(paper_->choice_papersize2)-1);
+       params.papersize2 = char(fl_get_choice(paper_->choice_papersize)-1);
+
        params.paperpackage =
-               static_cast<char>(fl_get_choice(paper_->choice_paperpackage)-1);
-       params.use_geometry = fl_get_button(paper_->push_use_geometry);
+               char(fl_get_choice(paper_->choice_paperpackage)-1);
+
+       // set params.papersize from params.papersize2 and params.paperpackage
+       lv_->buffer()->setPaperStuff();
+
+       params.use_geometry = fl_get_button(paper_->check_use_geometry);
+
        if (fl_get_button(paper_->radio_landscape))
                params.orientation = BufferParams::ORIENTATION_LANDSCAPE;
        else
                params.orientation = BufferParams::ORIENTATION_PORTRAIT;
-       params.paperwidth = fl_get_input(paper_->input_custom_width);
-       params.paperheight = fl_get_input(paper_->input_custom_height);
-       params.leftmargin = fl_get_input(paper_->input_left_margin);
-       params.topmargin = fl_get_input(paper_->input_top_margin);
-       params.rightmargin = fl_get_input(paper_->input_right_margin);
-       params.bottommargin = fl_get_input(paper_->input_bottom_margin);
-       params.headheight = fl_get_input(paper_->input_head_height);
-       params.headsep = fl_get_input(paper_->input_head_sep);
-       params.footskip = fl_get_input(paper_->input_foot_skip);
-       lv_->buffer()->setPaperStuff();
+
+       params.paperwidth =
+               getLengthFromWidgets(paper_->input_custom_width,
+                                    paper_->choice_custom_width_units);
+
+       params.paperheight =
+               getLengthFromWidgets(paper_->input_custom_height,
+                                    paper_->choice_custom_height_units);
+
+       params.leftmargin =
+               getLengthFromWidgets(paper_->input_left_margin,
+                                    paper_->choice_left_margin_units);
+
+       params.topmargin =
+               getLengthFromWidgets(paper_->input_top_margin,
+                                    paper_->choice_top_margin_units);
+
+       params.rightmargin =
+               getLengthFromWidgets(paper_->input_right_margin,
+                                    paper_->choice_right_margin_units);
+
+       params.bottommargin =
+               getLengthFromWidgets(paper_->input_bottom_margin,
+                                    paper_->choice_bottom_margin_units);
+
+       params.headheight =
+               getLengthFromWidgets(paper_->input_head_height,
+                                    paper_->choice_head_height_units);
+
+       params.headsep =
+               getLengthFromWidgets(paper_->input_head_sep,
+                                    paper_->choice_head_sep_units);
+
+       params.footskip =
+               getLengthFromWidgets(paper_->input_foot_skip,
+                                    paper_->choice_foot_skip_units);
 }
 
 
@@ -840,15 +911,18 @@ void FormDocument::paper_update(BufferParams const & params)
        if (!paper_.get())
                return;
 
-       fl_set_choice(paper_->choice_papersize2, params.papersize2 + 1);
+       fl_set_choice(paper_->choice_papersize, params.papersize2 + 1);
        fl_set_choice(paper_->choice_paperpackage, params.paperpackage + 1);
-       fl_set_button(paper_->push_use_geometry, params.use_geometry);
+       fl_set_button(paper_->check_use_geometry, params.use_geometry);
+
+       bool const useCustom = fl_get_choice(paper_->choice_papersize) == 2;
+       bool const useGeom = fl_get_button(paper_->check_use_geometry);
+
        fl_set_button(paper_->radio_portrait, 0);
-       setEnabled(paper_->radio_portrait,
-                  fl_get_choice(paper_->choice_papersize2) != 2);
+       setEnabled(paper_->radio_portrait, !useCustom);
        fl_set_button(paper_->radio_landscape, 0);
-       setEnabled(paper_->radio_landscape,
-                  fl_get_choice(paper_->choice_papersize2) != 2);
+       setEnabled(paper_->radio_landscape, !useCustom);
+
        if (params.orientation == BufferParams::ORIENTATION_LANDSCAPE)
                fl_set_button(paper_->radio_landscape, 1);
        else
@@ -856,38 +930,66 @@ void FormDocument::paper_update(BufferParams const & params)
        setEnabled(paper_->choice_paperpackage,
                   //either default papersize (preferences)
                   //or document papersize has to be A4
-                  (fl_get_choice(paper_->choice_papersize2) == 7
-                   || fl_get_choice(paper_->choice_papersize2) == 1
+                  (fl_get_choice(paper_->choice_papersize) == 7
+                   || fl_get_choice(paper_->choice_papersize) == 1
                    && lyxrc.default_papersize == 5)
                   && fl_get_button(paper_->radio_portrait));
-       fl_set_input(paper_->input_custom_width, params.paperwidth.c_str());
-       setEnabled(paper_->input_custom_width,
-                  fl_get_choice(paper_->choice_papersize2) == 2);
-       fl_set_input(paper_->input_custom_height, params.paperheight.c_str());
-       setEnabled(paper_->input_custom_height,
-                  fl_get_choice(paper_->choice_papersize2) == 2);
-       fl_set_input(paper_->input_left_margin, params.leftmargin.c_str());
-       setEnabled(paper_->input_left_margin,
-                  fl_get_button(paper_->push_use_geometry));
-       fl_set_input(paper_->input_top_margin, params.topmargin.c_str());
-       setEnabled(paper_->input_top_margin,
-                  fl_get_button(paper_->push_use_geometry));
-       fl_set_input(paper_->input_right_margin, params.rightmargin.c_str());
-       setEnabled(paper_->input_right_margin,
-                  fl_get_button(paper_->push_use_geometry));
-       fl_set_input(paper_->input_bottom_margin, params.bottommargin.c_str());
-       setEnabled(paper_->input_bottom_margin,
-                  fl_get_button(paper_->push_use_geometry));
-       fl_set_input(paper_->input_head_height, params.headheight.c_str());
-       setEnabled(paper_->input_head_height,
-                  fl_get_button(paper_->push_use_geometry));
-       fl_set_input(paper_->input_head_sep, params.headsep.c_str());
-       setEnabled(paper_->input_head_sep,
-                  fl_get_button(paper_->push_use_geometry));
-       fl_set_input(paper_->input_foot_skip, params.footskip.c_str());
-       setEnabled(paper_->input_foot_skip,
-                  fl_get_button(paper_->push_use_geometry));
-       fl_set_focus_object(paper_->form, paper_->choice_papersize2);
+
+       updateWidgetsFromLengthString(paper_->input_custom_width,
+                                     paper_->choice_custom_width_units,
+                                     params.paperwidth);
+       setEnabled(paper_->input_custom_width, useCustom);
+       setEnabled(paper_->choice_custom_width_units, useCustom);
+
+       updateWidgetsFromLengthString(paper_->input_custom_height,
+                                     paper_->choice_custom_height_units,
+                                     params.paperheight);
+       setEnabled(paper_->input_custom_height, useCustom);
+       setEnabled(paper_->choice_custom_height_units, useCustom);
+
+       updateWidgetsFromLengthString(paper_->input_left_margin,
+                                     paper_->choice_left_margin_units,
+                                     params.leftmargin);
+       setEnabled(paper_->input_left_margin, useGeom);
+       setEnabled(paper_->choice_left_margin_units, useGeom);
+
+       updateWidgetsFromLengthString(paper_->input_top_margin,
+                                     paper_->choice_top_margin_units,
+                                     params.topmargin);
+       setEnabled(paper_->input_top_margin, useGeom);
+       setEnabled(paper_->choice_top_margin_units, useGeom);
+
+       updateWidgetsFromLengthString(paper_->input_right_margin,
+                                     paper_->choice_right_margin_units,
+                                     params.rightmargin);
+       setEnabled(paper_->input_right_margin, useGeom);
+       setEnabled(paper_->choice_right_margin_units, useGeom);
+
+       updateWidgetsFromLengthString(paper_->input_bottom_margin,
+                                     paper_->choice_bottom_margin_units,
+                                     params.bottommargin);
+       setEnabled(paper_->input_bottom_margin, useGeom);
+       setEnabled(paper_->choice_bottom_margin_units, useGeom);
+
+       updateWidgetsFromLengthString(paper_->input_head_height,
+                                     paper_->choice_head_height_units,
+                                     params.headheight);
+       setEnabled(paper_->input_head_height, useGeom);
+       setEnabled(paper_->choice_head_height_units, useGeom);
+
+       updateWidgetsFromLengthString(paper_->input_head_sep,
+                                     paper_->choice_head_sep_units,
+                                     params.headsep);
+       setEnabled(paper_->input_head_sep, useGeom);
+       setEnabled(paper_->choice_head_sep_units, useGeom);
+
+       updateWidgetsFromLengthString(paper_->input_foot_skip,
+                                     paper_->choice_foot_skip_units,
+                                     params.footskip);
+       setEnabled(paper_->input_foot_skip, useGeom);
+       setEnabled(paper_->choice_foot_skip_units, useGeom);
+
+       fl_set_focus_object(paper_->form, paper_->choice_papersize);
 }
 
 
@@ -950,29 +1052,31 @@ void FormDocument::checkMarginValues()
 bool FormDocument::CheckDocumentInput(FL_OBJECT * ob, long)
 {
        string str;
-       int val;
        bool ok = true;
        char const * input;
-    
+
+// this is not needed after the recent redesign (Angus)
+#if 0 
+       int val;
        checkMarginValues();
-       if (ob == paper_->choice_papersize2) {
-               val = fl_get_choice(paper_->choice_papersize2)-1;
+       if (ob == paper_->choice_papersize) {
+               val = fl_get_choice(paper_->choice_papersize)-1;
                if (val == BufferParams::VM_PAPER_DEFAULT) {
-                       fl_set_button(paper_->push_use_geometry, 0);
+                       fl_set_button(paper_->check_use_geometry, 0);
                        setEnabled(paper_->input_top_margin,
-                                  fl_get_button(paper_->push_use_geometry));
+                                  fl_get_button(paper_->check_use_geometry));
                        setEnabled(paper_->input_bottom_margin,
-                                  fl_get_button(paper_->push_use_geometry));
+                                  fl_get_button(paper_->check_use_geometry));
                        setEnabled(paper_->input_left_margin,
-                                  fl_get_button(paper_->push_use_geometry));
+                                  fl_get_button(paper_->check_use_geometry));
                        setEnabled(paper_->input_right_margin,
-                                  fl_get_button(paper_->push_use_geometry));
+                                  fl_get_button(paper_->check_use_geometry));
                        setEnabled(paper_->input_head_height,
-                                  fl_get_button(paper_->push_use_geometry));
+                                  fl_get_button(paper_->check_use_geometry));
                        setEnabled(paper_->input_head_sep,
-                                  fl_get_button(paper_->push_use_geometry));
+                                  fl_get_button(paper_->check_use_geometry));
                        setEnabled(paper_->input_foot_skip,
-                                  fl_get_button(paper_->push_use_geometry));
+                                  fl_get_button(paper_->check_use_geometry));
                        checkMarginValues();
                } else {
                        if ((val != BufferParams::VM_PAPER_USLETTER) &&
@@ -981,21 +1085,21 @@ bool FormDocument::CheckDocumentInput(FL_OBJECT * ob, long)
                            (val != BufferParams::VM_PAPER_A4) &&
                            (val != BufferParams::VM_PAPER_A5) &&
                            (val != BufferParams::VM_PAPER_B5)) {
-                               fl_set_button(paper_->push_use_geometry, 1);
+                               fl_set_button(paper_->check_use_geometry, 1);
                                setEnabled(paper_->input_top_margin,
-                                          fl_get_button(paper_->push_use_geometry));
+                                          fl_get_button(paper_->check_use_geometry));
                                setEnabled(paper_->input_bottom_margin,
-                                          fl_get_button(paper_->push_use_geometry));
+                                          fl_get_button(paper_->check_use_geometry));
                                setEnabled(paper_->input_left_margin,
-                                          fl_get_button(paper_->push_use_geometry));
+                                          fl_get_button(paper_->check_use_geometry));
                                setEnabled(paper_->input_right_margin,
-                                          fl_get_button(paper_->push_use_geometry));
+                                          fl_get_button(paper_->check_use_geometry));
                                setEnabled(paper_->input_head_height,
-                                          fl_get_button(paper_->push_use_geometry));
+                                          fl_get_button(paper_->check_use_geometry));
                                setEnabled(paper_->input_head_sep,
-                                          fl_get_button(paper_->push_use_geometry));
+                                          fl_get_button(paper_->check_use_geometry));
                                setEnabled(paper_->input_foot_skip,
-                                          fl_get_button(paper_->push_use_geometry));
+                                          fl_get_button(paper_->check_use_geometry));
                        }
                        fl_set_choice(paper_->choice_paperpackage,
                                      BufferParams::PACKAGE_NONE + 1);
@@ -1003,21 +1107,21 @@ bool FormDocument::CheckDocumentInput(FL_OBJECT * ob, long)
        } else if (ob == paper_->choice_paperpackage) {
                val = fl_get_choice(paper_->choice_paperpackage)-1;
                if (val != BufferParams::PACKAGE_NONE) {
-                       fl_set_button(paper_->push_use_geometry, 0);
+                       fl_set_button(paper_->check_use_geometry, 0);
                        setEnabled(paper_->input_top_margin,
-                                  fl_get_button(paper_->push_use_geometry));
+                                  fl_get_button(paper_->check_use_geometry));
                        setEnabled(paper_->input_bottom_margin,
-                                  fl_get_button(paper_->push_use_geometry));
+                                  fl_get_button(paper_->check_use_geometry));
                        setEnabled(paper_->input_left_margin,
-                                  fl_get_button(paper_->push_use_geometry));
+                                  fl_get_button(paper_->check_use_geometry));
                        setEnabled(paper_->input_right_margin,
-                                  fl_get_button(paper_->push_use_geometry));
+                                  fl_get_button(paper_->check_use_geometry));
                        setEnabled(paper_->input_head_height,
-                                  fl_get_button(paper_->push_use_geometry));
+                                  fl_get_button(paper_->check_use_geometry));
                        setEnabled(paper_->input_head_sep,
-                                  fl_get_button(paper_->push_use_geometry));
+                                  fl_get_button(paper_->check_use_geometry));
                        setEnabled(paper_->input_foot_skip,
-                                  fl_get_button(paper_->push_use_geometry));
+                                  fl_get_button(paper_->check_use_geometry));
                }
        } else if (ob == class_->input_doc_spacing) {
                input = fl_get_input(class_->input_doc_spacing);
@@ -1047,6 +1151,8 @@ bool FormDocument::CheckDocumentInput(FL_OBJECT * ob, long)
        ok = ok && (str.empty() || isValidLength(str));
        str = fl_get_input(paper_->input_foot_skip);
        ok = ok && (str.empty() || isValidLength(str));
+#endif
+
        // "Synchronize" the choice and the input field, so that it
        // is impossible to commit senseless data.
        input = fl_get_input (class_->input_doc_skip);
index 58de37b4a9465775d73d660ee1cf905b04d410ee..684a61d23351b2ff1f20ce7d91c79f4d3c15b24b 100644 (file)
@@ -91,123 +91,142 @@ FD_form_doc_paper * FormDocument::build_doc_paper()
   fdui->form = fl_bgn_form(FL_NO_BOX, 440, 345);
   fdui->form->u_vdata = this;
   obj = fl_add_box(FL_FLAT_BOX, 0, 0, 440, 345, "");
+  obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 10, 15, 225, 120, _("Papersize"));
   {
-    char const * const dummy = N_("Special (A4 portrait only):|#S");
-    fdui->choice_paperpackage = obj = fl_add_choice(FL_NORMAL_CHOICE, 230, 180, 185, 30, idex(_(dummy)));
+    char const * const dummy = N_("Papersize:|#P");
+    fdui->choice_papersize = obj = fl_add_choice(FL_NORMAL_CHOICE, 110, 25, 115, 30, idex(_(dummy)));
     fl_set_button_shortcut(obj, scex(_(dummy)), 1);
   }
     fl_set_object_boxtype(obj, FL_FRAME_BOX);
     fl_set_object_lsize(obj, FL_NORMAL_SIZE);
-    fl_set_object_lalign(obj, FL_ALIGN_TOP);
     fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, INPUT);
-  obj = fl_add_frame(FL_ENGRAVED_FRAME, 440, 360, 10, 10, "");
-    fl_set_object_color(obj, FL_COL1, FL_COL1);
-  obj = fl_add_frame(FL_ENGRAVED_FRAME, 440, 350, 10, 10, "");
-    fl_set_object_color(obj, FL_COL1, FL_COL1);
-
-  fdui->greoup_radio_orientation = fl_bgn_group();
   {
-    char const * const dummy = N_("Portrait|#o");
-    fdui->radio_portrait = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 255, 40, 120, 30, idex(_(dummy)));
+    char const * const dummy = N_("Width:|#W");
+    fdui->input_custom_width = obj = fl_add_input(FL_NORMAL_INPUT, 110, 60, 55, 30, idex(_(dummy)));
     fl_set_button_shortcut(obj, scex(_(dummy)), 1);
   }
     fl_set_object_lsize(obj, FL_NORMAL_SIZE);
     fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, INPUT);
+  fdui->choice_custom_width_units = obj = fl_add_choice(FL_NORMAL_CHOICE, 170, 60, 55, 30, "");
+    fl_set_object_boxtype(obj, FL_FRAME_BOX);
+    fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, 0);
   {
-    char const * const dummy = N_("Landscape|#L");
-    fdui->radio_landscape = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 255, 75, 120, 30, idex(_(dummy)));
+    char const * const dummy = N_("Height:|#H");
+    fdui->input_custom_height = obj = fl_add_input(FL_NORMAL_INPUT, 110, 95, 55, 30, idex(_(dummy)));
     fl_set_button_shortcut(obj, scex(_(dummy)), 1);
   }
     fl_set_object_lsize(obj, FL_NORMAL_SIZE);
     fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, INPUT);
-  fl_end_group();
+  fdui->choice_custom_height_units = obj = fl_add_choice(FL_NORMAL_CHOICE, 170, 95, 55, 30, "");
+    fl_set_object_boxtype(obj, FL_FRAME_BOX);
+    fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, 0);
+  obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 245, 15, 180, 120, _("Orientation"));
 
+  fdui->group_radio_orientation = fl_bgn_group();
   {
-    char const * const dummy = N_("Papersize:|#P");
-    fdui->choice_papersize2 = obj = fl_add_choice(FL_NORMAL_CHOICE, 110, 25, 115, 30, idex(_(dummy)));
+    char const * const dummy = N_("Portrait|#o");
+    fdui->radio_portrait = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 255, 40, 120, 30, idex(_(dummy)));
     fl_set_button_shortcut(obj, scex(_(dummy)), 1);
   }
-    fl_set_object_boxtype(obj, FL_FRAME_BOX);
     fl_set_object_lsize(obj, FL_NORMAL_SIZE);
     fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, INPUT);
   {
-    char const * const dummy = N_("Custom Margins/Sizes|#M");
-    fdui->push_use_geometry = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 20, 155, 30, 30, idex(_(dummy)));
+    char const * const dummy = N_("Landscape|#L");
+    fdui->radio_landscape = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 255, 75, 120, 30, idex(_(dummy)));
     fl_set_button_shortcut(obj, scex(_(dummy)), 1);
   }
     fl_set_object_lsize(obj, FL_NORMAL_SIZE);
-    fl_set_object_lalign(obj, FL_ALIGN_RIGHT);
     fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, INPUT);
+  fl_end_group();
+
+  obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 10, 150, 415, 185, _("Margins"));
   {
-    char const * const dummy = N_("Width:|#W");
-    fdui->input_custom_width = obj = fl_add_input(FL_NORMAL_INPUT, 135, 60, 90, 30, idex(_(dummy)));
+    char const * const dummy = N_("Custom Margins/Sizes|#M");
+    fdui->check_use_geometry = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 20, 155, 30, 30, idex(_(dummy)));
     fl_set_button_shortcut(obj, scex(_(dummy)), 1);
   }
     fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+    fl_set_object_lalign(obj, FL_ALIGN_RIGHT);
     fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, INPUT);
   {
-    char const * const dummy = N_("Height:|#H");
-    fdui->input_custom_height = obj = fl_add_input(FL_NORMAL_INPUT, 135, 95, 90, 30, idex(_(dummy)));
+    char const * const dummy = N_("Special (A4 portrait only):|#S");
+    fdui->choice_paperpackage = obj = fl_add_choice(FL_NORMAL_CHOICE, 230, 180, 185, 30, idex(_(dummy)));
     fl_set_button_shortcut(obj, scex(_(dummy)), 1);
   }
+    fl_set_object_boxtype(obj, FL_FRAME_BOX);
     fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+    fl_set_object_lalign(obj, FL_ALIGN_TOP);
     fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, INPUT);
   {
     char const * const dummy = N_("Top:|#T");
-    fdui->input_top_margin = obj = fl_add_input(FL_NORMAL_INPUT, 100, 190, 90, 30, idex(_(dummy)));
+    fdui->input_top_margin = obj = fl_add_input(FL_NORMAL_INPUT, 80, 190, 55, 30, idex(_(dummy)));
     fl_set_button_shortcut(obj, scex(_(dummy)), 1);
   }
     fl_set_object_lsize(obj, FL_NORMAL_SIZE);
     fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, INPUT);
+  fdui->choice_top_margin_units = obj = fl_add_choice(FL_NORMAL_CHOICE, 140, 190, 55, 30, "");
+    fl_set_object_boxtype(obj, FL_FRAME_BOX);
+    fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, 0);
   {
     char const * const dummy = N_("Bottom:|#B");
-    fdui->input_bottom_margin = obj = fl_add_input(FL_NORMAL_INPUT, 100, 225, 90, 30, idex(_(dummy)));
+    fdui->input_bottom_margin = obj = fl_add_input(FL_NORMAL_INPUT, 80, 225, 55, 30, idex(_(dummy)));
     fl_set_button_shortcut(obj, scex(_(dummy)), 1);
   }
     fl_set_object_lsize(obj, FL_NORMAL_SIZE);
     fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, INPUT);
+  fdui->choice_bottom_margin_units = obj = fl_add_choice(FL_NORMAL_CHOICE, 140, 225, 55, 30, "");
+    fl_set_object_boxtype(obj, FL_FRAME_BOX);
+    fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, 0);
   {
     char const * const dummy = N_("Left:|#e");
-    fdui->input_left_margin = obj = fl_add_input(FL_NORMAL_INPUT, 100, 260, 90, 30, idex(_(dummy)));
+    fdui->input_left_margin = obj = fl_add_input(FL_NORMAL_INPUT, 80, 260, 55, 30, idex(_(dummy)));
     fl_set_button_shortcut(obj, scex(_(dummy)), 1);
   }
     fl_set_object_lsize(obj, FL_NORMAL_SIZE);
     fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, INPUT);
+  fdui->choice_left_margin_units = obj = fl_add_choice(FL_NORMAL_CHOICE, 140, 260, 55, 30, "");
+    fl_set_object_boxtype(obj, FL_FRAME_BOX);
+    fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, 0);
   {
     char const * const dummy = N_("Right:|#R");
-    fdui->input_right_margin = obj = fl_add_input(FL_NORMAL_INPUT, 100, 295, 90, 30, idex(_(dummy)));
+    fdui->input_right_margin = obj = fl_add_input(FL_NORMAL_INPUT, 80, 295, 55, 30, idex(_(dummy)));
     fl_set_button_shortcut(obj, scex(_(dummy)), 1);
   }
     fl_set_object_lsize(obj, FL_NORMAL_SIZE);
     fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, INPUT);
+  fdui->choice_right_margin_units = obj = fl_add_choice(FL_NORMAL_CHOICE, 140, 295, 55, 30, "");
+    fl_set_object_boxtype(obj, FL_FRAME_BOX);
+    fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, 0);
   {
     char const * const dummy = N_("Headheight:|#i");
-    fdui->input_head_height = obj = fl_add_input(FL_NORMAL_INPUT, 340, 225, 75, 30, idex(_(dummy)));
+    fdui->input_head_height = obj = fl_add_input(FL_NORMAL_INPUT, 300, 225, 55, 30, idex(_(dummy)));
     fl_set_button_shortcut(obj, scex(_(dummy)), 1);
   }
     fl_set_object_lsize(obj, FL_NORMAL_SIZE);
     fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, INPUT);
+  fdui->choice_head_height_units = obj = fl_add_choice(FL_NORMAL_CHOICE, 360, 225, 55, 30, "");
+    fl_set_object_boxtype(obj, FL_FRAME_BOX);
+    fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, 0);
   {
     char const * const dummy = N_("Headsep:|#d");
-    fdui->input_head_sep = obj = fl_add_input(FL_NORMAL_INPUT, 340, 260, 75, 30, idex(_(dummy)));
+    fdui->input_head_sep = obj = fl_add_input(FL_NORMAL_INPUT, 300, 260, 55, 30, idex(_(dummy)));
     fl_set_button_shortcut(obj, scex(_(dummy)), 1);
   }
     fl_set_object_lsize(obj, FL_NORMAL_SIZE);
     fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, INPUT);
+  fdui->choice_head_sep_units = obj = fl_add_choice(FL_NORMAL_CHOICE, 360, 260, 55, 30, "");
+    fl_set_object_boxtype(obj, FL_FRAME_BOX);
+    fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, 0);
   {
     char const * const dummy = N_("Footskip:|#F");
-    fdui->input_foot_skip = obj = fl_add_input(FL_NORMAL_INPUT, 340, 295, 75, 30, idex(_(dummy)));
+    fdui->input_foot_skip = obj = fl_add_input(FL_NORMAL_INPUT, 300, 295, 55, 30, idex(_(dummy)));
     fl_set_button_shortcut(obj, scex(_(dummy)), 1);
   }
     fl_set_object_lsize(obj, FL_NORMAL_SIZE);
     fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, INPUT);
-  fdui->text_warning = obj = fl_add_text(FL_NORMAL_TEXT, 10, 360, 420, 20, "");
-    fl_set_object_lsize(obj, FL_NORMAL_SIZE);
-    fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
-    fl_set_object_lstyle(obj, FL_BOLD_STYLE);
-  obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 245, 15, 180, 120, _("Orientation"));
-  obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 10, 15, 225, 120, _("Papersize"));
-  obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 10, 145, 415, 185, _("Margins"));
+  fdui->choice_foot_skip_units = obj = fl_add_choice(FL_NORMAL_CHOICE, 360, 295, 55, 30, "");
+    fl_set_object_boxtype(obj, FL_FRAME_BOX);
+    fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, 0);
   fl_end_form();
 
   fdui->form->fdui = fdui;
index 3d63129c47ee25882cdc790d3147649ab57d0126..56a4cf2e8a446accabeaba803638baaf5c24d893 100644 (file)
@@ -40,22 +40,30 @@ struct FD_form_doc_paper {
        ~FD_form_doc_paper();
 
        FL_FORM *form;
-       FL_OBJECT *choice_paperpackage;
-       FL_OBJECT *greoup_radio_orientation;
-       FL_OBJECT *radio_portrait;
-       FL_OBJECT *radio_landscape;
-       FL_OBJECT *choice_papersize2;
-       FL_OBJECT *push_use_geometry;
+       FL_OBJECT *choice_papersize;
        FL_OBJECT *input_custom_width;
+       FL_OBJECT *choice_custom_width_units;
        FL_OBJECT *input_custom_height;
+       FL_OBJECT *choice_custom_height_units;
+       FL_OBJECT *group_radio_orientation;
+       FL_OBJECT *radio_portrait;
+       FL_OBJECT *radio_landscape;
+       FL_OBJECT *check_use_geometry;
+       FL_OBJECT *choice_paperpackage;
        FL_OBJECT *input_top_margin;
+       FL_OBJECT *choice_top_margin_units;
        FL_OBJECT *input_bottom_margin;
+       FL_OBJECT *choice_bottom_margin_units;
        FL_OBJECT *input_left_margin;
+       FL_OBJECT *choice_left_margin_units;
        FL_OBJECT *input_right_margin;
+       FL_OBJECT *choice_right_margin_units;
        FL_OBJECT *input_head_height;
+       FL_OBJECT *choice_head_height_units;
        FL_OBJECT *input_head_sep;
+       FL_OBJECT *choice_head_sep_units;
        FL_OBJECT *input_foot_skip;
-       FL_OBJECT *text_warning;
+       FL_OBJECT *choice_foot_skip_units;
 };
 struct FD_form_doc_class {
        ~FD_form_doc_class();
index 382b61b7b3b84ac3baee4e3bf4af0ba3e47c65b8..e74153b07f41eccbdf666fc439e57402dd38eec7 100644 (file)
@@ -179,7 +179,7 @@ argument: INPUT
 Name: form_doc_paper
 Width: 440
 Height: 345
-Number of Objects: 23
+Number of Objects: 29
 
 --------------------
 class: FL_BOX
@@ -199,31 +199,67 @@ name:
 callback: 
 argument: 
 
+--------------------
+class: FL_LABELFRAME
+type: ENGRAVED_FRAME
+box: 10 15 225 120
+boxtype: FL_NO_BOX
+colors: FL_BLACK FL_COL1
+alignment: FL_ALIGN_TOP_LEFT
+style: FL_NORMAL_STYLE
+size: FL_DEFAULT_SIZE
+lcol: FL_BLACK
+label: Papersize
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: 
+callback: 
+argument: 
+
 --------------------
 class: FL_CHOICE
 type: NORMAL_CHOICE
-box: 230 180 185 30
+box: 110 25 115 30
 boxtype: FL_FRAME_BOX
 colors: FL_COL1 FL_BLACK
-alignment: FL_ALIGN_TOP
+alignment: FL_ALIGN_LEFT
 style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: Special (A4 portrait only):|#S
+label: Papersize:|#P
 shortcut: 
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
-name: choice_paperpackage
+name: choice_papersize
 callback: C_FormBaseDeprecatedInputCB
 argument: INPUT
 
 --------------------
-class: FL_FRAME
-type: ENGRAVED_FRAME
-box: 440 360 10 10
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_COL1
-alignment: FL_ALIGN_CENTER
+class: FL_INPUT
+type: NORMAL_INPUT
+box: 110 60 55 30
+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: Width:|#W
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: input_custom_width
+callback: C_FormBaseDeprecatedInputCB
+argument: INPUT
+
+--------------------
+class: FL_CHOICE
+type: NORMAL_CHOICE
+box: 170 60 55 30
+boxtype: FL_FRAME_BOX
+colors: FL_COL1 FL_BLACK
+alignment: FL_ALIGN_LEFT
 style: FL_NORMAL_STYLE
 size: FL_DEFAULT_SIZE
 lcol: FL_BLACK
@@ -231,21 +267,57 @@ label:
 shortcut: 
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
-name: 
-callback: 
-argument: 
+name: choice_custom_width_units
+callback: C_FormBaseDeprecatedInputCB
+argument: 0
 
 --------------------
-class: FL_FRAME
+class: FL_INPUT
+type: NORMAL_INPUT
+box: 110 95 55 30
+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: Height:|#H
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: input_custom_height
+callback: C_FormBaseDeprecatedInputCB
+argument: INPUT
+
+--------------------
+class: FL_CHOICE
+type: NORMAL_CHOICE
+box: 170 95 55 30
+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_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: choice_custom_height_units
+callback: C_FormBaseDeprecatedInputCB
+argument: 0
+
+--------------------
+class: FL_LABELFRAME
 type: ENGRAVED_FRAME
-box: 440 350 10 10
+box: 245 15 180 120
 boxtype: FL_NO_BOX
-colors: FL_COL1 FL_COL1
-alignment: FL_ALIGN_CENTER
+colors: FL_BLACK FL_COL1
+alignment: FL_ALIGN_TOP_LEFT
 style: FL_NORMAL_STYLE
 size: FL_DEFAULT_SIZE
 lcol: FL_BLACK
-label: 
+label: Orientation
 shortcut: 
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
@@ -267,7 +339,7 @@ label:
 shortcut: 
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
-name: greoup_radio_orientation
+name: group_radio_orientation
 callback: 
 argument: 
 
@@ -326,22 +398,22 @@ callback:
 argument: 
 
 --------------------
-class: FL_CHOICE
-type: NORMAL_CHOICE
-box: 110 25 115 30
-boxtype: FL_FRAME_BOX
-colors: FL_COL1 FL_BLACK
-alignment: FL_ALIGN_LEFT
+class: FL_LABELFRAME
+type: ENGRAVED_FRAME
+box: 10 150 415 185
+boxtype: FL_NO_BOX
+colors: FL_BLACK FL_COL1
+alignment: FL_ALIGN_TOP_LEFT
 style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
+size: FL_DEFAULT_SIZE
 lcol: FL_BLACK
-label: Papersize:|#P
+label: Margins
 shortcut: 
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
-name: choice_papersize2
-callback: C_FormBaseDeprecatedInputCB
-argument: INPUT
+name: 
+callback: 
+argument: 
 
 --------------------
 class: FL_CHECKBUTTON
@@ -357,68 +429,68 @@ label: Custom Margins/Sizes|#M
 shortcut: 
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
-name: push_use_geometry
+name: check_use_geometry
 callback: C_FormBaseDeprecatedInputCB
 argument: INPUT
 
 --------------------
-class: FL_INPUT
-type: NORMAL_INPUT
-box: 135 60 90 30
-boxtype: FL_DOWN_BOX
-colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_LEFT
+class: FL_CHOICE
+type: NORMAL_CHOICE
+box: 230 180 185 30
+boxtype: FL_FRAME_BOX
+colors: FL_COL1 FL_BLACK
+alignment: FL_ALIGN_TOP
 style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: Width:|#W
+label: Special (A4 portrait only):|#S
 shortcut: 
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
-name: input_custom_width
+name: choice_paperpackage
 callback: C_FormBaseDeprecatedInputCB
 argument: INPUT
 
 --------------------
 class: FL_INPUT
 type: NORMAL_INPUT
-box: 135 95 90 30
+box: 80 190 55 30
 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: Height:|#H
+label: Top:|#T
 shortcut: 
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
-name: input_custom_height
+name: input_top_margin
 callback: C_FormBaseDeprecatedInputCB
 argument: INPUT
 
 --------------------
-class: FL_INPUT
-type: NORMAL_INPUT
-box: 100 190 90 30
-boxtype: FL_DOWN_BOX
-colors: FL_COL1 FL_MCOL
+class: FL_CHOICE
+type: NORMAL_CHOICE
+box: 140 190 55 30
+boxtype: FL_FRAME_BOX
+colors: FL_COL1 FL_BLACK
 alignment: FL_ALIGN_LEFT
 style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
+size: FL_DEFAULT_SIZE
 lcol: FL_BLACK
-label: Top:|#T
+label: 
 shortcut: 
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
-name: input_top_margin
+name: choice_top_margin_units
 callback: C_FormBaseDeprecatedInputCB
-argument: INPUT
+argument: 0
 
 --------------------
 class: FL_INPUT
 type: NORMAL_INPUT
-box: 100 225 90 30
+box: 80 225 55 30
 boxtype: FL_DOWN_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_LEFT
@@ -433,10 +505,28 @@ name: input_bottom_margin
 callback: C_FormBaseDeprecatedInputCB
 argument: INPUT
 
+--------------------
+class: FL_CHOICE
+type: NORMAL_CHOICE
+box: 140 225 55 30
+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_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: choice_bottom_margin_units
+callback: C_FormBaseDeprecatedInputCB
+argument: 0
+
 --------------------
 class: FL_INPUT
 type: NORMAL_INPUT
-box: 100 260 90 30
+box: 80 260 55 30
 boxtype: FL_DOWN_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_LEFT
@@ -451,10 +541,28 @@ name: input_left_margin
 callback: C_FormBaseDeprecatedInputCB
 argument: INPUT
 
+--------------------
+class: FL_CHOICE
+type: NORMAL_CHOICE
+box: 140 260 55 30
+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_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: choice_left_margin_units
+callback: C_FormBaseDeprecatedInputCB
+argument: 0
+
 --------------------
 class: FL_INPUT
 type: NORMAL_INPUT
-box: 100 295 90 30
+box: 80 295 55 30
 boxtype: FL_DOWN_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_LEFT
@@ -470,130 +578,130 @@ callback: C_FormBaseDeprecatedInputCB
 argument: INPUT
 
 --------------------
-class: FL_INPUT
-type: NORMAL_INPUT
-box: 340 225 75 30
-boxtype: FL_DOWN_BOX
-colors: FL_COL1 FL_MCOL
+class: FL_CHOICE
+type: NORMAL_CHOICE
+box: 140 295 55 30
+boxtype: FL_FRAME_BOX
+colors: FL_COL1 FL_BLACK
 alignment: FL_ALIGN_LEFT
 style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
+size: FL_DEFAULT_SIZE
 lcol: FL_BLACK
-label: Headheight:|#i
+label: 
 shortcut: 
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
-name: input_head_height
+name: choice_right_margin_units
 callback: C_FormBaseDeprecatedInputCB
-argument: INPUT
+argument: 0
 
 --------------------
 class: FL_INPUT
 type: NORMAL_INPUT
-box: 340 260 75 30
+box: 300 225 55 30
 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: Headsep:|#d
+label: Headheight:|#i
 shortcut: 
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
-name: input_head_sep
+name: input_head_height
 callback: C_FormBaseDeprecatedInputCB
 argument: INPUT
 
 --------------------
-class: FL_INPUT
-type: NORMAL_INPUT
-box: 340 295 75 30
-boxtype: FL_DOWN_BOX
-colors: FL_COL1 FL_MCOL
+class: FL_CHOICE
+type: NORMAL_CHOICE
+box: 360 225 55 30
+boxtype: FL_FRAME_BOX
+colors: FL_COL1 FL_BLACK
 alignment: FL_ALIGN_LEFT
 style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
+size: FL_DEFAULT_SIZE
 lcol: FL_BLACK
-label: Footskip:|#F
+label: 
 shortcut: 
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
-name: input_foot_skip
+name: choice_head_height_units
 callback: C_FormBaseDeprecatedInputCB
-argument: INPUT
+argument: 0
 
 --------------------
-class: FL_TEXT
-type: NORMAL_TEXT
-box: 10 360 420 20
-boxtype: FL_FLAT_BOX
+class: FL_INPUT
+type: NORMAL_INPUT
+box: 300 260 55 30
+boxtype: FL_DOWN_BOX
 colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
-style: FL_BOLD_STYLE
+alignment: FL_ALIGN_LEFT
+style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: 
+label: Headsep:|#d
 shortcut: 
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
-name: text_warning
-callback: 
-argument: 
+name: input_head_sep
+callback: C_FormBaseDeprecatedInputCB
+argument: INPUT
 
 --------------------
-class: FL_LABELFRAME
-type: ENGRAVED_FRAME
-box: 245 15 180 120
-boxtype: FL_NO_BOX
-colors: FL_BLACK FL_COL1
-alignment: FL_ALIGN_TOP_LEFT
+class: FL_CHOICE
+type: NORMAL_CHOICE
+box: 360 260 55 30
+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: Orientation
+label: 
 shortcut: 
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
-name: 
-callback: 
-argument: 
+name: choice_head_sep_units
+callback: C_FormBaseDeprecatedInputCB
+argument: 0
 
 --------------------
-class: FL_LABELFRAME
-type: ENGRAVED_FRAME
-box: 10 15 225 120
-boxtype: FL_NO_BOX
-colors: FL_BLACK FL_COL1
-alignment: FL_ALIGN_TOP_LEFT
+class: FL_INPUT
+type: NORMAL_INPUT
+box: 300 295 55 30
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_MCOL
+alignment: FL_ALIGN_LEFT
 style: FL_NORMAL_STYLE
-size: FL_DEFAULT_SIZE
+size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: Papersize
+label: Footskip:|#F
 shortcut: 
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
-name: 
-callback: 
-argument: 
+name: input_foot_skip
+callback: C_FormBaseDeprecatedInputCB
+argument: INPUT
 
 --------------------
-class: FL_LABELFRAME
-type: ENGRAVED_FRAME
-box: 10 145 415 185
-boxtype: FL_NO_BOX
-colors: FL_BLACK FL_COL1
-alignment: FL_ALIGN_TOP_LEFT
+class: FL_CHOICE
+type: NORMAL_CHOICE
+box: 360 295 55 30
+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: Margins
+label: 
 shortcut: 
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
-name: 
-callback: 
-argument: 
+name: choice_foot_skip_units
+callback: C_FormBaseDeprecatedInputCB
+argument: 0
 
 =============== FORM ===============
 Name: form_doc_class
index c64dacc1ca8f9b596d503669754278914dc1a1ce..dcf721ddc08c5b55401d10bc1ab7de28fa3066ab 100644 (file)
@@ -18,6 +18,7 @@
 #include "support/filetools.h"
 #include "support/lstrings.h" // frontStrip, strip
 #include "gettext.h"
+#include "support/LAssert.h"
 
 using std::ofstream;
 using std::pair;
@@ -68,6 +69,66 @@ vector<string> const getVectorFromBrowser(FL_OBJECT * ob)
 }
 
 
+string getLengthFromWidgets(FL_OBJECT * input, FL_OBJECT * choice)
+{
+       // Paranoia check
+       lyx::Assert(input  && input->objclass  == FL_INPUT &&
+                   choice && choice->objclass == FL_CHOICE);
+
+       string length;
+
+       string len = strip(frontStrip(fl_get_input(input)));
+       if (len.empty())
+               len = "0";
+
+       string const units = strip(frontStrip(fl_get_choice_text(choice)));
+
+       return len + units;
+}
+       
+
+void updateWidgetsFromLengthString(FL_OBJECT * input, FL_OBJECT * choice,
+                                  string const & str)
+{
+       // Paranoia check
+       lyx::Assert(input  && input->objclass  == FL_INPUT &&
+                   choice && choice->objclass == FL_CHOICE);
+
+       // The unit is presumed to begin at the first char a-z
+       string const tmp = lowercase(strip(frontStrip(str)));
+
+       string::const_iterator p = tmp.begin();
+       for (; p != tmp.end(); ++p) {
+               if (*p >= 'a' && *p <= 'z')
+                       break;
+       }
+
+       string len = "0";
+       int unitpos = 1; // xforms has Fortran-style indexing
+
+       if (p == tmp.end()) {
+               if (isStrDbl(tmp))
+                       len = tmp;
+
+       } else {
+               string tmplen = string(tmp.begin(), p);
+               if (isStrDbl(tmplen))
+                       len = tmplen;
+               string unit = string(p+1, tmp.end());
+
+               for(int i = 0; i < fl_get_choice_maxitems(choice); ++i) {
+                       string const text = fl_get_choice_item_text(choice,i+1);
+                       if (unit == lowercase(strip(frontStrip(text)))) {
+                               unitpos = i+1;
+                               break;
+                       }
+               }
+       }
+       
+       fl_set_input(input,   len.c_str());
+       fl_set_choice(choice, unitpos);
+}
 // Take a string and add breaks so that it fits into a desired label width, w
 string formatted(string const & sin, int w, int size, int style)
 {
index 73a5e9184015101147c6938e00d1544401b02785..d6aec887991898c7d341b9520ab8a403be21205f 100644 (file)
@@ -22,6 +22,13 @@ std::vector<string> const getVectorFromChoice(FL_OBJECT *);
 /// Given an fl_browser, create a vector of its entries
 std::vector<string> const getVectorFromBrowser(FL_OBJECT *);
 
+/// Given input and choice widgets, create a string such as "1cm"
+string getLengthFromWidgets(FL_OBJECT * input, FL_OBJECT * choice);
+
+/// Given a string such as "1cm", set the input and choice widgets.
+void updateWidgetsFromLengthString(FL_OBJECT * input, FL_OBJECT * choice,
+                                  string const & str);
+
 /// struct holding xform-specific colors
 struct XformsColor : public NamedColor {
        int colorID;