make the drawing loops in screen and InsetText more similar to each other

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7416 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2003-07-28 13:18:35 +00:00
parent 7a3c1708d2
commit cf9d1fb908
2 changed files with 26 additions and 24 deletions

View File

@ -464,9 +464,12 @@ void LyXScreen::drawFromTo(LyXText * text, BufferView * bv,
// draw it // draw it
RowList::iterator const rend = text->rows().end(); RowList::iterator const rend = text->rows().end();
while (rit != rend && y < y2) { int yf = y;
paintRows(*bv, *text, rit, y + yo, xo, y + topy); while (rit != rend && yf < y2) {
paintRows(*bv, *text, rit,
y + yo, xo, y + topy);
y += rit->height(); y += rit->height();
yf += rit->height();
++rit; ++rit;
} }

View File

@ -321,6 +321,8 @@ void InsetText::draw(PainterInfo & pi, int x, int baseline) const
return; return;
} }
bv->hideCursor();
if (!owner()) if (!owner())
x += scroll(); x += scroll();
@ -339,17 +341,17 @@ void InsetText::draw(PainterInfo & pi, int x, int baseline) const
x += TEXT_TO_INSET_OFFSET; x += TEXT_TO_INSET_OFFSET;
RowList::iterator rowit = text_.rows().begin(); RowList::iterator rit = text_.rows().begin();
RowList::iterator end = text_.rows().end(); RowList::iterator end = text_.rows().end();
int y_offset = baseline - rowit->ascent_of_text(); int y_offset = baseline - rit->ascent_of_text();
int ph = pain.paperHeight(); int y2 = pain.paperHeight();
int first = 0; int first = 0;
int y = y_offset; int y = y_offset;
while (rowit != end && y + rowit->height() <= 0) { while (rit != end && y + rit->height() <= 0) {
y += rowit->height(); y += rit->height();
first += rowit->height(); first += rit->height();
++rowit; ++rit;
} }
if (y_offset < 0) { if (y_offset < 0) {
text_.top_y(-y_offset); text_.top_y(-y_offset);
@ -363,14 +365,12 @@ void InsetText::draw(PainterInfo & pi, int x, int baseline) const
int yf = y_offset + first; int yf = y_offset + first;
y = 0; y = 0;
bv->hideCursor(); while (rit != end && yf < y2) {
paintRows(*bv, text_, rit,
while (rowit != end && yf < ph) { y + y_offset + first, x, y + text_.top_y());
paintRows(*bv, text_, rowit, y += rit->height();
y + y_offset + first, int(x), y + text_.top_y()); yf += rit->height();
y += rowit->height(); ++rit;
yf += rowit->height();
++rowit;
} }
text_.clearPaint(); text_.clearPaint();
@ -2145,19 +2145,18 @@ void InsetText::selectSelectedWord(BufferView * bv)
void InsetText::toggleSelection(BufferView * bv, bool kill_selection) void InsetText::toggleSelection(BufferView * bv, bool kill_selection)
{ {
if (the_locking_inset) { if (the_locking_inset)
the_locking_inset->toggleSelection(bv, kill_selection); the_locking_inset->toggleSelection(bv, kill_selection);
}
int x = top_x + TEXT_TO_INSET_OFFSET; int x = top_x + TEXT_TO_INSET_OFFSET;
RowList::iterator rowit = text_.rows().begin(); RowList::iterator rit = text_.rows().begin();
RowList::iterator end = text_.rows().end(); RowList::iterator end = text_.rows().end();
int y_offset = top_baseline - rowit->ascent_of_text(); int y_offset = top_baseline - rit->ascent_of_text();
int y = y_offset; int y = y_offset;
while ((rowit != end) && ((y + rowit->height()) <= 0)) { while (rit != end && y + rit->height() <= 0) {
y += rowit->height(); y += rit->height();
++rowit; ++rit;
} }
if (y_offset < 0) if (y_offset < 0)
y_offset = y; y_offset = y;