diff options
author | Carl Hetherington <carl@carlh.net> | 2009-11-16 01:06:33 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2009-11-16 01:06:33 +0000 |
commit | 1e8f2693f7837fce868e0e4e710c6e8aeffb7662 (patch) | |
tree | 9e72fcc1a6e1c162f10d9e0332c006f3b3bb2e8c /gtk2_ardour/plugin_selector.cc | |
parent | 0aaa08a3d260539e2c193082d7c1ce2967a8e148 (diff) |
Build plugin menu only when plugins change, and build the first version of it before it is required to ensure that the first processor box popup menu appears fairly quickly.
git-svn-id: svn://localhost/ardour2/branches/3.0@6092 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/plugin_selector.cc')
-rw-r--r-- | gtk2_ardour/plugin_selector.cc | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/gtk2_ardour/plugin_selector.cc b/gtk2_ardour/plugin_selector.cc index f50c97e417..cf43422f4f 100644 --- a/gtk2_ardour/plugin_selector.cc +++ b/gtk2_ardour/plugin_selector.cc @@ -70,10 +70,14 @@ PluginSelector::PluginSelector (PluginManager *mgr) set_name ("PluginSelectorWindow"); add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK); + _plugin_menu = 0; manager = mgr; session = 0; in_row_change = false; + manager->PluginListChanged.connect (mem_fun (*this, &PluginSelector::build_plugin_menu)); + build_plugin_menu (); + plugin_model = Gtk::ListStore::create (plugin_columns); plugin_display.set_model (plugin_model); /* XXX translators: try to convert "Fav" into a short term @@ -189,6 +193,11 @@ PluginSelector::PluginSelector (PluginManager *mgr) refill (); } +PluginSelector::~PluginSelector () +{ + delete _plugin_menu; +} + void PluginSelector::row_clicked(GdkEventButton* event) { @@ -562,10 +571,16 @@ struct PluginMenuCompareByCategory { } }; -/** @return a Gtk::manage()d menu */ +/** @return Plugin menu. The caller should not delete it */ Gtk::Menu* PluginSelector::plugin_menu() { + return _plugin_menu; +} + +void +PluginSelector::build_plugin_menu () +{ PluginInfoList all_plugs; all_plugs.insert (all_plugs.end(), manager->ladspa_plugin_info().begin(), manager->ladspa_plugin_info().end()); @@ -581,10 +596,12 @@ PluginSelector::plugin_menu() using namespace Menu_Helpers; - Menu* menu = manage (new Menu()); - menu->set_name("ArdourContextMenu"); - - MenuList& items = menu->items(); + delete _plugin_menu; + + _plugin_menu = new Menu; + _plugin_menu->set_name("ArdourContextMenu"); + + MenuList& items = _plugin_menu->items(); items.clear (); Gtk::Menu* favs = create_favs_menu(all_plugs); @@ -598,8 +615,6 @@ PluginSelector::plugin_menu() Menu* by_category = create_by_category_menu(all_plugs); items.push_back (MenuElem (_("By Category"), *manage (by_category))); - - return menu; } Gtk::Menu* @@ -742,6 +757,8 @@ PluginSelector::favorite_changed (const Glib::ustring& path) manager->set_status (pi->type, pi->unique_id, status); manager->save_statuses (); + + build_plugin_menu (); } in_row_change = false; } |