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
This commit is contained in:
Carl Hetherington 2009-11-16 01:06:33 +00:00
parent 0aaa08a3d2
commit 1e8f2693f7
5 changed files with 34 additions and 12 deletions

View file

@ -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,9 +571,15 @@ 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;
@ -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;
}