]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetgraphics.C
fix #832
[lyx.git] / src / insets / insetgraphics.C
index 29c8dd28dce86522484b0b982387c3ffa74f5aad..f423210c58408ddf1d1db3f68e7cbf003925f4ac 100644 (file)
@@ -68,6 +68,7 @@ TODO
 #include "funcrequest.h"
 #include "gettext.h"
 #include "LaTeXFeatures.h"
+#include "Lsstream.h"
 #include "lyxlex.h"
 #include "lyxrc.h"
 #include "Lsstream.h"
@@ -218,38 +219,30 @@ InsetGraphics::~InsetGraphics()
 
 dispatch_result InsetGraphics::localDispatch(FuncRequest const & cmd)
 {
-       dispatch_result result = UNDISPATCHED;
-
        switch (cmd.action) {
        case LFUN_INSET_MODIFY: {
                InsetGraphicsParams p;
                InsetGraphicsMailer::string2params(cmd.argument, p);
-               if (p.filename.empty())
-                       break;
-
-               string const filepath = cmd.view()->buffer()->filePath();
-               setParams(p, filepath);
-               cmd.view()->updateInset(this);
-               result = DISPATCHED;
+               if (!p.filename.empty()) {
+                       string const filepath = cmd.view()->buffer()->filePath();
+                       setParams(p, filepath);
+                       cmd.view()->updateInset(this);
+               }
+               return DISPATCHED;
        }
-       break;
 
-       case LFUN_INSET_DIALOG_UPDATE: {
-               InsetGraphicsMailer mailer(*this);
-               mailer.updateDialog(cmd.view());
-       }
-       break;
+       case LFUN_INSET_DIALOG_UPDATE: 
+               InsetGraphicsMailer(*this).updateDialog(cmd.view());
+               return DISPATCHED;
 
+       case LFUN_INSET_EDIT:
        case LFUN_MOUSE_RELEASE:
-               edit(cmd.view(), cmd.x, cmd.y, cmd.button());
-               break;
+               InsetGraphicsMailer(*this).showDialog(cmd.view());
+               return DISPATCHED;
 
        default:
-               result = DISPATCHED;
-               break;
+               return Inset::localDispatch(cmd);
        }
-
-       return result;
 }
 
 
@@ -420,19 +413,6 @@ void InsetGraphics::draw(BufferView * bv, LyXFont const & font,
 }
 
 
-void InsetGraphics::edit(BufferView * bv, int, int, mouse_button::state)
-{
-       InsetGraphicsMailer mailer(*this);
-       mailer.showDialog(bv);
-}
-
-
-void InsetGraphics::edit(BufferView * bv, bool)
-{
-       edit(bv, 0, 0, mouse_button::none);
-}
-
-
 Inset::EDITABLE InsetGraphics::editable() const
 {
        return IS_EDITABLE;