]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiTabular.cpp
Use QMessageBox for toggleWarning if possible
[lyx.git] / src / frontends / qt4 / GuiTabular.cpp
index 495b2c62776aeb9105833791dba734f1bd42064b..645b7744c60d9c0f65167606467c84729655ce07 100644 (file)
@@ -33,6 +33,7 @@
 
 #include "support/convert.h"
 #include "support/debug.h"
+#include "support/lstrings.h"
 
 #include <QCheckBox>
 #include <QPushButton>
@@ -45,7 +46,9 @@ namespace lyx {
 namespace frontend {
 
 GuiTabular::GuiTabular(QWidget * parent)
-       : InsetParamsWidget(parent)
+       : InsetParamsWidget(parent), firstheader_suppressable_(false),
+         lastfooter_suppressable_(false)
+
 {
        setupUi(this);
 
@@ -217,7 +220,7 @@ void GuiTabular::enableWidgets() const
        else if (!multicolumnCB->isChecked() && !multirowCB->isChecked()
                && hAlignCO->findData(toqstr("decimal")) == -1)
                hAlignCO->addItem(qt_("At Decimal Separator"), toqstr("decimal"));
-       bool const dalign = 
+       bool const dalign =
                hAlignCO->itemData(hAlignCO->currentIndex()).toString() == QString("decimal");
        decimalPointED->setEnabled(dalign);
        decimalLA->setEnabled(dalign);
@@ -228,7 +231,8 @@ void GuiTabular::enableWidgets() const
        tabularWidthED->setEnabled(setwidth);
        tabularWidthUnitLC->setEnabled(setwidth);
 
-       rotateTabularAngleSB->setEnabled(rotateTabularCB->isChecked());
+       rotateTabularAngleSB->setEnabled(rotateTabularCB->isChecked()
+                                        && !longTabularCB->isChecked());
        rotateCellAngleSB->setEnabled(rotateCellCB->isChecked());
 
        bool const enable_valign =
@@ -256,6 +260,9 @@ void GuiTabular::enableWidgets() const
        // longtables and tabular* cannot have a vertical alignment
        TableAlignLA->setDisabled(is_tabular_star || longtabular);
        TableAlignCO->setDisabled(is_tabular_star || longtabular);
+       // longtable cannot be rotated with rotating package, only
+       // with [pdf]lscape, which only supports 90 deg.
+       rotateTabularAngleSB->setDisabled(longtabular);
 
        // FIXME: This Dialog is really horrible, disabling/enabling a checkbox
        // depending on the cursor position is very very unintuitive...
@@ -447,8 +454,7 @@ void GuiTabular::setTableAlignment(string & param_str) const
 
 docstring GuiTabular::dialogToParams() const
 {
-       // FIXME: We should use Tabular directly.
-       string param_str = "tabular from-dialog";
+       string param_str = "tabular";
 
        // table width
        string tabwidth = widgetsToLength(tabularWidthED, tabularWidthUnitLC);
@@ -555,7 +561,7 @@ docstring GuiTabular::dialogToParams() const
 
        // apply the special alignment
        string special = fromqstr(specialAlignmentED->text());
-       if (special.empty())
+       if (support::trim(special).empty())
                special = "none";
        if (multicolumnCB->isChecked())
                setParam(param_str, Tabular::SET_SPECIAL_MULTICOLUMN, special);
@@ -736,12 +742,16 @@ void GuiTabular::paramsToDialog(Inset const * inset)
                        rotateCellAngleSB->setValue(90);
        }
 
-       rotateTabularCB->setChecked(tabular.rotate != 0);
-       if (rotateTabularCB->isChecked())
-               rotateTabularAngleSB->setValue(tabular.rotate != 0 ? tabular.rotate : 90);
-
        longTabularCB->setChecked(tabular.is_long_tabular);
 
+       rotateTabularCB->setChecked(tabular.rotate != 0);
+       if (rotateTabularCB->isChecked()) {
+               if (longTabularCB->isChecked())
+                       rotateTabularAngleSB->setValue(90);
+               else
+                       rotateTabularAngleSB->setValue(tabular.rotate != 0 ? tabular.rotate : 90);
+       }
+
        borders->setTop(tabular.topLine(cell));
        borders->setBottom(tabular.bottomLine(cell));
        borders->setLeft(tabular.leftLine(cell));
@@ -1070,8 +1080,8 @@ bool GuiTabular::checkWidgets(bool readonly) const
 
 bool GuiTabular::funcEnabled(Tabular::Feature f) const
 {
-       string cmd = "tabular " + featureAsString(f);
-       return getStatus(FuncRequest(LFUN_INSET_MODIFY, cmd)).enabled();
+       FuncRequest r(LFUN_INSET_MODIFY, "tabular for-dialog" + featureAsString(f));
+       return getStatus(r).enabled();
 }