bit of clean up

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33522 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Edwin Leuven 2010-02-19 22:00:54 +00:00
parent 4db2685cbe
commit 3c765c6bc5
2 changed files with 10 additions and 35 deletions

View File

@ -867,32 +867,6 @@ bool Tabular::rightLine(idx_type cell) const
} }
bool Tabular::topAlreadyDrawn(idx_type cell) const
{
row_type const row = cellRow(cell);
if (row == 0)
return false;
return !rowTopLine(row) && bottomLine(cellAbove(cell));
}
bool Tabular::leftAlreadyDrawn(idx_type cell) const
{
col_type col = cellColumn(cell);
if (col == 0)
return false;
idx_type i = cellIndex(cellRow(cell), col - 1);
return rightLine(i) && !leftLine(cell);
}
bool Tabular::isLastRow(idx_type cell) const
{
return cellRow(cell) == row_info.size() - 1;
}
int Tabular::interRowSpace(row_type row) const int Tabular::interRowSpace(row_type row) const
{ {
if (!row || row >= row_info.size()) if (!row || row >= row_info.size())
@ -3460,7 +3434,10 @@ void InsetTabular::drawCellLines(Painter & pain, int x, int y,
onoffcol = change.color(); onoffcol = change.color();
} }
if (!tabular.topAlreadyDrawn(cell)) { bool topalreadydrawn = row > 0 && !tabular.rowTopLine(row)
&& tabular.bottomLine(tabular.cellAbove(cell));
if (!topalreadydrawn) {
on_off = !tabular.topLine(cell); on_off = !tabular.topLine(cell);
pain.line(x, y, x + w, y, pain.line(x, y, x + w, y,
on_off ? onoffcol : col, on_off ? onoffcol : col,
@ -3470,7 +3447,12 @@ void InsetTabular::drawCellLines(Painter & pain, int x, int y,
pain.line(x, y + h, x + w, y + h, pain.line(x, y + h, x + w, y + h,
on_off ? onoffcol : col, on_off ? onoffcol : col,
on_off ? Painter::line_onoffdash : Painter::line_solid); on_off ? Painter::line_onoffdash : Painter::line_solid);
if (!tabular.leftAlreadyDrawn(cell)) {
col_type const column = tabular.cellColumn(cell);
bool leftalreadydrawn = column > 0 && !tabular.leftLine(cell)
&& tabular.rightLine(tabular.cellIndex(row, column - 1));
if (!leftalreadydrawn) {
on_off = !tabular.leftLine(cell); on_off = !tabular.leftLine(cell);
pain.line(x, y, x, y + h, pain.line(x, y, x, y + h,
on_off ? onoffcol : col, on_off ? onoffcol : col,

View File

@ -272,13 +272,6 @@ public:
/// Returns true if there is a topline, returns false if not /// Returns true if there is a topline, returns false if not
bool rightLine(idx_type cell) const; bool rightLine(idx_type cell) const;
///
bool topAlreadyDrawn(idx_type cell) const;
///
bool leftAlreadyDrawn(idx_type cell) const;
///
bool isLastRow(idx_type cell) const;
/// return space occupied by the second horizontal line and /// return space occupied by the second horizontal line and
/// interline space above row \p row in pixels /// interline space above row \p row in pixels
int interRowSpace(row_type row) const; int interRowSpace(row_type row) const;