]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/FormParagraph.C
Change the semantics of 'none' and 'auto' viewers/editors: 'none' means now
[lyx.git] / src / frontends / xforms / FormParagraph.C
index b5bfe655d8b605e51b0ae09ef703a1897f54aa7e..a5f36f809618afe07ac452af612ffe5097a24476 100644 (file)
 #include "Spacing.h"
 
 #include "support/lstrings.h"
-#include "support/tostr.h"
+#include "support/convert.h"
 
 #include "lyx_forms.h"
 
-using lyx::support::contains_functor;
-using lyx::support::getStringFromVector;
-using lyx::support::rtrim;
+#include <boost/bind.hpp>
+
+using boost::bind;
 
-using std::bind2nd;
 using std::remove_if;
 
 using std::vector;
 using std::string;
 
+namespace lyx {
 
-namespace {
-
-string defaultUnit("cm");
-
-} // namespace anon
+using support::contains;
+using support::getStringFromVector;
+using support::rtrim;
 
+namespace frontend {
 
 typedef FormController<ControlParagraph, FormView<FD_paragraph> > base_class;
 
@@ -98,24 +97,8 @@ void FormParagraph::build()
        vector<string> units_vec = getLatexUnits();
        vector<string>::iterator del =
                remove_if(units_vec.begin(), units_vec.end(),
-                         bind2nd(contains_functor(), "%"));
+                         bind(contains<char>, _1, '%'));
        units_vec.erase(del, units_vec.end());
-
-       // set default unit for custom length
-       switch (lyxrc.default_papersize) {
-               case PAPER_DEFAULT:
-               case PAPER_USLETTER:
-               case PAPER_LEGALPAPER:
-               case PAPER_EXECUTIVEPAPER:
-                       defaultUnit = "in";
-                       break;
-               case PAPER_A3PAPER:
-               case PAPER_A4PAPER:
-               case PAPER_A5PAPER:
-               case PAPER_B5PAPER:
-                       defaultUnit = "cm";
-                       break;
-       }
 }
 
 
@@ -260,8 +243,8 @@ void FormParagraph::update()
        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());
+               fl_set_input(dialog_->input_linespacing,
+                       space.getValueAsString().c_str());
        } else {
                fl_set_input(dialog_->input_linespacing, "");
        }
@@ -284,3 +267,6 @@ ButtonPolicy::SMInput FormParagraph::input(FL_OBJECT * ob, long)
 
        return ButtonPolicy::SMI_VALID;
 }
+
+} // namespace frontend
+} // namespace lyx