#include <config.h>
-#ifdef __GNUG__
-#pragma implementation
-#endif
+#include "inseterror.h"
#include "BufferView.h"
-#include "frontends/font_metrics.h"
-#include "lyxfont.h"
+#include "funcrequest.h"
#include "gettext.h"
-#include "inseterror.h"
+#include "lyxfont.h"
+
+#include "frontends/Dialogs.h"
+#include "frontends/font_metrics.h"
#include "frontends/LyXView.h"
#include "frontends/Painter.h"
-#include "frontends/Dialogs.h"
+
+#include "support/LAssert.h"
using std::ostream;
-/* Error, used for the LaTeX-Error Messages */
InsetError::InsetError(string const & str, bool)
: contents(str)
{}
+InsetError::~InsetError()
+{
+ Dialogs::hide("error", this);
+}
+
+
+dispatch_result InsetError::localDispatch(FuncRequest const & cmd)
+{
+ dispatch_result result = UNDISPATCHED;
+
+ switch (cmd.action) {
+ case LFUN_MOUSE_RELEASE:
+ case LFUN_INSET_EDIT:
+ cmd.view()->owner()->getDialogs().show("error", getContents(), this);
+ return DISPATCHED;
+
+ default:
+ return Inset::localDispatch(cmd);
+ }
+}
+
+
int InsetError::ascent(BufferView *, LyXFont const & font) const
{
LyXFont efont;
void InsetError::draw(BufferView * bv, LyXFont const & font,
- int baseline, float & x, bool) const
+ int baseline, float & x) const
{
+ lyx::Assert(bv);
+ cache(bv);
+
Painter & pain = bv->painter();
LyXFont efont;
efont.setSize(font.size()).decSize();
{
return _("Opened error");
}
-
-
-void InsetError::edit(BufferView * bv, int, int, mouse_button::state)
-{
- bv->owner()->getDialogs().showError(this);
-}
-
-
-void InsetError::edit(BufferView * bv, bool)
-{
- edit(bv, 0, 0, mouse_button::none);
-}