The branch, master, has been updated. - Log -----------------------------------------------------------------
commit 3588f2f69675df8dbf829800b0ed6e4a455c68b4 Author: Juergen Spitzmueller <sp...@lyx.org> Date: Sun Sep 30 17:32:00 2012 +0200 Context menu item to add unknown branch (rest of #7643) diff --git a/lib/ui/stdcontext.inc b/lib/ui/stdcontext.inc index d250afa..3d6faf0 100644 --- a/lib/ui/stdcontext.inc +++ b/lib/ui/stdcontext.inc @@ -443,6 +443,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 "Add Unknown Branch|w" "branch-add" End # diff --git a/src/LyXAction.cpp b/src/LyXAction.cpp index 998b79d..1a49bd4 100644 --- a/src/LyXAction.cpp +++ b/src/LyXAction.cpp @@ -3501,7 +3501,7 @@ void LyXAction::init() * \li Origin: spitz, 7 Jul 2009 * \endvar */ - { LFUN_BRANCH_ADD, "branch-add", Noop, Buffer }, + { LFUN_BRANCH_ADD, "branch-add", AtPoint, Buffer }, /*! @@ -3536,7 +3536,7 @@ void LyXAction::init() * \li Origin: spitz, 30 Sep 2012 * \endvar */ - { LFUN_BRANCH_MASTER_ACTIVATE, "branch-master-activate", AtPoint, Buffer }, + { LFUN_BRANCH_MASTER_ACTIVATE, "branch-master-activate", AtPoint, Buffer }, /*! * \var lyx::FuncCode lyx::LFUN_BRANCH_MASTER_DEACTIVATE * \li Action: De-activate the branch in the master buffer. @@ -3545,7 +3545,7 @@ void LyXAction::init() * \li Origin: spitz, 30 Sep 2012 * \endvar */ - { LFUN_BRANCH_MASTER_DEACTIVATE, "branch-master-deactivate", AtPoint, Buffer }, + { LFUN_BRANCH_MASTER_DEACTIVATE, "branch-master-deactivate", AtPoint, Buffer }, /*! * \var lyx::FuncCode lyx::LFUN_BRANCHES_RENAME diff --git a/src/insets/InsetBranch.cpp b/src/insets/InsetBranch.cpp index f9d3025..e966de2 100644 --- a/src/insets/InsetBranch.cpp +++ b/src/insets/InsetBranch.cpp @@ -23,6 +23,7 @@ #include "FuncRequest.h" #include "FuncStatus.h" #include "Lexer.h" +#include "LyX.h" #include "OutputParams.h" #include "output_xhtml.h" #include "TextClass.h" @@ -165,6 +166,9 @@ void InsetBranch::doDispatch(Cursor & cur, FuncRequest & cmd) } break; } + case LFUN_BRANCH_ADD: + lyx::dispatch(FuncRequest(LFUN_BRANCH_ADD, params_.branch)); + break; case LFUN_INSET_TOGGLE: if (cmd.argument() == "assign") setStatus(cur, isBranchSelected() ? Open : Collapsed); @@ -182,13 +186,20 @@ void InsetBranch::doDispatch(Cursor & cur, FuncRequest & cmd) bool InsetBranch::getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus & flag) const { + bool const known_branch = + buffer().params().branchlist().find(params_.branch); + switch (cmd.action()) { case LFUN_INSET_MODIFY: flag.setEnabled(true); break; case LFUN_BRANCH_ACTIVATE: - flag.setEnabled(!isBranchSelected(true)); + flag.setEnabled(known_branch && !isBranchSelected(true)); + break; + + case LFUN_BRANCH_ADD: + flag.setEnabled(!known_branch); break; case LFUN_BRANCH_DEACTIVATE: @@ -196,7 +207,9 @@ bool InsetBranch::getStatus(Cursor & cur, FuncRequest const & cmd, break; case LFUN_BRANCH_MASTER_ACTIVATE: - flag.setEnabled(buffer().parent() && !isBranchSelected()); + flag.setEnabled(buffer().parent() + && buffer().masterBuffer()->params().branchlist().find(params_.branch) + && !isBranchSelected()); break; case LFUN_BRANCH_MASTER_DEACTIVATE: ----------------------------------------------------------------------- Summary of changes: lib/ui/stdcontext.inc | 1 + src/LyXAction.cpp | 6 +++--- src/insets/InsetBranch.cpp | 17 +++++++++++++++-- 3 files changed, 19 insertions(+), 5 deletions(-) hooks/post-receive -- The LyX Source Repository