fix crash with proof-type box markers

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3245 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2001-12-19 13:59:38 +00:00
parent 03a76a07ce
commit 721b2b3972
2 changed files with 10 additions and 6 deletions

View File

@ -1,3 +1,9 @@
2001-12-18 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* text.C (paintLastRow): use the label font instead of the font of
the last character to compute the size of *_BOX. This makes more
sense and avoids a crash with empty paragraphs.
Use Painter::rectangle to draw EMPTY_BOX.
2001-12-19 Juergen Vigna <jug@sad.it> 2001-12-19 Juergen Vigna <jug@sad.it>
* undo_funcs.C (textHandleUndo): fixed setting of inset_owner of * undo_funcs.C (textHandleUndo): fixed setting of inset_owner of

View File

@ -3510,7 +3510,7 @@ void LyXText::paintLastRow(DrawRowParams & p)
case END_LABEL_BOX: case END_LABEL_BOX:
case END_LABEL_FILLED_BOX: case END_LABEL_FILLED_BOX:
{ {
LyXFont const font = getFont(buffer, par, last); LyXFont const font = getLabelFont(buffer, par);
int const size = int(0.75 * lyxfont::maxAscent(font)); int const size = int(0.75 * lyxfont::maxAscent(font));
int const y = (p.yo + p.row->baseline()) - size; int const y = (p.yo + p.row->baseline()) - size;
int x = is_rtl ? LYX_PAPER_MARGIN : ww - LYX_PAPER_MARGIN - size; int x = is_rtl ? LYX_PAPER_MARGIN : ww - LYX_PAPER_MARGIN - size;
@ -3519,12 +3519,10 @@ void LyXText::paintLastRow(DrawRowParams & p)
x += (size - p.row->fill() + 1) * (is_rtl ? -1 : 1); x += (size - p.row->fill() + 1) * (is_rtl ? -1 : 1);
if (endlabel == END_LABEL_BOX) { if (endlabel == END_LABEL_BOX) {
p.pain->line(x, y, x, y + size, LColor::eolmarker); p.pain->rectangle(x, y, size, size, LColor::eolmarker);
p.pain->line(x + size, y, x + size , y + size, LColor::eolmarker);
p.pain->line(x, y, x + size, y, LColor::eolmarker);
p.pain->line(x, y + size, x + size, y + size, LColor::eolmarker);
} else { } else {
p.pain->fillRectangle(x, y, size, size, LColor::eolmarker); p.pain->fillRectangle(x, y, size, size,
LColor::eolmarker);
} }
break; break;
} }