1 /* This file is part of
2 * ======================================================
4 * LyX, The Document Processor
6 * Copyright 2001 The LyX Team.
8 * ======================================================
16 #pragma implementation
20 #include "ControlFloat.h"
21 #include "FormFloat.h"
22 #include "form_float.h"
23 #include "support/lstrings.h"
25 typedef FormCB<ControlFloat, FormDB<FD_form_float> > base_class;
27 FormFloat::FormFloat(ControlFloat & c)
28 : base_class(c, _("Float Options"))
32 // FIX: Needs to be implemented. (Lgb)
33 // A way to set to float default is missing.
34 // A way to set "force[!]" is missing.
36 void FormFloat::build()
38 dialog_.reset(build_float());
40 // Manage the ok, apply and cancel/close buttons
41 bc().setOK(dialog_->button_ok);
42 bc().setApply(dialog_->button_apply);
43 bc().setCancel(dialog_->button_cancel);
44 bc().setRestore(dialog_->button_restore);
46 bc().addReadOnly(dialog_->radio_top);
47 bc().addReadOnly(dialog_->radio_bottom);
48 bc().addReadOnly(dialog_->radio_page);
49 bc().addReadOnly(dialog_->radio_here);
50 bc().addReadOnly(dialog_->button_here_definitely);
54 void FormFloat::apply()
57 if (fl_get_button(dialog_->button_here_definitely)) {
60 if (fl_get_button(dialog_->radio_top)) {
63 if (fl_get_button(dialog_->radio_bottom)) {
66 if (fl_get_button(dialog_->radio_page)) {
69 if (fl_get_button(dialog_->radio_here)) {
73 controller().params().placement = placement;
77 void FormFloat::update()
83 bool here_definitely = false;
85 string placement(controller().params().placement);
86 std::cerr << "FormFloat::update() " << placement << std::endl;
88 if (contains(placement, "H")) {
89 here_definitely = true;
91 if (contains(placement, "t")) {
94 if (contains(placement, "b")) {
97 if (contains(placement, "p")) {
100 if (contains(placement, "h")) {
104 fl_set_button(dialog_->radio_top, top);
105 fl_set_button(dialog_->radio_bottom, bottom);
106 fl_set_button(dialog_->radio_page, page);
107 fl_set_button(dialog_->radio_here, here);
108 fl_set_button(dialog_->button_here_definitely, here_definitely);
112 ButtonPolicy::SMInput FormFloat::input(FL_OBJECT * ob, long)
114 if (ob == dialog_->button_here_definitely) {
115 if (fl_get_button(dialog_->button_here_definitely)) {
116 fl_set_button(dialog_->radio_top, false);
117 fl_set_button(dialog_->radio_bottom, false);
118 fl_set_button(dialog_->radio_page, false);
119 fl_set_button(dialog_->radio_here, false);
122 if (fl_get_button(dialog_->button_here_definitely)) {
123 fl_set_button(dialog_->button_here_definitely, false);