From 53e8fb60009c249535022dc3e2130ae1c900922b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Vigna?= Date: Mon, 18 Mar 2002 15:27:41 +0000 Subject: [PATCH] Fixed rules for setting left/right borders for multicolumns (fix #173). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3765 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 5 +++++ src/frontends/xforms/ChangeLog | 5 +++++ src/frontends/xforms/FormTabular.C | 29 +++++++++++++++++++++++------ src/tabular.C | 14 +++++++++----- 4 files changed, 42 insertions(+), 11 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index e865935982..7ea9a6e224 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,10 @@ 2002-03-18 Juergen Vigna + * tabular.C (LeftAlreadyDrawed): fixed for multicolumn borders. + (GetAdditionalWidth): ditto. + (RightLine): ditto. + (LeftLine): ditto. + * BufferView2.C (copy): use getLyXText() so that we do it inside an inset if we're there actually (probably not used right now but this is the direction to go for unifying code). diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index 96d459e490..b674bfa33c 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,8 @@ +2002-03-18 Juergen Vigna + + * FormTabular.C (update): deactivate left/right border settings for + multicolumns if not an outer cell or no parent multicolumn cell. + 2002-03-13 Angus Leeming * FormBase.C (show): diff --git a/src/frontends/xforms/FormTabular.C b/src/frontends/xforms/FormTabular.C index 781a2237fb..1ed5fe4035 100644 --- a/src/frontends/xforms/FormTabular.C +++ b/src/frontends/xforms/FormTabular.C @@ -207,12 +207,29 @@ void FormTabular::update() fl_set_button(cell_options_->check_border_bottom, tabular->BottomLine(cell)?1:0); setEnabled(cell_options_->check_border_bottom, true); - fl_set_button(cell_options_->check_border_left, - tabular->LeftLine(cell)?1:0); - setEnabled(cell_options_->check_border_left, true); - fl_set_button(cell_options_->check_border_right, - tabular->RightLine(cell)?1:0); - setEnabled(cell_options_->check_border_right, 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. + 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); + } else { + fl_set_button(cell_options_->check_border_left, 0); + setEnabled(cell_options_->check_border_left, false); + } + if (tabular->IsLastCellInRow(cell) || + tabular->IsMultiColumn(cell+1)) + { + fl_set_button(cell_options_->check_border_right, + tabular->RightLine(cell)?1:0); + setEnabled(cell_options_->check_border_right, true); + } else { + fl_set_button(cell_options_->check_border_right, 0); + setEnabled(cell_options_->check_border_right, false); + } pwidth = tabular->GetMColumnPWidth(cell); align = tabular->GetAlignment(cell); if (!pwidth.zero() || (align == LYX_ALIGN_LEFT)) diff --git a/src/tabular.C b/src/tabular.C index abb3821685..e5f64586a4 100644 --- a/src/tabular.C +++ b/src/tabular.C @@ -465,7 +465,9 @@ bool LyXTabular::BottomLine(int cell, bool onlycolumn) const bool LyXTabular::LeftLine(int cell, bool onlycolumn) const { - if (!onlycolumn && IsMultiColumn(cell)) { + if (!onlycolumn && IsMultiColumn(cell) && + (IsFirstCellInRow(cell) || IsMultiColumn(cell-1))) + { #ifdef SPECIAL_COLUM_HANDLING if (cellinfo_of_cell(cell)->align_special.empty()) return cellinfo_of_cell(cell)->left_line; @@ -486,7 +488,9 @@ bool LyXTabular::LeftLine(int cell, bool onlycolumn) const bool LyXTabular::RightLine(int cell, bool onlycolumn) const { - if (!onlycolumn && IsMultiColumn(cell)) { + if (!onlycolumn && IsMultiColumn(cell) && + (IsLastCellInRow(cell) || IsMultiColumn(cell+1))) + { #ifdef SPECIAL_COLUM_HANDLING if (cellinfo_of_cell(cell)->align_special.empty()) return cellinfo_of_cell(cell)->right_line; @@ -535,7 +539,7 @@ bool LyXTabular::LeftAlreadyDrawed(int cell) const if (GetAdditionalWidth(cell_info[row][column].cellno)) return false; #ifdef SPECIAL_COLUM_HANDLING - return column_info[column].right_line; + return RightLine(cell_info[row][column].cellno); #else return RightLine(cell_info[row][column].cellno, true); #endif @@ -588,8 +592,8 @@ int LyXTabular::GetAdditionalWidth(int cell) const // used to get it back in text.C int const col = right_column_of_cell(cell); int const row = row_of_cell(cell); - if (col < columns_ - 1 && RightLine(cell, true) && - LeftLine(cell_info[row][col+1].cellno, true)) // column_info[col+1].left_line) + if (col < columns_ - 1 && RightLine(cell) && + LeftLine(cell_info[row][col+1].cellno)) // column_info[col+1].left_line) { return WIDTH_OF_LINE; } else {