mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-23 00:38:01 +00:00
Menus: Factor Toc code
This commit is contained in:
parent
ab98adf925
commit
089b80fc7d
@ -351,6 +351,7 @@ public:
|
||||
void expandFloatListInsert(Buffer const * buf);
|
||||
void expandFloatInsert(Buffer const * buf);
|
||||
void expandFlexInsert(Buffer const * buf, InsetLayout::InsetLyXType type);
|
||||
void expandTocSubmenu(std::string const & type, Toc const & toc_list);
|
||||
void expandToc2(Toc const & toc_list, size_t from, size_t to, int depth, string toc_type);
|
||||
void expandToc(Buffer const * buf);
|
||||
void expandPasteRecent(Buffer const * buf);
|
||||
@ -1318,12 +1319,7 @@ void MenuDefinition::expandToc(Buffer const * buf)
|
||||
if (cit->first == "tableofcontents" || cit->second->empty())
|
||||
continue;
|
||||
MenuDefinition submenu;
|
||||
// "Open outliner..." entry
|
||||
FuncRequest f(LFUN_DIALOG_SHOW, "toc " + cit->first);
|
||||
submenu.add(MenuItem(MenuItem::Command, qt_("Open Outliner..."), f));
|
||||
submenu.add(MenuItem(MenuItem::Separator));
|
||||
// add entries
|
||||
submenu.expandToc2(*cit->second, 0, cit->second->size(), 0, cit->first);
|
||||
submenu.expandTocSubmenu(cit->first, *cit->second);
|
||||
MenuItem item(MenuItem::Submenu, guiName(cit->first, buf->params()));
|
||||
item.setSubmenu(submenu);
|
||||
// deserves to be in the main menu?
|
||||
@ -1352,6 +1348,17 @@ void MenuDefinition::expandToc(Buffer const * buf)
|
||||
}
|
||||
|
||||
|
||||
void MenuDefinition::expandTocSubmenu(std::string const & type, Toc const & toc)
|
||||
{
|
||||
// "Open outliner..." entry
|
||||
FuncRequest f(LFUN_DIALOG_SHOW, "toc " + type);
|
||||
add(MenuItem(MenuItem::Command, qt_("Open Outliner..."), f));
|
||||
add(MenuItem(MenuItem::Separator));
|
||||
// add entries
|
||||
expandToc2(toc, 0, toc.size(), 0, type);
|
||||
}
|
||||
|
||||
|
||||
void MenuDefinition::expandPasteRecent(Buffer const * buf)
|
||||
{
|
||||
docstring_list const sel = cap::availableSelections(buf);
|
||||
|
Loading…
x
Reference in New Issue
Block a user