From: Georg Baum Date: Mon, 3 Jul 2006 19:13:56 +0000 (+0000) Subject: merge booktabs branch X-Git-Tag: 1.6.10~13023 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=0c0c43b8eb42b4a895e12c774a9b12f2c5bc6c03;p=lyx.git merge booktabs branch git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14319 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/development/FORMAT b/development/FORMAT index 0d10ce636d..7ca9e10372 100644 --- a/development/FORMAT +++ b/development/FORMAT @@ -1,6 +1,19 @@ LyX file-format changes ----------------------- +2006-07-03 Georg Baum + + * format incremented to 248: Basic booktabs support + + The tag has a new switch: booktabs="true|false". + An absent switch is equivalent to booktabs="false". + Horizontal lines are set with the booktabs package if this switch + is on. + + The tag of tabulars has the following new attributes: + topspace, bottomspace and interlinespace. All take a LyXLength + as value, or the special keyword "default". + 2006-06-10 Jürgen Spitzmüller * format incremented to 247. The Grand Font Interface Rewrite. diff --git a/lib/ChangeLog b/lib/ChangeLog index 771fea0db9..54221d118c 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -614,6 +614,10 @@ * configure.m4: check for more viewers and editors +2004-11-11 Georg Baum + + * chkconfig.ltx: check package booktabs + 2004-11-05 Bennett Helm * bind/mac.bind: use -Tab and -backtab as shortcuts for diff --git a/lib/chkconfig.ltx b/lib/chkconfig.ltx index 790eb77cd6..ea5a8d8c5c 100644 --- a/lib/chkconfig.ltx +++ b/lib/chkconfig.ltx @@ -219,6 +219,7 @@ \TestPackage{array} \TestPackage{babel} \TestPackage{bibtopic} +\TestPackage{booktabs} \TestPackage{color} % this one should be there if graphics.sty is there. \TestPackage{dvipost} \TestPackage{fancybox} diff --git a/lib/doc/ChangeLog b/lib/doc/ChangeLog index 47c82c31fe..47e2b019dd 100644 --- a/lib/doc/ChangeLog +++ b/lib/doc/ChangeLog @@ -202,6 +202,10 @@ * Customization.lyx: document OptionalArgs +2004-11-11 Georg Baum + + * LaTeXConfig.lyx.in, LyXConfig.lyx.in: add booktabs package + 2004-11-04 Christian Ridderström * LaTeXConfig.lyx.in: remove "supported" and "other" from CTAN diff --git a/lib/doc/LaTeXConfig.lyx.in b/lib/doc/LaTeXConfig.lyx.in index 007ba30c8c..8f7dfa2801 100644 --- a/lib/doc/LaTeXConfig.lyx.in +++ b/lib/doc/LaTeXConfig.lyx.in @@ -2447,6 +2447,31 @@ longtable is needed by LyX to be able to output correctly multipage tables. \end_layout +\begin_layout Subsection +booktabs +\end_layout + +\begin_layout Description + +Found: @chk_booktabs@ +\end_layout + +\begin_layout Description + +CTAN: +\family typewriter +macros/latex/contrib/booktabs/ +\end_layout + +\begin_layout Description + +Notes: The package +\family sans +booktabs +\family default + is needed by LyX to be able to output correctly formal tables. +\end_layout + \begin_layout Subsection varioref \end_layout diff --git a/lib/doc/LyXConfig.lyx.in b/lib/doc/LyXConfig.lyx.in index 6c20a1158e..f27e717f66 100644 --- a/lib/doc/LyXConfig.lyx.in +++ b/lib/doc/LyXConfig.lyx.in @@ -1135,6 +1135,24 @@ Table of contents if you want to use non-English quotes. \layout Subsection +booktabs +\layout Description + +Found: @chk_booktabs@ +\layout Description + +CTAN: +\family typewriter +macros/latex/contrib/booktabs/ +\layout Description + +Notes: The package +\family sans +booktabs +\family default + is needed by LyX to be able to output correctly formal tables. +\layout Subsection + color \layout Description diff --git a/lib/lyx2lyx/ChangeLog b/lib/lyx2lyx/ChangeLog index 77bb7ee3e4..cf6919c097 100644 --- a/lib/lyx2lyx/ChangeLog +++ b/lib/lyx2lyx/ChangeLog @@ -1,3 +1,9 @@ +2006-03-14 Georg Baum + + * lyx_1_5.py: new file, handle new format 246 + * LyX.py: handle new format 246 + * lyx_1_4.py (revert_booktabs): move to lyx_1_5.py + 2006-03-06 José Matos * lyx_1_4.py (remove_paperpackage): Only reset the papersize for @@ -332,6 +338,11 @@ * lyx_1_4.py: unify the call convention of convertion functions. Now they all accept a file. +2004-12-06 Georg Baum + + * lyx_1_4.py, LyX.py: handle new format 239 + * lyx_1_4.py (revert_booktabs): move to 239 -> 238 conversion + 2004-12-03 José Matos * LyX.py: format up to 238. @@ -351,6 +362,11 @@ * lyx_1_2.py (convert): rename opt to file, as in all other files. +2004-12-06 Georg Baum + + * lyx_1_4.py, LyX.py: handle new format 238 + * lyx_1_4.py (revert_booktabs): new + 2004-10-28 José Matos * LyX.pm: add internal documentation. diff --git a/lib/lyx2lyx/LyX.py b/lib/lyx2lyx/LyX.py index 66e971b4ae..1ee2fb0c06 100644 --- a/lib/lyx2lyx/LyX.py +++ b/lib/lyx2lyx/LyX.py @@ -47,9 +47,9 @@ format_relation = [("0_10", [210], ["0.10.7","0.10"]), ("1_1_6", [217], ["1.1.6","1.1.6fix1","1.1.6fix2","1.1"]), ("1_1_6fix3", [218], ["1.1.6fix3","1.1.6fix4","1.1"]), ("1_2", [220], ["1.2.0","1.2.1","1.2.3","1.2.4","1.2"]), - ("1_3", [221], ["1.3.0","1.3.1","1.3.2","1.3.3","1.3.4","1.3.5","1.3.6","1.3"]), + ("1_3", [221], ["1.3.0","1.3.1","1.3.2","1.3.3","1.3.4","1.3.5","1.3.6","1.3.7","1.3"]), ("1_4", range(222,246), ["1.4.0", "1.4.1", "1.4.2svn"]), - ("1_5", range(246,248), ["1.5.0svn"])] + ("1_5", range(246,249), ["1.5.0svn","1.5"])] def formats_list(): diff --git a/lib/lyx2lyx/lyx_1_5.py b/lib/lyx2lyx/lyx_1_5.py index 1ce73f6610..e27dbc5336 100644 --- a/lib/lyx2lyx/lyx_1_5.py +++ b/lib/lyx2lyx/lyx_1_5.py @@ -1,6 +1,7 @@ # This file is part of lyx2lyx # -*- coding: iso-8859-1 -*- # Copyright (C) 2006 José Matos +# Copyright (C) 2004-2006 Georg Baum # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -16,7 +17,10 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -from parser_tools import find_token_exact, find_tokens, get_value +import re +from parser_tools import find_token, find_token_exact, find_tokens, find_end_of_inset, get_value +from string import replace + ## # Notes: Framed/Shaded @@ -170,16 +174,46 @@ def revert_font_settings(file): file.warning("Ignoring `\\font_osf = true'") +def revert_booktabs(file): +# we just remove the booktabs flag, everything else will become a mess. + re_row = re.compile(r'^$') + re_tspace = re.compile(r'\s+topspace="[^"]+"') + re_bspace = re.compile(r'\s+bottomspace="[^"]+"') + re_ispace = re.compile(r'\s+interlinespace="[^"]+"') + i = 0 + while 1: + i = find_token(file.body, "\\begin_inset Tabular", i) + if i == -1: + return + j = find_end_of_inset(file.body, i + 1) + if j == -1: + file.warning("Malformed LyX file: Could not find end of tabular.") + continue + for k in range(i, j): + if re.search('^$', file.body[k]): + file.warning("Converting 'booktabs' table to normal table.") + file.body[k] = replace(file.body[k], ' booktabs="true"', '') + if re.search(re_row, file.body[k]): + file.warning("Removing extra row space.") + file.body[k] = re_tspace.sub('', file.body[k]) + file.body[k] = re_bspace.sub('', file.body[k]) + file.body[k] = re_ispace.sub('', file.body[k]) + i = i + 1 + + ## # Conversion hub # convert = [[246, []], - [247, [convert_font_settings]]] + [247, [convert_font_settings]], + [248, []]] -revert = [[246, [revert_font_settings]], +revert = [[247, [revert_booktabs]], + [246, [revert_font_settings]], [245, [revert_framed]]] + if __name__ == "__main__": pass diff --git a/src/ChangeLog b/src/ChangeLog index 2329366cac..144f6dde91 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -38,6 +38,10 @@ * MenuBackend.h (clear): new method. +2006-03-14 Georg Baum + + * buffer.C: format up to 246. + 2006-03-13 Martin Vermeer * rowpainter.C (paintChangeBar): fix painting of change bar with @@ -2247,6 +2251,10 @@ * main.C: (main): no longer pass pointers to os::init. +2004-12-06 Georg Baum + + * buffer.C: format up to 239. + 2004-12-06 Alfredo Braunstein * undo.C (textUndoOrRedo): simplify logic, fix a crash @@ -2493,6 +2501,16 @@ * vspace.C: fix off-by-one-error, related to fix #1682 +2004-11-11 Georg Baum + + * buffer.C: format up to 238. + +2004-11-11 Edwin Leuven + + * LaTeXFeatures.C: add booktabs package + * tabular.[Ch] (use_booktabs, setBookTabs, useBookTabs): new members, + use them in several places + 2004-11-11 Jürgen Spitzmüller * lengthcommon.C: a more general fix for bug 1682 diff --git a/src/LaTeXFeatures.C b/src/LaTeXFeatures.C index 419e5ec098..921c15ef78 100644 --- a/src/LaTeXFeatures.C +++ b/src/LaTeXFeatures.C @@ -241,6 +241,7 @@ char const * simplefeatures[] = { "varioref", "prettyref", "float", + "booktabs", "dvipost", "fancybox", "calc", diff --git a/src/buffer.C b/src/buffer.C index 7603751c80..d5e60413b3 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -146,7 +146,7 @@ extern BufferList bufferlist; namespace { -int const LYX_FORMAT = 247; +int const LYX_FORMAT = 248; } // namespace anon diff --git a/src/frontends/controllers/ChangeLog b/src/frontends/controllers/ChangeLog index 1d33d438e1..47ccd4d1da 100644 --- a/src/frontends/controllers/ChangeLog +++ b/src/frontends/controllers/ChangeLog @@ -267,6 +267,10 @@ * ControlTabular.C (initialiseParams): Compute the active cell +2004-11-11 Edwin Leuven + + * ControlTabular.[Ch] (booktabs): new + 2004-11-09 Georg Baum * ControlInclude.C (browse): Use GetExtension() instead of diff --git a/src/frontends/controllers/ControlTabular.C b/src/frontends/controllers/ControlTabular.C index afbd485c50..513833f3fa 100644 --- a/src/frontends/controllers/ControlTabular.C +++ b/src/frontends/controllers/ControlTabular.C @@ -222,6 +222,15 @@ void ControlTabular::valign(ControlTabular::VALIGN v) } +void ControlTabular::booktabs(bool yes) +{ + if (yes) + set(LyXTabular::SET_BOOKTABS); + else + set(LyXTabular::UNSET_BOOKTABS); +} + + void ControlTabular::longTabular(bool yes) { if (yes) diff --git a/src/frontends/controllers/ControlTabular.h b/src/frontends/controllers/ControlTabular.h index fcdc2bb062..86c7f3fa1b 100644 --- a/src/frontends/controllers/ControlTabular.h +++ b/src/frontends/controllers/ControlTabular.h @@ -69,6 +69,8 @@ public: void valign(VALIGN h); + void booktabs(bool yes); + void longTabular(bool yes); private: diff --git a/src/frontends/gtk/GTabular.C b/src/frontends/gtk/GTabular.C index bd1918f388..eb5c1463f9 100644 --- a/src/frontends/gtk/GTabular.C +++ b/src/frontends/gtk/GTabular.C @@ -31,6 +31,10 @@ using std::string; using std::vector; +#ifdef WITH_WARNINGS +#warning Implement booktabs settings +#endif + namespace lyx { namespace frontend { diff --git a/src/frontends/qt3/ChangeLog b/src/frontends/qt3/ChangeLog index 914d5f312c..44a94ad795 100644 --- a/src/frontends/qt3/ChangeLog +++ b/src/frontends/qt3/ChangeLog @@ -697,6 +697,13 @@ * QPrefsDialog.h: include LColor.h to satisfy concept checks. * lcolorcache.h: ditto +2004-11-16 Georg Baum + + * QTabular.C (update_borders): disable vertical rules if using + booktabs + * QTabularDialog.C (booktabs_clicked): add a missing call to + form_->changed() and update the borders + 2004-11-15 Jean-Marc Lasgouttes * QtView.C (hasFocus): new method @@ -704,6 +711,12 @@ * QLPopupMenu.C (populate): remove a Qt/Mac hack to disable some menu entries when the main window does not have focus +2004-11-11 Edwin Leuven + + * QTabular.C (build_dialog, update_contents): handle booktabsCB + * QTabularDialog.[Ch] (booktabs_clicked): new + * ui/QTabularDialogBase.ui (booktabsCB): new checkbox + 2004-11-08 Jean-Marc Lasgouttes * QLToolbar.C (selected): use layoutSelected diff --git a/src/frontends/qt3/QTabular.C b/src/frontends/qt3/QTabular.C index ee63e03338..dbe60bc803 100644 --- a/src/frontends/qt3/QTabular.C +++ b/src/frontends/qt3/QTabular.C @@ -28,6 +28,7 @@ #include #include #include +#include #include "qsetborder.h" using std::string; @@ -60,6 +61,8 @@ void QTabular::build_dialog() bcview().addReadOnly(dialog_->borderSetPB); bcview().addReadOnly(dialog_->borderUnsetPB); bcview().addReadOnly(dialog_->borders); + bcview().addReadOnly(dialog_->booktabsRB); + bcview().addReadOnly(dialog_->borderDefaultRB); bcview().addReadOnly(dialog_->longTabularCB); bcview().addReadOnly(dialog_->headerStatusCB); bcview().addReadOnly(dialog_->headerBorderAboveCB); @@ -76,10 +79,25 @@ void QTabular::build_dialog() bcview().addReadOnly(dialog_->lastfooterBorderBelowCB); bcview().addReadOnly(dialog_->lastfooterNoContentsCB); bcview().addReadOnly(dialog_->newpageCB); + bcview().addReadOnly(dialog_->topspaceED); + bcview().addReadOnly(dialog_->topspaceUnit); + bcview().addReadOnly(dialog_->topspaceCO); + bcview().addReadOnly(dialog_->bottomspaceED); + bcview().addReadOnly(dialog_->bottomspaceUnit); + bcview().addReadOnly(dialog_->bottomspaceCO); + bcview().addReadOnly(dialog_->interlinespaceED); + bcview().addReadOnly(dialog_->interlinespaceUnit); + bcview().addReadOnly(dialog_->interlinespaceCO); // initialize the length validator addCheckedLineEdit(bcview(), dialog_->widthED, dialog_->fixedWidthColLA); + addCheckedLineEdit(bcview(), dialog_->topspaceED, + dialog_->topspaceLA); + addCheckedLineEdit(bcview(), dialog_->bottomspaceED, + dialog_->bottomspaceLA); + addCheckedLineEdit(bcview(), dialog_->interlinespaceED, + dialog_->interlinespaceLA); } @@ -94,10 +112,11 @@ void QTabular::update_borders() LyXTabular const & tabular = controller().tabular(); LyXTabular::idx_type const cell = controller().getActiveCell(); bool const isMulticolumnCell = tabular.isMultiColumn(cell); + bool const useBookTabs = tabular.useBookTabs(); if (!isMulticolumnCell) { - dialog_->borders->setLeftEnabled(true); - dialog_->borders->setRightEnabled(true); + dialog_->borders->setLeftEnabled(!useBookTabs); + dialog_->borders->setRightEnabled(!useBookTabs); dialog_->borders->setTop(tabular.topLine(cell, true)); dialog_->borders->setBottom(tabular.bottomLine(cell, true)); dialog_->borders->setLeft(tabular.leftLine(cell, true)); @@ -109,18 +128,18 @@ void QTabular::update_borders() dialog_->borders->setTop(tabular.topLine(cell)); dialog_->borders->setBottom(tabular.bottomLine(cell)); - // pay attention to left/right lines: they are only allowed - // to set if we are in first/last cell of row or if the left/right - // cell is also a multicolumn. + // pay attention to left/right lines: they are only allowed to set + // if we don't use booktabs and if we are in first/last cell of row + // or if the left/right cell is also a multicolumn. if (tabular.isFirstCellInRow(cell) || tabular.isMultiColumn(cell - 1)) { - dialog_->borders->setLeftEnabled(true); + dialog_->borders->setLeftEnabled(!useBookTabs); dialog_->borders->setLeft(tabular.leftLine(cell)); } else { dialog_->borders->setLeft(false); dialog_->borders->setLeftEnabled(false); } if (tabular.isLastCellInRow(cell) || tabular.isMultiColumn(cell + 1)) { - dialog_->borders->setRightEnabled(true); + dialog_->borders->setRightEnabled(!useBookTabs); dialog_->borders->setRight(tabular.rightLine(cell)); } else { dialog_->borders->setRight(false); @@ -151,6 +170,10 @@ void QTabular::update_contents() dialog_->longTabularCB->setChecked(tabular.isLongTabular()); + dialog_->borderDefaultRB->setChecked(!tabular.useBookTabs()); + + dialog_->booktabsRB->setChecked(tabular.useBookTabs()); + update_borders(); LyXLength pwidth; @@ -232,6 +255,60 @@ void QTabular::update_contents() dialog_->hAlignCB->setEnabled(true); dialog_->vAlignCB->setEnabled(!pwidth.zero()); + if (tabular.row_info[row].top_space.empty() + && !tabular.row_info[row].top_space_default) { + dialog_->topspaceCO->setCurrentItem(0); + } else if (tabular.row_info[row].top_space_default) { + dialog_->topspaceCO->setCurrentItem(1); + } else { + dialog_->topspaceCO->setCurrentItem(2); + lengthToWidgets(dialog_->topspaceED, + dialog_->topspaceUnit, + tabular.row_info[row].top_space.asString(), + default_unit); + } + dialog_->topspaceED->setEnabled(!isReadonly + && (dialog_->topspaceCO->currentItem() == 2)); + dialog_->topspaceUnit->setEnabled(!isReadonly + && (dialog_->topspaceCO->currentItem() == 2)); + dialog_->topspaceCO->setEnabled(!isReadonly); + + if (tabular.row_info[row].bottom_space.empty() + && !tabular.row_info[row].bottom_space_default) { + dialog_->bottomspaceCO->setCurrentItem(0); + } else if (tabular.row_info[row].bottom_space_default) { + dialog_->bottomspaceCO->setCurrentItem(1); + } else { + dialog_->bottomspaceCO->setCurrentItem(2); + lengthToWidgets(dialog_->bottomspaceED, + dialog_->bottomspaceUnit, + tabular.row_info[row].bottom_space.asString(), + default_unit); + } + dialog_->bottomspaceED->setEnabled(!isReadonly + && (dialog_->bottomspaceCO->currentItem() == 2)); + dialog_->bottomspaceUnit->setEnabled(!isReadonly + && (dialog_->bottomspaceCO->currentItem() == 2)); + dialog_->bottomspaceCO->setEnabled(!isReadonly); + + if (tabular.row_info[row].interline_space.empty() + && !tabular.row_info[row].interline_space_default) { + dialog_->interlinespaceCO->setCurrentItem(0); + } else if (tabular.row_info[row].interline_space_default) { + dialog_->interlinespaceCO->setCurrentItem(1); + } else { + dialog_->interlinespaceCO->setCurrentItem(2); + lengthToWidgets(dialog_->interlinespaceED, + dialog_->interlinespaceUnit, + tabular.row_info[row].interline_space.asString(), + default_unit); + } + dialog_->interlinespaceED->setEnabled(!isReadonly + && (dialog_->interlinespaceCO->currentItem() == 2)); + dialog_->interlinespaceUnit->setEnabled(!isReadonly + && (dialog_->interlinespaceCO->currentItem() == 2)); + dialog_->interlinespaceCO->setEnabled(!isReadonly); + if (!tabular.isLongTabular()) { dialog_->headerStatusCB->setChecked(false); dialog_->headerBorderAboveCB->setChecked(false); @@ -369,6 +446,48 @@ void QTabular::closeGUI() else controller().set(LyXTabular::SET_PWIDTH, width); } + + switch (dialog_->topspaceCO->currentItem()) { + case 0: + controller().set(LyXTabular::SET_TOP_SPACE, ""); + break; + case 1: + controller().set(LyXTabular::SET_TOP_SPACE, "default"); + break; + case 2: + controller().set(LyXTabular::SET_TOP_SPACE, + widgetsToLength(dialog_->topspaceED, + dialog_->topspaceUnit)); + break; + } + + switch (dialog_->bottomspaceCO->currentItem()) { + case 0: + controller().set(LyXTabular::SET_BOTTOM_SPACE, ""); + break; + case 1: + controller().set(LyXTabular::SET_BOTTOM_SPACE, "default"); + break; + case 2: + controller().set(LyXTabular::SET_BOTTOM_SPACE, + widgetsToLength(dialog_->bottomspaceED, + dialog_->bottomspaceUnit)); + break; + } + + switch (dialog_->interlinespaceCO->currentItem()) { + case 0: + controller().set(LyXTabular::SET_INTERLINE_SPACE, ""); + break; + case 1: + controller().set(LyXTabular::SET_INTERLINE_SPACE, "default"); + break; + case 2: + controller().set(LyXTabular::SET_INTERLINE_SPACE, + widgetsToLength(dialog_->interlinespaceED, + dialog_->interlinespaceUnit)); + break; + } } } // namespace frontend diff --git a/src/frontends/qt3/QTabularDialog.C b/src/frontends/qt3/QTabularDialog.C index b1fafff8bb..bed77295a8 100644 --- a/src/frontends/qt3/QTabularDialog.C +++ b/src/frontends/qt3/QTabularDialog.C @@ -14,13 +14,16 @@ #include "QTabularDialog.h" #include "QTabular.h" +#include "lengthcombo.h" #include "validators.h" #include "qt_helpers.h" +#include "controllers/ButtonController.h" #include "controllers/ControlTabular.h" #include #include +#include #include using std::string; @@ -37,6 +40,9 @@ QTabularDialog::QTabularDialog(QTabular * form) form, SLOT(slotClose())); widthED->setValidator(unsignedLengthValidator(widthED)); + topspaceED->setValidator(new LengthValidator(topspaceED)); + bottomspaceED->setValidator(new LengthValidator(bottomspaceED)); + interlinespaceED->setValidator(new LengthValidator(interlinespaceED)); } @@ -119,6 +125,96 @@ void QTabularDialog::width_changed() } +void QTabularDialog::topspace_changed() +{ + switch(topspaceCO->currentItem()) { + case 0: { + form_->controller().set(LyXTabular::SET_TOP_SPACE, ""); + topspaceED->setEnabled(false); + topspaceUnit->setEnabled(false); + break; + } + case 1: { + form_->controller().set(LyXTabular::SET_TOP_SPACE, "default"); + topspaceED->setEnabled(false); + topspaceUnit->setEnabled(false); + break; + } + case 2: { + if (!topspaceED->text().isEmpty()) + form_->controller().set(LyXTabular::SET_TOP_SPACE, + widgetsToLength(topspaceED, topspaceUnit)); + if (!form_->bc().bp().isReadOnly()) { + topspaceED->setEnabled(true); + topspaceUnit->setEnabled(true); + } + break; + } + } + form_->changed(); +} + + +void QTabularDialog::bottomspace_changed() +{ + switch(bottomspaceCO->currentItem()) { + case 0: { + form_->controller().set(LyXTabular::SET_BOTTOM_SPACE, ""); + bottomspaceED->setEnabled(false); + bottomspaceUnit->setEnabled(false); + break; + } + case 1: { + form_->controller().set(LyXTabular::SET_BOTTOM_SPACE, "default"); + bottomspaceED->setEnabled(false); + bottomspaceUnit->setEnabled(false); + break; + } + case 2: { + if (!bottomspaceED->text().isEmpty()) + form_->controller().set(LyXTabular::SET_BOTTOM_SPACE, + widgetsToLength(bottomspaceED, bottomspaceUnit)); + if (!form_->bc().bp().isReadOnly()) { + bottomspaceED->setEnabled(true); + bottomspaceUnit->setEnabled(true); + } + break; + } + } + form_->changed(); +} + + +void QTabularDialog::interlinespace_changed() +{ + switch(interlinespaceCO->currentItem()) { + case 0: { + form_->controller().set(LyXTabular::SET_INTERLINE_SPACE, ""); + interlinespaceED->setEnabled(false); + interlinespaceUnit->setEnabled(false); + break; + } + case 1: { + form_->controller().set(LyXTabular::SET_INTERLINE_SPACE, "default"); + interlinespaceED->setEnabled(false); + interlinespaceUnit->setEnabled(false); + break; + } + case 2: { + if (!interlinespaceED->text().isEmpty()) + form_->controller().set(LyXTabular::SET_INTERLINE_SPACE, + widgetsToLength(interlinespaceED, interlinespaceUnit)); + if (!form_->bc().bp().isReadOnly()) { + interlinespaceED->setEnabled(true); + interlinespaceUnit->setEnabled(true); + } + break; + } + } + form_->changed(); +} + + void QTabularDialog::multicolumn_clicked() { form_->controller().toggleMultiColumn(); @@ -344,5 +440,16 @@ void QTabularDialog::ltLastFooterEmpty_clicked() form_->changed(); } + +void QTabularDialog::booktabs_clicked() +{ + if (booktabsRB->isChecked()) + form_->controller().set(LyXTabular::SET_BOOKTABS); + else + form_->controller().set(LyXTabular::UNSET_BOOKTABS); + form_->update_borders(); + form_->changed(); +} + } // namespace frontend } // namespace lyx diff --git a/src/frontends/qt3/QTabularDialog.h b/src/frontends/qt3/QTabularDialog.h index ede823f2fb..13a5eb23cc 100644 --- a/src/frontends/qt3/QTabularDialog.h +++ b/src/frontends/qt3/QTabularDialog.h @@ -43,6 +43,9 @@ protected slots: virtual void vAlign_changed(int align); virtual void specialAlignment_changed(); virtual void width_changed(); + virtual void topspace_changed(); + virtual void bottomspace_changed(); + virtual void interlinespace_changed(); virtual void longTabular(); virtual void ltNewpage_clicked(); virtual void ltHeaderStatus_clicked(); @@ -59,6 +62,7 @@ protected slots: virtual void ltLastFooterBorderAbove_clicked(); virtual void ltLastFooterBorderBelow_clicked(); virtual void ltLastFooterEmpty_clicked(); + virtual void booktabs_clicked(); protected: virtual void closeEvent(QCloseEvent * e); diff --git a/src/frontends/qt3/ui/QTabularDialogBase.ui b/src/frontends/qt3/ui/QTabularDialogBase.ui index cc607d8f9e..84adcd7732 100644 --- a/src/frontends/qt3/ui/QTabularDialogBase.ui +++ b/src/frontends/qt3/ui/QTabularDialogBase.ui @@ -18,7 +18,7 @@ true - + unnamed @@ -28,7 +28,117 @@ 6 - + + + Layout2 + + + + unnamed + + + 0 + + + 6 + + + + TextLabel1 + + + Current cell: + + + + + tabularRowED + + + + 1 + 0 + 0 + 0 + + + + + 40 + 32767 + + + + NoFocus + + + Current row position + + + + + tabularColumnED + + + + 1 + 0 + 0 + 0 + + + + + 40 + 32767 + + + + NoFocus + + + Current column position + + + + + Spacer1 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + closePB + + + + 1 + 0 + 0 + 0 + + + + Close + + + false + + + + + TabWidget @@ -97,7 +207,7 @@ Horizontal alignment in column - + rotateTabularCB @@ -107,22 +217,28 @@ &Rotate table 90 degrees + + Alt+R + Rotate the table by 90 degrees - + rotateCellCB Rotate &cell 90 degrees + + Alt+C + Rotate this cell by 90 degrees - + specialAlignmentLA @@ -133,7 +249,7 @@ specialAlignmentED - + specialAlignmentED @@ -141,7 +257,7 @@ Custom column format (LaTeX) - + Spacer5 @@ -297,430 +413,706 @@ unnamed - - 11 - - - 6 - - + - setBordersGB + spacer7 - - Set Borders + + Vertical + + + Expanding + + + + 31 + 50 + + + + + + layout3 unnamed - - 11 - - - 6 - - + - bordersF + layout2 - - - 5 - 5 - 0 - 0 - + + + unnamed + + + + setBordersGB + + + Set Borders + + + + unnamed + + + 11 + + + 6 + + + + bordersF + + + + 5 + 5 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + 230 + 240 + 249 + + + 255 + 255 + 255 + + + 242 + 247 + 252 + + + 115 + 120 + 124 + + + 154 + 160 + 166 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 16 + 145 + 210 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + + 128 + 128 + 128 + + + 230 + 240 + 249 + + + 255 + 255 + 255 + + + 255 + 255 + 255 + + + 115 + 120 + 124 + + + 154 + 160 + 166 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 128 + 128 + 128 + + + 255 + 255 + 255 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 16 + 145 + 210 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + + 0 + 0 + 0 + + + 230 + 240 + 249 + + + 255 + 255 + 255 + + + 255 + 255 + 255 + + + 115 + 120 + 124 + + + 154 + 160 + 166 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 16 + 145 + 210 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + + + StyledPanel + + + Sunken + + + + + + unnamed + + + 3 + + + 6 + + + + borders + + + + 1 + 1 + 0 + 0 + + + + Set borders of the current (selected) cell(s) + + + + + + + + + allBordersGB + + + All Borders + + + + unnamed + + + 11 + + + 6 + + + + borderSetPB + + + &Set + + + Set all borders of the current (selected) cell(s) + + + + + borderUnsetPB + + + C&lear + + + Unset all borders of the current (selected) cell(s) + + + + + + + + + borderStyleBG - - - - - 0 - 0 - 0 - - - 230 - 240 - 249 - - - 255 - 255 - 255 - - - 242 - 247 - 252 - - - 115 - 120 - 124 - - - 154 - 160 - 166 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 255 - 255 - 255 - - - 0 - 0 - 0 - - - 16 - 145 - 210 - - - 255 - 255 - 255 - - - 0 - 0 - 0 - - - 0 - 0 - 0 - - - - - 128 - 128 - 128 - - - 230 - 240 - 249 - - - 255 - 255 - 255 - - - 255 - 255 - 255 - - - 115 - 120 - 124 - - - 154 - 160 - 166 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 128 - 128 - 128 - - - 255 - 255 - 255 - - - 255 - 255 - 255 - - - 0 - 0 - 0 - - - 16 - 145 - 210 - - - 255 - 255 - 255 - - - 0 - 0 - 0 - - - 0 - 0 - 0 - - - - - 0 - 0 - 0 - - - 230 - 240 - 249 - - - 255 - 255 - 255 - - - 255 - 255 - 255 - - - 115 - 120 - 124 - - - 154 - 160 - 166 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 255 - 255 - 255 - - - 0 - 0 - 0 - - - 16 - 145 - 210 - - - 255 - 255 - 255 - - - 0 - 0 - 0 - - - 0 - 0 - 0 - - - - - - StyledPanel - - - Sunken - - + + Style unnamed - - 3 - - - 6 - - + + + booktabsRB + + + Fo&rmal + + + Alt+R + + + Use formal (a.k.a. booktabs) border style (no vertical borders) + + + - borders + borderDefaultRB - - - 1 - 1 - 0 - 0 - + + De&fault + + + Alt+F - Set borders of the current (selected) cell(s) + Use default (grid-like) border style - - - - - allBordersGB - - - All Borders - - - - unnamed - - - 11 - - - 6 - - + - borderSetPB + spacer8 - - &Set + + Vertical - - Set all borders of the current (selected) cell(s) + + Expanding - - + + + 21 + 30 + + + + - borderUnsetPB + spacesGB - - C&lear + + + 3 + 3 + 0 + 0 + - - Unset all borders of the current (selected) cell(s) + + Additional Space - - - - - - Spacer6 - - - Horizontal - - - Expanding - - - - 20 - 20 - - - - - - Spacer7 - - - Vertical - - - Expanding - - - - 20 - 20 - - - - - - - - tab - - - &Longtable - - - - unnamed - - - 11 - - - 6 - - - - longTabularCB - - - &Use long table - + + + unnamed + + + + topspaceUnit + + + true + + + + 50 + 0 + + + + StrongFocus + + + + + bottomspaceUnit + + + true + + + + 50 + 0 + + + + StrongFocus + + + + + interlinespaceUnit + + + true + + + + 50 + 0 + + + + StrongFocus + + + + + interlinespaceED + + + true + + + + + + + + + + bottomspaceED + + + true + + + + + + + + + + topspaceED + + + true + + + + + + + + + + + None + + + + + Default + + + + + Custom + + + + topspaceCO + + + + + + None + + + + + Default + + + + + Custom + + + + bottomspaceCO + + + + + + None + + + + + Default + + + + + Custom + + + + interlinespaceCO + + + + + topspaceLA + + + T&op of row: + + + topspaceED + + + + + bottomspaceLA + + + Botto&m of row: + + + bottomspaceED + + + + + interlinespaceLA + + + Bet&ween rows: + + + interlinespaceED + + + + + + + spacer9 + + + Horizontal + + + Expanding + + + + 171 + 31 + + + + + + + + + + tab + + + &Longtable + + + + unnamed + + + 11 + + + 6 + + + + longTabularCB + + + &Use long table + Select for tables that span multiple pages @@ -964,117 +1356,7 @@ - - - Layout2 - - - - unnamed - - - 0 - - - 6 - - - - TextLabel1 - - - Current cell: - - - - - tabularRowED - - - - 1 - 0 - 0 - 0 - - - - - 40 - 32767 - - - - NoFocus - - - Current row position - - - - - tabularColumnED - - - - 1 - 0 - 0 - 0 - - - - - 40 - 32767 - - - - NoFocus - - - Current column position - - - - - Spacer1 - - - Horizontal - - - Expanding - - - - 20 - 20 - - - - - - closePB - - - - 1 - 0 - 0 - 0 - - - - Close - - - false - - - - - + @@ -1122,27 +1404,15 @@ - 89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000000c749444154388dad55db1184200c4c180bb81a28c73aad811228c356f42b3792db3cc0db2fc724bb7901dc7b270f27ed17fa5fa9b117b7cd90211f4ba0ac906a7f1453b4d30ca917bb590681552af23f69bfc4ffa71519d2c8f62546ea5ea03738b1c18c33a4d156f0d13f43b61952e4af6d6e8fb3a408f080448419a433d6486d85052fdba892a295f5d45785cd8c51a9d6de6a814a8d2131da51f98e7a3b64ec9da04a8db53d43be3c3c0b22cacf17e4cdb5a931649ceddf34b190cf0aa019f03f1fd3e7457f03b5a66c9ed26e86130000000049454e44ae426082 + 89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000000c749444154388dad55db1184200c4c180bb005eab1cd6b8112b40d4bf1bee2486ef3006fbf1c93ece605f07eece4e1a4ed42ff2b35f6e2961132e46309941952ed8f628a761a21f56217cb20b04a45fe276d97f8ffb422431ad96e62a4ee057a83131bcc38431a6d057f8eb5cb36438afcb5cded719614011e9088308374c61aa9adb0e0651b5552b4b29efaacb099312ad5da5b2d50a93124463b2adf516fbb8cbd1354a9b1b667c8a787674144f9f982bcb93635ba8cb3fd1b2616f251013403fee763fabce8bff0aa6c98500331e50000000049454e44ae426082 - borderSetPB - clicked() - QTabularDialogBase - borderSet_clicked() - - - borderUnsetPB + closePB clicked() QTabularDialogBase - borderUnset_clicked() - - - longTabularCB - toggled(bool) - longtableGB - setEnabled(bool) + close_clicked() longTabularCB @@ -1150,24 +1420,6 @@ newpageCB setEnabled(bool) - - hAlignCB - activated(int) - QTabularDialogBase - hAlign_changed(int) - - - vAlignCB - activated(int) - QTabularDialogBase - vAlign_changed(int) - - - multicolumnCB - clicked() - QTabularDialogBase - multicolumn_clicked() - newpageCB clicked() @@ -1175,16 +1427,16 @@ ltNewpage_clicked() - headerStatusCB + firstheaderNoContentsCB clicked() QTabularDialogBase - ltHeaderStatus_clicked() + ltFirstHeaderEmpty_clicked() - headerBorderAboveCB + lastfooterNoContentsCB clicked() QTabularDialogBase - ltHeaderBorderAbove_clicked() + ltLastFooterEmpty_clicked() headerBorderBelowCB @@ -1193,46 +1445,46 @@ ltHeaderBorderBelow_clicked() - firstheaderStatusCB + firstheaderBorderBelowCB clicked() QTabularDialogBase - ltFirstHeaderStatus_clicked() + ltFirstHeaderBorderBelow_clicked() - firstheaderBorderAboveCB + footerBorderBelowCB clicked() QTabularDialogBase - ltFirstHeaderBorderAbove_clicked() + ltFooterBorderBelow_clicked() - firstheaderBorderBelowCB + lastfooterBorderBelowCB clicked() QTabularDialogBase - ltFirstHeaderBorderBelow_clicked() + ltLastFooterBorderBelow_clicked() - firstheaderNoContentsCB + lastfooterBorderAboveCB clicked() QTabularDialogBase - ltFirstHeaderEmpty_clicked() + ltLastFooterBorderAbove_clicked() - footerStatusCB + footerBorderAboveCB clicked() QTabularDialogBase - ltFooterStatus_clicked() + ltFooterBorderAbove_clicked() - footerBorderAboveCB + firstheaderBorderAboveCB clicked() QTabularDialogBase - ltFooterBorderAbove_clicked() + ltFirstHeaderBorderAbove_clicked() - footerBorderBelowCB + headerBorderAboveCB clicked() QTabularDialogBase - ltFooterBorderBelow_clicked() + ltHeaderBorderAbove_clicked() lastfooterStatusCB @@ -1241,46 +1493,46 @@ ltLastFooterStatus_clicked() - lastfooterBorderAboveCB + footerStatusCB clicked() QTabularDialogBase - ltLastFooterBorderAbove_clicked() + ltFooterStatus_clicked() - lastfooterBorderBelowCB + firstheaderStatusCB clicked() QTabularDialogBase - ltLastFooterBorderBelow_clicked() + ltFirstHeaderStatus_clicked() - lastfooterNoContentsCB + headerStatusCB clicked() QTabularDialogBase - ltLastFooterEmpty_clicked() + ltHeaderStatus_clicked() - specialAlignmentED - returnPressed() - QTabularDialogBase - specialAlignment_changed() + longTabularCB + toggled(bool) + longtableGB + setEnabled(bool) - widthED - returnPressed() + longTabularCB + clicked() QTabularDialogBase - width_changed() + longTabular() - widthUnit - selectionChanged(LyXLength::UNIT) + borderUnsetPB + clicked() QTabularDialogBase - width_changed() + borderUnset_clicked() - closePB + borderSetPB clicked() QTabularDialogBase - close_clicked() + borderSet_clicked() borders @@ -1307,10 +1559,34 @@ leftBorder_changed() - rotateTabularCB + vAlignCB + activated(int) + QTabularDialogBase + vAlign_changed(int) + + + widthED + returnPressed() + QTabularDialogBase + width_changed() + + + widthUnit + selectionChanged(LyXLength::UNIT) + QTabularDialogBase + width_changed() + + + multicolumnCB clicked() QTabularDialogBase - rotateTabular() + multicolumn_clicked() + + + specialAlignmentED + returnPressed() + QTabularDialogBase + specialAlignment_changed() rotateCellCB @@ -1319,10 +1595,82 @@ rotateCell() - longTabularCB + rotateTabularCB clicked() QTabularDialogBase - longTabular() + rotateTabular() + + + hAlignCB + activated(int) + QTabularDialogBase + hAlign_changed(int) + + + topspaceCO + activated(int) + QTabularDialogBase + topspace_changed() + + + bottomspaceCO + activated(int) + QTabularDialogBase + bottomspace_changed() + + + interlinespaceCO + activated(int) + QTabularDialogBase + interlinespace_changed() + + + topspaceED + returnPressed() + QTabularDialogBase + topspace_changed() + + + bottomspaceED + returnPressed() + QTabularDialogBase + bottomspace_changed() + + + interlinespaceED + returnPressed() + QTabularDialogBase + interlinespace_changed() + + + topspaceUnit + selectionChanged(LyXLength::UNIT) + QTabularDialogBase + topspace_changed() + + + bottomspaceUnit + selectionChanged(LyXLength::UNIT) + QTabularDialogBase + bottomspace_changed() + + + interlinespaceUnit + selectionChanged(LyXLength::UNIT) + QTabularDialogBase + interlinespace_changed() + + + booktabsRB + clicked() + QTabularDialogBase + booktabs_clicked() + + + borderDefaultRB + clicked() + QTabularDialogBase + booktabs_clicked() @@ -1335,8 +1683,20 @@ rotateTabularCB rotateCellCB specialAlignmentED + closePB borderSetPB borderUnsetPB + borderDefaultRB + booktabsRB + topspaceCO + bottomspaceCO + interlinespaceCO + topspaceED + bottomspaceED + interlinespaceED + topspaceUnit + bottomspaceUnit + interlinespaceUnit longTabularCB headerStatusCB headerBorderAboveCB @@ -1353,13 +1713,13 @@ lastfooterBorderBelowCB lastfooterNoContentsCB newpageCB - closePB config.h qt_helpers.h + booktabs_clicked() borderSet_clicked() borderUnset_clicked() bottomBorder_changed() @@ -1391,10 +1751,16 @@ topBorder_changed() vAlign_changed(int) width_changed() + topspace_changed() + bottomspace_changed() + interlinespace_changed() lengthcombo.h qsetborder.h + lengthcombo.h + lengthcombo.h + lengthcombo.h diff --git a/src/frontends/qt4/QTabular.C b/src/frontends/qt4/QTabular.C index e8a03e32ba..04d5a83e60 100644 --- a/src/frontends/qt4/QTabular.C +++ b/src/frontends/qt4/QTabular.C @@ -28,6 +28,7 @@ #include #include #include +#include #include "qsetborder.h" using std::string; @@ -49,6 +50,18 @@ void QTabular::build_dialog() bcview().setCancel(dialog_->closePB); + bcview().addReadOnly(dialog_->topspaceED); + bcview().addReadOnly(dialog_->topspaceUnit); + bcview().addReadOnly(dialog_->topspaceCO); + bcview().addReadOnly(dialog_->bottomspaceED); + bcview().addReadOnly(dialog_->bottomspaceUnit); + bcview().addReadOnly(dialog_->bottomspaceCO); + bcview().addReadOnly(dialog_->interlinespaceED); + bcview().addReadOnly(dialog_->interlinespaceUnit); + bcview().addReadOnly(dialog_->interlinespaceCO); + bcview().addReadOnly(dialog_->borderDefaultRB); + bcview().addReadOnly(dialog_->booktabsRB); + bcview().addReadOnly(dialog_->multicolumnCB); bcview().addReadOnly(dialog_->rotateCellCB); bcview().addReadOnly(dialog_->rotateTabularCB); @@ -80,6 +93,12 @@ void QTabular::build_dialog() // initialize the length validator addCheckedLineEdit(bcview(), dialog_->widthED, dialog_->fixedWidthColLA); + addCheckedLineEdit(bcview(), dialog_->topspaceED, + dialog_->topspaceLA); + addCheckedLineEdit(bcview(), dialog_->bottomspaceED, + dialog_->bottomspaceLA); + addCheckedLineEdit(bcview(), dialog_->interlinespaceED, + dialog_->interlinespaceLA); } @@ -171,6 +190,63 @@ void QTabular::update_contents() LyXLength::UNIT default_unit = controller().useMetricUnits() ? LyXLength::CM : LyXLength::IN; + dialog_->borderDefaultRB->setChecked(!tabular.useBookTabs()); + dialog_->booktabsRB->setChecked(tabular.useBookTabs()); + + if (tabular.row_info[row].top_space.empty() + && !tabular.row_info[row].top_space_default) { + dialog_->topspaceCO->setCurrentItem(0); + } else if (tabular.row_info[row].top_space_default) { + dialog_->topspaceCO->setCurrentItem(1); + } else { + dialog_->topspaceCO->setCurrentItem(2); + lengthToWidgets(dialog_->topspaceED, + dialog_->topspaceUnit, + tabular.row_info[row].top_space.asString(), + default_unit); + } + dialog_->topspaceED->setEnabled(!isReadonly + && (dialog_->topspaceCO->currentItem() == 2)); + dialog_->topspaceUnit->setEnabled(!isReadonly + && (dialog_->topspaceCO->currentItem() == 2)); + dialog_->topspaceCO->setEnabled(!isReadonly); + + if (tabular.row_info[row].bottom_space.empty() + && !tabular.row_info[row].bottom_space_default) { + dialog_->bottomspaceCO->setCurrentItem(0); + } else if (tabular.row_info[row].bottom_space_default) { + dialog_->bottomspaceCO->setCurrentItem(1); + } else { + dialog_->bottomspaceCO->setCurrentItem(2); + lengthToWidgets(dialog_->bottomspaceED, + dialog_->bottomspaceUnit, + tabular.row_info[row].bottom_space.asString(), + default_unit); + } + dialog_->bottomspaceED->setEnabled(!isReadonly + && (dialog_->bottomspaceCO->currentItem() == 2)); + dialog_->bottomspaceUnit->setEnabled(!isReadonly + && (dialog_->bottomspaceCO->currentItem() == 2)); + dialog_->bottomspaceCO->setEnabled(!isReadonly); + + if (tabular.row_info[row].interline_space.empty() + && !tabular.row_info[row].interline_space_default) { + dialog_->interlinespaceCO->setCurrentItem(0); + } else if (tabular.row_info[row].interline_space_default) { + dialog_->interlinespaceCO->setCurrentItem(1); + } else { + dialog_->interlinespaceCO->setCurrentItem(2); + lengthToWidgets(dialog_->interlinespaceED, + dialog_->interlinespaceUnit, + tabular.row_info[row].interline_space.asString(), + default_unit); + } + dialog_->interlinespaceED->setEnabled(!isReadonly + && (dialog_->interlinespaceCO->currentItem() == 2)); + dialog_->interlinespaceUnit->setEnabled(!isReadonly + && (dialog_->interlinespaceCO->currentItem() == 2)); + dialog_->interlinespaceCO->setEnabled(!isReadonly); + string colwidth; if (!pwidth.zero()) colwidth = pwidth.asString(); @@ -369,6 +445,50 @@ void QTabular::closeGUI() else controller().set(LyXTabular::SET_PWIDTH, width); } + + /* DO WE NEED THIS? + switch (dialog_->topspaceCO->currentItem()) { + case 0: + controller().set(LyXTabular::SET_TOP_SPACE, ""); + break; + case 1: + controller().set(LyXTabular::SET_TOP_SPACE, "default"); + break; + case 2: + controller().set(LyXTabular::SET_TOP_SPACE, + widgetsToLength(dialog_->topspaceED, + dialog_->topspaceUnit)); + break; + } + + switch (dialog_->bottomspaceCO->currentItem()) { + case 0: + controller().set(LyXTabular::SET_BOTTOM_SPACE, ""); + break; + case 1: + controller().set(LyXTabular::SET_BOTTOM_SPACE, "default"); + break; + case 2: + controller().set(LyXTabular::SET_BOTTOM_SPACE, + widgetsToLength(dialog_->bottomspaceED, + dialog_->bottomspaceUnit)); + break; + } + + switch (dialog_->interlinespaceCO->currentItem()) { + case 0: + controller().set(LyXTabular::SET_INTERLINE_SPACE, ""); + break; + case 1: + controller().set(LyXTabular::SET_INTERLINE_SPACE, "default"); + break; + case 2: + controller().set(LyXTabular::SET_INTERLINE_SPACE, + widgetsToLength(dialog_->interlinespaceED, + dialog_->interlinespaceUnit)); + break; + } +*/ } } // namespace frontend diff --git a/src/frontends/qt4/QTabularDialog.C b/src/frontends/qt4/QTabularDialog.C index ecadd4763b..4fbc00fade 100644 --- a/src/frontends/qt4/QTabularDialog.C +++ b/src/frontends/qt4/QTabularDialog.C @@ -17,11 +17,13 @@ #include "validators.h" #include "qt_helpers.h" +#include "controllers/ButtonController.h" #include "controllers/ControlTabular.h" #include #include #include +#include #include using std::string; @@ -36,40 +38,59 @@ QTabularDialog::QTabularDialog(QTabular * form) setupUi(this); widthED->setValidator(unsignedLengthValidator(widthED)); - - connect( borderSetPB, SIGNAL( clicked() ), this, SLOT( borderSet_clicked() ) ); - connect( borderUnsetPB, SIGNAL( clicked() ), this, SLOT( borderUnset_clicked() ) ); - connect( longTabularCB, SIGNAL( toggled(bool) ), longtableGB, SLOT( setEnabled(bool) ) ); - connect( longTabularCB, SIGNAL( toggled(bool) ), newpageCB, SLOT( setEnabled(bool) ) ); - connect( hAlignCB, SIGNAL( activated(int) ), this, SLOT( hAlign_changed(int) ) ); - connect( vAlignCB, SIGNAL( activated(int) ), this, SLOT( vAlign_changed(int) ) ); - connect( multicolumnCB, SIGNAL( clicked() ), this, SLOT( multicolumn_clicked() ) ); - connect( newpageCB, SIGNAL( clicked() ), this, SLOT( ltNewpage_clicked() ) ); - connect( headerStatusCB, SIGNAL( clicked() ), this, SLOT( ltHeaderStatus_clicked() ) ); - connect( headerBorderAboveCB, SIGNAL( clicked() ), this, SLOT( ltHeaderBorderAbove_clicked() ) ); - connect( headerBorderBelowCB, SIGNAL( clicked() ), this, SLOT( ltHeaderBorderBelow_clicked() ) ); - connect( firstheaderStatusCB, SIGNAL( clicked() ), this, SLOT( ltFirstHeaderStatus_clicked() ) ); - connect( firstheaderBorderAboveCB, SIGNAL( clicked() ), this, SLOT( ltFirstHeaderBorderAbove_clicked() ) ); - connect( firstheaderBorderBelowCB, SIGNAL( clicked() ), this, SLOT( ltFirstHeaderBorderBelow_clicked() ) ); - connect( firstheaderNoContentsCB, SIGNAL( clicked() ), this, SLOT( ltFirstHeaderEmpty_clicked() ) ); - connect( footerStatusCB, SIGNAL( clicked() ), this, SLOT( ltFooterStatus_clicked() ) ); - connect( footerBorderAboveCB, SIGNAL( clicked() ), this, SLOT( ltFooterBorderAbove_clicked() ) ); - connect( footerBorderBelowCB, SIGNAL( clicked() ), this, SLOT( ltFooterBorderBelow_clicked() ) ); - connect( lastfooterStatusCB, SIGNAL( clicked() ), this, SLOT( ltLastFooterStatus_clicked() ) ); - connect( lastfooterBorderAboveCB, SIGNAL( clicked() ), this, SLOT( ltLastFooterBorderAbove_clicked() ) ); - connect( lastfooterBorderBelowCB, SIGNAL( clicked() ), this, SLOT( ltLastFooterBorderBelow_clicked() ) ); - connect( lastfooterNoContentsCB, SIGNAL( clicked() ), this, SLOT( ltLastFooterEmpty_clicked() ) ); - connect( specialAlignmentED, SIGNAL( returnPressed() ), this, SLOT( specialAlignment_changed() ) ); - connect( widthED, SIGNAL( returnPressed() ), this, SLOT( width_changed() ) ); - connect( widthUnit, SIGNAL( selectionChanged(LyXLength::UNIT) ), this, SLOT( width_changed() ) ); - connect( closePB, SIGNAL( clicked() ), this, SLOT( close_clicked() ) ); - connect( borders, SIGNAL( topSet(bool) ), this, SLOT( topBorder_changed() ) ); - connect( borders, SIGNAL( bottomSet(bool) ), this, SLOT( bottomBorder_changed() ) ); - connect( borders, SIGNAL( rightSet(bool) ), this, SLOT( rightBorder_changed() ) ); - connect( borders, SIGNAL( leftSet(bool) ), this, SLOT( leftBorder_changed() ) ); - connect( rotateTabularCB, SIGNAL( clicked() ), this, SLOT( rotateTabular() ) ); - connect( rotateCellCB, SIGNAL( clicked() ), this, SLOT( rotateCell() ) ); - connect( longTabularCB, SIGNAL( clicked() ), this, SLOT( longTabular() ) ); + topspaceED->setValidator(new LengthValidator(topspaceED)); + bottomspaceED->setValidator(new LengthValidator(bottomspaceED)); + interlinespaceED->setValidator(new LengthValidator(interlinespaceED)); + + connect(topspaceED, SIGNAL(returnPressed()), + this, SLOT(topspace_changed())); + connect(topspaceUnit, SIGNAL(selectionChanged(LyXLength::UNIT)), + this, SLOT(topspace_changed())); + connect(topspaceCO, SIGNAL(activated(int)), this, SLOT(topspace_changed())); + connect(bottomspaceED, SIGNAL(returnPressed()), + this, SLOT(bottomspace_changed())); + connect(bottomspaceUnit, SIGNAL(selectionChanged(LyXLength::UNIT)), + this, SLOT(bottomspace_changed())); + connect(bottomspaceCO, SIGNAL(activated(int)), this, SLOT(bottomspace_changed())); + connect(interlinespaceED, SIGNAL(returnPressed()), + this, SLOT(interlinespace_changed())); + connect(interlinespaceUnit, SIGNAL(selectionChanged(LyXLength::UNIT)), + this, SLOT(interlinespace_changed())); + connect(interlinespaceCO, SIGNAL(activated(int)), this, SLOT(interlinespace_changed())); + connect(booktabsRB, SIGNAL(clicked()), this, SLOT(on_booktabsRB_toggled())); + connect(borderSetPB, SIGNAL(clicked()), this, SLOT(borderSet_clicked())); + connect(borderUnsetPB, SIGNAL(clicked()), this, SLOT(borderUnset_clicked())); + connect(longTabularCB, SIGNAL(toggled(bool)), longtableGB, SLOT(setEnabled(bool))); + connect(longTabularCB, SIGNAL(toggled(bool)), newpageCB, SLOT(setEnabled(bool))); + connect(hAlignCB, SIGNAL(activated(int)), this, SLOT(hAlign_changed(int))); + connect(vAlignCB, SIGNAL(activated(int)), this, SLOT(vAlign_changed(int))); + connect(multicolumnCB, SIGNAL(clicked()), this, SLOT(multicolumn_clicked())); + connect(newpageCB, SIGNAL(clicked()), this, SLOT(ltNewpage_clicked())); + connect(headerStatusCB, SIGNAL(clicked()), this, SLOT(ltHeaderStatus_clicked())); + connect(headerBorderAboveCB, SIGNAL(clicked()), this, SLOT(ltHeaderBorderAbove_clicked())); + connect(headerBorderBelowCB, SIGNAL(clicked()), this, SLOT(ltHeaderBorderBelow_clicked())); + connect(firstheaderStatusCB, SIGNAL(clicked()), this, SLOT(ltFirstHeaderStatus_clicked())); + connect(firstheaderBorderAboveCB, SIGNAL(clicked()), this, SLOT(ltFirstHeaderBorderAbove_clicked())); + connect(firstheaderBorderBelowCB, SIGNAL(clicked()), this, SLOT(ltFirstHeaderBorderBelow_clicked())); + connect(firstheaderNoContentsCB, SIGNAL(clicked()), this, SLOT(ltFirstHeaderEmpty_clicked())); + connect(footerStatusCB, SIGNAL(clicked()), this, SLOT(ltFooterStatus_clicked())); + connect(footerBorderAboveCB, SIGNAL(clicked()), this, SLOT(ltFooterBorderAbove_clicked())); + connect(footerBorderBelowCB, SIGNAL(clicked()), this, SLOT(ltFooterBorderBelow_clicked())); + connect(lastfooterStatusCB, SIGNAL(clicked()), this, SLOT(ltLastFooterStatus_clicked())); + connect(lastfooterBorderAboveCB, SIGNAL(clicked()), this, SLOT(ltLastFooterBorderAbove_clicked())); + connect(lastfooterBorderBelowCB, SIGNAL(clicked()), this, SLOT(ltLastFooterBorderBelow_clicked())); + connect(lastfooterNoContentsCB, SIGNAL(clicked()), this, SLOT(ltLastFooterEmpty_clicked())); + connect(specialAlignmentED, SIGNAL(returnPressed()), this, SLOT(specialAlignment_changed())); + connect(widthED, SIGNAL(returnPressed()), this, SLOT(width_changed())); + connect(widthUnit, SIGNAL(selectionChanged(LyXLength::UNIT)), this, SLOT(width_changed())); + connect(closePB, SIGNAL(clicked()), this, SLOT(close_clicked())); + connect(borders, SIGNAL(topSet(bool)), this, SLOT(topBorder_changed())); + connect(borders, SIGNAL(bottomSet(bool)), this, SLOT(bottomBorder_changed())); + connect(borders, SIGNAL(rightSet(bool)), this, SLOT(rightBorder_changed())); + connect(borders, SIGNAL(leftSet(bool)), this, SLOT(leftBorder_changed())); + connect(rotateTabularCB, SIGNAL(clicked()), this, SLOT(rotateTabular())); + connect(rotateCellCB, SIGNAL(clicked()), this, SLOT(rotateCell())); + connect(longTabularCB, SIGNAL(clicked()), this, SLOT(longTabular())); } @@ -86,6 +107,104 @@ void QTabularDialog::closeEvent(QCloseEvent * e) } +void QTabularDialog::on_booktabsRB_toggled() +{ + form_->changed(); + form_->controller().booktabs(booktabsRB->isChecked()); + form_->update_borders(); +} + + +void QTabularDialog::topspace_changed() +{ + switch(topspaceCO->currentItem()) { + case 0: { + form_->controller().set(LyXTabular::SET_TOP_SPACE, ""); + topspaceED->setEnabled(false); + topspaceUnit->setEnabled(false); + break; + } + case 1: { + form_->controller().set(LyXTabular::SET_TOP_SPACE, "default"); + topspaceED->setEnabled(false); + topspaceUnit->setEnabled(false); + break; + } + case 2: { + if (!topspaceED->text().isEmpty()) + form_->controller().set(LyXTabular::SET_TOP_SPACE, + widgetsToLength(topspaceED, topspaceUnit)); + if (!form_->bc().bp().isReadOnly()) { + topspaceED->setEnabled(true); + topspaceUnit->setEnabled(true); + } + break; + } + } + form_->changed(); +} + + +void QTabularDialog::bottomspace_changed() +{ + switch(bottomspaceCO->currentItem()) { + case 0: { + form_->controller().set(LyXTabular::SET_BOTTOM_SPACE, ""); + bottomspaceED->setEnabled(false); + bottomspaceUnit->setEnabled(false); + break; + } + case 1: { + form_->controller().set(LyXTabular::SET_BOTTOM_SPACE, "default"); + bottomspaceED->setEnabled(false); + bottomspaceUnit->setEnabled(false); + break; + } + case 2: { + if (!bottomspaceED->text().isEmpty()) + form_->controller().set(LyXTabular::SET_BOTTOM_SPACE, + widgetsToLength(bottomspaceED, bottomspaceUnit)); + if (!form_->bc().bp().isReadOnly()) { + bottomspaceED->setEnabled(true); + bottomspaceUnit->setEnabled(true); + } + break; + } + } + form_->changed(); +} + + +void QTabularDialog::interlinespace_changed() +{ + switch(interlinespaceCO->currentItem()) { + case 0: { + form_->controller().set(LyXTabular::SET_INTERLINE_SPACE, ""); + interlinespaceED->setEnabled(false); + interlinespaceUnit->setEnabled(false); + break; + } + case 1: { + form_->controller().set(LyXTabular::SET_INTERLINE_SPACE, "default"); + interlinespaceED->setEnabled(false); + interlinespaceUnit->setEnabled(false); + break; + } + case 2: { + if (!interlinespaceED->text().isEmpty()) + form_->controller().set(LyXTabular::SET_INTERLINE_SPACE, + widgetsToLength(interlinespaceED, interlinespaceUnit)); + if (!form_->bc().bp().isReadOnly()) { + interlinespaceED->setEnabled(true); + interlinespaceUnit->setEnabled(true); + } + break; + } + } + form_->changed(); +} + + void QTabularDialog::close_clicked() { form_->closeGUI(); diff --git a/src/frontends/qt4/QTabularDialog.h b/src/frontends/qt4/QTabularDialog.h index 4f0fb2e406..3b150ce63d 100644 --- a/src/frontends/qt4/QTabularDialog.h +++ b/src/frontends/qt4/QTabularDialog.h @@ -32,6 +32,10 @@ public: protected Q_SLOTS: virtual void change_adaptor(); + virtual void topspace_changed(); + virtual void bottomspace_changed(); + virtual void interlinespace_changed(); + virtual void on_booktabsRB_toggled(); virtual void close_clicked(); virtual void borderSet_clicked(); virtual void borderUnset_clicked(); diff --git a/src/frontends/qt4/ui/QTabularUi.ui b/src/frontends/qt4/ui/QTabularUi.ui index a8109d6fa7..d14949115b 100644 --- a/src/frontends/qt4/ui/QTabularUi.ui +++ b/src/frontends/qt4/ui/QTabularUi.ui @@ -8,8 +8,8 @@ 0 0 - 447 - 408 + 439 + 360 @@ -18,14 +18,14 @@ true - + - 11 + 9 6 - + @@ -33,18 +33,94 @@ QTabWidget::Rounded + + 2 + &Table Settings - 11 + 9 6 - + + + + Column Width + + + + 9 + + + 6 + + + + + + + + true + + + Fixed width of the column + + + + + + + + + + Vertical alignment for fixed width columns + + + + Top + + + + + Middle + + + + + Bottom + + + + + + + + &Width: + + + widthED + + + + + + + &Vertical alignment: + + + vAlignCB + + + + + + + &Horizontal alignment: @@ -54,7 +130,7 @@ - + Horizontal alignment in column @@ -81,7 +157,23 @@ - + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 20 + 20 + + + + + true @@ -94,7 +186,7 @@ - + Rotate this cell by 90 degrees @@ -104,7 +196,17 @@ - + + + + Merge cells + + + &Multicolumn + + + + LaTe&X argument: @@ -114,144 +216,13 @@ - + Custom column format (LaTeX) - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 20 - 20 - - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 20 - 20 - - - - - - - - Merge cells - - - &Multicolumn - - - - - - - Column Width - - - - 11 - - - 6 - - - - - &Vertical alignment: - - - vAlignCB - - - - - - - true - - - - 50 - 0 - - - - Qt::StrongFocus - - - Width unit - - - - - - - true - - - Fixed width of the column - - - - - - - - - - &Width: - - - widthED - - - - - - - Vertical alignment for fixed width columns - - - - Top - - - - - Middle - - - - - Bottom - - - - - - - @@ -260,398 +231,560 @@ - 11 + 9 6 - - - Set Borders + + + 0 - - - 11 - - - 6 - - - - - - 5 - 5 - 0 - 0 - + + 6 + + + + + All Borders + + + + 11 + + + 6 + + + + + Set all borders of the current (selected) cell(s) + + + &Set + + + + + + + Unset all borders of the current (selected) cell(s) + + + C&lear + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 20 + 20 + + + + + + + + Style + + + + 9 - - - - - 0 - 0 - 0 - - - 230 - 240 - 249 - - - 255 - 255 - 255 - - - 242 - 247 - 252 - - - 115 - 120 - 124 - - - 154 - 160 - 166 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 255 - 255 - 255 - - - 0 - 0 - 0 - - - 16 - 145 - 210 - - - 255 - 255 - 255 - - - 0 - 0 - 255 - - - 255 - 0 - 255 - - - 232 - 232 - 232 - - - - - 0 - 0 - 0 - - - 230 - 240 - 249 - - - 255 - 255 - 255 - - - 255 - 255 - 255 - - - 115 - 120 - 124 - - - 154 - 160 - 166 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 255 - 255 - 255 - - - 0 - 0 - 0 - - - 16 - 145 - 210 - - - 255 - 255 - 255 - - - 0 - 0 - 255 - - - 255 - 0 - 255 - - - 232 - 232 - 232 - - - - - 128 - 128 - 128 - - - 230 - 240 - 249 - - - 255 - 255 - 255 - - - 255 - 255 - 255 - - - 115 - 120 - 124 - - - 154 - 160 - 166 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 128 - 128 - 128 - - - 255 - 255 - 255 - - - 255 - 255 - 255 - - - 0 - 0 - 0 - - - 16 - 145 - 210 - - - 255 - 255 - 255 - - - 0 - 0 - 255 - - - 255 - 0 - 255 - - - 232 - 232 - 232 - - - + + 6 - - QFrame::StyledPanel + + + + Use formal (a.k.a. booktabs) border style (no vertical borders) + + + Fo&rmal + + + + + + + Use default (grid-like) border style + + + De&fault + + + + + + + + + + Qt::Vertical + + + + 20 + 31 + + + + + + + + Set Borders + + + + 11 - - QFrame::Sunken + + 6 - - - 3 - - - 6 - - - - - - 1 - 1 - 0 - 0 - + + + + + 5 + 5 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + 230 + 240 + 249 + + + 255 + 255 + 255 + + + 242 + 247 + 252 + + + 115 + 120 + 124 + + + 154 + 160 + 166 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 16 + 145 + 210 + + + 255 + 255 + 255 + + + 0 + 0 + 255 + + + 255 + 0 + 255 + + + 232 + 232 + 232 + + + + + 0 + 0 + 0 + + + 230 + 240 + 249 + + + 255 + 255 + 255 + + + 255 + 255 + 255 + + + 115 + 120 + 124 + + + 154 + 160 + 166 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 16 + 145 + 210 + + + 255 + 255 + 255 + + + 0 + 0 + 255 + + + 255 + 0 + 255 + + + 232 + 232 + 232 + + + + + 128 + 128 + 128 + + + 230 + 240 + 249 + + + 255 + 255 + 255 + + + 255 + 255 + 255 + + + 115 + 120 + 124 + + + 154 + 160 + 166 + + + 0 + 0 + 0 + + + 255 + 255 + 255 + + + 128 + 128 + 128 + + + 255 + 255 + 255 + + + 255 + 255 + 255 + + + 0 + 0 + 0 + + + 16 + 145 + 210 + + + 255 + 255 + 255 + + + 0 + 0 + 255 + + + 255 + 0 + 255 + + + 232 + 232 + 232 + + + + + + QFrame::StyledPanel + + + QFrame::Sunken + + + + 3 - - Set borders of the current (selected) cell(s) + + 6 - - - - - - - - - - - - All Borders - - - - 11 - - - 6 - - - - - Set all borders of the current (selected) cell(s) - - - &Set - - - - - - - Unset all borders of the current (selected) cell(s) + + + + + 1 + 1 + 0 + 0 + + + + Set borders of the current (selected) cell(s) + + + + + + + + + + + + + Additional Space + + + + 9 - - C&lear + + 6 - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 20 - 20 - - - - - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 20 - 20 - - - + + + + T&op of row: + + + topspaceCO + + + + + + + + + + + + + + None + + + + + Default + + + + + Custom + + + + + + + + + None + + + + + Default + + + + + Custom + + + + + + + + + + + + + + Botto&m of row: + + + bottomspaceCO + + + + + + + + + + Bet&ween rows: + + + interlinespaceCO + + + + + + + + None + + + + + Default + + + + + Custom + + + + + + + + + + + @@ -661,18 +794,34 @@ - 11 + 9 6 - - + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + false + - Select for tables that span multiple pages + Set a page break on the current row - &Use long table + Page &break on current row @@ -872,16 +1021,13 @@ - - - - false - + + - Set a page break on the current row + Select for tables that span multiple pages - Page &break on current row + &Use long table @@ -889,7 +1035,7 @@ - + 0 @@ -993,16 +1139,16 @@ - QSetBorder - -
qsetborder.h
+ LengthCombo + QComboBox +
lengthcombo.h
0
- LengthCombo - -
lengthcombo.h
+ QSetBorder + QWidget +
qsetborder.h
0
@@ -1017,8 +1163,20 @@ rotateTabularCB rotateCellCB specialAlignmentED + closePB borderSetPB borderUnsetPB + borderDefaultRB + booktabsRB + topspaceCO + bottomspaceCO + interlinespaceCO + topspaceED + bottomspaceED + interlinespaceED + topspaceUnit + bottomspaceUnit + interlinespaceUnit longTabularCB headerStatusCB headerBorderAboveCB @@ -1035,7 +1193,6 @@ lastfooterBorderBelowCB lastfooterNoContentsCB newpageCB - closePB diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index 458485fe03..43343dbcc5 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -358,6 +358,11 @@ * FormFileDialog.C: add #include "filefilterlist.h" * FormBibtex.C: remove #include "globbing.h". +2004-11-16 Georg Baum + + * FormTabular.C (update): disable vertical rules if using + booktabs + 2004-11-16 Lars Gullik Bjonnes * Layoutengine.[Ch]: Break up circular dependency between Box and @@ -382,6 +387,11 @@ * XFormsView.C (hasFocus): new method, always returns true for now +2004-11-11 Edwin Leuven + + * FormTabular.C (update, input): handle check_booktabs + * forms/form_tabular.fd (check_booktabs): new checkbox + 2004-11-08 Jean-Marc Lasgouttes * XFormsToolbar.C (selected): use layoutSelected diff --git a/src/frontends/xforms/FormTabular.C b/src/frontends/xforms/FormTabular.C index cfb81319dc..5133dcb703 100644 --- a/src/frontends/xforms/FormTabular.C +++ b/src/frontends/xforms/FormTabular.C @@ -100,15 +100,30 @@ void FormTabular::build() fl_set_input_return(column_options_->input_column_width, FL_RETURN_END); + fl_set_input_return(column_options_->input_topspace, + FL_RETURN_END); + fl_set_input_return(column_options_->input_bottomspace, + FL_RETURN_END); + fl_set_input_return(column_options_->input_interlinespace, + FL_RETURN_END); fl_set_input_return(column_options_->input_special_alignment, FL_RETURN_END); // trigger an input event for cut&paste with middle mouse button. setPrehandler(column_options_->input_column_width); + setPrehandler(column_options_->input_topspace); + setPrehandler(column_options_->input_bottomspace); + setPrehandler(column_options_->input_interlinespace); setPrehandler(column_options_->input_special_alignment); fl_addto_choice(column_options_->choice_value_column_width, units.c_str()); + fl_addto_choice(column_options_->choice_value_topspace, + units.c_str()); + fl_addto_choice(column_options_->choice_value_bottomspace, + units.c_str()); + fl_addto_choice(column_options_->choice_value_interlinespace, + units.c_str()); // cell options form cell_options_.reset(build_tabular_cell(this)); @@ -164,6 +179,12 @@ void FormTabular::update() fl_activate_object(cell_options_->input_special_multialign); fl_activate_object(column_options_->input_column_width); fl_activate_object(column_options_->choice_value_column_width); + fl_activate_object(column_options_->input_topspace); + fl_activate_object(column_options_->choice_value_topspace); + fl_activate_object(column_options_->input_bottomspace); + fl_activate_object(column_options_->choice_value_bottomspace); + fl_activate_object(column_options_->input_interlinespace); + fl_activate_object(column_options_->choice_value_interlinespace); fl_set_input(dialog_->input_tabular_column, convert(column).c_str()); fl_deactivate_object(dialog_->input_tabular_column); @@ -180,13 +201,15 @@ void FormTabular::update() tabular.bottomLine(cell)?1:0); setEnabled(cell_options_->check_border_bottom, true); // pay attention to left/right lines they are only allowed - // to set if we are in first/last cell of row or if the left/right - // cell is also a multicolumn. + // to set if we don't use booktabs and if we are in + // first/last cell of row or if the left/right cell is also a + // multicolumn. if (tabular.isFirstCellInRow(cell) || tabular.isMultiColumn(cell-1)) { fl_set_button(cell_options_->check_border_left, tabular.leftLine(cell)?1:0); - setEnabled(cell_options_->check_border_left, true); + setEnabled(cell_options_->check_border_left, + !tabular.useBookTabs()); } else { fl_set_button(cell_options_->check_border_left, 0); setEnabled(cell_options_->check_border_left, false); @@ -195,7 +218,8 @@ void FormTabular::update() tabular.isMultiColumn(cell+1)) { fl_set_button(cell_options_->check_border_right, tabular.rightLine(cell)?1:0); - setEnabled(cell_options_->check_border_right, true); + setEnabled(cell_options_->check_border_right, + !tabular.useBookTabs()); } else { fl_set_button(cell_options_->check_border_right, 0); setEnabled(cell_options_->check_border_right, false); @@ -320,6 +344,39 @@ void FormTabular::update() setEnabled(column_options_->input_column_width, !isReadonly); setEnabled(column_options_->choice_value_column_width, !isReadonly); + if (tabular.row_info[row].top_space_default) + fl_set_input(column_options_->input_topspace, "default"); + else { + updateWidgetsFromLength(column_options_->input_topspace, + column_options_->choice_value_topspace, + tabular.row_info[row].top_space, + default_unit); + } + setEnabled(column_options_->input_topspace, !isReadonly); + setEnabled(column_options_->choice_value_topspace, !isReadonly); + + if (tabular.row_info[row].bottom_space_default) + fl_set_input(column_options_->input_bottomspace, "default"); + else { + updateWidgetsFromLength(column_options_->input_bottomspace, + column_options_->choice_value_bottomspace, + tabular.row_info[row].bottom_space, + default_unit); + } + setEnabled(column_options_->input_bottomspace, !isReadonly); + setEnabled(column_options_->choice_value_bottomspace, !isReadonly); + + if (tabular.row_info[row].interline_space_default) + fl_set_input(column_options_->input_interlinespace, "default"); + else { + updateWidgetsFromLength(column_options_->input_interlinespace, + column_options_->choice_value_interlinespace, + tabular.row_info[row].interline_space, + default_unit); + } + setEnabled(column_options_->input_interlinespace, !isReadonly); + setEnabled(column_options_->choice_value_interlinespace, !isReadonly); + setEnabled(cell_options_->check_useminipage, !pwidth.zero()); if (!pwidth.zero()) { if (tabular.getUsebox(cell) == 2) @@ -361,6 +418,9 @@ void FormTabular::update() setEnabled(column_options_->radio_valign_bottom, !pwidth.zero()); setEnabled(column_options_->radio_valign_middle, !pwidth.zero()); + fl_set_button(tabular_options_->check_booktabs, + tabular.useBookTabs()); + fl_set_button(tabular_options_->check_longtable, tabular.isLongTabular()); @@ -564,6 +624,72 @@ ButtonPolicy::SMInput FormTabular::input(FL_OBJECT * ob, long) return ButtonPolicy::SMI_VALID; } + if ((ob == column_options_->input_topspace) || + (ob == column_options_->choice_value_topspace)) { + string const input = getString(column_options_->input_topspace); + if (input == "default") + controller().set(LyXTabular::SET_TOP_SPACE, "default"); + else { + string const str = getLengthFromWidgets( + column_options_->input_topspace, + column_options_->choice_value_topspace); + controller().set(LyXTabular::SET_TOP_SPACE, str); + + //check if the input is valid + if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) { + postWarning(_("Invalid Length (valid example: 10mm)")); + return ButtonPolicy::SMI_INVALID; + } + } + + update(); // update for alignment + return ButtonPolicy::SMI_VALID; + } + + if ((ob == column_options_->input_bottomspace) || + (ob == column_options_->choice_value_bottomspace)) { + string const input = getString(column_options_->input_bottomspace); + if (input == "default") + controller().set(LyXTabular::SET_BOTTOM_SPACE, "default"); + else { + string const str = getLengthFromWidgets( + column_options_->input_bottomspace, + column_options_->choice_value_bottomspace); + controller().set(LyXTabular::SET_BOTTOM_SPACE, str); + + //check if the input is valid + if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) { + postWarning(_("Invalid Length (valid example: 10mm)")); + return ButtonPolicy::SMI_INVALID; + } + } + + update(); // update for alignment + return ButtonPolicy::SMI_VALID; + } + + if ((ob == column_options_->input_interlinespace) || + (ob == column_options_->choice_value_interlinespace)) { + string const input = getString(column_options_->input_interlinespace); + if (input == "default") + controller().set(LyXTabular::SET_INTERLINE_SPACE, "default"); + else { + string const str = getLengthFromWidgets( + column_options_->input_interlinespace, + column_options_->choice_value_interlinespace); + controller().set(LyXTabular::SET_INTERLINE_SPACE, str); + + //check if the input is valid + if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) { + postWarning(_("Invalid Length (valid example: 10mm)")); + return ButtonPolicy::SMI_INVALID; + } + } + + update(); // update for alignment + return ButtonPolicy::SMI_VALID; + } + if ((ob == cell_options_->input_mcolumn_width) || (ob == cell_options_->choice_value_mcolumn_width)) { string const str = @@ -622,6 +748,11 @@ ButtonPolicy::SMInput FormTabular::input(FL_OBJECT * ob, long) num = LyXTabular::SET_LONGTABULAR; else num = LyXTabular::UNSET_LONGTABULAR; + } else if (ob == tabular_options_->check_booktabs) { + if (fl_get_button(tabular_options_->check_booktabs)) + num = LyXTabular::SET_BOOKTABS; + else + num = LyXTabular::UNSET_BOOKTABS; } else if (ob == tabular_options_->check_rotate_tabular) { s = fl_get_button(tabular_options_->check_rotate_tabular); if (s) diff --git a/src/frontends/xforms/forms/form_tabular.fd b/src/frontends/xforms/forms/form_tabular.fd index 8ec9671329..b0a71054fa 100644 --- a/src/frontends/xforms/forms/form_tabular.fd +++ b/src/frontends/xforms/forms/form_tabular.fd @@ -10,13 +10,13 @@ SnapGrid: 5 =============== FORM =============== Name: form_tabular Width: 510 -Height: 325 +Height: 400 Number of Objects: 6 -------------------- class: FL_BOX type: FLAT_BOX -box: 0 0 510 325 +box: 0 0 510 400 boxtype: FL_FLAT_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -34,7 +34,7 @@ argument: -------------------- class: FL_TABFOLDER type: TOP_TABFOLDER -box: 0 0 505 250 +box: 0 0 505 335 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_TOP_LEFT @@ -52,7 +52,7 @@ argument: -------------------- class: FL_BUTTON type: NORMAL_BUTTON -box: 415 290 90 30 +box: 415 365 90 30 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -70,7 +70,7 @@ argument: 0 -------------------- class: FL_INPUT type: NORMAL_INPUT -box: 65 290 60 30 +box: 65 365 60 30 boxtype: FL_DOWN_BOX colors: FL_COL1 FL_MCOL alignment: FL_ALIGN_TOP_LEFT @@ -88,7 +88,7 @@ argument: -------------------- class: FL_INPUT type: NORMAL_INPUT -box: 5 290 60 30 +box: 5 365 60 30 boxtype: FL_DOWN_BOX colors: FL_COL1 FL_MCOL alignment: FL_ALIGN_TOP_LEFT @@ -125,7 +125,7 @@ argument: Name: form_tabular_options Width: 505 Height: 225 -Number of Objects: 10 +Number of Objects: 11 -------------------- class: FL_BOX @@ -292,7 +292,7 @@ argument: 0 -------------------- class: FL_LABELFRAME type: ENGRAVED_FRAME -box: 280 20 120 75 +box: 280 20 120 90 boxtype: FL_NO_BOX colors: FL_BLACK FL_COL1 alignment: FL_ALIGN_TOP_LEFT @@ -307,16 +307,34 @@ name: callback: argument: +-------------------- +class: FL_CHECKBUTTON +type: PUSH_BUTTON +box: 280 80 95 25 +boxtype: FL_NO_BOX +colors: FL_COL1 FL_YELLOW +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: Formal table|#F +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: check_booktabs +callback: C_FormDialogView_InputCB +argument: 0 + =============== FORM =============== Name: form_tabular_column Width: 505 -Height: 225 -Number of Objects: 24 +Height: 315 +Number of Objects: 31 -------------------- class: FL_BOX type: FLAT_BOX -box: 0 0 505 225 +box: 0 0 505 315 boxtype: FL_FLAT_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -349,6 +367,24 @@ name: callback: argument: +-------------------- +class: FL_LABELFRAME +type: ENGRAVED_FRAME +box: 20 230 475 75 +boxtype: FL_NO_BOX +colors: FL_BLACK FL_COL1 +alignment: FL_ALIGN_TOP_LEFT +style: FL_BOLD_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Vertical Space +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: +callback: +argument: + -------------------- class: FL_LABELFRAME type: ENGRAVED_FRAME @@ -747,6 +783,114 @@ name: radio_align_block callback: C_FormDialogView_InputCB argument: 0 +-------------------- +class: FL_INPUT +type: NORMAL_INPUT +box: 30 270 75 30 +boxtype: FL_DOWN_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_TOP_LEFT +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Top|#T +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: input_topspace +callback: C_FormDialogView_InputCB +argument: 0 + +-------------------- +class: FL_CHOICE +type: NORMAL_CHOICE +box: 110 270 60 30 +boxtype: FL_FRAME_BOX +colors: FL_COL1 FL_BLACK +alignment: FL_ALIGN_TOP_LEFT +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: |#L +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: choice_value_topspace +callback: C_FormDialogView_InputCB +argument: 0 + +-------------------- +class: FL_INPUT +type: NORMAL_INPUT +box: 190 270 75 30 +boxtype: FL_DOWN_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_TOP_LEFT +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Bottom|#B +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: input_bottomspace +callback: C_FormDialogView_InputCB +argument: 0 + +-------------------- +class: FL_CHOICE +type: NORMAL_CHOICE +box: 270 270 60 30 +boxtype: FL_FRAME_BOX +colors: FL_COL1 FL_BLACK +alignment: FL_ALIGN_TOP_LEFT +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: |#L +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: choice_value_bottomspace +callback: C_FormDialogView_InputCB +argument: 0 + +-------------------- +class: FL_INPUT +type: NORMAL_INPUT +box: 350 270 75 30 +boxtype: FL_DOWN_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_TOP_LEFT +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Interline|#I +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: input_interlinespace +callback: C_FormDialogView_InputCB +argument: 0 + +-------------------- +class: FL_CHOICE +type: NORMAL_CHOICE +box: 430 270 60 30 +boxtype: FL_FRAME_BOX +colors: FL_COL1 FL_BLACK +alignment: FL_ALIGN_TOP_LEFT +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: |#L +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: choice_value_interlinespace +callback: C_FormDialogView_InputCB +argument: 0 + =============== FORM =============== Name: form_tabular_cell Width: 505 diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 7477138e45..5d3ffcd993 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -799,6 +799,10 @@ * insettabular.[Ch] (string2params): Don't pretend to return the active cell anymore and simplify keyword parsing. +2004-11-11 Edwin Leuven + + * insettabular.C (getStatus, tabularFeatures): handle booktabs feature + 2004-11-10 Jean-Marc Lasgouttes * insetlatexaccent.h (isLetter): implement, so that word selection diff --git a/src/insets/insettabular.C b/src/insets/insettabular.C index 51f70a8f47..a8c9d8d95d 100644 --- a/src/insets/insettabular.C +++ b/src/insets/insettabular.C @@ -72,6 +72,7 @@ namespace { int const ADD_TO_HEIGHT = 2; int const ADD_TO_TABULAR_WIDTH = 2; +int const default_line_space = 10; /// boost::scoped_ptr paste_tabular; @@ -133,6 +134,11 @@ TabularFeature tabularFeature[] = { LyXTabular::SET_LTNEWPAGE, "set-ltnewpage" }, { LyXTabular::SET_SPECIAL_COLUMN, "set-special-column" }, { LyXTabular::SET_SPECIAL_MULTI, "set-special-multi" }, + { LyXTabular::SET_BOOKTABS, "set-booktabs" }, + { LyXTabular::UNSET_BOOKTABS, "unset-booktabs" }, + { LyXTabular::SET_TOP_SPACE, "set-top-space" }, + { LyXTabular::SET_BOTTOM_SPACE, "set-bottom-space" }, + { LyXTabular::SET_INTERLINE_SPACE, "set-interline-space" }, { LyXTabular::LAST_ACTION, "" } }; @@ -268,8 +274,14 @@ void InsetTabular::metrics(MetricsInfo & mi, Dimension & dim) const tabular.setWidthOfCell(cell, dim.wid); ++cell; } - tabular.setAscentOfRow(i, maxAsc + ADD_TO_HEIGHT); - tabular.setDescentOfRow(i, maxDesc + ADD_TO_HEIGHT); + int const top_space = tabular.row_info[i].top_space_default ? + default_line_space : + tabular.row_info[i].top_space.inPixels(mi.base.textwidth); + tabular.setAscentOfRow(i, maxAsc + ADD_TO_HEIGHT + top_space); + int const bottom_space = tabular.row_info[i].bottom_space_default ? + default_line_space : + tabular.row_info[i].bottom_space.inPixels(mi.base.textwidth); + tabular.setDescentOfRow(i, maxDesc + ADD_TO_HEIGHT + bottom_space); } dim.asc = tabular.getAscentOfRow(0); @@ -808,6 +820,9 @@ bool InsetTabular::getStatus(LCursor & cur, FuncRequest const & cmd, case LyXTabular::DELETE_COLUMN: case LyXTabular::SET_ALL_LINES: case LyXTabular::UNSET_ALL_LINES: + case LyXTabular::SET_TOP_SPACE: + case LyXTabular::SET_BOTTOM_SPACE: + case LyXTabular::SET_INTERLINE_SPACE: status.clear(); return true; @@ -946,6 +961,14 @@ bool InsetTabular::getStatus(LCursor & cur, FuncRequest const & cmd, case LyXTabular::SET_LTNEWPAGE: status.setOnOff(tabular.getLTNewPage(sel_row_start)); break; + + case LyXTabular::SET_BOOKTABS: + status.setOnOff(tabular.useBookTabs()); + break; + + case LyXTabular::UNSET_BOOKTABS: + status.setOnOff(!tabular.useBookTabs()); + break; default: status.clear(); @@ -1127,11 +1150,10 @@ int InsetTabular::dist(idx_type const cell, int x, int y) const Point o = theCoords.getInsets().xy(&inset); int const xbeg = o.x_ - tabular.getBeginningOfTextInCell(cell); int const xend = xbeg + tabular.getWidthOfColumn(cell); - int const ybeg = o.y_ - inset.ascent(); row_type const row = tabular.row_of_cell(cell); - int const rowheight = tabular.getAscentOfRow(row) - + tabular.getDescentOfRow(row); - int const yend = ybeg + rowheight; + int const ybeg = o.y_ - tabular.getAscentOfRow(row) - + tabular.getAdditionalHeight(row); + int const yend = o.y_ + tabular.getDescentOfRow(row); if (x < xbeg) xx = xbeg - x; @@ -1634,6 +1656,68 @@ void InsetTabular::tabularFeatures(LCursor & cur, tabular.setLTNewPage(row, !tabular.getLTNewPage(row)); break; + case LyXTabular::SET_BOOKTABS: + tabular.setBookTabs(true); + break; + + case LyXTabular::UNSET_BOOKTABS: + tabular.setBookTabs(false); + break; + + case LyXTabular::SET_TOP_SPACE: { + LyXLength len; + if (value == "default") + for (row_type i = sel_row_start; i <= sel_row_end; ++i) + tabular.row_info[i].top_space_default = true; + else if (isValidLength(value, &len)) + for (row_type i = sel_row_start; i <= sel_row_end; ++i) { + tabular.row_info[i].top_space_default = false; + tabular.row_info[i].top_space = len; + } + else + for (row_type i = sel_row_start; i <= sel_row_end; ++i) { + tabular.row_info[i].top_space_default = false; + tabular.row_info[i].top_space = len; + } + break; + } + + case LyXTabular::SET_BOTTOM_SPACE: { + LyXLength len; + if (value == "default") + for (row_type i = sel_row_start; i <= sel_row_end; ++i) + tabular.row_info[i].bottom_space_default = true; + else if (isValidLength(value, &len)) + for (row_type i = sel_row_start; i <= sel_row_end; ++i) { + tabular.row_info[i].bottom_space_default = false; + tabular.row_info[i].bottom_space = len; + } + else + for (row_type i = sel_row_start; i <= sel_row_end; ++i) { + tabular.row_info[i].bottom_space_default = false; + tabular.row_info[i].bottom_space = len; + } + break; + } + + case LyXTabular::SET_INTERLINE_SPACE: { + LyXLength len; + if (value == "default") + for (row_type i = sel_row_start; i <= sel_row_end; ++i) + tabular.row_info[i].interline_space_default = true; + else if (isValidLength(value, &len)) + for (row_type i = sel_row_start; i <= sel_row_end; ++i) { + tabular.row_info[i].interline_space_default = false; + tabular.row_info[i].interline_space = len; + } + else + for (row_type i = sel_row_start; i <= sel_row_end; ++i) { + tabular.row_info[i].interline_space_default = false; + tabular.row_info[i].interline_space = len; + } + break; + } + // dummy stuff just to avoid warnings case LyXTabular::LAST_ACTION: break; diff --git a/src/tabular.C b/src/tabular.C index 7bb2cf78a7..cdfa5e320f 100644 --- a/src/tabular.C +++ b/src/tabular.C @@ -64,6 +64,8 @@ using std::strlen; namespace { int const WIDTH_OF_LINE = 5; +int const default_line_space = 10; + template string const write_attribute(string const & name, T const & t) @@ -299,6 +301,21 @@ bool getTokenValue(string const & str, char const * token, LyXLength & len) } +bool getTokenValue(string const & str, char const * token, LyXLength & len, bool & flag) +{ + len = LyXLength(); + flag = false; + string tmp; + if (!getTokenValue(str, token, tmp)) + return false; + if (tmp == "default") { + flag = true; + return true; + } + return isValidLength(tmp, &len); +} + + void l_getline(istream & is, string & str) { str.erase(); @@ -380,6 +397,9 @@ LyXTabular::rowstruct::rowstruct() descent_of_row(0), top_line(true), bottom_line(false), + top_space_default(false), + bottom_space_default(false), + interline_space_default(false), endhead(false), endfirsthead(false), endfoot(false), @@ -432,6 +452,7 @@ void LyXTabular::init(BufferParams const & bp, row_type rows_arg, column_info.back().right_line = true; is_long_tabular = false; rotate = false; + use_booktabs = false; } @@ -607,10 +628,10 @@ LyXTabular::idx_type LyXTabular::numberOfCellsInRow(idx_type const cell) const } -// returns 1 if there is a topline, returns 0 if not bool LyXTabular::topLine(idx_type const cell, bool const onlycolumn) const { - if (!onlycolumn && isMultiColumn(cell)) + if (!onlycolumn && isMultiColumn(cell) && + !(use_booktabs && row_of_cell(cell) == 0)) return cellinfo_of_cell(cell).top_line; return row_info[row_of_cell(cell)].top_line; } @@ -618,7 +639,8 @@ bool LyXTabular::topLine(idx_type const cell, bool const onlycolumn) const bool LyXTabular::bottomLine(idx_type const cell, bool onlycolumn) const { - if (!onlycolumn && isMultiColumn(cell)) + if (!onlycolumn && isMultiColumn(cell) && + !(use_booktabs && isLastRow(cell))) return cellinfo_of_cell(cell).bottom_line; return row_info[row_of_cell(cell)].bottom_line; } @@ -626,6 +648,8 @@ bool LyXTabular::bottomLine(idx_type const cell, bool onlycolumn) const bool LyXTabular::leftLine(idx_type cell, bool onlycolumn) const { + if (use_booktabs) + return false; if (!onlycolumn && isMultiColumn(cell) && (isFirstCellInRow(cell) || isMultiColumn(cell-1))) { @@ -641,6 +665,8 @@ bool LyXTabular::leftLine(idx_type cell, bool onlycolumn) const bool LyXTabular::rightLine(idx_type cell, bool onlycolumn) const { + if (use_booktabs) + return false; if (!onlycolumn && isMultiColumn(cell) && (isLastCellInRow(cell) || isMultiColumn(cell + 1))) { @@ -721,9 +747,12 @@ int LyXTabular::getAdditionalHeight(row_type row) const top = row_info[row].top_line; } } + int const interline_space = row_info[row - 1].interline_space_default ? + default_line_space : + row_info[row - 1].interline_space.inPixels(width_of_tabular); if (top && bottom) - return WIDTH_OF_LINE; - return 0; + return interline_space + WIDTH_OF_LINE; + return interline_space; } @@ -1193,6 +1222,7 @@ void LyXTabular::write(Buffer const & buf, ostream & os) const // global longtable options os << "