Disentangle InsetTabular::drawSelection and InsetTabular::drawBackground().

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36484 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2010-11-25 13:08:26 +00:00
parent 340b1b0473
commit 3c5b30a8ea
3 changed files with 14 additions and 10 deletions

View File

@ -3509,7 +3509,7 @@ void InsetTabular::draw(PainterInfo & pi, int x, int y) const
Cursor & cur = pi.base.bv->cursor();
resetPos(cur);
// FIXME: As the full background is painted in drawSelection(),
// FIXME: As the full background is painted in drawBackground(),
// we have no choice but to do a full repaint for the Text cells.
pi.full_repaint = true;
@ -3551,6 +3551,15 @@ void InsetTabular::draw(PainterInfo & pi, int x, int y) const
}
void InsetTabular::drawBackground(PainterInfo & pi, int x, int y) const
{
x += scx_ + ADD_TO_TABULAR_WIDTH;
y -= tabular.rowAscent(0);
pi.pain.fillRectangle(x, y, tabular.width(), tabular.height(),
pi.backgroundColor(this));
}
void InsetTabular::drawSelection(PainterInfo & pi, int x, int y) const
{
Cursor & cur = pi.base.bv->cursor();
@ -3558,15 +3567,6 @@ void InsetTabular::drawSelection(PainterInfo & pi, int x, int y) const
x += scx_ + ADD_TO_TABULAR_WIDTH;
// FIXME: it is wrong to completely paint the background
// if we want to do single row painting.
// Paint background of current tabular
int const w = tabular.width();
int const h = tabular.height();
int yy = y - tabular.rowAscent(0);
pi.pain.fillRectangle(x, yy, w, h, pi.backgroundColor(this));
if (!cur.selection())
return;
if (&cur.inset() != this)

View File

@ -783,6 +783,8 @@ public:
///
void drawSelection(PainterInfo & pi, int x, int y) const;
///
void drawBackground(PainterInfo & pi, int x, int y) const;
///
bool editable() const { return true; }
///
bool hasSettings() const { return true; }

View File

@ -114,6 +114,8 @@ void RowPainter::paintInset(Inset const * inset, pos_type const pos)
int const x1 = int(x_);
pi_.base.bv->coordCache().insets().add(inset, x1, yo_);
// insets are painted completely. Recursive
// FIXME: it is wrong to completely paint the background
// if we want to do single row painting.
inset->drawBackground(pi_, x1, yo_);
inset->drawSelection(pi_, x1, yo_);
inset->draw(pi_, x1, yo_);