Implement toggling for longtabular and booktabs tabular features

This is needed for the tabular context menu. This menu is updated accordingly.
This commit is contained in:
Jean-Marc Lasgouttes 2015-11-13 14:09:04 +01:00
parent 0f5886b856
commit 68217b1e4a
4 changed files with 28 additions and 9 deletions

View File

@ -411,7 +411,7 @@ Menuset
Item "Left|L" "inset-modify tabular toggle-line-left"
Item "Right|R" "inset-modify tabular toggle-line-right"
End
Menu "table-alignment"
Item "Left|f" "command-alternatives inset-modify tabular m-align-left;inset-modify tabular align-left"
Item "Center|C" "command-alternatives inset-modify tabular m-align-center;inset-modify tabular align-center"
@ -422,7 +422,7 @@ Menuset
Item "Middle" "inset-modify tabular valign-middle"
Item "Bottom" "inset-modify tabular valign-bottom"
End
Menu "table-cols-rows"
Item "Multicolumn|u" "inset-modify tabular multicolumn"
Item "Multirow|w" "inset-modify tabular multirow"
@ -439,19 +439,16 @@ Menuset
Item "Move Column Right|v" "inset-modify tabular move-column-right"
Item "Move Column Left" "inset-modify tabular move-column-left"
End
Menu "context-tabular"
Item "Normal Table|g" "inset-modify tabular unset-longtabular"
Item "Multi-page Table|g" "inset-modify tabular set-longtabular"
Separator
Item "Default Style|m" "inset-modify tabular unset-booktabs"
Item "Formal Style|m" "inset-modify tabular set-booktabs"
Item "Multi-page Table|g" "inset-modify tabular toggle-longtabular"
Item "Formal Style|m" "inset-modify tabular toggle-booktabs"
Separator
Submenu "Borders|d" "table-borders"
Submenu "Alignment|i" "table-alignment"
Submenu "Columns/Rows|C" "table-cols-rows"
Separator
Item "Settings Dialog...|S" "inset-settings tabular"
Item "Settings...|S" "inset-settings tabular"
End
#

View File

@ -191,6 +191,9 @@ Menuset
# not much we can do to help here
Menu "edit_tabular"
Item "Multi-page Table|g" "inset-modify tabular toggle-longtabular"
Item "Formal Style|F" "inset-modify tabular toggle-booktabs"
Separator
Item "Multicolumn|M" "inset-modify tabular multicolumn"
Item "Multirow|u" "inset-modify tabular multirow"
Separator

View File

@ -151,6 +151,7 @@ TabularFeature tabularFeature[] =
{ Tabular::SET_MROFFSET, "set-mroffset", true },
{ Tabular::SET_ALL_LINES, "set-all-lines", false },
{ Tabular::UNSET_ALL_LINES, "unset-all-lines", false },
{ Tabular::TOGGLE_LONGTABULAR, "toggle-longtabular", false },
{ Tabular::SET_LONGTABULAR, "set-longtabular", false },
{ Tabular::UNSET_LONGTABULAR, "unset-longtabular", false },
{ Tabular::SET_PWIDTH, "set-pwidth", true },
@ -177,6 +178,7 @@ TabularFeature tabularFeature[] =
{ Tabular::UNSET_LTCAPTION, "unset-ltcaption", false },
{ Tabular::SET_SPECIAL_COLUMN, "set-special-column", true },
{ Tabular::SET_SPECIAL_MULTICOLUMN, "set-special-multicolumn", true },
{ Tabular::TOGGLE_BOOKTABS, "toggle-booktabs", false },
{ Tabular::SET_BOOKTABS, "set-booktabs", false },
{ Tabular::UNSET_BOOKTABS, "unset-booktabs", false },
{ Tabular::SET_TOP_SPACE, "set-top-space", true },
@ -4718,6 +4720,7 @@ bool InsetTabular::getStatus(Cursor & cur, FuncRequest const & cmd,
break;
case Tabular::SET_LONGTABULAR:
case Tabular::TOGGLE_LONGTABULAR:
// setting as longtable is not allowed when table is inside a float
if (cur.innerInsetOfType(FLOAT_CODE) != 0
|| cur.innerInsetOfType(WRAP_CODE) != 0)
@ -4866,6 +4869,7 @@ bool InsetTabular::getStatus(Cursor & cur, FuncRequest const & cmd,
status.setOnOff(tabular.ltCaption(sel_row_start));
break;
case Tabular::TOGGLE_BOOKTABS:
case Tabular::SET_BOOKTABS:
status.setOnOff(tabular.use_booktabs);
break;
@ -5761,6 +5765,13 @@ void InsetTabular::tabularFeatures(Cursor & cur,
}
break;
case Tabular::TOGGLE_LONGTABULAR:
if (tabular.is_long_tabular)
tabularFeatures(cur, Tabular::UNSET_LONGTABULAR);
else
tabular.is_long_tabular = true;
break;
case Tabular::SET_LONGTABULAR:
tabular.is_long_tabular = true;
break;
@ -5929,6 +5940,10 @@ void InsetTabular::tabularFeatures(Cursor & cur,
break;
}
case Tabular::TOGGLE_BOOKTABS:
tabular.use_booktabs = !tabular.use_booktabs;
break;
case Tabular::SET_BOOKTABS:
tabular.use_booktabs = true;
break;

View File

@ -219,6 +219,8 @@ public:
///
UNSET_ALL_LINES,
///
TOGGLE_LONGTABULAR,
///
SET_LONGTABULAR,
///
UNSET_LONGTABULAR,
@ -266,6 +268,8 @@ public:
///
SET_SPECIAL_MULTICOLUMN,
///
TOGGLE_BOOKTABS,
///
SET_BOOKTABS,
///
UNSET_BOOKTABS,