mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-24 13:48:59 +00:00
Add LFUN_BRANCH_ADD_INSERT.
http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg152890.html git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30467 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
5c4758357f
commit
edb52c37d2
@ -463,6 +463,8 @@ Menuset
|
||||
|
||||
Menu "insert_branches"
|
||||
Branches
|
||||
Separator
|
||||
Item "Insert New Branch...|I" "branch-add-insert"
|
||||
End
|
||||
|
||||
Menu "insert_phantom"
|
||||
|
@ -935,6 +935,7 @@ bool BufferView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
|
||||
case LFUN_NOTES_MUTATE:
|
||||
case LFUN_ALL_INSETS_TOGGLE:
|
||||
case LFUN_STATISTICS:
|
||||
case LFUN_BRANCH_ADD_INSERT:
|
||||
flag.setEnabled(true);
|
||||
break;
|
||||
|
||||
@ -1504,6 +1505,29 @@ bool BufferView::dispatch(FuncRequest const & cmd)
|
||||
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;
|
||||
}
|
||||
|
@ -436,6 +436,8 @@ enum FuncCode
|
||||
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
|
||||
|
@ -3327,6 +3327,17 @@ void LyXAction::init()
|
||||
* \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
|
||||
|
Loading…
Reference in New Issue
Block a user