#include "FormFloat.h"
#include "form_float.h"
#include "support/lstrings.h"
+#include "xforms_helpers.h"
typedef FormCB<ControlFloat, FormDB<FD_form_float> > base_class;
// FIX: Needs to be implemented. (Lgb)
// A way to set to float default is missing.
// A way to set "force[!]" is missing.
-// Also there are two groups of buttons [Here] and [top,bottom,page,here],
-// is is not really possible to choose from both groups. So this should
-// be disallowed by the dialog too.
void FormFloat::build()
{
bc().addReadOnly(dialog_->radio_bottom);
bc().addReadOnly(dialog_->radio_page);
bc().addReadOnly(dialog_->radio_here);
- bc().addReadOnly(dialog_->Here);
+ bc().addReadOnly(dialog_->button_here_definitely);
}
void FormFloat::apply()
{
string placement;
- if (fl_get_button(dialog_->Here)) {
+ if (fl_get_button(dialog_->button_here_definitely)) {
placement += "H";
} else {
if (fl_get_button(dialog_->radio_top)) {
bool bottom = false;
bool page = false;
bool here = false;
- bool Here = false;
+ bool here_definitely = false;
string placement(controller().params().placement);
if (contains(placement, "H")) {
- Here = true;
+ here_definitely = true;
} else {
if (contains(placement, "t")) {
top = true;
fl_set_button(dialog_->radio_bottom, bottom);
fl_set_button(dialog_->radio_page, page);
fl_set_button(dialog_->radio_here, here);
- fl_set_button(dialog_->Here, Here);
-
+ fl_set_button(dialog_->button_here_definitely, here_definitely);
+ setEnabled(dialog_->button_here_definitely, controller().params().allow_here_definitely);
}
+
+ButtonPolicy::SMInput FormFloat::input(FL_OBJECT * ob, long)
+{
+ if (ob == dialog_->button_here_definitely) {
+ if (fl_get_button(dialog_->button_here_definitely)) {
+ fl_set_button(dialog_->radio_top, false);
+ fl_set_button(dialog_->radio_bottom, false);
+ fl_set_button(dialog_->radio_page, false);
+ fl_set_button(dialog_->radio_here, false);
+ }
+ } else {
+ if (fl_get_button(dialog_->button_here_definitely)) {
+ fl_set_button(dialog_->button_here_definitely, false);
+ }
+ }
+
+ return ButtonPolicy::SMI_VALID;
+}