+void
+PluginSelector::filter_mode_changed ()
+{
+ std::string mode = filter_mode.get_active_text ();
+
+ if (mode == _("Favorites only") || mode == _("Hidden only")) {
+ filter_entry.set_sensitive (false);
+ } else {
+ filter_entry.set_sensitive (true);
+ }
+
+ refill ();
+}
+
+void
+PluginSelector::on_show ()
+{
+ ArdourDialog::on_show ();
+ filter_entry.grab_focus ();
+}
+
+struct PluginMenuCompareByCreator {
+ bool operator() (PluginInfoPtr a, PluginInfoPtr b) const {
+ int cmp;
+
+ cmp = strcasecmp (a->creator.c_str(), b->creator.c_str());
+
+ if (cmp < 0) {
+ return true;
+ } else if (cmp == 0) {
+ /* same creator ... compare names */
+ if (strcasecmp (a->name.c_str(), b->name.c_str()) < 0) {
+ return true;
+ }
+ }
+ return false;
+ }
+};
+
+struct PluginMenuCompareByName {
+ bool operator() (PluginInfoPtr a, PluginInfoPtr b) const {
+ int cmp;
+
+ cmp = strcasecmp (a->name.c_str(), b->name.c_str());
+
+ if (cmp < 0) {
+ return true;
+ } else if (cmp == 0) {
+ /* same name ... compare type */
+ if (a->type < b->type) {
+ return true;
+ }
+ }
+ return false;
+ }
+};
+
+struct PluginMenuCompareByCategory {
+ bool operator() (PluginInfoPtr a, PluginInfoPtr b) const {
+ int cmp;
+
+ cmp = strcasecmp (a->category.c_str(), b->category.c_str());
+
+ if (cmp < 0) {
+ return true;
+ } else if (cmp == 0) {
+ /* same category ... compare names */
+ if (strcasecmp (a->name.c_str(), b->name.c_str()) < 0) {
+ return true;
+ }
+ }
+ return false;
+ }
+};
+
+/** @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());
+#ifdef VST_SUPPORT
+ all_plugs.insert (all_plugs.end(), manager.vst_plugin_info().begin(), manager.vst_plugin_info().end());
+#endif
+#ifdef LXVST_SUPPORT
+ all_plugs.insert (all_plugs.end(), manager.lxvst_plugin_info().begin(), manager.lxvst_plugin_info().end());
+#endif
+#ifdef AUDIOUNIT_SUPPORT
+ all_plugs.insert (all_plugs.end(), manager.au_plugin_info().begin(), manager.au_plugin_info().end());
+#endif
+#ifdef LV2_SUPPORT
+ all_plugs.insert (all_plugs.end(), manager.lv2_plugin_info().begin(), manager.lv2_plugin_info().end());
+#endif