Further tweaks to Plugin-Selector:
authorRobin Gareus <robin@gareus.org>
Tue, 30 Jan 2018 11:40:06 +0000 (12:40 +0100)
committerRobin Gareus <robin@gareus.org>
Tue, 30 Jan 2018 11:40:06 +0000 (12:40 +0100)
* update current search when toggling search_ignore_checkbox
* take filter-view into account when changing plugin-status,
  immediately hide hidden or un-favorerd plugins from view.
* default to "effects only"

gtk2_ardour/plugin_selector.cc

index 294d0f937125bbff137246591a7794ea26b1648a..93d30bb2f41c257734084ce988d01e6a44588305 100644 (file)
@@ -120,7 +120,7 @@ PluginSelector::PluginSelector (PluginManager& mgr)
        added_list.set_headers_visible (true);
        added_list.set_reorderable (false);
 
-       for (int i = 2; i <=7; i++) {
+       for (int i = 2; i <= 7; i++) {
                Gtk::TreeView::Column* column = plugin_display.get_column(i);
                if (column) {
                        column->set_sort_column(i);
@@ -197,10 +197,6 @@ PluginSelector::PluginSelector (PluginManager& mgr)
        _fil_hidden_radio = manage (new RadioButton (fil_radio_group, _("Show Hidden Only")));
        _fil_all_radio = manage (new RadioButton (fil_radio_group, _("Show All")));
 
-#ifndef MIXBUS
-       _fil_all_radio->set_active ();
-#endif
-
        _fil_type_combo = manage (new ComboBoxText);
        _fil_type_combo->append_text (_("Show All Formats"));
        _fil_type_combo->append_text (X_("VST"));
@@ -502,7 +498,7 @@ PluginSelector::setup_search_string (string& searchstr)
 void
 PluginSelector::set_sensitive_widgets ()
 {
-       if (_search_ignore_checkbox->get_active() && (search_entry.get_text() != "")) {
+       if (_search_ignore_checkbox->get_active() && !search_entry.get_text().empty()) {
                _fil_effects_radio->set_sensitive(false);
                _fil_instruments_radio->set_sensitive(false);
                _fil_utils_radio->set_sensitive(false);
@@ -523,6 +519,9 @@ PluginSelector::set_sensitive_widgets ()
                _fil_creator_combo->set_sensitive(true);
                _fil_channel_combo->set_sensitive(true);
        }
+       if (!search_entry.get_text().empty()) {
+               refill ();
+       }
 }
 
 void
@@ -850,7 +849,9 @@ void
 PluginSelector::search_entry_changed ()
 {
        set_sensitive_widgets();
-       refill ();
+       if (search_entry.get_text().empty()) {
+               refill ();
+       }
 }
 
 void
@@ -895,9 +896,17 @@ PluginSelector::plugin_status_changed (PluginType t, std::string uid, PluginMana
                        (*i)[plugin_columns.hidden] = (stat == PluginManager::Hidden) ? true : false;
 
                        /* if plug was hidden, remove it from the view */
-                       if (stat==PluginManager::Hidden) {
+                       if (stat == PluginManager::Hidden) {
+                               if (!_fil_hidden_radio->get_active() && !_fil_all_radio->get_active()) {
+                                       plugin_model->erase(i);
+                               }
+                       } else if (_fil_hidden_radio->get_active()) {
                                plugin_model->erase(i);
                        }
+                       /* if no longer a favorite, remove it from the view */
+                       if (stat != PluginManager::Favorite && _fil_favorites_radio->get_active()) {
+                                       plugin_model->erase(i);
+                       }
 
                        /* plugin menu must be re-built to accommodate Hidden and Favorite plugins */
                        build_plugin_menu();