1 /* This file is part of
2 * ======================================================
4 * LyX, The Document Processor
6 * Copyright 1995 Matthias Ettrich
7 * Copyright 1995-2001 The LyX Team.
9 * ====================================================== */
14 #pragma implementation
17 #include "BufferView.h"
21 #include "inseterror.h"
24 #include "frontends/Dialogs.h"
28 /* Error, used for the LaTeX-Error Messages */
30 InsetError::InsetError(string const & str, bool)
35 int InsetError::ascent(BufferView *, LyXFont const & font) const
38 efont.setSize(font.size()).decSize();
39 return lyxfont::maxAscent(efont) + 1;
43 int InsetError::descent(BufferView *, LyXFont const & font) const
46 efont.setSize(font.size()).decSize();
47 return lyxfont::maxDescent(efont) + 1;
51 int InsetError::width(BufferView *, LyXFont const & font) const
54 efont.setSize(font.size()).decSize();
55 return 6 + lyxfont::width(_("Error"), efont);
59 void InsetError::draw(BufferView * bv, LyXFont const & font,
60 int baseline, float & x, bool) const
62 Painter & pain = bv->painter();
64 efont.setSize(font.size()).decSize();
65 efont.setColor(LColor::error);
67 // Draw as "Error" in a framed box
69 pain.fillRectangle(int(x), baseline - ascent(bv, font) + 1,
71 ascent(bv, font) + descent(bv, font) - 2,
73 pain.rectangle(int(x), baseline - ascent(bv, font) + 1,
75 ascent(bv, font) + descent(bv, font) - 2,
77 pain.text(int(x + 2), baseline, _("Error"), efont);
79 x += width(bv, font) - 1;
83 string const InsetError::editMessage() const
85 return _("Opened error");
89 void InsetError::edit(BufferView * bv, int, int, unsigned int)
91 bv->owner()->getDialogs()->showError(this);
95 void InsetError::edit(BufferView * bv, bool)