From: Abdelrazak Younes Date: Sat, 1 Sep 2007 09:24:20 +0000 (+0000) Subject: * InsetCollapsable::metrics(): it seems we don't need to refit anymore. Saves an... X-Git-Tag: 1.6.10~8577 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=fb74d5a4763e2c0e76de63bc6b8cc94b8acd603f;p=lyx.git * InsetCollapsable::metrics(): it seems we don't need to refit anymore. Saves an InsetText::metrics() call and enable single Row painting within opened inline insets. * 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 --- diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp index 81a9626966..d9b3bb8cbd 100644 --- a/src/TextMetrics.cpp +++ b/src/TextMetrics.cpp @@ -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); diff --git a/src/insets/InsetCollapsable.cpp b/src/insets/InsetCollapsable.cpp index 85b7e10510..54a4fc83b3 100644 --- a/src/insets/InsetCollapsable.cpp +++ b/src/insets/InsetCollapsable.cpp @@ -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();