X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FMenuBackend.C;h=5419f6d8b718fb8ffa923724cd6e2073d18e3481;hb=8765ab59cdddad67284007813ef25934ea0042ce;hp=356c4eb44f986a902f495ca54ce84cccfe953df3;hpb=e0e00a92fc04cba66dd0825ed95b7420deb4afcd;p=lyx.git diff --git a/src/MenuBackend.C b/src/MenuBackend.C index 356c4eb44f..5419f6d8b7 100644 --- a/src/MenuBackend.C +++ b/src/MenuBackend.C @@ -134,7 +134,7 @@ docstring const MenuItem::shortcut() const } -docstring const MenuItem::binding() const +docstring const MenuItem::binding(bool forgui) const { if (kind_ != Command) return docstring(); @@ -144,7 +144,7 @@ docstring const MenuItem::binding() const kb_keymap::Bindings bindings = theTopLevelKeymap().findbindings(func_); if (bindings.size()) { - return from_utf8(bindings.begin()->print()); + return bindings.begin()->print(forgui); } else { lyxerr[Debug::KBMAP] << "No binding for " @@ -275,7 +275,7 @@ Menu & Menu::read(LyXLex & lex) // fallback to md_item case md_item: { lex.next(true); - docstring const name = _(lex.getString()); + docstring const name = translateIfPossible(lex.getDocString()); lex.next(true); string const command = lex.getString(); FuncRequest func = lyxaction.lookupFunc(command); @@ -349,7 +349,7 @@ Menu & Menu::read(LyXLex & lex) // fallback to md_submenu case md_submenu: { lex.next(true); - docstring const mlabel = _(lex.getString()); + docstring const mlabel = translateIfPossible(lex.getDocString()); lex.next(true); docstring const mname = lex.getDocString(); add(MenuItem(MenuItem::Submenu, mlabel, mname, @@ -413,10 +413,9 @@ void Menu::checkShortcuts() const } -void MenuBackend::specialMenu(docstring const &name) +void MenuBackend::specialMenu(Menu const & menu) { - if (hasMenu(name)) - specialmenu_ = &getMenu(name); + specialmenu_ = menu; } @@ -448,10 +447,11 @@ void expandLastfiles(Menu & tomenu) int ii = 1; for (; lfit != lf.end() && ii < 10; ++lfit, ++ii) { + string const file = lfit->absFilename(); docstring const label = convert(ii) + ". " - + makeDisplayPath((*lfit), 30) + + makeDisplayPath(file, 30) + char_type('|') + convert(ii); - tomenu.add(MenuItem(MenuItem::Command, label, FuncRequest(LFUN_FILE_OPEN, (*lfit)))); + tomenu.add(MenuItem(MenuItem::Command, label, FuncRequest(LFUN_FILE_OPEN, file))); } } @@ -486,7 +486,7 @@ void expandBookmarks(Menu & tomenu) for (size_t i = 1; i <= bm.size(); ++i) { if (bm.isValid(i)) { docstring const label = convert(i) + ". " - + makeDisplayPath(bm.bookmark(i).filename, 20) + + makeDisplayPath(bm.bookmark(i).filename.absFilename(), 20) + char_type('|') + convert(i); tomenu.add(MenuItem(MenuItem::Command, label, FuncRequest(LFUN_BOOKMARK_GOTO, convert(i)))); @@ -536,10 +536,12 @@ void expandFormats(MenuItem::Kind kind, Menu & tomenu, Buffer const * buf) switch (kind) { case MenuItem::ImportFormats: + // FIXME: This is a hack, we should rather solve + // FIXME: bug 2488 instead. if ((*fit)->name() == "text") - label = _("Plain Text as Lines"); + label = _("Plain Text"); else if ((*fit)->name() == "textparagraph") - label = _("Plain Text as Paragraphs"); + label = _("Plain Text, Join Lines"); label += "..."; break; case MenuItem::ViewFormats: @@ -626,7 +628,7 @@ void expandCharStyleInsert(Menu & tomenu, Buffer const * buf) docstring const label = from_utf8(cit->name); tomenu.addWithStatusCheck(MenuItem(MenuItem::Command, label, FuncRequest(LFUN_CHARSTYLE_INSERT, - cit->name))); + label))); } } @@ -889,8 +891,7 @@ void MenuBackend::expand(Menu const & frommenu, Menu & tomenu, break; case MenuItem::Command: - if (!specialmenu_ - || !specialmenu_->hasFunc(cit->func())) + if (!specialmenu_.hasFunc(cit->func())) tomenu.addWithStatusCheck(*cit); } }