From b83d39ce33d8f624db4610e0edc97fe1ff5f141d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Mon, 28 Jul 2003 18:40:05 +0000 Subject: [PATCH] move row loop for drawing from screen.C and insettext.C to rowpainter.C git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7423 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/screen.C | 12 +++--------- src/insets/insettext.C | 9 ++------- src/rowpainter.C | 14 ++++++++++++++ src/rowpainter.h | 7 ++++--- src/text2.C | 2 +- 5 files changed, 24 insertions(+), 20 deletions(-) diff --git a/src/frontends/screen.C b/src/frontends/screen.C index 6a7c2b83a0..5b05f4e502 100644 --- a/src/frontends/screen.C +++ b/src/frontends/screen.C @@ -10,10 +10,10 @@ * Splash screen code added by Angus Leeming */ - #include #include "screen.h" + #include "lyxtext.h" #include "lyxrc.h" #include "lyxrow.h" @@ -465,16 +465,10 @@ void LyXScreen::drawFromTo(LyXText * text, BufferView * bv, // draw it RowList::iterator const rend = text->rows().end(); int yf = y; - while (rit != rend && yf < y2) { - paintRows(*bv, *text, rit, - y + yo, xo, y + topy); - y += rit->height(); - yf += rit->height(); - ++rit; - } + paintRows2(*bv, *text, rit, rend, xo, y, yf, y2, yo); // maybe we have to clear the screen at the bottom - if ((y < y2) && !text->isInInset()) { + if (y < y2 && !text->isInInset()) { workarea().getPainter().fillRectangle(0, y, workarea().workWidth(), y2 - y, LColor::bottomarea); diff --git a/src/insets/insettext.C b/src/insets/insettext.C index 128065ebe6..addaed18b4 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -364,14 +364,9 @@ void InsetText::draw(PainterInfo & pi, int x, int baseline) const int yf = y_offset + first; y = 0; + int yo = y_offset + first; - while (rit != end && yf < y2) { - paintRows(*bv, text_, rit, - y + y_offset + first, x, y + text_.top_y()); - y += rit->height(); - yf += rit->height(); - ++rit; - } + paintRows2(*bv, text_, rit, end, x, y, yf, y2, yo); text_.clearPaint(); diff --git a/src/rowpainter.C b/src/rowpainter.C index 4357cfb271..52237e9af1 100644 --- a/src/rowpainter.C +++ b/src/rowpainter.C @@ -1092,3 +1092,17 @@ void paintRows(BufferView const & bv, LyXText const & text, RowPainter painter(bv, text, rit, y_offset, x_offset, y); painter.paint(); } + + +void paintRows2(BufferView const & bv, LyXText const & text, + RowList::iterator rit, RowList::iterator end, + int xo, int & y, int yf, int y2, int yo) +{ + while (rit != end && yf < y2) { + paintRows(bv, text, rit, y + yo, xo, y + text.top_y()); + y += rit->height(); + yf += rit->height(); + ++rit; + } +} + diff --git a/src/rowpainter.h b/src/rowpainter.h index 4d58ab5f04..1dcc2474c7 100644 --- a/src/rowpainter.h +++ b/src/rowpainter.h @@ -21,9 +21,10 @@ class LyXText; class BufferView; class VSpace; -/// initialise painter and paint the row -void paintRows(BufferView const & bv, LyXText const & text, - RowList::iterator rit, int y_offset, int x_offset, int y); +/// initialise painter and paint the rows +void paintRows2(BufferView const & bv, LyXText const & text, + RowList::iterator rit, RowList::iterator end, + int xo, int & y, int yf, int y2, int yo); /// return the pixel height of a space marker before/after a par int getLengthMarkerHeight(BufferView const & bv, VSpace const & vsp); diff --git a/src/text2.C b/src/text2.C index e5b7120953..1ce87ebd57 100644 --- a/src/text2.C +++ b/src/text2.C @@ -1738,7 +1738,7 @@ LyXText::getColumnNearX(RowList::iterator rit, int & x, bool & boundary) const // check for empty row if (!rit_par->size()) { - x = tmpx; + x = int(tmpx); return 0; } -- 2.39.2