[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:

------------------------------------------------------------------------
r13328 | vermeer | 2006-03-10 17:10:35 +0100 (Fri, 10 Mar 2006) | 1
line

Fix bug 2195: Slowness in rendering inside insets, especially on the
Mac
------------------------------------------------------------------------

I think this should be reverted, and a better solution found.
Probably not all of it, but at least the InsetText::Wide part.
(removing just that fixes the bug I see)

Martin, what am I forgetting?

Index: src/insets/insettext.h
===================================================================
--- src/insets/insettext.h      (revision 14067)
+++ src/insets/insettext.h      (working copy)
@@ -140,8 +140,6 @@
        ///
        InsetText(InsetText const &);
        ///
-       bool & Wide() const { return wide_inset_; }
-       ///
        bool const Tall() const;
        ///
        void forceParagraphsToDefault(LCursor & cur);
@@ -166,8 +164,6 @@
        mutable lyx::pit_type old_pit;
        ///
        static int border_;
-       ///
-       mutable bool wide_inset_;
 public:
        ///
        mutable LyXText text_;
Index: src/insets/insettext.C
===================================================================
--- src/insets/insettext.C      (revision 14067)
+++ src/insets/insettext.C      (working copy)
@@ -208,7 +208,7 @@
                int const a = text_.ascent() + border_;
                int const h = a + text_.descent() + border_;
                int const ww = pi.base.bv->workWidth();
-               if (w > ww - 40 || Wide())  {
+               if (w > ww - 40)  {
                        pi.pain.line(0, y - a, ww, y - a, frameColor());
                        pi.pain.line(0, y - a + h, ww, y - a + h, frameColor());
                } else {
@@ -223,13 +223,8 @@
        int const w = text_.width() + 2 * border_;
        int const a = text_.ascent() + border_;
        int const h = a + text_.descent() + border_;
-       int const ww = pi.base.bv->workWidth();
-       if (Wide())
-               pi.pain.fillRectangle(0, y - a, ww, h,
-                       backgroundColor());
-       else
-               pi.pain.fillRectangle(x, y - a, w, h,
-                       backgroundColor());
+       pi.pain.fillRectangle(x, y - a, w, h,
+                             backgroundColor());
        text_.drawSelection(pi, x, y);
 }
 
Index: src/rowpainter.C
===================================================================
--- src/rowpainter.C    (revision 14067)
+++ src/rowpainter.C    (working copy)
@@ -166,11 +166,10 @@
        pi.erased_ = erased_ || isDeletedText(par_, pos);
        theCoords.insets().add(inset, int(x_), yo_);
        InsetText const * const in = inset->asTextInset();
-       // non-wide insets are painted completely. Recursive
        bool tmp = bv_.repaintAll();
-       if (!in || !in->Wide()) {
+       if (!in) {
                bv_.repaintAll(true);
-               lyxerr[Debug::PAINTING] << endl << "Paint inset fully" << endl;
+               lyxerr[Debug::PAINTING] << "Paint inset fully" << endl;
        }
        if (bv_.repaintAll())
                inset->drawSelection(pi, int(x_), yo_);
@@ -780,9 +779,9 @@
 }
 
 
-void paintPar
-       (PainterInfo & pi, LyXText const & text, pit_type pit, int x, int y,
-        bool repaintAll)
+void paintPar(PainterInfo & pi, LyXText const & text,
+             pit_type pit, int x, int y,
+             bool repaintAll)
 {
 //     lyxerr << "  paintPar: pit: " << pit << " at y: " << y << endl;
        static NullPainter nop;
@@ -811,17 +810,6 @@
                bool in_inset_alone_on_row = innerCursorOnRow(pi, pit, rit,
                        text);
 
-               // If this is the only object on the row, we can make it wide
-               for (pos_type i = rit->pos() ; i != rit->endpos(); ++i) {
-                       InsetBase const * const in = par.getInset(i);
-                       if (in) {
-                               InsetText const * const t = in->asTextInset();
-                               if (t)
-                                       t->Wide() = in_inset_alone_on_row &&
-                                                   t->Tall();
-                       }
-               }
-
                // If selection is on, the current row signature differs
                // from cache, or cursor is inside an inset _on this row_,
                // then paint the row

-- 
        Lgb

Reply via email to