* 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
This commit is contained in:
Abdelrazak Younes 2008-03-11 08:25:13 +00:00
parent 99a5b638c3
commit 4f1d3f2162
3 changed files with 29 additions and 7 deletions

View File

@ -221,6 +221,8 @@ docstring GuiToc::guiName(string const & type) const
{ {
if (type == "tableofcontents") if (type == "tableofcontents")
return _("Table of Contents"); return _("Table of Contents");
if (type == "child")
return _("Child Documents");
if (type == "equation") if (type == "equation")
return _("List of Equations"); return _("List of Equations");
if (type == "footnote") if (type == "footnote")

View File

@ -893,6 +893,8 @@ void MenuDefinition::expandToc(Buffer const * buf)
add(MenuItem(MenuItem::Command, qt_("Master Document"), f)); add(MenuItem(MenuItem::Command, qt_("Master Document"), f));
} }
MenuDefinition other_lists;
FloatList const & floatlist = buf->params().documentClass().floats(); FloatList const & floatlist = buf->params().documentClass().floats();
TocList const & toc_list = buf->tocBackend().tocs(); TocList const & toc_list = buf->tocBackend().tocs();
TocList::const_iterator cit = toc_list.begin(); 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(); string const & floatName = floatlist.getType(cit->first).listName();
QString label; QString label;
if (!floatName.empty()) bool in_other_list = true;
if (!floatName.empty()) {
label = qt_(floatName); label = qt_(floatName);
// BUG3633: listings is not a proper float so its name in_other_list = false;
// is not shown in floatlist. }
else if (cit->first == "equation") else if (cit->first == "child") {
label = qt_("Child Documents");
in_other_list = false;
} else if (cit->first == "equation")
label = qt_("List of Equations"); label = qt_("List of Equations");
else if (cit->first == "index") else if (cit->first == "index")
label = qt_("List of Indexes"); label = qt_("List of Indexes");
@ -933,14 +939,25 @@ void MenuDefinition::expandToc(Buffer const * buf)
label = qt_("Labels and References"); label = qt_("Labels and References");
else if (cit->first == "citation") else if (cit->first == "citation")
label = qt_("List of Citations"); 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 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); MenuItem item(MenuItem::Submenu, label);
item.setSubmenu(submenu);
if (in_other_list)
other_lists.add(item);
else {
item.setSubmenu(submenu); item.setSubmenu(submenu);
add(item); add(item);
} }
}
if (!other_lists.empty()) {
MenuItem item(MenuItem::Submenu, qt_("Other Lists"));
item.setSubmenu(other_lists);
add(item);
}
// Handle normal TOC // Handle normal TOC
cit = toc_list.find("tableofcontents"); cit = toc_list.find("tableofcontents");

View File

@ -884,6 +884,9 @@ void InsetInclude::addToToc(ParConstIterator const & cpit) const
if (!childbuffer) if (!childbuffer)
return; return;
Toc & toc = buffer().tocBackend().toc("child");
toc.push_back(TocItem(cpit, 0, childbuffer->fileName().displayName()));
TocList & toclist = buffer().tocBackend().tocs(); TocList & toclist = buffer().tocBackend().tocs();
TocList const & childtoclist = childbuffer->tocBackend().tocs(); TocList const & childtoclist = childbuffer->tocBackend().tocs();
TocList::const_iterator it = childtoclist.begin(); TocList::const_iterator it = childtoclist.begin();