From 4f1d3f21625bcc8c5adb07408a824521434d8425 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Tue, 11 Mar 2008 08:25:13 +0000 Subject: [PATCH] * add "Child Documents" navigate submenu. * 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 | 2 ++ src/frontends/qt4/Menus.cpp | 31 ++++++++++++++++++++++++------- src/insets/InsetInclude.cpp | 3 +++ 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/src/frontends/qt4/GuiToc.cpp b/src/frontends/qt4/GuiToc.cpp index 5d7b3c4ff1..274ba3e1b6 100644 --- a/src/frontends/qt4/GuiToc.cpp +++ b/src/frontends/qt4/GuiToc.cpp @@ -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") diff --git a/src/frontends/qt4/Menus.cpp b/src/frontends/qt4/Menus.cpp index c9dbf4626e..de4732af03 100644 --- a/src/frontends/qt4/Menus.cpp +++ b/src/frontends/qt4/Menus.cpp @@ -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) { diff --git a/src/insets/InsetInclude.cpp b/src/insets/InsetInclude.cpp index 1cdcb3ce40..ba253d2c4b 100644 --- a/src/insets/InsetInclude.cpp +++ b/src/insets/InsetInclude.cpp @@ -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(); -- 2.39.2