]> git.lyx.org Git - lyx.git/commitdiff
* InsetCollapsable::metrics(): it seems we don't need to refit anymore. Saves an...
authorAbdelrazak Younes <younes@lyx.org>
Sat, 1 Sep 2007 09:24:20 +0000 (09:24 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Sat, 1 Sep 2007 09:24:20 +0000 (09:24 +0000)
* TextMetrics::drawParagraph(): force full repaint on Insets that are within the current repainting row.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19968 a592a061-630c-0410-9148-cb99ea01b6c8

src/TextMetrics.cpp
src/insets/InsetCollapsable.cpp

index 81a9626966eab4803946b10b1e62f1e0368a9d88..d9b3bb8cbd70733508a0c6def22e32908eae8857 100644 (file)
@@ -1027,21 +1027,27 @@ void TextMetrics::drawParagraph(PainterInfo & pi, pit_type pit, int x, int y) co
                // changed.
                // Clear background of this row
                // (if paragraph background was not cleared)
-               if (!pi.full_repaint && row_has_changed)
+               if (!pi.full_repaint && row_has_changed) {
                        pi.pain.fillRectangle(x, y - rit->ascent(),
                        width(), rit->height(),
                        text_->backgroundColor());
+               }
 
                // Instrumentation for testing row cache (see also
                // 12 lines lower):
                if (lyxerr.debugging(Debug::PAINTING)) {
                        if (text_->isMainText(bv_->buffer()))
-                               LYXERR(Debug::PAINTING) << "{" <<
-                               pi.full_repaint << row_has_changed << "}";
+                               LYXERR(Debug::PAINTING) << "\n{" <<
+                               pi.full_repaint << row_has_changed << "}  ";
                        else
                                LYXERR(Debug::PAINTING) << "[" <<
                                pi.full_repaint << row_has_changed << "]";
                }
+
+               // Backup full_repaint status and force full repaint
+               // for inner insets as the Row has been cleared out.
+               bool tmp = pi.full_repaint;
+               pi.full_repaint = true;
                rp.paintAppendix();
                rp.paintDepthBar();
                rp.paintChangeBar();
@@ -1051,6 +1057,8 @@ void TextMetrics::drawParagraph(PainterInfo & pi, pit_type pit, int x, int y) co
                if (rit + 1 == re)
                        rp.paintLast();
                y += rit->descent();
+               // Restore full_repaint status.
+               pi.full_repaint = tmp;
        }
        // Re-enable screen drawing for future use of the painter.
        pi.pain.setDrawingEnabled(true);
index 85b7e105104c3474030aef6c72a2542e9d98927e..54a4fc83b3d7e9ee1d24484365be33639df5e01b 100644 (file)
@@ -213,13 +213,7 @@ bool InsetCollapsable::metrics(MetricsInfo & mi, Dimension & dim) const
                        openinlined_ = !hasFixedWidth()
                                && textdim_.wid < 0.5 * mi.base.bv->workWidth();
                        if (openinlined_) {
-                               // FIXME: this is not ideal but we need to clear it
-                               // out because the Row::changed() status is reset.
-                               mi.base.bv->textMetrics(&text_).clear();
-                               // Correct for button width, and re-fit
-                               mi.base.textwidth -= dim.wid;
-                               InsetText::metrics(mi, textdim_);
-                               mi.base.textwidth += dim.wid;
+                               // Correct for button width.
                                dim.wid += textdim_.wid;
                                dim.des = max(dim.des - textdim_.asc + dim.asc, textdim_.des);
                                dim.asc = textdim_.asc;
@@ -336,7 +330,7 @@ void InsetCollapsable::draw(PainterInfo & pi, int x, int y) const
                                s, font, Color::none, Color::none);
                }
 
-               // a visual cue when the cursor is inside the inset
+               // a visual clue when the cursor is inside the inset
                Cursor & cur = pi.base.bv->cursor();
                if (cur.isInside(this)) {
                        y -= ascent();