* LyX, The Document Processor
*
* Copyright 1995 Matthias Ettrich
- * Copyright 1995-1999 The LyX Team.
+ * Copyright 1995-2000 The LyX Team.
*
* ====================================================== */
#include "gettext.h"
#include "lyx_gui_misc.h" // CancelCloseBoxCB
#include "Painter.h"
+#include "BufferView.h"
+#include "font.h"
+
+using std::ostream;
/* Error, used for the LaTeX-Error Messages */
+#if 0
InsetError::InsetError()
{
form = 0;
}
+#endif
InsetError::InsetError(string const & str)
- : contents(str)
-{
- form = 0;
-}
+ : contents(str), form(0)
+{}
InsetError::~InsetError()
}
-int InsetError::ascent(Painter &, LyXFont const & font) const
+int InsetError::ascent(BufferView *, LyXFont const & font) const
{
LyXFont efont;
efont.setSize(font.size()).decSize();
- return efont.maxAscent() + 1;
+ return lyxfont::maxAscent(efont) + 1;
}
-int InsetError::descent(Painter &, LyXFont const & font) const
+int InsetError::descent(BufferView *, LyXFont const & font) const
{
LyXFont efont;
efont.setSize(font.size()).decSize();
- return efont.maxDescent() + 1;
+ return lyxfont::maxDescent(efont) + 1;
}
-int InsetError::width(Painter &, LyXFont const & font) const
+int InsetError::width(BufferView *, LyXFont const & font) const
{
LyXFont efont;
efont.setSize(font.size()).decSize();
- return 6 + efont.textWidth(_("Error"), strlen(_("Error")));
+ return 6 + lyxfont::width(_("Error"), efont);
}
-void InsetError::draw(Painter & pain, LyXFont const & font,
- int baseline, float & x) const
+void InsetError::draw(BufferView * bv, LyXFont const & font,
+ int baseline, float & x, bool) const
{
+ Painter & pain = bv->painter();
LyXFont efont;
efont.setSize(font.size()).decSize();
efont.setColor(LColor::error);
// Draw as "Error" in a framed box
x += 1;
- pain.fillRectangle(int(x), baseline - ascent(pain, font) + 1,
- width(pain, font) - 2,
- ascent(pain, font) + descent(pain, font) - 2,
+ pain.fillRectangle(int(x), baseline - ascent(bv, font) + 1,
+ width(bv, font) - 2,
+ ascent(bv, font) + descent(bv, font) - 2,
LColor::insetbg);
- pain.rectangle(int(x), baseline - ascent(pain, font) + 1,
- width(pain, font) - 2,
- ascent(pain, font) + descent(pain, font) - 2,
+ pain.rectangle(int(x), baseline - ascent(bv, font) + 1,
+ width(bv, font) - 2,
+ ascent(bv, font) + descent(bv, font) - 2,
LColor::error);
pain.text(int(x + 2), baseline, _("Error"), efont);
- x += width(pain, font) - 1;
-}
-
-
-void InsetError::Write(ostream &) const
-{
-}
-
-
-void InsetError::Read(LyXLex &)
-{
+ x += width(bv, font) - 1;
}
-int InsetError::Latex(ostream &, signed char /*fragile*/) const
+void InsetError::Write(Buffer const *, ostream &) const
{
- return 0;
}
-#ifndef USE_OSTREAM_ONLY
-int InsetError::Latex(string &, signed char /*fragile*/) const
+void InsetError::Read(Buffer const *, LyXLex &)
{
- return 0;
}
-int InsetError::Linuxdoc(string &) const
+int InsetError::Latex(Buffer const *, ostream &,
+ bool /*fragile*/, bool /*fs*/) const
{
return 0;
}
-int InsetError::DocBook(string &) const
+int InsetError::Ascii(Buffer const *, ostream &) const
{
return 0;
}
-#else
-int InsetError::Linuxdoc(ostream &) const
+int InsetError::Linuxdoc(Buffer const *, ostream &) const
{
return 0;
}
-int InsetError::DocBook(ostream &) const
+int InsetError::DocBook(Buffer const *, ostream &) const
{
return 0;
}
-#endif
bool InsetError::AutoDelete() const
// A C wrapper
-extern "C" void C_InsetError_CloseErrorCB(FL_OBJECT * ob, long data)
+extern "C"
+void C_InsetError_CloseErrorCB(FL_OBJECT * ob, long data)
{
InsetError::CloseErrorCB(ob , data);
}
+char const * InsetError::EditMessage() const
+{
+ return _("Opened error");
+}
+
+
void InsetError::Edit(BufferView *, int, int, unsigned int)
{
static int ow = 400, oh = 240;