- } else {
- x += cellXPos(cur.idx());
- x += tabular.textHOffset(cur.idx());
- cell(cur.idx())->drawSelection(pi, x, 0 /* ignored */);
- }
-}
-
-
-void InsetTabular::drawCellLines(Painter & pain, int x, int y,
- row_type row, idx_type cell, Change const & change) const
-{
- y = y - tabular.rowAscent(row);
- int const w = tabular.columnWidth(cell);
- int const h = tabular.rowHeight(cell);
- bool on_off = false;
- Color col = Color_tabularline;
- Color onoffcol = Color_tabularonoffline;
-
- if (change.changed()) {
- col = change.color();
- onoffcol = change.color();
- }
-
- if (!tabular.topAlreadyDrawn(cell)) {
- on_off = !tabular.topLine(cell);
- pain.line(x, y, x + w, y,
- on_off ? onoffcol : col,
- on_off ? Painter::line_onoffdash : Painter::line_solid);
- }
- on_off = !tabular.bottomLine(cell);
- pain.line(x, y + h, x + w, y + h,
- on_off ? onoffcol : col,
- on_off ? Painter::line_onoffdash : Painter::line_solid);
- if (!tabular.leftAlreadyDrawn(cell)) {
- on_off = !tabular.leftLine(cell);
- pain.line(x, y, x, y + h,
- on_off ? onoffcol : col,
- on_off ? Painter::line_onoffdash : Painter::line_solid);
- }
- on_off = !tabular.rightLine(cell);
- pain.line(x + w - tabular.interColumnSpace(cell), y,
- x + w - tabular.interColumnSpace(cell), y + h,
- on_off ? onoffcol : col,
- on_off ? Painter::line_onoffdash : Painter::line_solid);
+ }
+ // FIXME: This code has no effect because InsetTableCell does not handle
+ // drawSelection other than the trivial implementation in Inset.
+ //else {
+ // x += cellXPos(cur.idx());
+ // x += tabular.textHOffset(cur.idx());
+ // cell(cur.idx())->drawSelection(pi, x, 0 /* ignored */);
+ //}
+}
+
+
+void InsetTabular::drawCellLines(PainterInfo & pi, int x, int y,
+ row_type row, idx_type cell) const
+{
+ y -= tabular.rowAscent(row);
+ int const w = tabular.cellWidth(cell);
+ int const h = tabular.cellHeight(cell);
+ Color const linecolor = pi.textColor(Color_tabularline);
+ Color const gridcolor = pi.textColor(Color_tabularonoffline);
+
+ // Top
+ bool drawline = tabular.topLine(cell)
+ || (row > 0 && tabular.bottomLine(tabular.cellAbove(cell)));
+ pi.pain.line(x, y, x + w, y,
+ drawline ? linecolor : gridcolor,
+ drawline ? Painter::line_solid : Painter::line_onoffdash);
+
+ // Bottom
+ drawline = tabular.bottomLine(cell);
+ pi.pain.line(x, y + h, x + w, y + h,
+ drawline ? linecolor : gridcolor,
+ drawline ? Painter::line_solid : Painter::line_onoffdash);
+
+ // Left
+ col_type const col = tabular.cellColumn(cell);
+ drawline = tabular.leftLine(cell)
+ || (col > 0 && tabular.rightLine(tabular.cellIndex(row, col - 1)));
+ pi.pain.line(x, y, x, y + h,
+ drawline ? linecolor : gridcolor,
+ drawline ? Painter::line_solid : Painter::line_onoffdash);
+
+ // Right
+ x -= tabular.interColumnSpace(cell);
+ col_type next_cell_col = col + 1;
+ while (next_cell_col < tabular.ncols()
+ && tabular.isMultiColumn(tabular.cellIndex(row, next_cell_col)))
+ next_cell_col++;
+ drawline = tabular.rightLine(cell)
+ || (next_cell_col < tabular.ncols()
+ && tabular.leftLine(tabular.cellIndex(row, next_cell_col)));
+ pi.pain.line(x + w, y, x + w, y + h,
+ drawline ? linecolor : gridcolor,
+ drawline ? Painter::line_solid : Painter::line_onoffdash);