]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiTabular.cpp
Fix handling of the add branch textfield in GuiBranches
[lyx.git] / src / frontends / qt4 / GuiTabular.cpp
index 87f351b6117010c013340e87372761377dc51c21..7a197231f93c087a73052f2f81cb119a9be7eb38 100644 (file)
@@ -218,9 +218,12 @@ void GuiTabular::checkEnabled()
        bool const is_tabular_star = !tabularWidthED->text().isEmpty();
        rotateTabularCB->setDisabled(is_tabular_star);
 
-       vAlignCO->setEnabled(!multirowCB->isChecked()
+       bool const enable_valign =
+               !multirowCB->isChecked()
                && !widgetsToLength(columnWidthED, columnWidthUnitLC).empty()
-               && specialAlignmentED->text().isEmpty());
+               && specialAlignmentED->text().isEmpty();
+       vAlignCO->setEnabled(enable_valign);
+       vAlignLA->setEnabled(enable_valign);
 
        topspaceED->setEnabled(topspaceCO->currentIndex() == 2);
        topspaceED->setEnabled(topspaceCO->currentIndex() == 2);
@@ -244,7 +247,10 @@ void GuiTabular::checkEnabled()
        // depending on the cursor position is very very unintuitive...
        // We need some edit boxes to show which rows are header/footer/etc
        // without having to move the cursor first.
-       headerStatusCB->setEnabled(longtabular);
+       headerStatusCB->setEnabled(longtabular
+               && (headerStatusCB->isChecked() ?
+                   funcEnabled(Tabular::UNSET_LTHEAD) :
+                   funcEnabled(Tabular::SET_LTHEAD)));
        headerBorderAboveCB->setEnabled(longtabular
                && headerStatusCB->isChecked());
        headerBorderBelowCB->setEnabled(longtabular
@@ -256,14 +262,19 @@ void GuiTabular::checkEnabled()
        // check if setting a first header is allowed
        // additionally check firstheaderNoContentsCB because when this is
        // the case a first header makes no sense
-       firstheaderStatusCB->setEnabled(funcEnabled(Tabular::SET_LTFIRSTHEAD)
+       firstheaderStatusCB->setEnabled((firstheaderStatusCB->isChecked() ?
+                  funcEnabled(Tabular::UNSET_LTFIRSTHEAD) :
+                  funcEnabled(Tabular::SET_LTFIRSTHEAD))
                && longtabular && !firstheaderNoContentsCB->isChecked());
        firstheaderBorderAboveCB->setEnabled(longtabular
                && firstheaderStatusCB->isChecked());
        firstheaderBorderBelowCB->setEnabled(longtabular
                && firstheaderStatusCB->isChecked());
 
-       footerStatusCB->setEnabled(longtabular);
+       footerStatusCB->setEnabled(longtabular
+               && (footerStatusCB->isChecked() ?
+                   funcEnabled(Tabular::UNSET_LTFOOT) :
+                   funcEnabled(Tabular::SET_LTFOOT)));
        footerBorderAboveCB->setEnabled(longtabular
                && footerBorderAboveCB->isChecked());
        footerBorderBelowCB->setEnabled(longtabular
@@ -275,7 +286,9 @@ void GuiTabular::checkEnabled()
        // check if setting a last footer is allowed
        // additionally check lastfooterNoContentsCB because when this is
        // the case a last footer makes no sense
-       lastfooterStatusCB->setEnabled(funcEnabled(Tabular::SET_LTLASTFOOT)
+       lastfooterStatusCB->setEnabled((lastfooterStatusCB->isChecked() ?
+                  funcEnabled(Tabular::UNSET_LTLASTFOOT) :
+                  funcEnabled(Tabular::SET_LTLASTFOOT))
                && longtabular && !lastfooterNoContentsCB->isChecked());
        lastfooterBorderAboveCB->setEnabled(longtabular
                && lastfooterBorderAboveCB->isChecked());
@@ -287,8 +300,10 @@ void GuiTabular::checkEnabled()
 
        multicolumnCB->setEnabled(funcEnabled(Tabular::MULTICOLUMN));
        multirowCB->setEnabled(funcEnabled(Tabular::MULTIROW));
-       multirowOffsetED->setEnabled(multirowCB->isChecked());
-       multirowOffsetUnitLC->setEnabled(multirowCB->isChecked());
+       bool const enable_mr = multirowCB->isChecked();
+       multirowOffsetLA->setEnabled(enable_mr);
+       multirowOffsetED->setEnabled(enable_mr);
+       multirowOffsetUnitLC->setEnabled(enable_mr);
 
        changed();
 }
@@ -408,7 +423,7 @@ void GuiTabular::setTableAlignment(string & param_str) const
 docstring GuiTabular::dialogToParams() const
 {
        // FIXME: We should use Tabular directly.
-       string param_str = "tabular";
+       string param_str = "tabular from-dialog";
 
        // table width
        string tabwidth = widgetsToLength(tabularWidthED, tabularWidthUnitLC);