]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetGraphics.cpp
Cleanup mouse/selection/context-menu interactions.
[lyx.git] / src / insets / InsetGraphics.cpp
index de06ea498383da131923dfa1d25691b3b4537e36..eb98501ee81e56dc2c58c61dad112a80012dd6e5 100644 (file)
@@ -175,12 +175,10 @@ void InsetGraphics::doDispatch(Cursor & cur, FuncRequest & cmd)
 {
        switch (cmd.action) {
        case LFUN_GRAPHICS_EDIT: {
-               // use buffer() from cursor because this inset may not
-               // have an initialized buffer_.
-               Buffer const & buf = cur.bv().buffer();
-               InsetGraphicsParams p;
-               InsetGraphicsMailer::string2params(to_utf8(cmd.argument()), buf, p);
-               editGraphics(p, buf);
+               InsetGraphicsParams p = params();
+               if (!cmd.argument().empty())
+                       InsetGraphicsMailer::string2params(to_utf8(cmd.argument()), buffer(), p);
+               editGraphics(p, buffer());
                break;
        }
 
@@ -199,7 +197,7 @@ void InsetGraphics::doDispatch(Cursor & cur, FuncRequest & cmd)
                break;
 
        case LFUN_MOUSE_RELEASE:
-               if (!cur.selection())
+               if (!cur.selection() && cmd.button() == mouse_button::button1)
                        InsetGraphicsMailer(*this).showDialog(&cur.bv());
                break;
 
@@ -942,6 +940,12 @@ void InsetGraphics::addToToc(ParConstIterator const & cpit) const
 }
 
 
+docstring InsetGraphics::contextMenu(BufferView const &, int, int) const
+{
+       return from_ascii("context-graphics");
+}
+
+
 string const InsetGraphicsMailer::name_("graphics");
 
 InsetGraphicsMailer::InsetGraphicsMailer(InsetGraphics & inset)