diff --git a/lib/Makefile.am b/lib/Makefile.am index fd3ad852ec..1df01b2f9c 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -680,6 +680,7 @@ dist_images_DATA1X = \ images/tabular-feature_move-row-up.svgz \ images/tabular-feature_multicolumn.svgz \ images/tabular-feature_multirow.svgz \ + images/tabular-feature_reset-formal-default.svgz \ images/tabular-feature_set-all-lines.svgz \ images/tabular-feature_set-longtabular.svgz \ images/tabular-feature_set-rotate-cell.svgz \ @@ -1962,6 +1963,7 @@ dist_imagesoxygen_DATA1X = \ images/oxygen/tabular-feature_move-row-up.svgz \ images/oxygen/tabular-feature_multicolumn.svgz \ images/oxygen/tabular-feature_multirow.svgz \ + images/oxygen/tabular-feature_reset-formal-default.svgz \ images/oxygen/tabular-feature_set-all-lines.svgz \ images/oxygen/tabular-feature_set-border-lines.svgz \ images/oxygen/tabular-feature_set-inner-lines.svgz \ @@ -2160,6 +2162,7 @@ dist_imagesclassic_DATA = \ images/classic/tabular-feature_m-valign-top.png \ images/classic/tabular-feature_multicolumn.png \ images/classic/tabular-feature_multirow.png \ + images/classic/tabular-feature_reset-formal-default.png \ images/classic/tabular-feature_set-all-lines.png \ images/classic/tabular-feature_set-border-lines.png \ images/classic/tabular-feature_set-inner-lines.png \ diff --git a/lib/images/classic/tabular-feature_reset-formal-default.png b/lib/images/classic/tabular-feature_reset-formal-default.png new file mode 100644 index 0000000000..382d5629fc Binary files /dev/null and b/lib/images/classic/tabular-feature_reset-formal-default.png differ diff --git a/lib/images/oxygen/tabular-feature_reset-formal-default.svgz b/lib/images/oxygen/tabular-feature_reset-formal-default.svgz new file mode 100644 index 0000000000..04b410b791 Binary files /dev/null and b/lib/images/oxygen/tabular-feature_reset-formal-default.svgz differ diff --git a/lib/images/tabular-feature_reset-formal-default.svgz b/lib/images/tabular-feature_reset-formal-default.svgz new file mode 100644 index 0000000000..dadd0d1e00 Binary files /dev/null and b/lib/images/tabular-feature_reset-formal-default.svgz differ diff --git a/lib/ui/stdcontext.inc b/lib/ui/stdcontext.inc index e358ce910a..6f86dd124c 100644 --- a/lib/ui/stdcontext.inc +++ b/lib/ui/stdcontext.inc @@ -435,6 +435,7 @@ Menuset Item "Bottom|B" "tabular-feature toggle-line-bottom" Item "Left|L" "tabular-feature toggle-line-left" Item "Right|R" "tabular-feature toggle-line-right" + OptItem "Reset Formal Defaults|F" "tabular-feature reset-formal-default" End Menu "table-alignment" diff --git a/lib/ui/stdtoolbars.inc b/lib/ui/stdtoolbars.inc index f48f27b73f..10bb531b5d 100644 --- a/lib/ui/stdtoolbars.inc +++ b/lib/ui/stdtoolbars.inc @@ -161,6 +161,7 @@ ToolbarSet Item "Set all lines" "tabular-feature set-all-lines" Item "Set inner lines" "tabular-feature set-inner-lines" Item "Unset all lines" "tabular-feature unset-all-lines" + Item "Reset formal default lines" "tabular-feature reset-formal-default" Separator Item "Align left" "command-alternatives tabular-feature m-align-left;tabular-feature align-left" Item "Align center" "command-alternatives tabular-feature m-align-center;tabular-feature align-center" diff --git a/src/LyXAction.cpp b/src/LyXAction.cpp index 1374ab5ff0..59bdbe8d1c 100644 --- a/src/LyXAction.cpp +++ b/src/LyXAction.cpp @@ -3757,7 +3757,8 @@ void LyXAction::init() valign-top|valign-bottom|valign-middle|longtabular-align-left|\n longtabular-align-center|longtabular-align-right|m-align-left|m-align-right|\n m-align-center|m-valign-top|m-valign-bottom|m-valign-middle|multicolumn|\n - set-all-lines|unset-all-lines|toggle-longtabular|set-longtabular|unset-longtabular|set-pwidth|\n + reset-formal-default|set-all-lines|unset-all-lines|toggle-longtabular|\n + set-longtabular|unset-longtabular|set-pwidth|\n set-mpwidth|set-rotate-tabular|unset-rotate-tabular|toggle-rotate-tabular|\n set-rotate-cell|unset-rotate-cell|toggle-rotate-cell|set-usebox|set-lthead|\n unset-lthead|set-ltfirsthead|unset-ltfirsthead|set-ltfoot|unset-ltfoot|\n diff --git a/src/frontends/qt4/GuiTabular.cpp b/src/frontends/qt4/GuiTabular.cpp index 8168b56a51..dd25e9dad5 100644 --- a/src/frontends/qt4/GuiTabular.cpp +++ b/src/frontends/qt4/GuiTabular.cpp @@ -86,6 +86,8 @@ GuiTabular::GuiTabular(QWidget * parent) this, SLOT(borderSet_clicked())); connect(borderUnsetPB, SIGNAL(clicked()), this, SLOT(borderUnset_clicked())); + connect(resetFormalCB, SIGNAL(clicked()), + this, SLOT(checkEnabled())); connect(hAlignCO, SIGNAL(activated(int)), this, SLOT(checkEnabled())); connect(vAlignCO, SIGNAL(activated(int)), @@ -234,6 +236,7 @@ void GuiTabular::enableWidgets() const hAlignCO->itemData(hAlignCO->currentIndex()).toString() == QString("decimal"); decimalPointED->setEnabled(dalign); decimalLA->setEnabled(dalign); + resetFormalCB->setEnabled(booktabsRB->isChecked()); bool const setwidth = TableAlignCO->currentText() == qt_("Middle"); tabularWidthLA->setEnabled(setwidth); @@ -558,7 +561,9 @@ docstring GuiTabular::dialogToParams() const } // - if (borders->topLineSet() && borders->bottomLineSet() && borders->leftLineSet() + if (resetFormalCB->isChecked()) + setParam(param_str, Tabular::RESET_FORMAL_DEFAULT); + else if (borders->topLineSet() && borders->bottomLineSet() && borders->leftLineSet() && borders->rightLineSet()) setParam(param_str, Tabular::SET_ALL_LINES); else if (borders->topLineUnset() && borders->bottomLineUnset() && borders->leftLineUnset() diff --git a/src/frontends/qt4/ui/TabularUi.ui b/src/frontends/qt4/ui/TabularUi.ui index 5ced77a086..4b26680499 100644 --- a/src/frontends/qt4/ui/TabularUi.ui +++ b/src/frontends/qt4/ui/TabularUi.ui @@ -739,6 +739,15 @@ + + + + 0 + 0 + 0 + + + @@ -894,6 +903,15 @@ + + + + 0 + 0 + 0 + + + @@ -1049,6 +1067,15 @@ + + + + 0 + 0 + 0 + + + @@ -1119,6 +1146,26 @@ true + + + + Use default (grid-like) border style + + + De&fault + + + + + + + If this is checked, the table will be reset to the formal default style (only top and bottom row have vertical lines) + + + Use Default &Formal Style + + + @@ -1132,16 +1179,6 @@ - - - - Use default (grid-like) border style - - - De&fault - - - diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp index 44f251a728..2bb49f8781 100644 --- a/src/insets/InsetTabular.cpp +++ b/src/insets/InsetTabular.cpp @@ -155,6 +155,7 @@ TabularFeature tabularFeature[] = { Tabular::UNSET_MULTIROW, "unset-multirow", false }, { Tabular::SET_MROFFSET, "set-mroffset", true }, { Tabular::SET_ALL_LINES, "set-all-lines", false }, + { Tabular::RESET_FORMAL_DEFAULT, "reset-formal-default", false }, { Tabular::UNSET_ALL_LINES, "unset-all-lines", false }, { Tabular::TOGGLE_LONGTABULAR, "toggle-longtabular", false }, { Tabular::SET_LONGTABULAR, "set-longtabular", false }, @@ -4983,6 +4984,10 @@ bool InsetTabular::getFeatureStatus(Cursor & cur, string const & s, status.setEnabled(!tabular.ltCaption(tabular.cellRow(cur.idx()))); break; + case Tabular::RESET_FORMAL_DEFAULT: + status.setEnabled(tabular.use_booktabs); + break; + case Tabular::SET_LINE_TOP: case Tabular::SET_LINE_BOTTOM: status.setEnabled(!tabular.ltCaption(tabular.cellRow(cur.idx()))); @@ -6165,6 +6170,19 @@ void InsetTabular::tabularFeatures(Cursor & cur, } break; + case Tabular::RESET_FORMAL_DEFAULT: + for (row_type r = 0; r < tabular.nrows(); ++r) { + bool const head_or_foot = r == 0 || r == tabular.nrows() - 1; + for (col_type c = 0; c < tabular.ncols(); ++c) { + idx_type const cell = tabular.cellIndex(r, c); + tabular.setTopLine(cell, head_or_foot); + tabular.setBottomLine(cell, head_or_foot); + tabular.setRightLine(cell, false); + tabular.setLeftLine(cell, false); + } + } + break; + case Tabular::SET_BORDER_LINES: for (row_type r = sel_row_start; r <= sel_row_end; ++r) { tabular.setLeftLine(tabular.cellIndex(r, sel_col_start), true); diff --git a/src/insets/InsetTabular.h b/src/insets/InsetTabular.h index 92ccdb6bc2..9bc1746195 100644 --- a/src/insets/InsetTabular.h +++ b/src/insets/InsetTabular.h @@ -223,6 +223,8 @@ public: /// SET_ALL_LINES, /// + RESET_FORMAL_DEFAULT, + /// UNSET_ALL_LINES, /// TOGGLE_LONGTABULAR,