]> git.lyx.org Git - features.git/commitdiff
J�rgen S's consistent minipage patch.
authorAngus Leeming <leeming@lyx.org>
Tue, 29 Jan 2002 09:38:09 +0000 (09:38 +0000)
committerAngus Leeming <leeming@lyx.org>
Tue, 29 Jan 2002 09:38:09 +0000 (09:38 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3447 a592a061-630c-0410-9148-cb99ea01b6c8

src/LaTeXFeatures.C
src/frontends/xforms/ChangeLog
src/frontends/xforms/FormMinipage.C
src/frontends/xforms/FormMinipage.h
src/frontends/xforms/form_minipage.C
src/frontends/xforms/form_minipage.h
src/frontends/xforms/forms/form_minipage.fd

index cb28134d432034f442f6318caccdf850e197464d..01049c315e9aeeaae244373ef2a39559cf224930 100644 (file)
@@ -339,15 +339,19 @@ string const LaTeXFeatures::getTClassPreamble() const
        // the text class specific preamble 
        LyXTextClass const & tclass = textclasslist.TextClass(params.textclass);
        ostringstream tcpreamble;
-       
+
        tcpreamble << tclass.preamble();
 
        for (layout_type i = 0; i < tclass.numLayouts(); ++i) {
                if (layout[i]) {
-                       tcpreamble  << tclass[i].preamble();
+                       tcpreamble << tclass[i].preamble();
                }
        }
 
+       // DEC's implementation of ostringstream has a bug which can be
+       // overcome with this forcing.
+       tcpreamble.seekp(std::ios::beg);
+
        return tcpreamble.str().c_str();
 }      
 
index 590d44a465866c5faff117a9a699839e67656a31..03781d585d60ddd0b059d7be1fb22d2cd76f740b 100644 (file)
@@ -8,6 +8,13 @@
        * xforms-helpers.h: added two choice const for the LyXLength
        one with all and one only with length which have a unit.
 
+2002-01-29  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
+
+       * forms/form_minipage.fd: add text_warning field.
+
+       *FormMinipage.[Ch]: added input filters and warnings
+       (ButtonPolicy::SMInput FormMinipage::input)
+
 2002-01-28  Angus Leeming  <a.leeming@ic.ac.uk>
 
        * FormAboutlyx.[Ch]: Removed redundant form() method and
index 4e9ec3a12645f46e548a2f353cbde73db341ceef..519f3c455946d3794408b8207b90232128549c59 100644 (file)
@@ -90,3 +90,28 @@ void FormMinipage::update()
        break;
     }
 }
+
+ButtonPolicy::SMInput FormMinipage::input(FL_OBJECT * ob, long)
+{
+       ButtonPolicy::SMInput action = ButtonPolicy::SMI_NOOP;
+
+       // disallow senseless data
+       // warnings if input is senseless
+       //
+       string input = fl_get_input(dialog_->input_width);
+       bool invalid = false;
+
+       if (ob == dialog_->input_width) {
+               invalid = !isValidLength(input) && !isStrDbl(input);
+               if (invalid) {
+                       fl_set_object_label(dialog_->text_warning,
+                               _("Warning: Invalid Length!"));
+                       fl_show_object(dialog_->text_warning);
+                       action = ButtonPolicy::SMI_INVALID;
+               } else {
+                       fl_hide_object(dialog_->text_warning);
+                       action = ButtonPolicy::SMI_VALID;
+               }
+       }
+       return action;
+}
index d640f50614db4e9a776700b33a74072d1f36801d..deaaa0eb2ccc5b6aaef0e555d22ccbc059f64f4d 100644 (file)
@@ -39,6 +39,8 @@ private:
        virtual void build();
        /// Update dialog before/whilst showing it.
        virtual void update();
+       /// Filter the inputs on callback from xforms
+       virtual ButtonPolicy::SMInput input(FL_OBJECT *, long);
 
        /// Fdesign generated method
        FD_form_minipage * build_minipage();
index 81ec868406ded469db79a20f385c732c6e48e3c8..427dbdcfcf9b3cac459f675aa7a569de565da4d4 100644 (file)
@@ -89,6 +89,8 @@ FD_form_minipage * FormMinipage::build_minipage()
   }
     fl_set_object_lsize(obj, FL_NORMAL_SIZE);
     fl_set_object_callback(obj, C_FormBaseRestoreCB, 0);
+  fdui->text_warning = obj = fl_add_text(FL_NORMAL_TEXT, 20, 90, 210, 30, "");
+    fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
   fl_end_form();
 
   fdui->form->fdui = fdui;
index 9598da08caddb3363c4bb52cf56f921ee423bd70..a7f45190a3375cd6d731890982768c1bd035ca3b 100644 (file)
@@ -27,6 +27,7 @@ struct FD_form_minipage {
        FL_OBJECT *button_apply;
        FL_OBJECT *button_ok;
        FL_OBJECT *button_restore;
+       FL_OBJECT *text_warning;
 };
 
 #endif /* FD_form_minipage_h_ */
index 2b610ab11b616e857175dc2a66682e1a4a232074..962b3f8e98c4ae7fc491e5098804d93f1f05fafa 100644 (file)
@@ -10,7 +10,7 @@ Unit of measure: FL_COORD_PIXEL
 Name: form_minipage
 Width: 430
 Height: 170
-Number of Objects: 14
+Number of Objects: 15
 
 --------------------
 class: FL_BOX
@@ -105,7 +105,7 @@ argument: 0
 --------------------
 class: FL_BEGIN_GROUP
 type: 0
-box: 0 10 10 0
+box: 0 0 0
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_CENTER
@@ -264,5 +264,23 @@ name: button_restore
 callback: C_FormBaseRestoreCB
 argument: 0
 
+--------------------
+class: FL_TEXT
+type: NORMAL_TEXT
+box: 20 90 210 30
+boxtype: FL_FLAT_BOX
+colors: FL_COL1 FL_MCOL
+alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
+style: FL_NORMAL_STYLE
+size: FL_DEFAULT_SIZE
+lcol: FL_BLACK
+label: 
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: text_warning
+callback: 
+argument: 
+
 ==============================
 create_the_forms