diff --git a/src/frontends/qt4/GuiWrap.cpp b/src/frontends/qt4/GuiWrap.cpp index ddbe458b1c..d11fce7d06 100644 --- a/src/frontends/qt4/GuiWrap.cpp +++ b/src/frontends/qt4/GuiWrap.cpp @@ -49,13 +49,20 @@ GuiWrapDialog::GuiWrapDialog(LyXView & lv) this, SLOT(change_adaptor())); connect(valignCO, SIGNAL(highlighted(const QString &)), this, SLOT(change_adaptor())); + connect(overhangCB, SIGNAL(stateChanged(int)), + this, SLOT(change_adaptor())); connect(overhangED, SIGNAL(textChanged(const QString &)), this, SLOT(change_adaptor())); connect(overhangUnitLC, SIGNAL(selectionChanged(lyx::Length::UNIT)), this, SLOT(change_adaptor())); + connect(linesCB, SIGNAL(stateChanged(int)), + this, SLOT(change_adaptor())); connect(linesSB, SIGNAL(valueChanged(int)), this, SLOT(change_adaptor())); + connect(overhangCB, SIGNAL(stateChanged(int)), this, SLOT(overhangChecked(int))); + connect(linesCB, SIGNAL(stateChanged(int)), this, SLOT(linesChecked(int))); + widthED->setValidator(unsignedLengthValidator(widthED)); // FIXME: // overhang can be negative, but the unsignedLengthValidator allows this @@ -70,13 +77,15 @@ GuiWrapDialog::GuiWrapDialog(LyXView & lv) bc().addReadOnly(widthED); bc().addReadOnly(widthUnitLC); bc().addReadOnly(valignCO); + bc().addReadOnly(overhangCB); bc().addReadOnly(overhangED); bc().addReadOnly(overhangUnitLC); + bc().addReadOnly(linesCB); bc().addReadOnly(linesSB); // initialize the length validator bc().addCheckedLineEdit(widthED, widthLA); - bc().addCheckedLineEdit(overhangED, overhangLA); + bc().addCheckedLineEdit(overhangED, overhangCB); } @@ -99,6 +108,26 @@ void GuiWrapDialog::change_adaptor() } +void GuiWrapDialog::overhangChecked(int checkState) +{ + if (checkState == Qt::Checked) { + overhangED->setEnabled(true); + overhangUnitLC->setEnabled(true); + } else { + overhangED->setEnabled(false); + overhangUnitLC->setEnabled(false); + } +} + +void GuiWrapDialog::linesChecked(int checkState) +{ + if (checkState == Qt::Checked) + linesSB->setEnabled(true); + else + linesSB->setEnabled(false); +} + + void GuiWrapDialog::applyView() { double const width_value = widthED->text().toDouble(); @@ -113,8 +142,20 @@ void GuiWrapDialog::applyView() InsetWrapParams & params = controller().params(); params.width = Length(width_value, widthUnit); - params.overhang = Length(overhang_value, overhangUnit); - params.lines = linesSB->value(); + + if (overhangCB->checkState() == Qt::Checked) + params.overhang = Length(overhang_value, overhangUnit); + else + // when value is "0" the option is not set in the LaTeX-output + // in InsetWrap.cpp + params.overhang = Length("0in"); + + if (linesCB->checkState() == Qt::Checked) + params.lines = linesSB->value(); + else + // when value is "0" the option is not set in the LaTeX-output + // in InsetWrap.cpp + params.lines = 0; switch (valignCO->currentIndex()) { case 0: diff --git a/src/frontends/qt4/GuiWrap.h b/src/frontends/qt4/GuiWrap.h index 9fa79f2e5b..7fc097b396 100644 --- a/src/frontends/qt4/GuiWrap.h +++ b/src/frontends/qt4/GuiWrap.h @@ -28,6 +28,10 @@ public: private Q_SLOTS: void change_adaptor(); + /// overhang checkbox + void overhangChecked(int); + /// lines checkbox + void linesChecked(int); private: void closeEvent(QCloseEvent * e); diff --git a/src/frontends/qt4/ui/WrapUi.ui b/src/frontends/qt4/ui/WrapUi.ui index 6c3d47e1db..424202e72f 100644 --- a/src/frontends/qt4/ui/WrapUi.ui +++ b/src/frontends/qt4/ui/WrapUi.ui @@ -15,37 +15,6 @@ true - - - - 10 - 110 - 221 - 22 - - - - - 0 - - - 6 - - - - - &Number of needed lines (optional): - - - valignCO - - - - - - - - @@ -155,62 +124,13 @@ - - - - 292 - 11 - 98 - 16 - - - - &Placement: - - - valignCO - - - - - - 292 - 32 - 98 - 18 - - - - Vertical alignment - - - - Outer (default) - - - - - Inner - - - - - Left - - - - - Right - - - - + 10 10 - 271 - 88 + 281 + 42 @@ -235,18 +155,8 @@ - - - - &Width: - - - widthED - - - - - + + &Unit: @@ -255,31 +165,6 @@ - - - - - 1 - 0 - 0 - 0 - - - - Width value - - - - - - - &Overhang (optional): - - - widthED - - - @@ -300,12 +185,164 @@ Qt::StrongFocus - Units of width value + Unit of width value + + + + &Width: + + + widthED + + + + + + + + + 303 + 11 + 100 + 41 + + + + + 0 + + + 6 + + + + + &Placement: + + + valignCO + + + + + + + Vertical alignment + + + + Outer (default) + + + + + Inner + + + + + Left + + + + + Right + + + + + + + + + + 10 + 110 + 242 + 22 + + + + + 0 + + + 6 + - + + + false + + + number of needed lines + + + + + + + use number of lines + + + &Number of needed lines (optional): + + + + + + + + + 11 + 60 + 281 + 46 + + + + + 0 + + + 6 + + + + + use overhang + + + &Overhang (optional): + + + false + + + + + + + false + + + + 1 + 0 + 0 + 0 + + + + Overhang value + + + + + &Unit: @@ -314,8 +351,11 @@ - + + + false + 13 @@ -334,7 +374,7 @@ Qt::StrongFocus - Units of width value + Unit of overhang value @@ -352,10 +392,15 @@ widthED widthUnitLC valignCO + overhangCB + overhangED + overhangUnitLC + linesCB + linesSB restorePB okPB - applyPB closePB + applyPB qt_helpers.h