mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 21:21:32 +00:00
slimmer interface to paintrows
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7425 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
83b7a0b72a
commit
b6c4462095
@ -444,28 +444,14 @@ void LyXScreen::drawFromTo(LyXText * text, BufferView * bv,
|
||||
int y1, int y2, int yo, int xo)
|
||||
{
|
||||
lyxerr[Debug::GUI] << "screen: drawFromTo " << y1 << '-' << y2 << endl;
|
||||
hideCursor();
|
||||
|
||||
int const topy = text->top_y();
|
||||
int y_text = topy + y1;
|
||||
RowList::iterator rit = text->getRowNearY(y_text);
|
||||
int y = y_text - topy;
|
||||
// y1 is now the real beginning of row on the screen
|
||||
|
||||
hideCursor();
|
||||
|
||||
#if 0
|
||||
// some day it should look like that:
|
||||
// redo metrics
|
||||
Dimension dim;
|
||||
LyXFont font;
|
||||
MetricsInfo mi(bv, font, workarea().workWidth());
|
||||
text->metrics(mi, dim);
|
||||
#endif
|
||||
|
||||
// draw it
|
||||
RowList::iterator const rend = text->rows().end();
|
||||
int yf = y;
|
||||
paintRows2(*bv, *text, rit, rend, xo, y, yf, y2, yo);
|
||||
y = paintRows(*bv, *text, rit, xo, y, y, y2, yo);
|
||||
|
||||
// maybe we have to clear the screen at the bottom
|
||||
if (y < y2 && !text->isInInset()) {
|
||||
|
@ -362,21 +362,17 @@ void InsetText::draw(PainterInfo & pi, int x, int baseline) const
|
||||
first = 0;
|
||||
}
|
||||
|
||||
int yf = y_offset + first;
|
||||
y = 0;
|
||||
int yo = y_offset + first;
|
||||
|
||||
paintRows2(*bv, text_, rit, end, x, y, yf, y2, yo);
|
||||
paintRows(*bv, text_, rit, x, 0, yo, y2, yo);
|
||||
|
||||
text_.clearPaint();
|
||||
|
||||
if (drawFrame_ == ALWAYS || (drawFrame_ == LOCKED && locked)) {
|
||||
if (drawFrame_ == ALWAYS || (drawFrame_ == LOCKED && locked))
|
||||
drawFrame(pain, int(start_x));
|
||||
}
|
||||
|
||||
if (need_update != INIT) {
|
||||
if (need_update != INIT)
|
||||
need_update = NONE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1058,7 +1058,7 @@ int getLengthMarkerHeight(BufferView const & bv, VSpace const & vsp)
|
||||
}
|
||||
|
||||
|
||||
void paintRows(BufferView const & bv, LyXText const & text,
|
||||
void paintRowsHelper(BufferView const & bv, LyXText const & text,
|
||||
RowList::iterator rit, int y_offset, int x_offset, int y)
|
||||
{
|
||||
// fix up missing metrics() call for main LyXText
|
||||
@ -1094,15 +1094,16 @@ void paintRows(BufferView const & bv, LyXText const & text,
|
||||
}
|
||||
|
||||
|
||||
void paintRows2(BufferView const & bv, LyXText const & text,
|
||||
RowList::iterator rit, RowList::iterator end,
|
||||
int xo, int & y, int yf, int y2, int yo)
|
||||
int paintRows(BufferView const & bv, LyXText const & text,
|
||||
RowList::iterator rit, int xo, int y, int yf, int y2, int yo)
|
||||
{
|
||||
RowList::iterator end = text.rows().end();
|
||||
while (rit != end && yf < y2) {
|
||||
paintRows(bv, text, rit, y + yo, xo, y + text.top_y());
|
||||
paintRowsHelper(bv, text, rit, y + yo, xo, y + text.top_y());
|
||||
y += rit->height();
|
||||
yf += rit->height();
|
||||
++rit;
|
||||
}
|
||||
return y;
|
||||
}
|
||||
|
||||
|
@ -21,10 +21,10 @@ class LyXText;
|
||||
class BufferView;
|
||||
class VSpace;
|
||||
|
||||
/// 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);
|
||||
/// paint the rows
|
||||
// return last used y
|
||||
int paintRows(BufferView const & bv, LyXText const & text,
|
||||
RowList::iterator rit, 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);
|
||||
|
Loading…
Reference in New Issue
Block a user