mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 21:40:19 +00:00
* insettabular.C (drawSelection): initialize cell background
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14141 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
1ec4d26038
commit
40d8a3cce5
@ -332,6 +332,36 @@ void InsetTabular::drawSelection(PainterInfo & pi, int x, int y) const
|
||||
setPosCache(pi, x, y);
|
||||
|
||||
LCursor & cur = pi.base.bv->cursor();
|
||||
|
||||
x += scx_ + ADD_TO_TABULAR_WIDTH;
|
||||
|
||||
// Here we take the cursor slice that is the tabular.
|
||||
lyx::size_type d = 0;
|
||||
bool found = false;
|
||||
for (; d < cur.depth(); d++) {
|
||||
if (ptr_cmp(&cur[d].inset(), this)) {
|
||||
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())
|
||||
return;
|
||||
if (!ptr_cmp(&cur.inset(), this))
|
||||
@ -339,7 +369,6 @@ void InsetTabular::drawSelection(PainterInfo & pi, int x, int y) const
|
||||
|
||||
//resetPos(cur);
|
||||
|
||||
x += scx_ + ADD_TO_TABULAR_WIDTH;
|
||||
|
||||
if (tablemode(cur)) {
|
||||
row_type rs, re;
|
||||
|
Loading…
Reference in New Issue
Block a user