]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/FormMinipage.C
Bugfixes: checkboxes to radiobuttons (from J�rgen S) and remove a little
[lyx.git] / src / frontends / xforms / FormMinipage.C
index a591e18c445915936782735696795c2ad3e1f704..4e9ec3a12645f46e548a2f353cbde73db341ceef 100644 (file)
@@ -24,6 +24,7 @@
 #include "support/lstrings.h"
 #include "helper_funcs.h"
 #include "debug.h"
+#include "xforms_helpers.h"
 
 typedef FormCB<ControlMinipage, FormDB<FD_form_minipage> > base_class;
 
@@ -38,7 +39,7 @@ void FormMinipage::build()
 
        fl_set_input_return(dialog_->input_width, FL_RETURN_CHANGED);
 
-       string const choice = getStringFromVector(minipage::getUnits(), "|");
+       string const choice = getStringFromVector(getLatexUnits(), "|");
        fl_addto_choice(dialog_->choice_width_units, subst(choice, "%", "%%").c_str());
 
        // Manage the ok, apply and cancel/close buttons
@@ -58,11 +59,9 @@ void FormMinipage::build()
 
 void FormMinipage::apply()
 {
-       string const units = fl_get_choice_text(dialog_->choice_width_units);
-       double const val = strToDbl(fl_get_input(dialog_->input_width));
-
-       controller().params().width =
-               tostr(val) + frontStrip(strip(subst(units,"%%","%")));
+       controller().params().pageWidth =
+               LyXLength(getLengthFromWidgets(dialog_->input_width,
+                       dialog_->choice_width_units));
 
        if (fl_get_button(dialog_->radio_top))
                controller().params().pos = InsetMinipage::top;
@@ -75,9 +74,9 @@ void FormMinipage::apply()
 
 void FormMinipage::update()
 {
-    LyXLength len(controller().params().width.c_str());
-    fl_set_input(dialog_->input_width,tostr(len.value()).c_str());
-    fl_set_choice(dialog_->choice_width_units, len.unit()+1);
+    LyXLength len(controller().params().pageWidth);
+    fl_set_input(dialog_->input_width, tostr(len.value()).c_str());
+    fl_set_choice(dialog_->choice_width_units, len.unit() + 1);
 
     switch (controller().params().pos) {
     case InsetMinipage::top: