]> git.lyx.org Git - lyx.git/blobdiff - src/MenuBackend.C
Delay bibfileCache first update up until it is used.
[lyx.git] / src / MenuBackend.C
index 356c4eb44f986a902f495ca54ce84cccfe953df3..81d6a5db90fcb3d41f08ab7cd48de15880425af1 100644 (file)
@@ -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<docstring>(ii) + ". "
-                       + makeDisplayPath((*lfit), 30)
+                       + makeDisplayPath(file, 30)
                        + char_type('|') + convert<docstring>(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<docstring>(i) + ". "
-                               + makeDisplayPath(bm.bookmark(i).filename, 20)
+                               + makeDisplayPath(bm.bookmark(i).filename.absFilename(), 20)
                                + char_type('|') + convert<docstring>(i);
                        tomenu.add(MenuItem(MenuItem::Command, label, FuncRequest(LFUN_BOOKMARK_GOTO, 
                                convert<docstring>(i))));
@@ -626,7 +626,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 +889,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);
                }
        }