]> git.lyx.org Git - lyx.git/blobdiff - src/insets/inseterror.C
Rename LatexRunParams::fragile as moving_arg.
[lyx.git] / src / insets / inseterror.C
index 14f81578d2e6e6dd5a910d7ebc52ae3f12372183..b32c8880584f76273a2a466cc94df5f8c878ce2c 100644 (file)
@@ -13,6 +13,7 @@
 #include "inseterror.h"
 
 #include "BufferView.h"
+#include "dimension.h"
 #include "funcrequest.h"
 #include "gettext.h"
 #include "lyxfont.h"
@@ -26,7 +27,6 @@
 
 using std::ostream;
 
-/* Error, used for the LaTeX-Error Messages */
 
 InsetError::InsetError(string const & str, bool)
        : contents(str)
@@ -41,47 +41,33 @@ InsetError::~InsetError()
 
 dispatch_result InsetError::localDispatch(FuncRequest const & cmd)
 {
-       dispatch_result result = UNDISPATCHED;
+       // UNUSED: dispatch_result result = UNDISPATCHED;
 
        switch (cmd.action) {
        case LFUN_MOUSE_RELEASE:
-               edit(cmd.view(), cmd.x, cmd.y, cmd.button());
-               break;
+       case LFUN_INSET_EDIT:
+               cmd.view()->owner()->getDialogs().show("error", getContents(), this);
+               return DISPATCHED;
 
        default:
-               break;
+               return Inset::localDispatch(cmd);
        }
-
-       return result;
 }
 
 
-int InsetError::ascent(BufferView *, LyXFont const & font) const
+void InsetError::dimension(BufferView *, LyXFont const & font,
+       Dimension & dim) const
 {
        LyXFont efont;
        efont.setSize(font.size()).decSize();
-       return font_metrics::maxAscent(efont) + 1;
-}
-
-
-int InsetError::descent(BufferView *, LyXFont const & font) const
-{
-       LyXFont efont;
-       efont.setSize(font.size()).decSize();
-       return font_metrics::maxDescent(efont) + 1;
-}
-
-
-int InsetError::width(BufferView *, LyXFont const & font) const
-{
-       LyXFont efont;
-       efont.setSize(font.size()).decSize();
-       return 6 + font_metrics::width(_("Error"), efont);
+       dim.a = font_metrics::maxAscent(efont) + 1;
+       dim.d = font_metrics::maxDescent(efont) + 1;
+       dim.w = 6 + font_metrics::width(_("Error"), 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);
@@ -111,15 +97,3 @@ string const InsetError::editMessage() const
 {
        return _("Opened error");
 }
-
-
-void InsetError::edit(BufferView * bv, int, int, mouse_button::state)
-{
-       bv->owner()->getDialogs().show("error", getContents(), this);
-}
-
-
-void InsetError::edit(BufferView * bv, bool)
-{
-       edit(bv, 0, 0, mouse_button::none);
-}