mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-14 12:25:11 +00:00
Add shortcut to the TOC menu.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1431 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
f8e05c6800
commit
e1b7bd5d36
@ -1,3 +1,7 @@
|
|||||||
|
2001-01-31 Dekel Tsur <dekelts@tau.ac.il>
|
||||||
|
|
||||||
|
* Menubar_pimpl.C (add_toc2): Add shortcut to the TOC menu.
|
||||||
|
|
||||||
2001-01-25 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
2001-01-25 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
||||||
|
|
||||||
* FormPreferences.C (GetFrom): fix crash when there is no format
|
* FormPreferences.C (GetFrom): fix crash when there is no format
|
||||||
|
@ -232,6 +232,7 @@ void add_toc2(int menu, string const & extra_label,
|
|||||||
vector<Buffer::TocItem> const & toc_list,
|
vector<Buffer::TocItem> const & toc_list,
|
||||||
size_type from, size_type to, int depth)
|
size_type from, size_type to, int depth)
|
||||||
{
|
{
|
||||||
|
int shortcut_count = 0;
|
||||||
if (to - from <= max_number_of_items) {
|
if (to - from <= max_number_of_items) {
|
||||||
for (size_type i = from; i < to; ++i) {
|
for (size_type i = from; i < to; ++i) {
|
||||||
int const action = lyxaction.
|
int const action = lyxaction.
|
||||||
@ -243,7 +244,13 @@ void add_toc2(int menu, string const & extra_label,
|
|||||||
label += "%x" + tostr(action + action_offset);
|
label += "%x" + tostr(action + action_offset);
|
||||||
if (i == to - 1 && depth == 0)
|
if (i == to - 1 && depth == 0)
|
||||||
label += extra_label;
|
label += extra_label;
|
||||||
fl_addtopup(menu, label.c_str());
|
if (toc_list[i].depth == depth
|
||||||
|
&& ++shortcut_count <= 9) {
|
||||||
|
label += "%h";
|
||||||
|
fl_addtopup(menu, label.c_str(),
|
||||||
|
tostr(shortcut_count).c_str());
|
||||||
|
} else
|
||||||
|
fl_addtopup(menu, label.c_str());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
size_type pos = from;
|
size_type pos = from;
|
||||||
@ -274,16 +281,30 @@ void add_toc2(int menu, string const & extra_label,
|
|||||||
label = limit_string_length(label);
|
label = limit_string_length(label);
|
||||||
if (new_pos == to && depth == 0)
|
if (new_pos == to && depth == 0)
|
||||||
label += extra_label;
|
label += extra_label;
|
||||||
|
string shortcut;
|
||||||
|
if (toc_list[pos].depth == depth &&
|
||||||
|
++shortcut_count <= 9)
|
||||||
|
shortcut = tostr(shortcut_count);
|
||||||
|
|
||||||
if (new_pos == pos + 1) {
|
if (new_pos == pos + 1) {
|
||||||
label += "%x" + tostr(action + action_offset);
|
label += "%x" + tostr(action + action_offset);
|
||||||
fl_addtopup(menu, label.c_str());
|
if (!shortcut.empty()) {
|
||||||
|
label += "%h";
|
||||||
|
fl_addtopup(menu, label.c_str(),
|
||||||
|
shortcut.c_str());
|
||||||
|
} else
|
||||||
|
fl_addtopup(menu, label.c_str());
|
||||||
} else {
|
} else {
|
||||||
int menu2 = get_new_submenu(smn, win);
|
int menu2 = get_new_submenu(smn, win);
|
||||||
add_toc2(menu2, extra_label, smn, win,
|
add_toc2(menu2, extra_label, smn, win,
|
||||||
toc_list, pos, new_pos, depth+1);
|
toc_list, pos, new_pos, depth+1);
|
||||||
label += "%m";
|
label += "%m";
|
||||||
fl_addtopup(menu, label.c_str(), menu2);
|
if (!shortcut.empty()) {
|
||||||
|
label += "%h";
|
||||||
|
fl_addtopup(menu, label.c_str(), menu2,
|
||||||
|
shortcut.c_str());
|
||||||
|
} else
|
||||||
|
fl_addtopup(menu, label.c_str(), menu2);
|
||||||
}
|
}
|
||||||
pos = new_pos;
|
pos = new_pos;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user