mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-06 00:10:59 +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)
|
int y1, int y2, int yo, int xo)
|
||||||
{
|
{
|
||||||
lyxerr[Debug::GUI] << "screen: drawFromTo " << y1 << '-' << y2 << endl;
|
lyxerr[Debug::GUI] << "screen: drawFromTo " << y1 << '-' << y2 << endl;
|
||||||
|
hideCursor();
|
||||||
|
|
||||||
int const topy = text->top_y();
|
int const topy = text->top_y();
|
||||||
int y_text = topy + y1;
|
int y_text = topy + y1;
|
||||||
RowList::iterator rit = text->getRowNearY(y_text);
|
RowList::iterator rit = text->getRowNearY(y_text);
|
||||||
int y = y_text - topy;
|
int y = y_text - topy;
|
||||||
// y1 is now the real beginning of row on the screen
|
|
||||||
|
|
||||||
hideCursor();
|
y = paintRows(*bv, *text, rit, xo, y, y, y2, yo);
|
||||||
|
|
||||||
#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);
|
|
||||||
|
|
||||||
// maybe we have to clear the screen at the bottom
|
// maybe we have to clear the screen at the bottom
|
||||||
if (y < y2 && !text->isInInset()) {
|
if (y < y2 && !text->isInInset()) {
|
||||||
|
@ -362,22 +362,18 @@ void InsetText::draw(PainterInfo & pi, int x, int baseline) const
|
|||||||
first = 0;
|
first = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int yf = y_offset + first;
|
|
||||||
y = 0;
|
|
||||||
int yo = y_offset + first;
|
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();
|
text_.clearPaint();
|
||||||
|
|
||||||
if (drawFrame_ == ALWAYS || (drawFrame_ == LOCKED && locked)) {
|
if (drawFrame_ == ALWAYS || (drawFrame_ == LOCKED && locked))
|
||||||
drawFrame(pain, int(start_x));
|
drawFrame(pain, int(start_x));
|
||||||
}
|
|
||||||
|
|
||||||
if (need_update != INIT) {
|
if (need_update != INIT)
|
||||||
need_update = NONE;
|
need_update = NONE;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void InsetText::drawFrame(Painter & pain, int x) const
|
void InsetText::drawFrame(Painter & pain, int x) const
|
||||||
|
@ -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)
|
RowList::iterator rit, int y_offset, int x_offset, int y)
|
||||||
{
|
{
|
||||||
// fix up missing metrics() call for main LyXText
|
// 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,
|
int paintRows(BufferView const & bv, LyXText const & text,
|
||||||
RowList::iterator rit, RowList::iterator end,
|
RowList::iterator rit, int xo, int y, int yf, int y2, int yo)
|
||||||
int xo, int & y, int yf, int y2, int yo)
|
|
||||||
{
|
{
|
||||||
|
RowList::iterator end = text.rows().end();
|
||||||
while (rit != end && yf < y2) {
|
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();
|
y += rit->height();
|
||||||
yf += rit->height();
|
yf += rit->height();
|
||||||
++rit;
|
++rit;
|
||||||
}
|
}
|
||||||
|
return y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,10 +21,10 @@ class LyXText;
|
|||||||
class BufferView;
|
class BufferView;
|
||||||
class VSpace;
|
class VSpace;
|
||||||
|
|
||||||
/// initialise painter and paint the rows
|
/// paint the rows
|
||||||
void paintRows2(BufferView const & bv, LyXText const & text,
|
// return last used y
|
||||||
RowList::iterator rit, RowList::iterator end,
|
int paintRows(BufferView const & bv, LyXText const & text,
|
||||||
int xo, int & y, int yf, int y2, int yo);
|
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
|
/// return the pixel height of a space marker before/after a par
|
||||||
int getLengthMarkerHeight(BufferView const & bv, VSpace const & vsp);
|
int getLengthMarkerHeight(BufferView const & bv, VSpace const & vsp);
|
||||||
|
Loading…
Reference in New Issue
Block a user