]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/FormParagraph.C
doxygen fixes
[lyx.git] / src / frontends / xforms / FormParagraph.C
index 91943ac01b3c6a3edac4ccaf8660edb19f4b0fe2..dd5c4bb3151dffefeb08cf3fbbb08a50fb836d95 100644 (file)
@@ -1,13 +1,10 @@
-/* This file is part of
- * ======================================================
- * 
- *           LyX, The Document Processor
- *      
- *           Copyright 2000-2001 The LyX Team.
+/**
+ * \file FormParagraph.C
+ * Copyright 2000-2001 The LyX Team.
+ * See the file COPYING.
  *
- *           @author Jürgen Vigna
- *
- *======================================================*/
+ * \author Jürgen Vigna, jug@sad.it
+ */
 
 #include <config.h>
 
 
 #include "support/lstrings.h"
 
+#include <functional>
+
 using Liason::setMinibuffer;
 using SigC::slot;
+using std::vector;
+using std::bind2nd;
+using std::remove_if;
 
 
 FormParagraph::FormParagraph(LyXView * lv, Dialogs * d)
@@ -76,9 +78,9 @@ void FormParagraph::changedParagraph()
        Paragraph const * const p = getCurrentParagraph();
        if (p == 0 || p == par_)
                return;
-#ifdef WITH_WARNINGS
-#warning Please someone of you GUII people have a look at this!
-#endif
+
+       // OBS FIX LOOK HERE
+
        // shouldn't we chage the par_ pointer too?
        // anyway for me the below function does just nothing!
        // (Jug 20020108)
@@ -91,8 +93,8 @@ void FormParagraph::changedParagraph()
 
 void FormParagraph::redraw()
 {
-       if( form() && form()->visible )
-               fl_redraw_form( form() );
+       if (form() && form()->visible)
+               fl_redraw_form(form());
 }
 
 
@@ -124,14 +126,28 @@ void FormParagraph::build()
     fl_set_input_return(dialog_->input_linespacing, FL_RETURN_CHANGED);
     fl_set_input_filter(dialog_->input_linespacing, fl_unsigned_float_filter);
 
+    setPrehandler(dialog_->input_space_above);
+    setPrehandler(dialog_->input_space_below);
+    setPrehandler(dialog_->input_labelwidth);
+    setPrehandler(dialog_->input_linespacing);
+
     // Create the contents of the unit choices
     // Don't include the "%" terms...
-    std::vector<string> units_vec = getLatexUnits();
-    for (std::vector<string>::iterator it = units_vec.begin();
+    vector<string> units_vec = getLatexUnits();
+#if 0
+    for (vector<string>::iterator it = units_vec.begin();
        it != units_vec.end(); ++it) {
        if (contains(*it, "%"))
                it = units_vec.erase(it, it+1) - 1;
     }
+#else
+    // Something similar to this is a better way to erase
+    vector<string>::iterator del =
+           remove_if(units_vec.begin(), units_vec.end(),
+                     bind2nd(contains_functor(), "%"));
+    units_vec.erase(del, units_vec.end());
+#endif
+    
     string units = getStringFromVector(units_vec, "|");
 
     fl_addto_choice(dialog_->choice_value_space_above,  units.c_str());
@@ -316,10 +332,11 @@ void FormParagraph::update()
     fl_set_button(dialog_->radio_align_center, 0);
     fl_set_button(dialog_->radio_align_block, 0);
 
+    LyXTextClass const & tclass = textclasslist[buf->params.textclass];
+    
     int align = par_->getAlign();
     if (align == LYX_ALIGN_LAYOUT)
-       align = textclasslist.Style(buf->params.textclass,
-                                   par_->getLayout()).align;
+           align = tclass[par_->layout()].align;
 
     switch (align) {
     case LYX_ALIGN_RIGHT:
@@ -336,9 +353,7 @@ void FormParagraph::update()
        break;
     }
 
-    LyXAlignment alignpos =
-           textclasslist.Style(buf->params.textclass,
-                               par_->getLayout()).alignpossible;
+    LyXAlignment alignpos = tclass[par_->layout()].alignpossible;
 
     setEnabled(dialog_->radio_align_block,  bool(alignpos & LYX_ALIGN_BLOCK));
     setEnabled(dialog_->radio_align_center, bool(alignpos & LYX_ALIGN_CENTER));
@@ -412,14 +427,9 @@ void FormParagraph::update()
         bool const metric = lyxrc.default_papersize > 3;
         string const default_unit = metric ? "cm" : "in";
         string const length = par_->params().spaceTop().length().asString();
-       //check if there's a stretch or shrink factor
-       if (!isValidLength(length) && !isStrDbl(length))
-               fl_set_input(dialog_->input_space_above, length.c_str());
-       else {
-               updateWidgetsFromLengthString(dialog_->input_space_above,
+       updateWidgetsFromLengthString(dialog_->input_space_above,
                                              dialog_->choice_value_space_above,
                                              length, default_unit);
-       }
        break;
     }
     }
@@ -458,14 +468,9 @@ void FormParagraph::update()
         string const default_unit = metric ? "cm" : "in";
         string const length =
                par_->params().spaceBottom().length().asString();
-       //check if there's a stretch or shrink factor
-       if (!isValidLength(length) && !isStrDbl(length))
-               fl_set_input(dialog_->input_space_below, length.c_str());
-       else {
-               updateWidgetsFromLengthString(dialog_->input_space_below,
+       updateWidgetsFromLengthString(dialog_->input_space_below,
                                              dialog_->choice_value_space_below,
                                              length, default_unit);
-       }
        break;
     }
     }