From 5cd85b521db183b53b9e627e88e41becd0faf864 Mon Sep 17 00:00:00 2001 From: John Levon Date: Sun, 8 Sep 2002 06:16:40 +0000 Subject: [PATCH] float dialog fixes git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5234 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt2/ChangeLog | 8 + src/frontends/qt2/QFloat.C | 65 +++-- src/frontends/qt2/QFloatDialog.C | 37 +++ src/frontends/qt2/QFloatDialog.h | 5 +- src/frontends/qt2/ui/QFloatDialog.ui | 362 ++++++++++++++++++++------- 5 files changed, 366 insertions(+), 111 deletions(-) diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index 3029dbcdc4..ae7fb0ae0a 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -1,3 +1,11 @@ +2002-09-08 John Levon + + * QFloat.h: + * QFloat.C: + * QFloatDialog.h: + * QFloatDialog.C: + * ui/QFloatDialog.ui: fix bug 527 and more + 2002-09-08 John Levon * qfont_loader.C: fix bug 531 (emph()) diff --git a/src/frontends/qt2/QFloat.C b/src/frontends/qt2/QFloat.C index 7713d512bf..ca85bc9b52 100644 --- a/src/frontends/qt2/QFloat.C +++ b/src/frontends/qt2/QFloat.C @@ -17,18 +17,16 @@ #include "QFloat.h" #include "Qt2BC.h" #include "gettext.h" -#include "helper_funcs.h" #include "support/lstrings.h" -#include #include #include typedef Qt2CB > base_class; QFloat::QFloat() - : base_class(_("LaTeX Information")) + : base_class(_("Float Settings")) { } @@ -41,22 +39,38 @@ void QFloat::build_dialog() bc().setApply(dialog_->applyPB); bc().setOK(dialog_->okPB); bc().setRestore(dialog_->restorePB); + + bc().addReadOnly(dialog_->topCB); + bc().addReadOnly(dialog_->bottomCB); + bc().addReadOnly(dialog_->herepossiblyCB); + bc().addReadOnly(dialog_->heredefinitelyCB); + bc().addReadOnly(dialog_->pageCB); + bc().addReadOnly(dialog_->ignoreCB); + bc().addReadOnly(dialog_->defaultsCB); + bc().addReadOnly(dialog_->spanCB); } void QFloat::update_contents() { + bool def_placement = false; bool top = false; bool bottom = false; bool page = false; bool here = false; - bool forcehere = false; + bool force = false; + bool here_definitely = false; - string placement(controller().params().placement); + string const placement(controller().params().placement); - if (contains(placement, "H")) { - forcehere = true; + if (placement.empty()) { + def_placement = true; + } else if (contains(placement, "H")) { + here_definitely = true; } else { + if (contains(placement, "!")) { + force = true; + } if (contains(placement, "t")) { top = true; } @@ -70,33 +84,48 @@ void QFloat::update_contents() here = true; } } - - dialog_->top->setChecked(top); - dialog_->bottom->setChecked(bottom); - dialog_->page->setChecked(page); - dialog_->here->setChecked(here); - dialog_->forcehere->setChecked(forcehere); + + dialog_->defaultsCB->setChecked(def_placement); + dialog_->topCB->setChecked(top); + dialog_->bottomCB->setChecked(bottom); + dialog_->pageCB->setChecked(page); + dialog_->herepossiblyCB->setChecked(here); + dialog_->ignoreCB->setChecked(force); + dialog_->ignoreCB->setEnabled(top || bottom || page || here); + dialog_->heredefinitelyCB->setChecked(here_definitely); + + if (controller().params().wide) { + dialog_->herepossiblyCB->setChecked(false); + dialog_->bottomCB->setChecked(false); + } + + dialog_->spanCB->setChecked(controller().params().wide); } + void QFloat::apply() { string placement; - if (dialog_->forcehere->isChecked()) { + if (dialog_->heredefinitelyCB->isChecked()) { placement += "H"; } else { - if (dialog_->top->isChecked()) { + if (dialog_->ignoreCB->isChecked()) { + placement += "!"; + } + if (dialog_->topCB->isChecked()) { placement += "t"; } - if (dialog_->bottom->isChecked()) { + if (dialog_->bottomCB->isChecked()) { placement += "b"; } - if (dialog_->page->isChecked()) { + if (dialog_->pageCB->isChecked()) { placement += "p"; } - if (dialog_->here->isChecked()) { + if (dialog_->herepossiblyCB->isChecked()) { placement += "h"; } } controller().params().placement = placement; + controller().params().wide = dialog_->spanCB->isChecked(); } diff --git a/src/frontends/qt2/QFloatDialog.C b/src/frontends/qt2/QFloatDialog.C index 0dfc1755dc..8efa34320e 100644 --- a/src/frontends/qt2/QFloatDialog.C +++ b/src/frontends/qt2/QFloatDialog.C @@ -13,6 +13,7 @@ #include "ControlFloat.h" #include +#include #include "QFloatDialog.h" #include "QFloat.h" @@ -43,3 +44,39 @@ void QFloatDialog::closeEvent(QCloseEvent * e) form_->slotWMHide(); e->accept(); } + +void QFloatDialog::tbhpClicked() +{ + heredefinitelyCB->setChecked(false); + bool allow(topCB->isChecked()); + allow |= bottomCB->isChecked(); + allow |= pageCB->isChecked(); + allow |= herepossiblyCB->isChecked(); + ignoreCB->setEnabled(allow); +} + + +void QFloatDialog::heredefinitelyClicked() +{ + topCB->setChecked(false); + bottomCB->setChecked(false); + pageCB->setChecked(false); + herepossiblyCB->setChecked(false); +} + + +void QFloatDialog::spanClicked() +{ + bool const span(spanCB->isChecked()); + + if (!defaultsCB->isChecked()) { + herepossiblyCB->setEnabled(!span); + heredefinitelyCB->setEnabled(!span); + } + + if (!span) + return; + + herepossiblyCB->setChecked(false); + heredefinitelyCB->setChecked(false); +} diff --git a/src/frontends/qt2/QFloatDialog.h b/src/frontends/qt2/QFloatDialog.h index e1a7e6817e..7b1ad62134 100644 --- a/src/frontends/qt2/QFloatDialog.h +++ b/src/frontends/qt2/QFloatDialog.h @@ -23,7 +23,10 @@ public: protected slots: virtual void change_adaptor(); - + virtual void tbhpClicked(); + virtual void heredefinitelyClicked(); + virtual void spanClicked(); + protected: virtual void closeEvent(QCloseEvent * e); diff --git a/src/frontends/qt2/ui/QFloatDialog.ui b/src/frontends/qt2/ui/QFloatDialog.ui index babeb1eea1..d47b5489a7 100644 --- a/src/frontends/qt2/ui/QFloatDialog.ui +++ b/src/frontends/qt2/ui/QFloatDialog.ui @@ -14,7 +14,7 @@ 0 0 369 - 169 + 259 @@ -25,7 +25,7 @@ sizeGripEnabled true - + margin 11 @@ -34,7 +34,203 @@ spacing 6 - + + QCheckBox + + name + defaultsCB + + + text + Use &default placement + + + toolTip + Use LaTeX default settings + + + + QGroupBox + + name + placement + + + title + Advanced placement options + + + + margin + 11 + + + spacing + 6 + + + QLayoutWidget + + name + Layout6 + + + + margin + 0 + + + spacing + 6 + + + QCheckBox + + name + topCB + + + text + &Top of page + + + toolTip + Prefer top of page + + + + QCheckBox + + name + bottomCB + + + text + &Bottom of page + + + toolTip + Prefer bottom of page + + + + QCheckBox + + name + pageCB + + + text + &Page of floats + + + toolTip + Separate page for multiple floats + + + + QCheckBox + + name + herepossiblyCB + + + text + &Here if possible + + + toolTip + Place float at current position if possible + + + + QCheckBox + + name + ignoreCB + + + text + &Ignore LaTeX rules + + + toolTip + Ignore the internal LaTeX placement rules + + + + + + QLayoutWidget + + name + Layout7 + + + + margin + 0 + + + spacing + 6 + + + QCheckBox + + name + heredefinitelyCB + + + text + Here definitely + + + toolTip + Place float at current position + + + + + name + Spacer7 + + + orientation + Vertical + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + + + + + QCheckBox + + name + spanCB + + + text + &Span columns + + + toolTip + Span columns in multi-column documents + + + QLayoutWidget name @@ -116,129 +312,111 @@ - - QGroupBox - - name - placement - - - title - Placement - - - - margin - 11 - - - spacing - 6 - - - QRadioButton - - name - bottom - - - text - Bottom of the page - - - - QRadioButton - - name - top - - - text - Top of the page - - - - QRadioButton - - name - page - - - text - Page of floats - - - - QRadioButton - - name - here - - - text - Here, if possible - - - - - - QCheckBox - - name - forcehere - - - text - Here, definitely - - - + - forcehere + defaultsCB toggled(bool) placement setDisabled(bool) - top + defaultsCB toggled(bool) QFloatDialogBase change_adaptor() - page + defaultsCB + toggled(bool) + QFloatDialogBase + tbhpClicked() + + + topCB toggled(bool) QFloatDialogBase change_adaptor() - bottom + topCB + clicked() + QFloatDialogBase + tbhpClicked() + + + bottomCB + toggled(bool) + QFloatDialogBase + change_adaptor() + + + bottomCB + clicked() + QFloatDialogBase + tbhpClicked() + + + pageCB + toggled(bool) + QFloatDialogBase + change_adaptor() + + + pageCB + clicked() + QFloatDialogBase + tbhpClicked() + + + herepossiblyCB toggled(bool) QFloatDialogBase change_adaptor() - here - stateChanged(int) + herepossiblyCB + clicked() + QFloatDialogBase + tbhpClicked() + + + ignoreCB + toggled(bool) QFloatDialogBase change_adaptor() - forcehere + spanCB toggled(bool) QFloatDialogBase change_adaptor() + + spanCB + clicked() + QFloatDialogBase + spanClicked() + + + heredefinitelyCB + toggled(bool) + QFloatDialogBase + change_adaptor() + + + heredefinitelyCB + clicked() + QFloatDialogBase + heredefinitelyClicked() + change_adaptor() + heredefinitelyClicked() + spanClicked() + tbhpClicked() - top - bottom - page - here - forcehere restorePB okPB applyPB -- 2.39.5