3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS
14 #pragma implementation
17 #include "ControlFloat.h"
18 #include "QFloatDialog.h"
21 #include "qt_helpers.h"
23 #include "support/lstrings.h"
25 #include <qpushbutton.h>
26 #include <qcheckbox.h>
28 typedef Qt2CB<ControlFloat, Qt2DB<QFloatDialog> > base_class;
32 : base_class(qt_("Float Settings"))
37 void QFloat::build_dialog()
39 dialog_.reset(new QFloatDialog(this));
41 bc().setCancel(dialog_->closePB);
42 bc().setApply(dialog_->applyPB);
43 bc().setOK(dialog_->okPB);
44 bc().setRestore(dialog_->restorePB);
46 bc().addReadOnly(dialog_->topCB);
47 bc().addReadOnly(dialog_->bottomCB);
48 bc().addReadOnly(dialog_->herepossiblyCB);
49 bc().addReadOnly(dialog_->heredefinitelyCB);
50 bc().addReadOnly(dialog_->pageCB);
51 bc().addReadOnly(dialog_->ignoreCB);
52 bc().addReadOnly(dialog_->defaultsCB);
53 bc().addReadOnly(dialog_->spanCB);
57 void QFloat::update_contents()
59 bool def_placement = false;
65 bool here_definitely = false;
67 FloatParams const & params = controller().params();
69 string const & placement = params.placement;
71 if (placement.empty()) {
73 } else if (contains(placement, "H")) {
74 here_definitely = true;
76 if (contains(placement, "!")) {
79 if (contains(placement, "t")) {
82 if (contains(placement, "b")) {
85 if (contains(placement, "p")) {
88 if (contains(placement, "h")) {
93 dialog_->defaultsCB->setChecked(def_placement);
94 dialog_->topCB->setChecked(top);
95 dialog_->bottomCB->setChecked(bottom);
96 dialog_->pageCB->setChecked(page);
97 dialog_->herepossiblyCB->setChecked(here);
98 dialog_->ignoreCB->setChecked(force);
99 dialog_->ignoreCB->setEnabled(top || bottom || page || here);
100 dialog_->heredefinitelyCB->setChecked(here_definitely);
103 dialog_->herepossiblyCB->setChecked(false);
104 dialog_->bottomCB->setChecked(false);
107 dialog_->spanCB->setChecked(params.wide);
113 FloatParams & params = controller().params();
115 params.wide = dialog_->spanCB->isChecked();
117 if (dialog_->defaultsCB->isChecked()) {
118 params.placement.erase();
124 if (dialog_->heredefinitelyCB->isChecked()) {
127 if (dialog_->ignoreCB->isChecked()) {
130 if (dialog_->topCB->isChecked()) {
133 if (dialog_->bottomCB->isChecked()) {
136 if (dialog_->pageCB->isChecked()) {
139 if (dialog_->herepossiblyCB->isChecked()) {
143 params.placement = placement;