]> git.lyx.org Git - lyx.git/blobdiff - src/MenuBackend.cpp
cleanups: split Paragraph::Private::simpleTeXSpecialChars() in two. Remove two or...
[lyx.git] / src / MenuBackend.cpp
index fec705230dd64dddca6ce2f7518f36575a1abc3b..d4e0e2b7df9b55ce53c5cfefeae56cab4ce170fd 100644 (file)
@@ -65,7 +65,7 @@ using std::max;
 using std::sort;
 using std::string;
 using std::vector;
-
+using std::stack;
 
 namespace {
 
@@ -423,6 +423,27 @@ void Menu::checkShortcuts() const
 }
 
 
+bool Menu::searchFunc(FuncRequest & func, stack<docstring> & names)
+{
+       const_iterator m = begin();
+       const_iterator m_end = end();
+       for (; m != m_end; ++m) {
+               if (m->kind() == MenuItem::Command && m->func() == func) {
+                       names.push(m->label());
+                       return true;
+               } else if (m->kind() == MenuItem::Submenu) {
+                       names.push(m->label());
+                       Menu submenu = menubackend.getMenu(m->submenuname());
+                       if (submenu.searchFunc(func, names))
+                               return true;
+                       else
+                               names.pop();
+               }
+       }
+       return false;
+}
+
+
 void MenuBackend::specialMenu(Menu const & menu)
 {
        specialmenu_ = menu;