diff --git a/lib/ui/stdcontext.inc b/lib/ui/stdcontext.inc index f1a0eafd07..ede63c517f 100644 --- a/lib/ui/stdcontext.inc +++ b/lib/ui/stdcontext.inc @@ -494,6 +494,7 @@ Menuset OptItem "Deactivate Branch|e" "branch-deactivate" OptItem "Activate Branch in Master|M" "branch-master-activate" OptItem "Deactivate Branch in Master|v" "branch-master-deactivate" + OptItem "Toggle Inversion|I" "branch-invert" OptItem "Add Unknown Branch|w" "branch-add" End diff --git a/src/FuncCode.h b/src/FuncCode.h index 40ec9d3543..04f1671630 100644 --- a/src/FuncCode.h +++ b/src/FuncCode.h @@ -465,6 +465,7 @@ enum FuncCode // 340 LFUN_BUFFER_MOVE_PREVIOUS, // skostysh 20150408 LFUN_TABULAR_FEATURE, // gm, 20151210 + LFUN_BRANCH_INVERT, // rgheck, 20160712 LFUN_LASTACTION // end of the table }; diff --git a/src/LyXAction.cpp b/src/LyXAction.cpp index 3702810ba0..24687c79f0 100644 --- a/src/LyXAction.cpp +++ b/src/LyXAction.cpp @@ -3641,6 +3641,15 @@ void LyXAction::init() { LFUN_BRANCH_ADD, "branch-add", AtPoint, Buffer }, +/*! + * \var lyx::FuncCode lyx::LFUN_BRANCH_INVERT + * \li Action: Toggles inversion status of branch inset. + * \li Syntax: branch-invert + * \li Origin: rgheck, 12 July 2016 + * \endvar + */ + { LFUN_BRANCH_INVERT, "branch-invert", AtPoint, Buffer }, + /*! * \var lyx::FuncCode lyx::LFUN_BRANCH_ACTIVATE * \li Action: Activate the branch. diff --git a/src/insets/InsetBranch.cpp b/src/insets/InsetBranch.cpp index 59423ce7ff..e02f09b625 100644 --- a/src/insets/InsetBranch.cpp +++ b/src/insets/InsetBranch.cpp @@ -188,6 +188,9 @@ void InsetBranch::doDispatch(Cursor & cur, FuncRequest & cmd) } break; } + case LFUN_BRANCH_INVERT: + params_.inverted = !params_.inverted; + break; case LFUN_BRANCH_ADD: lyx::dispatch(FuncRequest(LFUN_BRANCH_ADD, params_.branch)); break; @@ -220,6 +223,10 @@ bool InsetBranch::getStatus(Cursor & cur, FuncRequest const & cmd, flag.setEnabled(known_branch && !isBranchSelected(true)); break; + case LFUN_BRANCH_INVERT: + flag.setEnabled(true); + break; + case LFUN_BRANCH_ADD: flag.setEnabled(!known_branch); break;