]> git.lyx.org Git - lyx.git/blobdiff - src/Text3.cpp
Ensure the focus is returned to the editing area after a dispatch.
[lyx.git] / src / Text3.cpp
index 726224ff86cd61fcb42f1cb42c3848222a42559d..947975530204c41b5f0085728084277c541ba58b 100644 (file)
@@ -893,17 +893,15 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
        }
 
        case LFUN_SET_GRAPHICS_GROUP: {
-               Inset * instmp = &cur.inset();
-               if (instmp->lyxCode() != GRAPHICS_CODE) instmp = cur.nextInset();
-               if (!instmp || instmp->lyxCode() != GRAPHICS_CODE) break;
+               InsetGraphics * ins = InsetGraphics::getCurrentGraphicsInset(cur);
+               if (!ins)
+                       break;
 
                cur.recordUndoFullDocument();
-               Inset & inset = *instmp;
-               InsetGraphics & ins = static_cast<InsetGraphics &>(inset);
 
                string id = to_utf8(cmd.argument());
                string grp = InsetGraphics::getGroupParams(bv->buffer(), id);
-               InsetGraphicsParams tmp, inspar = ins.getParams();
+               InsetGraphicsParams tmp, inspar = ins->getParams();
 
                if (id.empty())
                        inspar.groupId = to_utf8(cmd.argument());
@@ -913,7 +911,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                        inspar = tmp;
                }
 
-               ins.setParams(inspar);
+               ins->setParams(inspar);
        }
 
        case LFUN_SPACE_INSERT:
@@ -2275,7 +2273,6 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
        case LFUN_BUFFER_BEGIN_SELECT:
        case LFUN_BUFFER_END_SELECT:
        case LFUN_UNICODE_INSERT:
-       case LFUN_SET_GRAPHICS_GROUP:
                // these are handled in our dispatch()
                enable = true;
                break;