From f1b78fbf9f07947f1d42d92dab7f882734943848 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Vigna?= Date: Mon, 4 Mar 2002 11:26:17 +0000 Subject: [PATCH] Fixed recalculate of multicolumns on screen (fix #150). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3656 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 6 ++++++ src/tabular.C | 15 +++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 64bf241ac7..907e62a41c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2002-03-04 Juergen Vigna + + * tabular.C (calculate_width_of_column_NMC): fixed to use also the + last column of multicolumn cells. + (SetWidthOfMulticolCell): recalculate NMC and real columns. + 2002-03-04 Jose Abilio Oliveira Matos * exporter.C (Export): for linuxdoc and docbook the buffer is a nice diff --git a/src/tabular.C b/src/tabular.C index e72d5ae0b6..9ca78ad16f 100644 --- a/src/tabular.C +++ b/src/tabular.C @@ -644,7 +644,9 @@ bool LyXTabular::SetWidthOfMulticolCell(int cell, int new_width) if (old_val != cell_info[row][column2].width_of_cell) { // in this case we have to recalculate all multicolumn cells which // have this column as one of theirs but not as last one + calculate_width_of_column_NMC(i); recalculateMulticolumnsOfColumn(i); + calculate_width_of_column(i); } return true; } @@ -955,16 +957,21 @@ bool LyXTabular::calculate_width_of_column(int column) // -// calculate the with of the column without regarding REAL MultiColumn -// cells. This means MultiColumn-cells spanning more than 1 column. +// Calculate the columns regarding ONLY the normal cells and if this +// column is inside a multicolumn cell then use it only if its the last +// column of this multicolumn cell as this gives an added with to the +// column, all the rest should be adapted! // bool LyXTabular::calculate_width_of_column_NMC(int column) { int const old_column_width = column_info[column].width_of_column; int max = 0; for (int i = 0; i < rows_; ++i) { - if (!IsMultiColumn(GetCellNumber(i, column), true) && - (cell_info[i][column].width_of_cell > max)) { + int cell = GetCellNumber(i, column); + bool ismulti = IsMultiColumn(cell, true); + if ((!ismulti || (column == right_column_of_cell(cell))) && + (cell_info[i][column].width_of_cell > max)) + { max = cell_info[i][column].width_of_cell; } }