]> git.lyx.org Git - features.git/commitdiff
* add "Child Documents" navigate submenu.
authorAbdelrazak Younes <younes@lyx.org>
Tue, 11 Mar 2008 08:25:13 +0000 (08:25 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Tue, 11 Mar 2008 08:25:13 +0000 (08:25 +0000)
* move secondary lists to "Other Lists" navigate submenu as the menu started to be crowded.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23656 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiToc.cpp
src/frontends/qt4/Menus.cpp
src/insets/InsetInclude.cpp

index 5d7b3c4ff17b3b0b28de9b77ef1238257a1ec83f..274ba3e1b6eaabb2ec670c90eb1839905f5b1e7b 100644 (file)
@@ -221,6 +221,8 @@ docstring GuiToc::guiName(string const & type) const
 {
        if (type == "tableofcontents")
                return _("Table of Contents");
+       if (type == "child")
+               return _("Child Documents");
        if (type == "equation")
                return _("List of Equations");
        if (type == "footnote")
index c9dbf4626e8536e96d85931ca7cb722c4eb560d7..de4732af03a47d99ad5c211496cc9f4151174f1f 100644 (file)
@@ -893,6 +893,8 @@ void MenuDefinition::expandToc(Buffer const * buf)
                add(MenuItem(MenuItem::Command, qt_("Master Document"), f));
        }
 
+       MenuDefinition other_lists;
+       
        FloatList const & floatlist = buf->params().documentClass().floats();
        TocList const & toc_list = buf->tocBackend().tocs();
        TocList::const_iterator cit = toc_list.begin();
@@ -913,11 +915,15 @@ void MenuDefinition::expandToc(Buffer const * buf)
                }
                string const & floatName = floatlist.getType(cit->first).listName();
                QString label;
-               if (!floatName.empty())
+               bool in_other_list = true;
+               if (!floatName.empty()) {
                        label = qt_(floatName);
-               // BUG3633: listings is not a proper float so its name
-               // is not shown in floatlist.
-               else if (cit->first == "equation")
+                       in_other_list = false;
+               }
+               else if (cit->first == "child") {
+                       label = qt_("Child Documents");
+                       in_other_list = false;
+               } else if (cit->first == "equation")
                        label = qt_("List of Equations");
                else if (cit->first == "index")
                        label = qt_("List of Indexes");
@@ -933,15 +939,26 @@ void MenuDefinition::expandToc(Buffer const * buf)
                        label = qt_("Labels and References");
                else if (cit->first == "citation")
                        label = qt_("List of Citations");
-               // this should not happen now, but if something else like
-               // listings is added later, this can avoid an empty menu name.
                else
-                       label = qt_("Other floats");
+                       // This should not happen unless the entry is missing above.
+                       label = qt_("Other floats: ") + toqstr(cit->first);
+
                MenuItem item(MenuItem::Submenu, label);
                item.setSubmenu(submenu);
+               if (in_other_list)
+                       other_lists.add(item);
+               else {
+                       item.setSubmenu(submenu);
+                       add(item);
+               }
+       }
+       if (!other_lists.empty()) {
+               MenuItem item(MenuItem::Submenu, qt_("Other Lists"));
+               item.setSubmenu(other_lists);
                add(item);
        }
 
+
        // Handle normal TOC
        cit = toc_list.find("tableofcontents");
        if (cit == end) {
index 1cdcb3ce402da52a46486656d3ffaa78eb9166a7..ba253d2c4b80e00ddc556838f95883d1b72225cd 100644 (file)
@@ -884,6 +884,9 @@ void InsetInclude::addToToc(ParConstIterator const & cpit) const
        if (!childbuffer)
                return;
 
+       Toc & toc = buffer().tocBackend().toc("child");
+       toc.push_back(TocItem(cpit, 0, childbuffer->fileName().displayName()));
+
        TocList & toclist = buffer().tocBackend().tocs();
        TocList const & childtoclist = childbuffer->tocBackend().tocs();
        TocList::const_iterator it = childtoclist.begin();