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
This commit is contained in:
Jean-Marc Lasgouttes 2015-10-27 16:48:29 +01:00
parent 1f81cd7b65
commit 5e0e676530
3 changed files with 25 additions and 15 deletions

View File

@ -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);
}

View File

@ -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());
}

View File

@ -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;