]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/Menus.cpp
Use localized item when calculating the panel stack's tree widget width.
[lyx.git] / src / frontends / qt4 / Menus.cpp
index 2a3032c4daf0bc0d99f744b739528ea239aa8d3a..535ee31d865d258de1799bfc61b9485f1359893c 100644 (file)
@@ -1311,19 +1311,20 @@ void MenuDefinition::expandToc(Buffer const * buf)
        }
 
        MenuDefinition other_lists;
-       TocList const & toc_list = buf->tocBackend().tocs();
-       TocList::const_iterator cit = toc_list.begin();
-       TocList::const_iterator end = toc_list.end();
-       for (; cit != end; ++cit) {
+       // In the navigation menu, only add tocs from this document
+       TocBackend const & backend = buf->tocBackend();
+       TocList const & toc_list = backend.tocs();
+       for (pair<string, shared_ptr<Toc>> const & toc : toc_list) {
                // Handle table of contents later
-               if (cit->first == "tableofcontents" || cit->second->empty())
+               if (toc.first == "tableofcontents" || toc.second->empty())
                        continue;
                MenuDefinition submenu;
-               submenu.expandTocSubmenu(cit->first, *cit->second);
-               MenuItem item(MenuItem::Submenu, guiName(cit->first, buf->params()));
+               submenu.expandTocSubmenu(toc.first, *toc.second);
+               docstring const toc_name = backend.outlinerName(toc.first);
+               MenuItem item(MenuItem::Submenu, toqstr(toc_name));
                item.setSubmenu(submenu);
                // deserves to be in the main menu?
-               if (!TocBackend::isOther(cit->first))
+               if (!TocBackend::isOther(toc.first))
                        add(item);
                else
                        other_lists.add(item);
@@ -1335,8 +1336,8 @@ void MenuDefinition::expandToc(Buffer const * buf)
        }
        // Handle normal TOC
        add(MenuItem(MenuItem::Separator));
-       cit = toc_list.find("tableofcontents");
-       if (cit == end)
+       TocList::const_iterator cit = toc_list.find("tableofcontents");
+       if (cit == toc_list.end())
                LYXERR(Debug::GUI, "No table of contents.");
        else {
                if (!cit->second->empty())
@@ -1539,7 +1540,7 @@ void MenuDefinition::expandCiteStyles(BufferView const * bv)
                                static_cast<InsetCitation const *>(inset);
 
        Buffer const * buf = &bv->buffer();
-       BufferParams const & bp = buf->params();
+       BufferParams const & bp = buf->masterParams();
        string const cmd = citinset->params().getCmdName();
 
        docstring const & key = citinset->getParam("key");
@@ -1556,7 +1557,18 @@ void MenuDefinition::expandCiteStyles(BufferView const * bv)
 
        vector<docstring> const keys = getVectorFromString(key);
 
-       vector<CitationStyle> const citeStyleList = buf->params().citeStyles();
+       vector<CitationStyle> const citeStyleList = bp.citeStyles();
+
+       CitationStyle cs = citinset->getCitationStyle(bp, cmd, citeStyleList);
+       bool const qualified = cs.hasQualifiedList
+               && (keys.size() > 1
+                   || !citinset->getParam("pretextlist").empty()
+                   || !citinset->getParam("posttextlist").empty());
+       std::map<docstring, docstring> pres =
+               citinset->getQualifiedLists(citinset->getParam("pretextlist"));
+       std::map<docstring, docstring> posts =
+               citinset->getQualifiedLists(citinset->getParam("posttextlist"));
+
        CiteItem ci;
        ci.textBefore = citinset->getParam("before");
        ci.textAfter = citinset->getParam("after");
@@ -1564,6 +1576,9 @@ void MenuDefinition::expandCiteStyles(BufferView const * bv)
        ci.Starred = star;
        ci.context = CiteItem::Dialog;
        ci.max_size = 40;
+       ci.isQualified = qualified;
+       ci.pretexts = pres;
+       ci.posttexts = posts;
        vector<docstring> citeStrings =
                buf->masterBibInfo().getCiteStrings(keys, citeStyleList, bv->buffer(), ci);
 
@@ -1580,9 +1595,6 @@ void MenuDefinition::expandCiteStyles(BufferView const * bv)
                                                "changetype " + from_utf8(citationStyleToString(cs)))));
        }
 
-       // Extra features of the citation styles
-       CitationStyle cs = citinset->getCitationStyle(bp, cmd, citeStyleList);
-
        if (cs.hasStarredVersion) {
                docstring starred = _("All authors|h");
                // Check if we have a custom string/tooltip for the starred version