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 #include "ControlFloat.h"
15 #include "QFloatDialog.h"
18 #include "qt_helpers.h"
20 #include "support/lstrings.h"
22 #include <qpushbutton.h>
23 #include <qcheckbox.h>
25 typedef Qt2CB<ControlFloat, Qt2DB<QFloatDialog> > base_class;
29 : base_class(qt_("Float Settings"))
34 void QFloat::build_dialog()
36 dialog_.reset(new QFloatDialog(this));
38 bc().setCancel(dialog_->closePB);
39 bc().setApply(dialog_->applyPB);
40 bc().setOK(dialog_->okPB);
41 bc().setRestore(dialog_->restorePB);
43 bc().addReadOnly(dialog_->topCB);
44 bc().addReadOnly(dialog_->bottomCB);
45 bc().addReadOnly(dialog_->herepossiblyCB);
46 bc().addReadOnly(dialog_->heredefinitelyCB);
47 bc().addReadOnly(dialog_->pageCB);
48 bc().addReadOnly(dialog_->ignoreCB);
49 bc().addReadOnly(dialog_->defaultsCB);
50 bc().addReadOnly(dialog_->spanCB);
54 void QFloat::update_contents()
56 bool def_placement = false;
62 bool here_definitely = false;
64 FloatParams const & params = controller().params();
66 string const & placement = params.placement;
68 if (placement.empty()) {
70 } else if (contains(placement, "H")) {
71 here_definitely = true;
73 if (contains(placement, "!")) {
76 if (contains(placement, "t")) {
79 if (contains(placement, "b")) {
82 if (contains(placement, "p")) {
85 if (contains(placement, "h")) {
90 dialog_->defaultsCB->setChecked(def_placement);
91 dialog_->topCB->setChecked(top);
92 dialog_->bottomCB->setChecked(bottom);
93 dialog_->pageCB->setChecked(page);
94 dialog_->herepossiblyCB->setChecked(here);
95 dialog_->ignoreCB->setChecked(force);
96 dialog_->ignoreCB->setEnabled(top || bottom || page || here);
97 dialog_->heredefinitelyCB->setChecked(here_definitely);
100 dialog_->herepossiblyCB->setChecked(false);
101 dialog_->bottomCB->setChecked(false);
104 dialog_->spanCB->setChecked(params.wide);
110 FloatParams & params = controller().params();
112 params.wide = dialog_->spanCB->isChecked();
114 if (dialog_->defaultsCB->isChecked()) {
115 params.placement.erase();
121 if (dialog_->heredefinitelyCB->isChecked()) {
124 if (dialog_->ignoreCB->isChecked()) {
127 if (dialog_->topCB->isChecked()) {
130 if (dialog_->bottomCB->isChecked()) {
133 if (dialog_->pageCB->isChecked()) {
136 if (dialog_->herepossiblyCB->isChecked()) {
140 params.placement = placement;