Fix drawing of horizontal line and page break.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20480 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-09-25 07:07:11 +00:00
parent 82d3607f05
commit 4b649e746a
2 changed files with 10 additions and 3 deletions

View File

@ -46,12 +46,15 @@ void InsetLine::metrics(MetricsInfo & mi, Dimension & dim) const
dim.asc = 3;
dim.des = 3;
dim.wid = mi.base.textwidth;
// Cache the inset dimension.
setDimCache(mi, dim);
}
void InsetLine::draw(PainterInfo & pi, int x, int y) const
{
pi.pain.line(x, y, x + pi.base.textwidth, y, Color::topline,
Dimension const dim = dimension(*pi.base.bv);
pi.pain.line(x, y, x + dim.wid, y, Color::topline,
Painter::line_solid, Painter::line_thick);
}

View File

@ -46,6 +46,8 @@ void InsetPagebreak::metrics(MetricsInfo & mi, Dimension & dim) const
dim.asc = defaultRowHeight();
dim.des = defaultRowHeight();
dim.wid = mi.base.textwidth;
// Cache the inset dimension.
setDimCache(mi, dim);
}
@ -55,12 +57,14 @@ void InsetPagebreak::draw(PainterInfo & pi, int x, int y) const
font.setColor(Color::pagebreak);
font.decSize();
Dimension const dim = dimension(*pi.base.bv);
int w = 0;
int a = 0;
int d = 0;
theFontMetrics(font).rectText(insetLabel(), w, a, d);
int const text_start = int(x + (pi.base.textwidth - w) / 2);
int const text_start = int(x + (dim.wid - w) / 2);
int const text_end = text_start + w;
pi.pain.rectText(text_start, y + d, insetLabel(), font,
@ -68,7 +72,7 @@ void InsetPagebreak::draw(PainterInfo & pi, int x, int y) const
pi.pain.line(x, y, text_start, y,
Color::pagebreak, Painter::line_onoffdash);
pi.pain.line(text_end, y, int(x + pi.base.textwidth), y,
pi.pain.line(text_end, y, int(x + dim.wid), y,
Color::pagebreak, Painter::line_onoffdash);
}