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.
35 // Also there are two groups of buttons [Here] and [top,bottom,page,here],
36 // is is not really possible to choose from both groups. So this should
37 // be disallowed by the dialog too.
39 void FormFloat::build()
41 dialog_.reset(build_float());
43 // Manage the ok, apply and cancel/close buttons
44 bc().setOK(dialog_->button_ok);
45 bc().setApply(dialog_->button_apply);
46 bc().setCancel(dialog_->button_cancel);
47 bc().setRestore(dialog_->button_restore);
49 bc().addReadOnly(dialog_->radio_top);
50 bc().addReadOnly(dialog_->radio_bottom);
51 bc().addReadOnly(dialog_->radio_page);
52 bc().addReadOnly(dialog_->radio_here);
53 bc().addReadOnly(dialog_->Here);
57 void FormFloat::apply()
60 if (fl_get_button(dialog_->Here)) {
63 if (fl_get_button(dialog_->radio_top)) {
66 if (fl_get_button(dialog_->radio_bottom)) {
69 if (fl_get_button(dialog_->radio_page)) {
72 if (fl_get_button(dialog_->radio_here)) {
76 controller().params().placement = placement;
80 void FormFloat::update()
88 string placement(controller().params().placement);
90 if (contains(placement, "H")) {
93 if (contains(placement, "t")) {
96 if (contains(placement, "b")) {
99 if (contains(placement, "p")) {
102 if (contains(placement, "h")) {
106 fl_set_button(dialog_->radio_top, top);
107 fl_set_button(dialog_->radio_bottom, bottom);
108 fl_set_button(dialog_->radio_page, page);
109 fl_set_button(dialog_->radio_here, here);
110 fl_set_button(dialog_->Here, Here);