mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-01 21:45:23 +00:00
Draw top/bottom rules heavier for booktab
This gives a better idea of the TeX output, even though the width are not correct.
This commit is contained in:
parent
76512a7569
commit
8651cd89f6
@ -4211,35 +4211,43 @@ void InsetTabular::drawSelection(PainterInfo & pi, int x, int y) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
void tabline(PainterInfo const & pi, int x1, int y1, int x2, int y2,
|
||||||
|
bool drawline, bool heavy = false)
|
||||||
|
{
|
||||||
|
ColorCode const col = drawline ? Color_tabularline : Color_tabularonoffline;
|
||||||
|
pi.pain.line(x1, y1, x2, y2, pi.textColor(col),
|
||||||
|
drawline ? Painter::line_solid : Painter::line_onoffdash,
|
||||||
|
(heavy ? 2 : 1) * Painter::thin_line);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetTabular::drawCellLines(PainterInfo & pi, int x, int y,
|
void InsetTabular::drawCellLines(PainterInfo & pi, int x, int y,
|
||||||
row_type row, idx_type cell) const
|
row_type row, idx_type cell) const
|
||||||
{
|
{
|
||||||
y -= tabular.rowAscent(row);
|
y -= tabular.rowAscent(row);
|
||||||
int const w = tabular.cellWidth(cell);
|
int const w = tabular.cellWidth(cell);
|
||||||
int const h = tabular.cellHeight(cell);
|
int const h = tabular.cellHeight(cell);
|
||||||
Color const linecolor = pi.textColor(Color_tabularline);
|
|
||||||
Color const gridcolor = pi.textColor(Color_tabularonoffline);
|
|
||||||
|
|
||||||
// Top
|
// Top
|
||||||
bool drawline = tabular.topLine(cell)
|
bool drawline = tabular.topLine(cell)
|
||||||
|| (row > 0 && tabular.bottomLine(tabular.cellAbove(cell)));
|
|| (row > 0 && tabular.bottomLine(tabular.cellAbove(cell)));
|
||||||
pi.pain.line(x, y, x + w, y,
|
bool heavy = tabular.use_booktabs && row == 0 && tabular.topLine(cell);
|
||||||
drawline ? linecolor : gridcolor,
|
tabline(pi, x, y, x + w, y, drawline, heavy);
|
||||||
drawline ? Painter::line_solid : Painter::line_onoffdash);
|
|
||||||
|
|
||||||
// Bottom
|
// Bottom
|
||||||
drawline = tabular.bottomLine(cell);
|
drawline = tabular.bottomLine(cell);
|
||||||
pi.pain.line(x, y + h, x + w, y + h,
|
heavy = tabular.use_booktabs && row == tabular.nrows() - 1 && drawline;
|
||||||
drawline ? linecolor : gridcolor,
|
tabline(pi, x, y + h, x + w, y + h, drawline, heavy);
|
||||||
drawline ? Painter::line_solid : Painter::line_onoffdash);
|
|
||||||
|
|
||||||
// Left
|
// Left
|
||||||
col_type const col = tabular.cellColumn(cell);
|
col_type const col = tabular.cellColumn(cell);
|
||||||
drawline = tabular.leftLine(cell)
|
drawline = tabular.leftLine(cell)
|
||||||
|| (col > 0 && tabular.rightLine(tabular.cellIndex(row, col - 1)));
|
|| (col > 0 && tabular.rightLine(tabular.cellIndex(row, col - 1)));
|
||||||
pi.pain.line(x, y, x, y + h,
|
tabline(pi, x, y, x, y + h, drawline);
|
||||||
drawline ? linecolor : gridcolor,
|
|
||||||
drawline ? Painter::line_solid : Painter::line_onoffdash);
|
|
||||||
|
|
||||||
// Right
|
// Right
|
||||||
x -= tabular.interColumnSpace(cell);
|
x -= tabular.interColumnSpace(cell);
|
||||||
@ -4250,9 +4258,7 @@ void InsetTabular::drawCellLines(PainterInfo & pi, int x, int y,
|
|||||||
drawline = tabular.rightLine(cell)
|
drawline = tabular.rightLine(cell)
|
||||||
|| (next_cell_col < tabular.ncols()
|
|| (next_cell_col < tabular.ncols()
|
||||||
&& tabular.leftLine(tabular.cellIndex(row, next_cell_col)));
|
&& tabular.leftLine(tabular.cellIndex(row, next_cell_col)));
|
||||||
pi.pain.line(x + w, y, x + w, y + h,
|
tabline(pi, x + w, y, x + w, y + h, drawline);
|
||||||
drawline ? linecolor : gridcolor,
|
|
||||||
drawline ? Painter::line_solid : Painter::line_onoffdash);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user