From cebd63f844a8c1eb74515799c38c2608c14623fc Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Mon, 2 Jun 2008 12:51:36 +0000 Subject: [PATCH] Move secondary toolbars to View->Toolbars->Other Toolbars. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25069 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/Menus.cpp | 15 +++++++++++++-- src/frontends/qt4/Toolbars.cpp | 6 ++++++ src/frontends/qt4/Toolbars.h | 2 ++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/frontends/qt4/Menus.cpp b/src/frontends/qt4/Menus.cpp index 55c36c494a..7acb9e11b3 100644 --- a/src/frontends/qt4/Menus.cpp +++ b/src/frontends/qt4/Menus.cpp @@ -1004,12 +1004,23 @@ void MenuDefinition::expandPasteRecent() void MenuDefinition::expandToolbars() { + MenuDefinition other_lists; // extracts the toolbars from the backend Toolbars::Infos::const_iterator cit = guiApp->toolbars().begin(); Toolbars::Infos::const_iterator end = guiApp->toolbars().end(); for (; cit != end; ++cit) { - add(MenuItem(MenuItem::Command, qt_(cit->gui_name), - FuncRequest(LFUN_TOOLBAR_TOGGLE, cit->name))); + MenuItem const item(MenuItem::Command, qt_(cit->gui_name), + FuncRequest(LFUN_TOOLBAR_TOGGLE, cit->name)); + if (guiApp->toolbars().isMainToolbar(cit->name)) + add(item); + else + other_lists.add(item); + } + + if (!other_lists.empty()) { + MenuItem item(MenuItem::Submenu, qt_("Other Toolbars")); + item.setSubmenu(other_lists); + add(item); } } diff --git a/src/frontends/qt4/Toolbars.cpp b/src/frontends/qt4/Toolbars.cpp index 33c444d0e5..b1d6a41336 100644 --- a/src/frontends/qt4/Toolbars.cpp +++ b/src/frontends/qt4/Toolbars.cpp @@ -323,5 +323,11 @@ int Toolbars::defaultVisibility(std::string const & name) const } +bool Toolbars::isMainToolbar(std::string const & name) const +{ + return toolbar_visibility_.find(name) != toolbar_visibility_.end(); +} + + } // namespace frontend } // namespace lyx diff --git a/src/frontends/qt4/Toolbars.h b/src/frontends/qt4/Toolbars.h index 99d12efc53..0932a6861d 100644 --- a/src/frontends/qt4/Toolbars.h +++ b/src/frontends/qt4/Toolbars.h @@ -131,6 +131,8 @@ public: ToolbarInfo const * info(std::string const & name) const; /// int defaultVisibility(std::string const & name) const; + /// + bool isMainToolbar(std::string const & name) const; private: /// all the defined toolbars