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
This commit is contained in:
André Pönitz 2003-07-28 18:40:05 +00:00
parent 8ea43a75e2
commit b83d39ce33
5 changed files with 24 additions and 20 deletions

View File

@ -10,10 +10,10 @@
* Splash screen code added by Angus Leeming
*/
#include <config.h>
#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);

View File

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

View File

@ -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;
}
}

View File

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

View File

@ -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;
}