Move Tocs to the "Other lists" submenu based on a blacklist

This causes user-defined Tocs to appear in the main list
This commit is contained in:
Guillaume Munch 2015-11-30 15:27:43 +00:00
parent a64a31c1e5
commit ab98adf925
3 changed files with 26 additions and 2 deletions

View File

@ -339,4 +339,26 @@ docstring TocBackend::outlinerName(string const & type) const
}
bool TocBackend::isOther(std::string const & type)
{
// This is where having an Enum of types would have been more elegant...
return type == "graphics"
|| type == "note"
|| type == "branch"
|| type == "change"
|| type == "label"
|| type == "citation"
|| type == "equation"
|| type == "footnote"
|| type == "marginalnote"
|| type == "nomencl"
|| type == "listings"
|| type == "math-macro"
|| type == "external"
|| type == "senseless"
|| type == "index"
|| type.substr(0,6) == "index:";
}
} // namespace lyx

View File

@ -180,6 +180,9 @@ public:
odocstringstream & os, size_t max_length) const;
///
docstring outlinerName(std::string const & type) const;
/// Whether a toc type is less important and appears in the "Other lists"
/// submenu
static bool isOther(std::string const & type);
private:
///

View File

@ -1310,7 +1310,6 @@ void MenuDefinition::expandToc(Buffer const * buf)
}
MenuDefinition other_lists;
FloatList const & floatlist = buf->params().documentClass().floats();
TocList const & toc_list = buf->tocBackend().tocs();
TocList::const_iterator cit = toc_list.begin();
TocList::const_iterator end = toc_list.end();
@ -1328,7 +1327,7 @@ void MenuDefinition::expandToc(Buffer const * buf)
MenuItem item(MenuItem::Submenu, guiName(cit->first, buf->params()));
item.setSubmenu(submenu);
// deserves to be in the main menu?
if (floatlist.typeExist(cit->first) || cit->first == "child")
if (!TocBackend::isOther(cit->first))
add(item);
else
other_lists.add(item);