* insettabular.C (drawSelection): revision of previous patch:

initialize table background



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14158 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Martin Vermeer 2006-06-20 10:44:49 +00:00
parent 6aa29e1b9d
commit 2e590eeee4

View File

@ -337,32 +337,11 @@ void InsetTabular::drawSelection(PainterInfo & pi, int x, int y) const
x += scx_ + ADD_TO_TABULAR_WIDTH; x += scx_ + ADD_TO_TABULAR_WIDTH;
// Here we take the cursor slice that is the tabular. // Paint background of current tabular
lyx::size_type d = 0; int const w = tabular.getWidthOfTabular();
bool found = false; int const h = tabular.getHeightOfTabular();
for (; d < cur.depth(); d++) { int yy = y - tabular.getAscentOfRow(0);
if (ptr_cmp(&cur[d].inset(), this)) { pi.pain.fillRectangle(x, yy, w, h, backgroundColor());
found = true;
break;
}
}
if (found) {
CursorSlice const & sl = cur[d];
// Paint background of current cell
int const w = tabular.getWidthOfColumn(sl.idx());
int yy = y - tabular.getAscentOfRow(0) + ADD_TO_HEIGHT;
row_type j = 0;
for (; tabular.getCellNumber(j, tabular.columns() - 1) < sl.idx(); ++j) {
int const a = tabular.getAscentOfRow(j);
int const h = a + tabular.getDescentOfRow(j);
yy += h;
yy += tabular.getAdditionalHeight(j + 1);
}
int const h = tabular.getAscentOfRow(j) + tabular.getDescentOfRow(j);
pi.pain.fillRectangle(x + getCellXPos(sl.idx()), yy, w, h,
backgroundColor());
}
if (!cur.selection()) if (!cur.selection())
return; return;