Menu "insert_branches"
Branches
+ Separator
+ Item "Insert New Branch...|I" "branch-add-insert"
End
Menu "insert_phantom"
case LFUN_NOTES_MUTATE:
case LFUN_ALL_INSETS_TOGGLE:
case LFUN_STATISTICS:
+ case LFUN_BRANCH_ADD_INSERT:
flag.setEnabled(true);
break;
break;
}
+ case LFUN_BRANCH_ADD_INSERT: {
+ docstring branch_name = from_utf8(cmd.getArg(0));
+ if (branch_name.empty())
+ if (!Alert::askForText(branch_name, _("Branch name")) ||
+ branch_name.empty())
+ break;
+
+ DispatchResult drtmp;
+ buffer_.dispatch(FuncRequest(LFUN_BRANCH_ADD, branch_name), drtmp);
+ if (drtmp.error()) {
+ Alert::warning(_("Branch already exists"), drtmp.message());
+ break;
+ }
+ BranchList & branch_list = buffer_.params().branchlist();
+ Branch const * branch = branch_list.find(branch_name);
+ string const x11hexname = X11hexname(branch->color());
+ docstring const str = branch_name + ' ' + from_ascii(x11hexname);
+ lyx::dispatch(FuncRequest(LFUN_SET_COLOR, str));
+ lyx::dispatch(FuncRequest(LFUN_BRANCH_INSERT, branch_name));
+ break;
+ }
+
+
default:
return false;
}
LFUN_BUFFER_EXPORT, // Lgb 97-07-29
LFUN_BUFFER_TOGGLE_COMPRESSION, // bpeng 20060427
LFUN_BRANCH_ADD, // spitz 20090707
+ LFUN_BRANCH_ADD_INSERT,
+ // 340
LFUN_BRANCHES_RENAME, // spitz 20090709
LFUN_LASTACTION // end of the table
* \endvar
*/
{ LFUN_BRANCHES_RENAME, "branches-rename", Noop, Buffer },
+/*!
+ * \var lyx::FuncCode lyx::LFUN_BRANCH_ADD_INSERT
+ * \li Action: Create new branch and directly put the branch inset into
+ the document.
+ * \li Syntax: branch-add-insert [<NAME>]
+ * \li Params: <NAME>: Branch name. If it is not specified, you will be asked.
+ * \li Origin: sanda, 10 Jul 2009
+ * \endvar
+ */
+ { LFUN_BRANCH_ADD_INSERT, "branch-add-insert", Noop, Buffer },
+
/*!
* \var lyx::FuncCode lyx::LFUN_LABEL_COPY_AS_REF