From 0da8a39a3b8fd59004b1f3463a605266b5281744 Mon Sep 17 00:00:00 2001 From: Georg Baum Date: Mon, 19 Dec 2011 21:28:11 +0000 Subject: [PATCH] Ensure that head/foot cannot be unset as long is the row is a caption git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40527 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiTabular.cpp | 18 ++++++++++++++---- src/insets/InsetTabular.cpp | 4 ++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/frontends/qt4/GuiTabular.cpp b/src/frontends/qt4/GuiTabular.cpp index bb01c3bd24..7a197231f9 100644 --- a/src/frontends/qt4/GuiTabular.cpp +++ b/src/frontends/qt4/GuiTabular.cpp @@ -247,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 @@ -259,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 @@ -278,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()); diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp index 01ee12c516..dca6a18c3d 100644 --- a/src/insets/InsetTabular.cpp +++ b/src/insets/InsetTabular.cpp @@ -4610,6 +4610,7 @@ bool InsetTabular::getStatus(Cursor & cur, FuncRequest const & cmd, break; case Tabular::UNSET_LTFIRSTHEAD: + status.setEnabled(sel_row_start == sel_row_end && !tabular.ltCaption(sel_row_start)); status.setOnOff(!tabular.getRowOfLTFirstHead(sel_row_start, dummyltt)); break; @@ -4619,6 +4620,7 @@ bool InsetTabular::getStatus(Cursor & cur, FuncRequest const & cmd, break; case Tabular::UNSET_LTHEAD: + status.setEnabled(sel_row_start == sel_row_end && !tabular.ltCaption(sel_row_start)); status.setOnOff(!tabular.getRowOfLTHead(sel_row_start, dummyltt)); break; @@ -4628,6 +4630,7 @@ bool InsetTabular::getStatus(Cursor & cur, FuncRequest const & cmd, break; case Tabular::UNSET_LTFOOT: + status.setEnabled(sel_row_start == sel_row_end && !tabular.ltCaption(sel_row_start)); status.setOnOff(!tabular.getRowOfLTFoot(sel_row_start, dummyltt)); break; @@ -4637,6 +4640,7 @@ bool InsetTabular::getStatus(Cursor & cur, FuncRequest const & cmd, break; case Tabular::UNSET_LTLASTFOOT: + status.setEnabled(sel_row_start == sel_row_end && !tabular.ltCaption(sel_row_start)); status.setOnOff(!tabular.getRowOfLTLastFoot(sel_row_start, dummyltt)); break; -- 2.39.2