On Thu, Jun 29, 2006 at 11:05:31AM +0300, Martin Vermeer wrote: > On Thu, Jun 29, 2006 at 01:08:32AM +0300, Martin Vermeer wrote: > > On Wed, Jun 28, 2006 at 03:06:36PM +0200, Jean-Marc Lasgouttes wrote: > > > >>>>> "Jean-Marc" == Jean-Marc Lasgouttes <[EMAIL PROTECTED]> writes: > > > > > > Jean-Marc> This is because the rowpainter code sets Wide() on these > > > Jean-Marc> insets, because they are alone on a row. The following > > > Jean-Marc> patches test additionally that the inset is not the last > > > Jean-Marc> element of the paragraph. It seems to work for me, but I am > > > Jean-Marc> not sure it is the right condition to test. > > > > No, I have serious doubts here. And there will be situations where an > > inset is the last (or only) element of a paragraph, and contains lots of > > texts that we want to render parsimoniously. So I am afraid that this > > subverts the speed-up effect. > > I enabled the painting debugging by -dbg PAINTING, and can confirm my > doubts. > > A Note inset, even if apparently alone on its row and followed by text > in the same paragraph that has wrapped to the next row, will _never_ go > Wide with your patch. (I tried the 1.4 version). > > I expect Bennett would find the old slowness back. > > Yes, it "fixes" -- rather, suppresses -- the note-in-tabular bug :-(
Here is my patch improved as I think it should be. This works, and reserves even the right amount of space in a cell, not too much. The expression for openinlined_ may perhaps be refined still, but main thing is it shouldn't depend on mi.base.textwidth. - Martin
Index: insetcollapsable.C =================================================================== --- insetcollapsable.C (revision 14237) +++ insetcollapsable.C (working copy) @@ -138,7 +138,8 @@ void InsetCollapsable::metrics(MetricsIn dim = dimensionCollapsed(); if (status() == Open) { InsetText::metrics(mi, textdim_); - openinlined_ = textdim_.wid + 2 * dim.wid <= mi.base.textwidth; + // This expression should not contain mi.base.texwidth + openinlined_ = textdim_.wid < 0.5 * mi.base.bv->workWidth(); if (openinlined_) { // Correct for button width, and re-fit mi.base.textwidth -= dim.wid; Index: insettabular.C =================================================================== --- insettabular.C (revision 14262) +++ insettabular.C (working copy) @@ -261,9 +261,15 @@ void InsetTabular::metrics(MetricsInfo & tabular.getCellInset(cell)->metrics(m, dim); if (!p_width.zero()) dim.wid = m.base.textwidth; + tabular.setWidthOfCell(cell, dim.wid); + if (p_width.zero()) { + m.base.textwidth = dim.wid + 2 * ADD_TO_TABULAR_WIDTH; + // FIXME there must be a way to get rid of + // the second metrics call + tabular.getCellInset(cell)->metrics(m, dim); + } maxAsc = max(maxAsc, dim.asc); maxDesc = max(maxDesc, dim.des); - tabular.setWidthOfCell(cell, dim.wid); ++cell; } tabular.setAscentOfRow(i, maxAsc + ADD_TO_HEIGHT);
pgpVMLyAbDD7z.pgp
Description: PGP signature