3 * Copyright 2002 the LyX Team
4 * Read the file COPYING
6 * \author Edwin Leuven <leuven@fee.uva.nl>
12 #pragma implementation
15 #include "ControlFloat.h"
16 #include "QFloatDialog.h"
21 #include "support/lstrings.h"
23 #include <qpushbutton.h>
24 #include <qcheckbox.h>
26 typedef Qt2CB<ControlFloat, Qt2DB<QFloatDialog> > base_class;
29 : base_class(_("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 string const placement(controller().params().placement);
66 if (placement.empty()) {
68 } else if (contains(placement, "H")) {
69 here_definitely = true;
71 if (contains(placement, "!")) {
74 if (contains(placement, "t")) {
77 if (contains(placement, "b")) {
80 if (contains(placement, "p")) {
83 if (contains(placement, "h")) {
88 dialog_->defaultsCB->setChecked(def_placement);
89 dialog_->topCB->setChecked(top);
90 dialog_->bottomCB->setChecked(bottom);
91 dialog_->pageCB->setChecked(page);
92 dialog_->herepossiblyCB->setChecked(here);
93 dialog_->ignoreCB->setChecked(force);
94 dialog_->ignoreCB->setEnabled(top || bottom || page || here);
95 dialog_->heredefinitelyCB->setChecked(here_definitely);
97 if (controller().params().wide) {
98 dialog_->herepossiblyCB->setChecked(false);
99 dialog_->bottomCB->setChecked(false);
102 dialog_->spanCB->setChecked(controller().params().wide);
108 controller().params().wide = dialog_->spanCB->isChecked();
110 if (dialog_->defaultsCB->isChecked()) {
111 controller().params().placement = "";
117 if (dialog_->heredefinitelyCB->isChecked()) {
120 if (dialog_->ignoreCB->isChecked()) {
123 if (dialog_->topCB->isChecked()) {
126 if (dialog_->bottomCB->isChecked()) {
129 if (dialog_->pageCB->isChecked()) {
132 if (dialog_->herepossiblyCB->isChecked()) {
136 controller().params().placement = placement;