Menu "context-note"
Item "LyX Note|N" "inset-modify note Note Note"
Item "Comment|m" "inset-modify note Note Comment"
- Item "Greyed Out|G" "inset-modify note Note Greyedout"
+ Item "Greyed Out|y" "inset-modify note Note Greyedout"
Separator
Item "Open All Notes|A" "inset-forall Note inset-toggle open"
- Item "Close All Notes|l" "inset-forall Note inset-toggle close"
+ Item "Close All Notes|o" "inset-forall Note inset-toggle close"
End
#
Item "Jump Back to Saved Bookmark|B" "bookmark-goto 0"
OptItem "Forward Search|F" "forward-search"
Separator
- Item "Move Paragraph Up|o" "paragraph-move-up"
+ Item "Move Paragraph Up|h" "paragraph-move-up"
Item "Move Paragraph Down|v" "paragraph-move-down"
Separator
EnvironmentSeparatorsContext
const;
///
bool hasFunc(FuncRequest const &) const;
+ /// The real size of the menu considering hidden entries
+ int realSize() const;
/// Add the menu item unconditionally
void add(MenuItem const & item) { items_.push_back(item); }
/// Checks the associated FuncRequest status before adding the
}
+int MenuDefinition::realSize() const
+{
+ int res = 0;
+ for (auto const & it : *this) {
+ if (it.kind() == MenuItem::Submenu)
+ ++res;
+ else if (it.kind() == MenuItem::Command) {
+ FuncStatus status = lyx::getStatus(*it.func());
+ // count only items that are actually displayed
+ if (!status.unknown() && (status.enabled() || !it.optional()))
+ ++res;
+ }
+ }
+ return res;
+}
+
+
void MenuDefinition::catSub(docstring const & name)
{
add(MenuItem(MenuItem::Submenu,
if (i > 0)
add(MenuItem(MenuItem::Separator));
docstring const arg = wl.word() + " " + from_ascii(wl.lang()->lang());
- add(MenuItem(MenuItem::Command, qt_("Add to personal dictionary|n"),
+ add(MenuItem(MenuItem::Command, qt_("Add to personal dictionary|r"),
FuncRequest(LFUN_SPELLING_ADD, arg)));
add(MenuItem(MenuItem::Command, qt_("Ignore this occurrence|g"),
FuncRequest(LFUN_FONT_NO_SPELLCHECK, arg)));
- add(MenuItem(MenuItem::Command, qt_("Ignore all for this session|I"),
+ add(MenuItem(MenuItem::Command, qt_("Ignore all for this session|l"),
FuncRequest(LFUN_SPELLING_IGNORE, arg)));
- add(MenuItem(MenuItem::Command, qt_("Ignore all in this document|d"),
+ add(MenuItem(MenuItem::Command, qt_("Ignore all in this document|u"),
FuncRequest(LFUN_SPELLING_ADD_LOCAL, arg)));
}
}
buf->masterBuffer()->getLanguages();
if (languages_buffer.size() < 2) {
- add(MenuItem(MenuItem::Command, qt_("Switch Language...|L"),
+ add(MenuItem(MenuItem::Command, qt_("Switch Language...|w"),
FuncRequest(LFUN_DIALOG_SHOW, "character")));
return;
}
docstring identifier = qstring_to_ucs4(qmenu->d->name);
MenuDefinition fromLyxMenu(qmenu->d->name);
+ BufferView * bv = 0;
+ if (qmenu->d->view)
+ bv = qmenu->d->view->currentBufferView();
while (!identifier.empty()) {
docstring menu_name;
identifier = split(identifier, menu_name, ';');
}
MenuDefinition cat_menu = d->getMenu(toqstr(menu_name));
- //FIXME: 50 is a wild guess. We should take into account here
- //the expansion of menu items, disabled optional items etc.
+ // We take into account here the expansion of menu items,
+ // disabled optional items etc.
+ MenuDefinition to_menu;
+ d->expand(fromLyxMenu, to_menu, bv);
+ MenuDefinition to_cat_menu;
+ d->expand(cat_menu, to_cat_menu, bv);
bool const in_sub_menu = !fromLyxMenu.empty()
- && fromLyxMenu.size() + cat_menu.size() > 50 ;
+ && to_menu.realSize() + to_cat_menu.realSize() > 50;
if (in_sub_menu)
fromLyxMenu.catSub(menu_name);
else
return;
}
- BufferView * bv = 0;
- if (qmenu->d->view)
- bv = qmenu->d->view->currentBufferView();
d->expand(fromLyxMenu, *qmenu->d->top_level_menu, bv);
qmenu->d->populate(qmenu, *qmenu->d->top_level_menu);
}