From: Jean-Marc Lasgouttes Date: Wed, 30 Apr 2008 13:03:19 +0000 (+0000) Subject: * BufferView.cpp (getStatus): fix NEXT_INSET(TOGGLE|MODIFY) in order X-Git-Tag: 1.6.10~4942 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=66837f5af564831fbaa0907a3658c1bca5bdb523;p=lyx.git * BufferView.cpp (getStatus): fix NEXT_INSET(TOGGLE|MODIFY) in order to make context menus work. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24560 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/BufferView.cpp b/src/BufferView.cpp index de9e950a00..27beef22c0 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -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; }