* 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
This commit is contained in:
Abdelrazak Younes 2007-09-01 09:24:20 +00:00
parent 7a6edab5c1
commit fb74d5a476
2 changed files with 13 additions and 11 deletions

View 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);

View 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();