On Sun, Oct 19, 2003 at 02:45:07PM +0300, Martin Vermeer spake thusly: ... > > Would that be a clean enough solution if it works? > > Forget it... works kind-of, but not well enough (i.e. just as poorly > as fudging the width in metrics). > > 1) The empty line below the inset is still there... I don't really > understand it. > > 2) There is the problem that the 'sensitive area' of the inset lands > in a different place than the visible mathinset, i.e., at the left > margin. Apparently it isn't shifted by offset_ as it should to be > compatible with its draw routine. How to do that? (And note that this > problem *will* keep biting you if you don't have the mathinset as wide > as the text but positioned in the middle!) > > Perhaps re-writing it in terms of breakLineBefore/breakLineAfter is > the way to go. But don't look at me like that ;-) > > - Martin
Attached the code that does a line break before and after the inset. (The line dim.wid = m.base.textwidth in formula metrics I have commented out so mathinsets are at a sane width.) This behaves no better than before. Still the extra empty row below (is there something fishy with row division?) and I didn't do anything about the sensitive area mis-location (that should be done in checkInset in text3.C, no?) I'm running out of good ideas :-( - Martin
Index: text.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text.C,v retrieving revision 1.463 diff -u -p -r1.463 text.C --- text.C 17 Oct 2003 18:01:09 -0000 1.463 +++ text.C 19 Oct 2003 13:00:42 -0000 @@ -691,6 +691,25 @@ pos_type LyXText::rowBreakPoint(Paragrap point = i; break; } + InsetOld * in; + // Break before... + if (i < last) { + in = pit->isInset(i + 1) ? pit->getInset(i + 1) : 0; + if (in) { + if (in->display()) { + point = i; + break; + } + } + } + // ...and after. + in = pit->isInset(i) ? pit->getInset(i) : 0; + if (in) { + if (in->display()) { + point = i; + break; + } + } char const c = pit->getChar(i); if (i > endPosOfFontSpan) { @@ -716,7 +735,7 @@ pos_type LyXText::rowBreakPoint(Paragrap x += thiswidth; chunkwidth += thiswidth; - InsetOld * in = pit->isInset(i) ? pit->getInset(i) : 0; + in = pit->isInset(i) ? pit->getInset(i) : 0; // break before a character that will fall off // the right of the row @@ -2128,7 +2147,19 @@ int LyXText::redoParagraphInternal(Parag RowList::iterator rit = pit->rows.begin(); RowList::iterator end = pit->rows.end(); for (rit = pit->rows.begin(); rit != end; ++rit) { - int const f = fill(pit, *rit, ww); + int f = fill(pit, *rit, ww); + // Position of next char: + pos_type z = rit->end(); + if (z < pit->size()) { + // Is this an inset in "display" mode? + if (pit->isInset(z)) { + InsetOld * inset = pit->getInset(z); + if (inset->display()) { + // suppress filling of line (row) beforeit + f = 0; + } + } + } int const w = ww - f; par_width = std::max(par_width, w); rit->fill(f);
pgp00000.pgp
Description: PGP signature