commit 5e0e6765309da32a2b82cdebc0c13b2a5b06f948
Author: Jean-Marc Lasgouttes <[email protected]>
Date:   Tue Oct 27 16:48:29 2015 +0100

    Disable setting vertical lines when using a formal table
    
    The code in InsetTabular disables the toolbar icons and menu entries 
related to vertical lines.
    
    The code in GuiTabular disables vertical lines in the Settings dialog.
    Note that there was a bug in
    GuiSetBorders::set(Left|Right|Top|Bottom)Enabled, where the borders
    did not get drawn correctly.
    
    Fixes bug #9816

diff --git a/src/frontends/qt4/GuiSetBorder.cpp 
b/src/frontends/qt4/GuiSetBorder.cpp
index d3f72a6..80a7d74 100644
--- a/src/frontends/qt4/GuiSetBorder.cpp
+++ b/src/frontends/qt4/GuiSetBorder.cpp
@@ -151,31 +151,31 @@ void GuiSetBorder::drawBottom(bool draw)
 }
 
 
-void GuiSetBorder::setLeftEnabled(bool border)
+void GuiSetBorder::setLeftEnabled(bool enabled)
 {
-       left_.enabled = border;
-       drawLeft(border);
+       left_.enabled = enabled;
+       drawLeft(left_.set);
 }
 
 
-void GuiSetBorder::setRightEnabled(bool border)
+void GuiSetBorder::setRightEnabled(bool enabled)
 {
-       right_.enabled = border;
-       drawRight(border);
+       right_.enabled = enabled;
+       drawRight(right_.set);
 }
 
 
-void GuiSetBorder::setTopEnabled(bool border)
+void GuiSetBorder::setTopEnabled(bool enabled)
 {
-       top_.enabled = border;
-       drawTop(border);
+       top_.enabled = enabled;
+       drawTop(top_.set);
 }
 
 
-void GuiSetBorder::setBottomEnabled(bool border)
+void GuiSetBorder::setBottomEnabled(bool enabled)
 {
-       bottom_.enabled = border;
-       drawBottom(border);
+       bottom_.enabled = enabled;
+       drawBottom(bottom_.set);
 }
 
 
diff --git a/src/frontends/qt4/GuiTabular.cpp b/src/frontends/qt4/GuiTabular.cpp
index 58dcd59..495b2c6 100644
--- a/src/frontends/qt4/GuiTabular.cpp
+++ b/src/frontends/qt4/GuiTabular.cpp
@@ -320,6 +320,10 @@ void GuiTabular::enableWidgets() const
        multirowOffsetLA->setEnabled(enable_mr);
        multirowOffsetED->setEnabled(enable_mr);
        multirowOffsetUnitLC->setEnabled(enable_mr);
+
+       // Vertical lines cannot be set in formal tables
+       borders->setLeftEnabled(!booktabsRB->isChecked());
+       borders->setRightEnabled(!booktabsRB->isChecked());
 }
 
 
diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp
index ae6ea58..b8b47f7 100644
--- a/src/insets/InsetTabular.cpp
+++ b/src/insets/InsetTabular.cpp
@@ -4622,9 +4622,13 @@ bool InsetTabular::getStatus(Cursor & cur, FuncRequest 
const & cmd,
 
                case Tabular::SET_LINE_TOP:
                case Tabular::SET_LINE_BOTTOM:
+                       
status.setEnabled(!tabular.ltCaption(tabular.cellRow(cur.idx())));
+                       break;
+
                case Tabular::SET_LINE_LEFT:
                case Tabular::SET_LINE_RIGHT:
-                       
status.setEnabled(!tabular.ltCaption(tabular.cellRow(cur.idx())));
+                       status.setEnabled(!tabular.use_booktabs
+                                         && 
!tabular.ltCaption(tabular.cellRow(cur.idx())));
                        break;
 
                case Tabular::TOGGLE_LINE_TOP:
@@ -4638,12 +4642,14 @@ bool InsetTabular::getStatus(Cursor & cur, FuncRequest 
const & cmd,
                        break;
 
                case Tabular::TOGGLE_LINE_LEFT:
-                       
status.setEnabled(!tabular.ltCaption(tabular.cellRow(cur.idx())));
+                       status.setEnabled(!tabular.use_booktabs
+                                         && 
!tabular.ltCaption(tabular.cellRow(cur.idx())));
                        status.setOnOff(tabular.leftLine(cur.idx()));
                        break;
 
                case Tabular::TOGGLE_LINE_RIGHT:
-                       
status.setEnabled(!tabular.ltCaption(tabular.cellRow(cur.idx())));
+                       status.setEnabled(!tabular.use_booktabs
+                                         && 
!tabular.ltCaption(tabular.cellRow(cur.idx())));
                        status.setOnOff(tabular.rightLine(cur.idx()));
                        break;
 

Reply via email to