From 3c765c6bc51ae37c2e0ddf28c357316aa9d06216 Mon Sep 17 00:00:00 2001 From: Edwin Leuven Date: Fri, 19 Feb 2010 22:00:54 +0000 Subject: [PATCH] bit of clean up git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33522 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/insets/InsetTabular.cpp | 38 ++++++++++--------------------------- src/insets/InsetTabular.h | 7 ------- 2 files changed, 10 insertions(+), 35 deletions(-) diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp index d6213afcc3..6c628049ac 100644 --- a/src/insets/InsetTabular.cpp +++ b/src/insets/InsetTabular.cpp @@ -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 { if (!row || row >= row_info.size()) @@ -3460,7 +3434,10 @@ void InsetTabular::drawCellLines(Painter & pain, int x, int y, 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); pain.line(x, y, x + w, y, 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, on_off ? onoffcol : col, 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); pain.line(x, y, x, y + h, on_off ? onoffcol : col, diff --git a/src/insets/InsetTabular.h b/src/insets/InsetTabular.h index 8e2b20d0de..545deb080f 100644 --- a/src/insets/InsetTabular.h +++ b/src/insets/InsetTabular.h @@ -272,13 +272,6 @@ public: /// Returns true if there is a topline, returns false if not 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 /// interline space above row \p row in pixels int interRowSpace(row_type row) const;