* 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
This commit is contained in:
Jean-Marc Lasgouttes 2008-04-30 13:03:19 +00:00
parent 9b4a26a252
commit 66837f5af5

View 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;
}