On Mon, 2006-06-12 at 09:30 +0200, Lars Gullik Bjønnes wrote: > Martin Vermeer <[EMAIL PROTECTED]> writes: > > | On Sat, 2006-06-10 at 15:22 +0200, Lars Gullik Bjønnes wrote: > | > [EMAIL PROTECTED] (Lars Gullik Bjønnes) writes: > | > > | > | We have a drawing error with insets. It is very easy to see with the > | > | note inset. Just load the userguide, look at the 'Note' inset near the > | > | top, place the cursor within it and see the background and frame > | > | change. > | > | > | > | If the note is not the first item in the paragraph -> no error > | > | If the note contains just one paragraph -> no error > | > | > | > | I so far fail to see just where the logic in our drawing fails, any > | > | help appreciated. > | > | > | > | Is this bug also present in 1.4? > | > > | > This bug is caused by r13328: > | > | Am I right in suspecting that what you call a "bug" is in fact my design > | choice / visual innovation? If so, I resent it... stop calling names ;-) > > Possibly. I'd still call it a bug though. > > We should find a better solution. The Wide() thing really feels like a > hack. (And there should be no reason why a Wide() non-Wide() have to > be drawn differently.)
Attached a slightly better (less visually intrusive) solution. The logic is still the same, but now it draws a real box (with fixed dimensions) not extending to the canvas edge. It appears to work OK in my limited testing. Note that now insets within insets never go Wide, I hope Bennett is OK with that (i.e., the slower rendering that this implies). - Martin PS Getting rid of Wide() would only be possible if you have, inside insettext, access to the _maximum_ left and right edges of the contained text, rather than the _actual_ ones... do these exist? You must be able to render frame and background in consistent per-row pieces that fit together.
Index: rowpainter.C =================================================================== --- rowpainter.C (revision 14084) +++ rowpainter.C (working copy) @@ -774,7 +774,8 @@ if (sl.text() == &text && sl.pit() == pit && sl.pos() == rit->pos()) - return d < cur.depth() - 1; + // For now, allow only to make only top-level insets Wide + return d == 0; } return false; } @@ -836,8 +837,8 @@ // (if paragraph background was not cleared) if (!repaintAll && (!in_inset_alone_on_row || row_has_changed)) { - pi.pain.fillRectangle(( rowno ? 0 : x - 10 ), y - rit->ascent(), - pi.base.bv->workWidth(), rit->height(), + pi.pain.fillRectangle(10, y - rit->ascent(), + pi.base.bv->workWidth() - 40, rit->height(), text.backgroundColor()); // If outer row has changed, force nested // insets to repaint completely Index: insets/insettext.C =================================================================== --- insets/insettext.C (revision 14084) +++ insets/insettext.C (working copy) @@ -209,8 +209,7 @@ int const h = a + text_.descent() + border_; int const ww = pi.base.bv->workWidth(); if (w > ww - 40 || Wide()) { - pi.pain.line(0, y - a, ww, y - a, frameColor()); - pi.pain.line(0, y - a + h, ww, y - a + h, frameColor()); + pi.pain.rectangle(10, y - a, ww - 40, h, frameColor()); } else { pi.pain.rectangle(x, y - a, w, h, frameColor()); } @@ -225,7 +224,7 @@ int const h = a + text_.descent() + border_; int const ww = pi.base.bv->workWidth(); if (Wide()) - pi.pain.fillRectangle(0, y - a, ww, h, + pi.pain.fillRectangle(10, y - a, ww - 40, h, backgroundColor()); else pi.pain.fillRectangle(x, y - a, w, h,
signature.asc
Description: This is a digitally signed message part