]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiLine.cpp
QDialogButtonBox for the remaining dialogs.
[lyx.git] / src / frontends / qt4 / GuiLine.cpp
index bfa8ae5208fc48bc9aca41b3d759549009209496..2a8b9de2bc16429900fdb3d98c6da4af9c8037f0 100644 (file)
@@ -3,6 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
+ * \author Abdelrazak Younes
  * \author Uwe Stöhr
  *
  * Full author contact details are available in file CREDITS.
@@ -59,9 +60,12 @@ GuiLine::GuiLine(QWidget * parent) : InsetParamsWidget(parent)
        WidthLE->setValidator(unsignedGlueLengthValidator(WidthLE));
        HeightLE->setValidator(unsignedGlueLengthValidator(HeightLE));
 
-       OffsetLE->setText("0");
+       OffsetLE->setText("0.5");
+       OffsetUnitCO->setCurrentItem(Length::EX);
        WidthLE->setText("100");
-       HeightLE->setText("0.5");
+       WidthUnitCO->setCurrentItem(Length::PCW);
+       HeightLE->setText("1");
+       HeightUnitCO->setCurrentItem(Length::PT);
        setFocusProxy(WidthLE);
 }
 
@@ -69,11 +73,11 @@ GuiLine::GuiLine(QWidget * parent) : InsetParamsWidget(parent)
 docstring GuiLine::dialogToParams() const
 {
        InsetCommandParams params(insetCode());
-       params["offset"] = from_utf8(widgetsToLength(OffsetLE, OffsetUnitCO));;
+       params["offset"] = from_utf8(widgetsToLength(OffsetLE, OffsetUnitCO));
        params["width"] = from_utf8(widgetsToLength(WidthLE, WidthUnitCO));
        params["height"] = from_utf8(widgetsToLength(HeightLE, HeightUnitCO));
        params.setCmdName("rule");
-       return from_ascii(InsetLine::params2string("line", params));
+       return from_ascii(InsetLine::params2string(params));
 }
 
 
@@ -96,8 +100,14 @@ void GuiLine::paramsToDialog(Inset const * inset)
 }
 
 
-bool GuiLine::checkWidgets() const
+bool GuiLine::checkWidgets(bool readonly) const
 {
+       WidthLE->setReadOnly(readonly);
+       HeightLE->setReadOnly(readonly);
+       OffsetLE->setReadOnly(readonly);
+       OffsetUnitCO->setEnabled(!readonly);
+       HeightUnitCO->setEnabled(!readonly);
+       WidthUnitCO->setEnabled(!readonly);
        if (!InsetParamsWidget::checkWidgets())
                return false;
        // FIXME: this should be handled in unsignedGlueLengthValidator!
@@ -106,7 +116,6 @@ bool GuiLine::checkWidgets() const
        // FIXME: this should be handled in unsignedGlueLengthValidator!
        if (HeightLE->text().startsWith('-'))
                return false;
-       // FIXME: Is there something else to check?
        return true;
 }