mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-23 16:52:02 +00:00
Re-organize and comment code a bit.
This commit is contained in:
parent
da2696cc63
commit
5fa493aa4a
@ -1437,42 +1437,42 @@ void MenuDefinition::expandBranches(Buffer const * buf)
|
|||||||
if (!buf || buf->hasReadonlyFlag())
|
if (!buf || buf->hasReadonlyFlag())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BufferParams const & master_params = buf->masterBuffer()->params();
|
BranchList const & master_list =
|
||||||
BufferParams const & params = buf->params();
|
buf->masterBuffer()->params().branchlist();
|
||||||
if (params.branchlist().empty() && master_params.branchlist().empty() ) {
|
BranchList const & child_list = buf->params().branchlist();
|
||||||
|
if (child_list.empty() && master_list.empty() ) {
|
||||||
add(MenuItem(MenuItem::Help, qt_("No Branches Set for Document!")));
|
add(MenuItem(MenuItem::Help, qt_("No Branches Set for Document!")));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BranchList::const_iterator cit = master_params.branchlist().begin();
|
BranchList::const_iterator mit = master_list.begin();
|
||||||
BranchList::const_iterator end = master_params.branchlist().end();
|
BranchList::const_iterator const mend = master_list.end();
|
||||||
|
for (int ii = 1; mit != mend; ++mit, ++ii) {
|
||||||
for (int ii = 1; cit != end; ++cit, ++ii) {
|
// NUM. Branch Name + "|", which triggers an empty shortcut in
|
||||||
docstring label = cit->branch();
|
// case that character should be in the branch name
|
||||||
|
docstring label = convert<docstring>(ii) + ". " +
|
||||||
|
mit->branch() + char_type('|');
|
||||||
if (ii < 10) {
|
if (ii < 10) {
|
||||||
label = convert<docstring>(ii) + ". " + label
|
// Add NUM as a keyboard shortcut
|
||||||
+ char_type('|') + convert<docstring>(ii);
|
label += convert<docstring>(ii);
|
||||||
}
|
}
|
||||||
addWithStatusCheck(MenuItem(MenuItem::Command, toqstr(label),
|
addWithStatusCheck(MenuItem(MenuItem::Command, toqstr(label),
|
||||||
FuncRequest(LFUN_BRANCH_INSERT,
|
FuncRequest(LFUN_BRANCH_INSERT,
|
||||||
cit->branch())));
|
mit->branch())));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buf == buf->masterBuffer())
|
if (buf == buf->masterBuffer())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
MenuDefinition child_branches;
|
MenuDefinition child_branches;
|
||||||
|
BranchList::const_iterator ccit = child_list.begin();
|
||||||
BranchList::const_iterator ccit = params.branchlist().begin();
|
BranchList::const_iterator cend = child_list.end();
|
||||||
BranchList::const_iterator cend = params.branchlist().end();
|
|
||||||
|
|
||||||
for (int ii = 1; ccit != cend; ++ccit, ++ii) {
|
for (int ii = 1; ccit != cend; ++ccit, ++ii) {
|
||||||
docstring label = ccit->branch();
|
docstring label = convert<docstring>(ii) + ". " +
|
||||||
|
ccit->branch() + char_type('|');
|
||||||
if (ii < 10) {
|
if (ii < 10) {
|
||||||
label = convert<docstring>(ii) + ". " + label
|
label += convert<docstring>(ii);
|
||||||
+ char_type('|') + convert<docstring>(ii);
|
}
|
||||||
} else
|
|
||||||
label += char_type('|');
|
|
||||||
child_branches.addWithStatusCheck(MenuItem(MenuItem::Command,
|
child_branches.addWithStatusCheck(MenuItem(MenuItem::Command,
|
||||||
toqstr(label),
|
toqstr(label),
|
||||||
FuncRequest(LFUN_BRANCH_INSERT,
|
FuncRequest(LFUN_BRANCH_INSERT,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user