]> git.lyx.org Git - features.git/blobdiff - src/frontends/qt4/Menus.cpp
Add MenuString to InsetLayout
[features.git] / src / frontends / qt4 / Menus.cpp
index 64f17edfa29310e5ef1025d6d470391797c1bc23..91ab3f271e5a7b2a3c17daae75672fc82587d893 100644 (file)
@@ -1230,13 +1230,16 @@ void MenuDefinition::expandFlexInsert(
                if (cit->second.lyxtype() == type) {
                        if (!cit->second.obsoleted_by().empty())
                                continue;
-                       docstring label = cit->first;
+                       docstring name = cit->first;
                        // we remove the "Flex:" prefix, if it is present
-                       if (prefixIs(label, from_ascii("Flex:")))
-                               label = label.substr(5);
+                       if (prefixIs(name, from_ascii("Flex:")))
+                               name = name.substr(5);
+                       docstring const label = (cit->second.menustring().empty()) ?
+                                               name
+                                             : cit->second.menustring();
                        addWithStatusCheck(MenuItem(MenuItem::Command,
                                toqstr(translateIfPossible(label)),
-                               FuncRequest(LFUN_FLEX_INSERT, Lexer::quoteString(label))));
+                               FuncRequest(LFUN_FLEX_INSERT, Lexer::quoteString(name))));
                }
        }
        // FIXME This is a little clunky.
@@ -1679,8 +1682,9 @@ void MenuDefinition::expandInfoArguments(BufferView const * bv)
        }
        InsetInfo const * iinset = static_cast<InsetInfo const *>(inset);
 
-       string const type = iinset->infoType();
-       vector<pair<string,docstring>> const args = iinset->getArguments(type);
+       string const type = iinset->params().infoType();
+       vector<pair<string,docstring>> const args =
+                       iinset->params().getArguments(&bv->buffer(), type);
 
        // Don't generate a menu for big lists (such as lfuns and rcs)
        if (args.size() > 15)
@@ -2539,10 +2543,10 @@ void Menus::read(Lexer & lex)
 
 
 bool Menus::searchMenu(FuncRequest const & func,
-       docstring_list & names) const
+       docstring_list & names, BufferView const * bv) const
 {
        MenuDefinition menu;
-       d->expand(d->menubar_, menu, 0);
+       d->expand(d->menubar_, menu, bv);
        return menu.searchMenu(func, names);
 }