mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Allow syncing open/close status of branch inset with it's activation status.
This was kicked out by 742b39f4
(the code in inset toggle survived).
https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg217311.html
This commit is contained in:
parent
28b206665f
commit
02ffd6dd70
@ -502,6 +502,7 @@ enum FuncCode
|
||||
LFUN_SPELLING_REMOVE_LOCAL, // jspitzm 20210307
|
||||
LFUN_FINISHED_DOWN, // lasgouttes 20210629
|
||||
LFUN_FINISHED_UP, // lasgouttes 20210629
|
||||
LFUN_BRANCH_SYNC_ALL, // sanda 20220415
|
||||
LFUN_LASTACTION // end of the table
|
||||
};
|
||||
|
||||
|
@ -452,6 +452,15 @@ void LyXAction::init()
|
||||
*/
|
||||
{ LFUN_BRANCH_INSERT, "branch-insert", Noop, Edit },
|
||||
|
||||
/*!
|
||||
* \var lyx::FuncCode lyx::LFUN_BRANCH_SYNC_ALL
|
||||
* \li Action: Open/close all insets of selected branch (depending on its selection status).
|
||||
* \li Syntax: branch-toggle-all
|
||||
* \li Origin: sanda, 15 April 2022
|
||||
* \endvar
|
||||
*/
|
||||
{ LFUN_BRANCH_SYNC_ALL, "branch-sync-all", AtPoint, Buffer },
|
||||
|
||||
/*!
|
||||
* \var lyx::FuncCode lyx::LFUN_BRANCH_INVERT
|
||||
* \li Action: Toggles inversion status of branch inset.
|
||||
|
@ -224,9 +224,12 @@ void InsetBranch::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
case LFUN_BRANCH_ADD:
|
||||
lyx::dispatch(FuncRequest(LFUN_BRANCH_ADD, params_.branch));
|
||||
break;
|
||||
case LFUN_BRANCH_SYNC_ALL:
|
||||
lyx::dispatch(FuncRequest(LFUN_INSET_FORALL, "Branch:" + params_.branch + " inset-toggle assign"));
|
||||
break;
|
||||
case LFUN_INSET_TOGGLE:
|
||||
if (cmd.argument() == "assign")
|
||||
setStatus(cur, isBranchSelected() ? Open : Collapsed);
|
||||
setStatus(cur, (isBranchSelected(true) != params_.inverted) ? Open : Collapsed);
|
||||
else
|
||||
InsetCollapsible::doDispatch(cur, cmd);
|
||||
break;
|
||||
@ -276,6 +279,10 @@ bool InsetBranch::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
flag.setEnabled(buffer().parent() && isBranchSelected());
|
||||
break;
|
||||
|
||||
case LFUN_BRANCH_SYNC_ALL:
|
||||
flag.setEnabled(known_branch);
|
||||
break;
|
||||
|
||||
case LFUN_INSET_TOGGLE:
|
||||
if (cmd.argument() == "assign")
|
||||
flag.setEnabled(true);
|
||||
|
Loading…
Reference in New Issue
Block a user