X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2Finseterror.C;h=b1a879cfaa531a2959cc8b80029722a9af58f07a;hb=3c8aba3b556871fb1100a2f98cd93d5d4e3f70c9;hp=163c7275eca51fd615e31d092876a72373627457;hpb=cfdd73ea94c3cc0058459d67b1c62fabd31fbeb1;p=lyx.git diff --git a/src/insets/inseterror.C b/src/insets/inseterror.C index 163c7275ec..b1a879cfaa 100644 --- a/src/insets/inseterror.C +++ b/src/insets/inseterror.C @@ -4,7 +4,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ @@ -15,10 +15,12 @@ #endif #include "inseterror.h" -#include "lyxdraw.h" #include "gettext.h" #include "lyx_gui_misc.h" // CancelCloseBoxCB #include "Painter.h" +#include "font.h" + +using std::ostream; /* Error, used for the LaTeX-Error Messages */ @@ -45,58 +47,30 @@ InsetError::~InsetError() } -#ifdef USE_PAINTER int InsetError::ascent(Painter &, LyXFont const & font) const { LyXFont efont; efont.setSize(font.size()).decSize(); - return efont.maxAscent() + 1; + return lyxfont::maxAscent(efont) + 1; } -#else -int InsetError::Ascent(LyXFont const & font) const -{ - LyXFont efont; - efont.setSize(font.size()).decSize(); - return efont.maxAscent()+1; -} -#endif -#ifdef USE_PAINTER int InsetError::descent(Painter &, LyXFont const & font) const { LyXFont efont; efont.setSize(font.size()).decSize(); - return efont.maxDescent() + 1; -} -#else -int InsetError::Descent(LyXFont const & font) const -{ - LyXFont efont; - efont.setSize(font.size()).decSize(); - return efont.maxDescent()+1; + return lyxfont::maxDescent(efont) + 1; } -#endif -#ifdef USE_PAINTER int InsetError::width(Painter &, LyXFont const & font) const { LyXFont efont; efont.setSize(font.size()).decSize(); - return 6 + efont.textWidth(_("Error"), strlen(_("Error"))); -} -#else -int InsetError::Width(LyXFont const & font) const -{ - LyXFont efont; - efont.setSize(font.size()).decSize(); - return 6 + efont.textWidth(_("Error"), strlen(_("Error"))); + return 6 + lyxfont::width(_("Error"), efont); } -#endif -#ifdef USE_PAINTER void InsetError::draw(Painter & pain, LyXFont const & font, int baseline, float & x) const { @@ -118,29 +92,9 @@ void InsetError::draw(Painter & pain, LyXFont const & font, x += width(pain, font) - 1; } -#else -void InsetError::Draw(LyXFont font, LyXScreen & scr, - int baseline, float & x) -{ - LyXFont efont; - efont.setSize(font.size()).decSize(); - efont.setLatex(LyXFont::ON); - - // Draw as "Error" in a framed box - x += 1; - scr.fillRectangle(gc_lighted, - int(x), baseline - Ascent(font)+1, - Width(font)-2, Ascent(font)+ Descent(font)-2); - scr.drawRectangle(gc_foot, - int(x), baseline-Ascent(font)+1, - Width(font)-2, Ascent(font)+Descent(font)-2); - scr.drawString(efont, _("Error"), baseline, int(x+2)); - x += Width(font) - 1; -} -#endif -void InsetError::Write(ostream &) +void InsetError::Write(ostream &) const { } @@ -150,25 +104,26 @@ void InsetError::Read(LyXLex &) } -int InsetError::Latex(ostream &, signed char /*fragile*/) +int InsetError::Latex(ostream &, + bool /*fragile*/, bool /*fs*/) const { return 0; } -int InsetError::Latex(string &, signed char /*fragile*/) +int InsetError::Ascii(ostream &) const { return 0; } -int InsetError::Linuxdoc(string &) +int InsetError::Linuxdoc(ostream &) const { return 0; } -int InsetError::DocBook(string &) +int InsetError::DocBook(ostream &) const { return 0; } @@ -180,9 +135,9 @@ bool InsetError::AutoDelete() const } -unsigned char InsetError::Editable() const +Inset::EDITABLE InsetError::Editable() const { - return 1; + return IS_EDITABLE; } @@ -204,7 +159,13 @@ extern "C" void C_InsetError_CloseErrorCB(FL_OBJECT * ob, long data) } -void InsetError::Edit(int, int) +char const * InsetError::EditMessage() const +{ + return _("Opened error"); +} + + +void InsetError::Edit(BufferView *, int, int, unsigned int) { static int ow = 400, oh = 240;