X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fplugin_selector.cc;h=3f03a218e523237612f3e779d202a36d71db6728;hb=3dcb7bf3d3f4eca512c799b5f63fd412e5e3e233;hp=9d78a4277eae3cd5d7ff7c34136cef78ca12bb1b;hpb=bdac92b7633fe6be5cb0abc812ed55d2494f30d5;p=ardour.git diff --git a/gtk2_ardour/plugin_selector.cc b/gtk2_ardour/plugin_selector.cc index 9d78a4277e..3f03a218e5 100644 --- a/gtk2_ardour/plugin_selector.cc +++ b/gtk2_ardour/plugin_selector.cc @@ -32,6 +32,7 @@ #include #include #include +#include #include "gtkmm2ext/utils.h" @@ -60,7 +61,7 @@ PluginSelector::PluginSelector (PluginManager& mgr) : ArdourDialog (_("Plugin Manager"), true, false) , search_clear_button (Stock::CLEAR) , manager (mgr) - , inhibit_refill (false) + , _inhibit_refill (false) { set_name ("PluginSelectorWindow"); add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK); @@ -68,10 +69,12 @@ PluginSelector::PluginSelector (PluginManager& mgr) _plugin_menu = 0; in_row_change = false; + //anytime the list changes ( Status, Tags, or scanned plugins ) we need to rebuild redirect-box plugin selector menu manager.PluginListChanged.connect (plugin_list_changed_connection, invalidator (*this), boost::bind (&PluginSelector::build_plugin_menu, this), gui_context()); - manager.PluginListChanged.connect (plugin_list_changed_connection, invalidator (*this), boost::bind (&PluginSelector::refill, this), gui_context()); - manager.PluginStatusesChanged.connect (plugin_list_changed_connection, invalidator (*this), boost::bind (&PluginSelector::plugin_status_changed, this, _1, _2, _3), gui_context()); - manager.PluginTagsChanged.connect(plugin_list_changed_connection, invalidator (*this), boost::bind (&PluginSelector::tags_changed, this, _1, _2, _3), gui_context()); + + //these are used to update the info of specific entries, while they are being edited + manager.PluginStatusChanged.connect (plugin_list_changed_connection, invalidator (*this), boost::bind (&PluginSelector::plugin_status_changed, this, _1, _2, _3), gui_context()); + manager.PluginTagChanged.connect(plugin_list_changed_connection, invalidator (*this), boost::bind (&PluginSelector::tags_changed, this, _1, _2, _3), gui_context()); plugin_model = Gtk::ListStore::create (plugin_columns); plugin_display.set_model (plugin_model); @@ -160,17 +163,19 @@ PluginSelector::PluginSelector (PluginManager& mgr) _search_ignore_checkbox->set_active(true); _search_ignore_checkbox->set_name ("pluginlist filter button"); - Gtk::Label* search_help_label = manage (new Label( - _("All search terms must be matched.\n" - "Ex: \"ess dyn\" will find \"dynamic de-esser\" but not \"de-esser\"." - ), Gtk::ALIGN_LEFT)); + Gtk::Label* search_help_label1 = manage (new Label( + _("All search terms must be matched."), Gtk::ALIGN_LEFT)); + + Gtk::Label* search_help_label2 = manage (new Label( + _("Ex: \"ess dyn\" will find \"dynamic de-esser\" but not \"de-esser\"."), Gtk::ALIGN_LEFT)); search_table->attach (search_entry, 0, 3, 0, 1, FILL|EXPAND, FILL); search_table->attach (search_clear_button, 3, 4, 0, 1, FILL, FILL); search_table->attach (*_search_name_checkbox, 0, 1, 1, 2, FILL, FILL); search_table->attach (*_search_tags_checkbox, 1, 2, 1, 2, FILL, FILL); search_table->attach (*_search_ignore_checkbox,2, 3, 1, 2, FILL, FILL); - search_table->attach (*search_help_label, 0, 3, 2, 3, FILL, FILL); + search_table->attach (*search_help_label1, 0, 3, 2, 3, FILL, FILL); + search_table->attach (*search_help_label2, 0, 3, 3, 4, FILL, FILL); search_table->set_border_width (4); search_table->set_col_spacings (4); @@ -206,7 +211,7 @@ PluginSelector::PluginSelector (PluginManager& mgr) #ifdef LV2_SUPPORT _fil_type_combo.append_text_item (X_("LV2")); #endif - _fil_type_combo.append_text_item (X_("LUA")); + _fil_type_combo.append_text_item (X_("Lua")); _fil_type_combo.append_text_item (X_("LADSPA")); _fil_type_combo.set_text (_("Show All Formats")); @@ -214,17 +219,6 @@ PluginSelector::PluginSelector (PluginManager& mgr) _fil_creator_combo.set_text_ellipsize (Pango::ELLIPSIZE_END); _fil_creator_combo.set_layout_ellipsize_width (PANGO_SCALE * 160 * UIConfiguration::instance ().get_ui_scale ()); - _fil_channel_combo.append_text_item (_("Audio I/O")); - _fil_channel_combo.append_text_item (_("Mono Audio I/O")); - _fil_channel_combo.append_text_item (_("Stereo Audio I/O")); - _fil_channel_combo.append_text_item (_("MIDI I/O (only)")); - _fil_channel_combo.append_text_item (_("Show All I/O")); -#ifdef MIXBUS - _fil_channel_combo.set_text (_("Audio I/O")); -#else - _fil_channel_combo.set_text (_("Show All I/O")); -#endif - VBox* filter_vbox = manage (new VBox); filter_vbox->pack_start (*_fil_effects_radio, false, false); filter_vbox->pack_start (*_fil_instruments_radio, false, false); @@ -234,7 +228,6 @@ PluginSelector::PluginSelector (PluginManager& mgr) filter_vbox->pack_start (*_fil_all_radio, false, false); filter_vbox->pack_start (_fil_type_combo, false, false); filter_vbox->pack_start (_fil_creator_combo, false, false); - filter_vbox->pack_start (_fil_channel_combo, false, false); filter_vbox->set_border_width (4); filter_vbox->set_spacing (4); @@ -253,7 +246,6 @@ PluginSelector::PluginSelector (PluginManager& mgr) _fil_type_combo.StateChanged.connect (sigc::mem_fun (*this, &PluginSelector::refill)); _fil_creator_combo.StateChanged.connect (sigc::mem_fun (*this, &PluginSelector::refill)); - _fil_channel_combo.StateChanged.connect (sigc::mem_fun (*this, &PluginSelector::refill)); /* TAG entry */ @@ -268,16 +260,21 @@ PluginSelector::PluginSelector (PluginManager& mgr) tag_reset_button = manage (new Button (_("Reset"))); tag_reset_button->signal_clicked().connect (sigc::mem_fun (*this, &PluginSelector::tag_reset_button_clicked)); - Gtk::Label* tagging_help_label = manage (new Label( - _("Enter space-separated, one-word Tags for the selected plugin.\n" - "You can include dashes, colons or underscores in a Tag.\n" - "Ex: \"dynamic de-esser vocal\" applies 3 Tags." - ), Gtk::ALIGN_LEFT)); + Gtk::Label* tagging_help_label1 = manage (new Label( + _("Enter space-separated, one-word Tags for the selected plugin."), Gtk::ALIGN_LEFT)); + + Gtk::Label* tagging_help_label2 = manage (new Label( + _("You can include dashes, colons or underscores in a Tag."), Gtk::ALIGN_LEFT)); + + Gtk::Label* tagging_help_label3 = manage (new Label( + _("Ex: \"dynamic de-esser vocal\" applies 3 Tags."), Gtk::ALIGN_LEFT)); int p = 0; tagging_table->attach (*tag_entry, 0, 1, p, p+1, FILL|EXPAND, FILL); tagging_table->attach (*tag_reset_button, 1, 2, p, p+1, FILL, FILL); p++; - tagging_table->attach (*tagging_help_label, 0, 2, p, p+1, FILL, FILL); p++; + tagging_table->attach (*tagging_help_label1, 0, 2, p, p+1, FILL, FILL); p++; + tagging_table->attach (*tagging_help_label2, 0, 2, p, p+1, FILL, FILL); p++; + tagging_table->attach (*tagging_help_label3, 0, 2, p, p+1, FILL, FILL); p++; Frame* tag_frame = manage (new Frame); tag_frame->set_name ("BaseFrame"); @@ -424,7 +421,7 @@ PluginSelector::show_this_plugin (const PluginInfoPtr& info, const std::string& } #endif - if (_fil_type_combo.get_text() == X_("LUA") && info->type != Lua) { + if (_fil_type_combo.get_text() == X_("Lua") && info->type != Lua) { return false; } @@ -440,42 +437,6 @@ PluginSelector::show_this_plugin (const PluginInfoPtr& info, const std::string& } } - /* Filter "I/O" combobox */ - - if (_fil_channel_combo.get_text() != _("Show All I/O") || info->reconfigurable_io ()) { - -#if 0 - if (info->reconfigurable_io ()) { - return true; // who knows.... ? - } -#endif - - if (_fil_channel_combo.get_text() == _("Audio I/O")) { - if ((info->n_inputs.n_audio() == 0 || info->n_outputs.n_audio() == 0)) { - return false; - } - } - - if (_fil_channel_combo.get_text() == _("Mono Audio I/O")) { - if (info->n_inputs.n_audio() != 1 || info->n_outputs.n_audio() != 1) { - return false; - } - } - - if (_fil_channel_combo.get_text() == _("Stereo Audio I/O")) { - if (info->n_inputs.n_audio() != 2 || info->n_outputs.n_audio() != 2) { - return false; - } - } - - if (_fil_channel_combo.get_text() == _("MIDI I/O (only)")) { - if ((info->n_inputs.n_audio() != 0 || info->n_outputs.n_audio() == 0)) { - return false; - } - } - - } - return true; } @@ -496,9 +457,10 @@ PluginSelector::set_sensitive_widgets () _fil_favorites_radio->set_sensitive(false); _fil_hidden_radio->set_sensitive(false); _fil_all_radio->set_sensitive(false); + _inhibit_refill = true; _fil_type_combo.set_sensitive(false); _fil_creator_combo.set_sensitive(false); - _fil_channel_combo.set_sensitive(false); + _inhibit_refill = false; } else { _fil_effects_radio->set_sensitive(true); _fil_instruments_radio->set_sensitive(true); @@ -506,9 +468,10 @@ PluginSelector::set_sensitive_widgets () _fil_favorites_radio->set_sensitive(true); _fil_hidden_radio->set_sensitive(true); _fil_all_radio->set_sensitive(true); + _inhibit_refill = true; _fil_type_combo.set_sensitive(true); _fil_creator_combo.set_sensitive(true); - _fil_channel_combo.set_sensitive(true); + _inhibit_refill = false; } if (!search_entry.get_text().empty()) { refill (); @@ -518,7 +481,7 @@ PluginSelector::set_sensitive_widgets () void PluginSelector::refill () { - if (inhibit_refill) { + if (_inhibit_refill) { return; } @@ -526,6 +489,15 @@ PluginSelector::refill () in_row_change = true; + plugin_display.set_model (Glib::RefPtr(0)); + + int sort_col; + SortType sort_type; + bool sorted = plugin_model->get_sort_column_id (sort_col, sort_type); + + /* Disable sorting to gain performance */ + plugin_model->set_sort_column (-2, SORT_ASCENDING); + plugin_model->clear (); setup_search_string (searchstr); @@ -539,6 +511,11 @@ PluginSelector::refill () lua_refiller (searchstr); in_row_change = false; + + plugin_display.set_model (plugin_model); + if (sorted) { + plugin_model->set_sort_column (sort_col, sort_type); + } } void @@ -604,7 +581,7 @@ PluginSelector::refiller (const PluginInfoList& plugs, const::std::string& searc } else { snprintf (buf, sizeof(buf), "%d / %d", (*i)->n_inputs.n_audio(), (*i)->n_outputs.n_audio()); newrow[plugin_columns.audio_io] = buf; - snprintf (buf, sizeof(buf), "%d / %d", (*i)->n_inputs.n_audio(), (*i)->n_outputs.n_audio()); + snprintf (buf, sizeof(buf), "%d / %d", (*i)->n_inputs.n_midi(), (*i)->n_outputs.n_midi()); newrow[plugin_columns.midi_io] = buf; } @@ -811,8 +788,8 @@ PluginSelector::run () manager.save_statuses(); } - if (_need_menu_rebuild) { - build_plugin_menu(); + if ( _need_tag_save || _need_status_save || _need_menu_rebuild ) { + manager.PluginListChanged(); //emit signal } return (int) r; @@ -833,6 +810,7 @@ PluginSelector::tag_reset_button_clicked () manager.reset_tags (pi); display_selection_changed (); _need_tag_save = true; + _need_menu_rebuild = true; } } @@ -852,9 +830,10 @@ PluginSelector::tag_entry_changed () TreeModel::Row row = *(plugin_display.get_selection()->get_selected()); ARDOUR::PluginInfoPtr pi = row[plugin_columns.plugin]; - manager.set_tags (pi->type, pi->unique_id, tag_entry->get_text(), false); + manager.set_tags (pi->type, pi->unique_id, tag_entry->get_text(), pi->name, PluginManager::FromGui); _need_tag_save = true; + _need_menu_rebuild = true; } } @@ -869,11 +848,6 @@ PluginSelector::tags_changed (PluginType t, std::string unique_id, std::string t } row[plugin_columns.tags] = tags; } - - /* A plugin's tags change while the user is entering them. - * defer a rebuilding of the "tag" menu until the dialog is closed. - */ - _need_menu_rebuild = true; } void @@ -899,9 +873,6 @@ PluginSelector::plugin_status_changed (PluginType t, std::string uid, PluginMana plugin_model->erase(i); } - /* plugin menu must be re-built to accommodate Hidden and Favorite plugins */ - build_plugin_menu(); - return; } } @@ -1062,11 +1033,11 @@ PluginSelector::create_favs_menu (PluginInfoList& all_plugs) Gtk::Menu* PluginSelector::create_by_creator_menu (ARDOUR::PluginInfoList& all_plugs) { - inhibit_refill = true; + _inhibit_refill = true; _fil_creator_combo.clear_items (); _fil_creator_combo.append_text_item (_("Show All Creators")); _fil_creator_combo.set_text (_("Show All Creators")); - inhibit_refill = false; + _inhibit_refill = false; using namespace Menu_Helpers; @@ -1149,12 +1120,11 @@ PluginSelector::create_by_tags_menu (ARDOUR::PluginInfoList& all_plugs) Gtk::Menu* submenu; if ((x = tags_submenu_map.find (*t)) != tags_submenu_map.end()) { submenu = x->second; - } else { + string typ = GetPluginTypeStr(*i); + MenuElem elem ((*i)->name + typ, (sigc::bind (sigc::mem_fun (*this, &PluginSelector::plugin_chosen_from_menu), *i))); + elem.get_child()->set_use_underline (false); + submenu->items().push_back (elem); } - string typ = GetPluginTypeStr(*i); - MenuElem elem ((*i)->name + typ, (sigc::bind (sigc::mem_fun (*this, &PluginSelector::plugin_chosen_from_menu), *i))); - elem.get_child()->set_use_underline (false); - submenu->items().push_back (elem); } } return by_tags; @@ -1202,6 +1172,7 @@ PluginSelector::favorite_changed (const std::string& path) manager.set_status (pi->type, pi->unique_id, status); _need_status_save = true; + _need_menu_rebuild = true; } in_row_change = false; } @@ -1234,6 +1205,7 @@ PluginSelector::hidden_changed (const std::string& path) manager.set_status (pi->type, pi->unique_id, status); _need_status_save = true; + _need_menu_rebuild = true; } in_row_change = false; }