]> git.lyx.org Git - lyx.git/blobdiff - src/MenuBackend.C
Almost fix 'make check'. The only remaining problem is an undefined
[lyx.git] / src / MenuBackend.C
index 356c4eb44f986a902f495ca54ce84cccfe953df3..5419f6d8b718fb8ffa923724cd6e2073d18e3481 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))));
@@ -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);
                }
        }