Am Donnerstag, 11. November 2004 20:09 schrieb Georg Baum: > TODO list: > > 1. Disable changing of vertical rules in the frontends if booktabs are > enabled. The output of vertical rules is already suppressed.
The attached patch implements this. Georg
Index: src/frontends/qt2/QTabular.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QTabular.C,v retrieving revision 1.31.4.1 diff -u -p -r1.31.4.1 QTabular.C --- src/frontends/qt2/QTabular.C 11 Nov 2004 19:09:06 -0000 1.31.4.1 +++ src/frontends/qt2/QTabular.C 13 Nov 2004 20:45:43 -0000 @@ -90,10 +90,11 @@ void QTabular::update_borders() LyXTabular const & tabular = controller().tabular(); int 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)); @@ -105,18 +106,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); Index: src/frontends/qt2/QTabularDialog.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QTabularDialog.C,v retrieving revision 1.24.4.1 diff -u -p -r1.24.4.1 QTabularDialog.C --- src/frontends/qt2/QTabularDialog.C 11 Nov 2004 19:09:06 -0000 1.24.4.1 +++ src/frontends/qt2/QTabularDialog.C 13 Nov 2004 20:45:43 -0000 @@ -352,6 +352,8 @@ void QTabularDialog::booktabs_clicked() form_->controller().set(LyXTabular::SET_BOOKTABS); else form_->controller().set(LyXTabular::UNSET_BOOKTABS); + form_->update_borders(); + form_->changed(); } } // namespace frontend Index: src/frontends/xforms/FormTabular.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FormTabular.C,v retrieving revision 1.83.4.1 diff -u -p -r1.83.4.1 FormTabular.C --- src/frontends/xforms/FormTabular.C 11 Nov 2004 19:09:07 -0000 1.83.4.1 +++ src/frontends/xforms/FormTabular.C 13 Nov 2004 20:45:46 -0000 @@ -180,13 +180,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 +197,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);