X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2Finseterror.C;h=cd4b51737c3d6bfcb4c3ceac13f4cad805d1849b;hb=4a5b7a5952ad2381fcdf4830511293e184c7c5a1;hp=59bbcc2fb085ef2e477b1ab9ac0936e82bc1173a;hpb=666140b7f20ad45d69b6c8aad25ae37f79ef03b1;p=lyx.git diff --git a/src/insets/inseterror.C b/src/insets/inseterror.C index 59bbcc2fb0..cd4b51737c 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-2000 The LyX Team. + * Copyright 1995-2001 The LyX Team. * * ====================================================== */ @@ -14,38 +14,22 @@ #pragma implementation #endif -#include "inseterror.h" -#include "gettext.h" -#include "lyx_gui_misc.h" // CancelCloseBoxCB -#include "Painter.h" #include "BufferView.h" #include "font.h" +#include "lyxfont.h" +#include "gettext.h" +#include "inseterror.h" +#include "LyXView.h" +#include "Painter.h" +#include "frontends/Dialogs.h" using std::ostream; /* Error, used for the LaTeX-Error Messages */ -InsetError::InsetError() -{ - form = 0; -} - - -InsetError::InsetError(string const & str) +InsetError::InsetError(string const & str, bool) : contents(str) -{ - form = 0; -} - - -InsetError::~InsetError() -{ - if (form) { - fl_hide_form(form); - fl_free_form(form); - form = 0; - } -} +{} int InsetError::ascent(BufferView *, LyXFont const & font) const @@ -96,108 +80,19 @@ void InsetError::draw(BufferView * bv, LyXFont const & font, } -void InsetError::Write(Buffer const *, ostream &) const -{ -} - - -void InsetError::Read(Buffer const *, LyXLex &) -{ -} - - -int InsetError::Latex(Buffer const *, ostream &, - bool /*fragile*/, bool /*fs*/) const -{ - return 0; -} - - -int InsetError::Ascii(Buffer const *, ostream &) const -{ - return 0; -} - - -int InsetError::Linuxdoc(Buffer const *, ostream &) const -{ - return 0; -} - - -int InsetError::DocBook(Buffer const *, ostream &) const -{ - return 0; -} - - -bool InsetError::AutoDelete() const -{ - return true; -} - - -Inset::EDITABLE InsetError::Editable() const -{ - return IS_EDITABLE; -} - - -void InsetError::CloseErrorCB(FL_OBJECT * ob, long) -{ - InsetError * inset = static_cast(ob->u_vdata); - if (inset->form) { - fl_hide_form(inset->form); - fl_free_form(inset->form); - inset->form = 0; - } -} - - -// A C wrapper -extern "C" void C_InsetError_CloseErrorCB(FL_OBJECT * ob, long data) -{ - InsetError::CloseErrorCB(ob , data); -} - - -char const * InsetError::EditMessage() const +string const InsetError::editMessage() const { return _("Opened error"); } -void InsetError::Edit(BufferView *, int, int, unsigned int) +void InsetError::edit(BufferView * bv, int, int, unsigned int) { - static int ow = 400, oh = 240; - - if (!form) { - FL_OBJECT * obj; - form = fl_bgn_form(FL_UP_BOX, ow, oh); - strobj = fl_add_box(FL_FRAME_BOX, 10, 10, 380, 180, ""); - fl_set_object_color(strobj, FL_MCOL, FL_MCOL); - fl_set_object_gravity(strobj, FL_NorthWest, FL_SouthEast); - obj = fl_add_button(FL_RETURN_BUTTON, 140, 200, 120, 30, - _("Close")); - fl_set_object_callback(obj, C_InsetError_CloseErrorCB, 0); - obj->u_vdata = this; - fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_resize(obj, FL_RESIZE_NONE); - fl_end_form(); - fl_set_form_atclose(form, CancelCloseBoxCB, 0); - } - fl_set_object_label(strobj, contents.c_str()); - if (form->visible) { - fl_raise_form(form); - } else { - fl_show_form(form, FL_PLACE_MOUSE | FL_FREE_SIZE, - FL_FULLBORDER, _("LaTeX Error")); - fl_set_form_minsize(form, ow, oh); - } + bv->owner()->getDialogs()->showError(this); } -Inset * InsetError::Clone() const +void InsetError::edit(BufferView * bv, bool) { - return new InsetError(contents); + edit(bv, 0, 0, 0); }