On Sun, 28 Aug 2005 13:30:07 +0200 Juergen Spitzmueller <[EMAIL PROTECTED]> wrote:
> Martin Vermeer wrote: > > Ah. But I remember that was in a quite different part of the code, > right? > > Don't think so. These were the changes: Ah, heck. So we have to study this. First off: 1) It appears that tabular.isPartOfMultiColumn(i, j) returns true only if cell i,j is part of a multicolumn cell, *but not the first one*. See source in tabular.C. Then, tabular.h tells us that the first cell's enum value is CELL_BEGIN_OF_MULTICOLUMN, which is not tested for. OK? 2) Reading setWidthOfMulticolCell() I see that what happens is, that for all cells but the last one, the column width is assumed; the last cell is set to have what remains of the total width. 3) The p_width info of a multicolumn cell however seems to be stored in the first cell (only?). Hmmm. The following seems to work: Index: insettabular.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettabular.C,v retrieving revision 1.483 diff -u -p -r1.483 insettabular.C --- insettabular.C 7 Aug 2005 18:36:21 -0000 1.483 +++ insettabular.C 28 Aug 2005 17:18:40 -0000 @@ -242,10 +242,16 @@ void InsetTabular::metrics(MetricsInfo & int maxDesc = 0; for (col_type j = 0; j < tabular.columns(); ++j) { if (tabular.isPartOfMultiColumn(i, j)) + // Multicolumn cell, but not first one continue; Dimension dim; MetricsInfo m = mi; - LyXLength p_width = tabular.column_info[j].p_width; + LyXLength p_width; + if (tabular.cell_info[i][j].multicolumn == + LyXTabular::CELL_BEGIN_OF_MULTICOLUMN) + p_width = tabular.cellinfo_of_cell(cell).p_width; + else + p_width = tabular.column_info[j].p_width; if (!p_width.zero()) m.base.textwidth = p_width.inPixels(mi.base.textwidth); tabular.getCellInset(cell)->metrics(m, dim); This stuff could do with some sanitizing... - Martin