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"
23 #include "support/lstrings.h"
25 #include <qpushbutton.h>
26 #include <qcheckbox.h>
28 typedef Qt2CB<ControlFloat, Qt2DB<QFloatDialog> > base_class;
31 : base_class(_("Float Settings"))
36 void QFloat::build_dialog()
38 dialog_.reset(new QFloatDialog(this));
40 bc().setCancel(dialog_->closePB);
41 bc().setApply(dialog_->applyPB);
42 bc().setOK(dialog_->okPB);
43 bc().setRestore(dialog_->restorePB);
45 bc().addReadOnly(dialog_->topCB);
46 bc().addReadOnly(dialog_->bottomCB);
47 bc().addReadOnly(dialog_->herepossiblyCB);
48 bc().addReadOnly(dialog_->heredefinitelyCB);
49 bc().addReadOnly(dialog_->pageCB);
50 bc().addReadOnly(dialog_->ignoreCB);
51 bc().addReadOnly(dialog_->defaultsCB);
52 bc().addReadOnly(dialog_->spanCB);
56 void QFloat::update_contents()
58 bool def_placement = false;
64 bool here_definitely = false;
66 string const placement(controller().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);
99 if (controller().params().wide) {
100 dialog_->herepossiblyCB->setChecked(false);
101 dialog_->bottomCB->setChecked(false);
104 dialog_->spanCB->setChecked(controller().params().wide);
110 controller().params().wide = dialog_->spanCB->isChecked();
112 if (dialog_->defaultsCB->isChecked()) {
113 controller().params().placement = "";
119 if (dialog_->heredefinitelyCB->isChecked()) {
122 if (dialog_->ignoreCB->isChecked()) {
125 if (dialog_->topCB->isChecked()) {
128 if (dialog_->bottomCB->isChecked()) {
131 if (dialog_->pageCB->isChecked()) {
134 if (dialog_->herepossiblyCB->isChecked()) {
138 controller().params().placement = placement;