]> git.lyx.org Git - features.git/commitdiff
* BufferView.cpp (getStatus): fix NEXT_INSET(TOGGLE|MODIFY) in order
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 30 Apr 2008 13:03:19 +0000 (13:03 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 30 Apr 2008 13:03:19 +0000 (13:03 +0000)
to make context menus work.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24560 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView.cpp

index de9e950a001a1a816deb2ad33b360c0385d5160a..27beef22c097ef2ef5c315a5ac12510f5ba05315 100644 (file)
@@ -867,45 +867,18 @@ FuncStatus BufferView::getStatus(FuncRequest const & cmd)
                flag.enabled(true);
                break;
 
-       case LFUN_NEXT_INSET_TOGGLE: {
-               // this is the real function we want to invoke
-               FuncRequest tmpcmd = FuncRequest(LFUN_INSET_TOGGLE, cmd.argument());
-               // if there is an inset at cursor, see whether it
-               // can be modified.
-               Inset * inset = cur.nextInset();
-               if (inset) {
-                       inset->getStatus(cur, tmpcmd, flag);
-                       return flag;
-                       break;
-               }
-               // if it did not work, try the underlying inset.
-               if (!inset || !cur.result().dispatched())
-                       getStatus(tmpcmd);
-
-               if (!cur.result().dispatched())
-                       // else disable
-                       flag.enabled(false);
-               break;
-       }
-
+       case LFUN_NEXT_INSET_TOGGLE: 
        case LFUN_NEXT_INSET_MODIFY: {
                // this is the real function we want to invoke
-               FuncRequest tmpcmd = FuncRequest(LFUN_INSET_MODIFY, cmd.argument());
+               FuncCode const code = 
+                       (cmd.action == LFUN_NEXT_INSET_TOGGLE) 
+                       ? LFUN_INSET_TOGGLE : LFUN_INSET_MODIFY;
+               FuncRequest const tmpcmd = FuncRequest(code, cmd.argument());
                // if there is an inset at cursor, see whether it
-               // can be modified.
+               // handles the lfun, other start from scratch
                Inset * inset = cur.nextInset();
-               if (inset) {
-                       inset->getStatus(cur, tmpcmd, flag);
-                       return flag;
-                       break;
-               }
-               // if it did not work, try the underlying inset.
-               if (!inset || !cur.result().dispatched())
-                       getStatus(tmpcmd);
-
-               if (!cur.result().dispatched())
-                       // else disable
-                       flag.enabled(false);
+               if (!inset || !inset->getStatus(cur, tmpcmd, flag))
+                       flag = lyx::getStatus(tmpcmd);
                break;
        }