mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 21:21:32 +00:00
Simplify and fix the TOGGLE_INSET code for branch inset. If it turns out
that the extra complexity was intended, I would be interested to know what the idea was. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28979 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
3030a279ac
commit
827c72e1f5
@ -144,20 +144,8 @@ void InsetBranch::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
break;
|
||||
|
||||
case LFUN_INSET_TOGGLE:
|
||||
if (cmd.argument() == "assign") {
|
||||
// The branch inset uses "assign".
|
||||
if (isBranchSelected()) {
|
||||
if (status(cur.bv()) != Open)
|
||||
setStatus(cur, Open);
|
||||
else
|
||||
cur.undispatched();
|
||||
} else {
|
||||
if (status(cur.bv()) != Collapsed)
|
||||
setStatus(cur, Collapsed);
|
||||
else
|
||||
cur.undispatched();
|
||||
}
|
||||
}
|
||||
if (cmd.argument() == "assign")
|
||||
setStatus(cur, isBranchSelected() ? Open : Collapsed);
|
||||
else
|
||||
InsetCollapsable::doDispatch(cur, cmd);
|
||||
break;
|
||||
@ -179,17 +167,11 @@ bool InsetBranch::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
break;
|
||||
|
||||
case LFUN_INSET_TOGGLE:
|
||||
if (cmd.argument() == "open" || cmd.argument() == "close" ||
|
||||
cmd.argument() == "toggle")
|
||||
flag.setEnabled(true);
|
||||
else if (cmd.argument() == "assign" || cmd.argument().empty()) {
|
||||
if (isBranchSelected())
|
||||
flag.setEnabled(status(cur.bv()) != Open);
|
||||
else
|
||||
flag.setEnabled(status(cur.bv()) != Collapsed);
|
||||
} else
|
||||
if (cmd.argument() == "assign") {
|
||||
flag.setEnabled(true);
|
||||
break;
|
||||
}
|
||||
//fall through to generic InsetCollapsable implmementation
|
||||
|
||||
default:
|
||||
return InsetCollapsable::getStatus(cur, cmd, flag);
|
||||
|
Loading…
Reference in New Issue
Block a user