*
* \author Jürgen Vigna
*
- * Full author contact details are available in file CREDITS
+ * Full author contact details are available in file CREDITS.
*/
#include <config.h>
-
-#include "xformsBC.h"
-#include "ControlMinipage.h"
#include "FormMinipage.h"
+#include "ControlMinipage.h"
#include "forms/form_minipage.h"
-#include "support/lstrings.h"
-#include "helper_funcs.h"
-#include "debug.h"
+
#include "xforms_helpers.h"
-#include FORMS_H_LOCATION
+#include "xformsBC.h"
+
+#include "controllers/helper_funcs.h"
+
+#include "support/lstrings.h"
+#include "support/tostr.h"
+
+#include "lyx_forms.h"
+
+using lyx::support::getStringFromVector;
+using lyx::support::isStrDbl;
+using lyx::support::subst;
+
+using std::string;
+
-typedef FormCB<ControlMinipage, FormDB<FD_minipage> > base_class;
+typedef FormController<ControlMinipage, FormView<FD_minipage> > base_class;
-FormMinipage::FormMinipage()
- : base_class(_("Minipage Options"))
+FormMinipage::FormMinipage(Dialog & parent)
+ : base_class(parent, _("Minipage Settings"))
{}
fl_addto_choice(dialog_->choice_width_units, subst(choice, "%", "%%").c_str());
// Manage the ok, apply and cancel/close buttons
- bc().setOK(dialog_->button_ok);
- bc().setApply(dialog_->button_apply);
- bc().setCancel(dialog_->button_close);
- bc().setRestore(dialog_->button_restore);
-
- bc().addReadOnly(dialog_->input_width);
- bc().addReadOnly(dialog_->choice_width_units);
- bc().addReadOnly(dialog_->radio_top);
- bc().addReadOnly(dialog_->radio_middle);
- bc().addReadOnly(dialog_->radio_bottom);
+ bcview().setOK(dialog_->button_ok);
+ bcview().setApply(dialog_->button_apply);
+ bcview().setCancel(dialog_->button_close);
+ bcview().setRestore(dialog_->button_restore);
+
+ bcview().addReadOnly(dialog_->input_width);
+ bcview().addReadOnly(dialog_->choice_width_units);
+ bcview().addReadOnly(dialog_->radio_top);
+ bcview().addReadOnly(dialog_->radio_middle);
+ bcview().addReadOnly(dialog_->radio_bottom);
}
void FormMinipage::apply()
{
- controller().params().pageWidth =
+ controller().params().width =
LyXLength(getLengthFromWidgets(dialog_->input_width,
dialog_->choice_width_units));
void FormMinipage::update()
{
- LyXLength len(controller().params().pageWidth);
+ LyXLength len(controller().params().width);
fl_set_input(dialog_->input_width, tostr(len.value()).c_str());
fl_set_choice(dialog_->choice_width_units, len.unit() + 1);
string const input = getString(dialog_->input_width);
bool const invalid = !isValidLength(input) && !isStrDbl(input);
if (invalid) {
- postWarning(_("Invalid Length!"));
+ postWarning(_("Invalid length!"));
action = ButtonPolicy::SMI_INVALID;
} else {
action = ButtonPolicy::SMI_VALID;