]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/FormParagraph.C
Swap two printer related help messages.
[lyx.git] / src / frontends / xforms / FormParagraph.C
index 8413b0dd7e8bee691201a05e9fd855dc29473e5e..66e2b819e701a5e399fe4f7df3e7e7c5f2c2a576 100644 (file)
@@ -49,6 +49,19 @@ FormParagraph::~FormParagraph()
 }
 
 
+void FormParagraph::redraw()
+{
+       if( form() && form()->visible )
+               fl_redraw_form( form() );
+       else
+               return;
+
+       FL_FORM * outer_form = fl_get_active_folder(dialog_->tabbed_folder);
+       if (outer_form && outer_form->visible)
+               fl_redraw_form( outer_form );
+}
+
+
 FL_FORM * FormParagraph::form() const
 {
     if (dialog_) return dialog_->form;
@@ -61,7 +74,11 @@ void FormParagraph::build()
     // the tabbed folder
     dialog_ = build_tabbed_paragraph();
 
-    // manage the restore, ok, apply and cancel/close buttons
+    // Workaround dumb xforms sizing bug
+    minw_ = form()->w;
+    minh_ = form()->h;
+
+    // Manage the ok, apply, restore and cancel/close buttons
     bc_.setOK(dialog_->button_ok);
     bc_.setApply(dialog_->button_apply);
     bc_.setCancel(dialog_->button_cancel);
@@ -132,8 +149,7 @@ void FormParagraph::apply()
 }
 
 
-// we can safely ignore the parameter because we can always update
-void FormParagraph::update(bool)
+void FormParagraph::update()
 {
     if (!dialog_)
         return;
@@ -466,7 +482,7 @@ void FormParagraph::extra_update()
                 par->pextra_width.c_str());
     fl_set_input(extra_->input_pextra_widthp,
                 par->pextra_widthp.c_str());
-    switch(par->pextra_alignment) {
+    switch (par->pextra_alignment) {
     case LyXParagraph::MINIPAGE_ALIGN_TOP:
        fl_set_button(extra_->radio_pextra_top, 1);
        break;
@@ -547,17 +563,17 @@ bool FormParagraph::input(FL_OBJECT * ob, long)
     //
     // "Synchronize" the choices and input fields, making it
     // impossible to commit senseless data.
-    if (ob == general_->choice_space_above) {
-       if (fl_get_choice (general_->choice_space_above) != 7)
-           fl_set_input (general_->input_space_above, "");
-    } else if (ob == general_->choice_space_below) {
-       if (fl_get_choice (general_->choice_space_below) != 7)
-           fl_set_input (general_->input_space_below, "");
-    }
+
+    if (fl_get_choice (general_->choice_space_above) != 7)
+        fl_set_input (general_->input_space_above, "");
+
+    if (fl_get_choice (general_->choice_space_below) != 7)
+        fl_set_input (general_->input_space_below, "");
+
     //
     // then the extra form
     //
-    else if (ob == extra_->radio_pextra_indent) {
+    if (ob == extra_->radio_pextra_indent) {
        int n = fl_get_button(extra_->radio_pextra_indent);
        if (n) {
            fl_set_button(extra_->radio_pextra_minipage, 0);
@@ -648,32 +664,28 @@ bool FormParagraph::input(FL_OBJECT * ob, long)
     // first the general form
     //
     string input = fl_get_input (general_->input_space_above);
+    bool invalid = false;
        
-    if (input.empty()) {
-       fl_set_choice (general_->choice_space_above, 1);
-    } else if (isValidGlueLength (input)) {
-       fl_set_choice (general_->choice_space_above, 7);
-    } else {
-       fl_set_choice (general_->choice_space_above, 7);
-       fl_set_object_label(dialog_->text_warning,
-                   _("Warning: Invalid Length (valid example: 10mm)"));
-       fl_show_object(dialog_->text_warning);
-       ret = false;
-    }
-    
+    if (fl_get_choice(general_->choice_space_above)==7)
+        invalid = !input.empty() && !isValidGlueLength(input);
+
     input = fl_get_input (general_->input_space_below);
-       
-    if (input.empty()) {
-       fl_set_choice (general_->choice_space_below, 1);
-    } else if (isValidGlueLength(input)) {
-       fl_set_choice (general_->choice_space_below, 7);
-    } else {
-       fl_set_choice (general_->choice_space_below, 7);
-       fl_set_object_label(dialog_->text_warning,
-                   _("Warning: Invalid Length (valid example: 10mm)"));
-       fl_show_object(dialog_->text_warning);
-       ret = false;
+
+    if (fl_get_choice(general_->choice_space_below)==7)
+        invalid = invalid || (!input.empty() && !isValidGlueLength(input));
+    
+    if (ob == general_->input_space_above || ob == general_->input_space_below) {
+        if (invalid) {
+            fl_set_object_label(dialog_->text_warning,
+                _("Warning: Invalid Length (valid example: 10mm)"));
+            fl_show_object(dialog_->text_warning);
+            return false;
+        } else {
+            fl_hide_object(dialog_->text_warning);
+            return true;
+        }
     }
+
     //
     // then the extra form
     //