Don't show hidden controls inline in the mixer-strip
[ardour.git] / gtk2_ardour / plugin_selector.cc
index 9796107f0284b8bcadd293b9df5ef62417f877c1..3f03a218e523237612f3e779d202a36d71db6728 100644 (file)
@@ -32,6 +32,7 @@
 #include <gtkmm/notebook.h>
 #include <gtkmm/stock.h>
 #include <gtkmm/table.h>
+#include <gtkmm/treestore.h>
 
 #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);
@@ -210,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"));
 
@@ -218,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);
@@ -238,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);
@@ -257,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 */
 
@@ -433,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;
        }
 
@@ -449,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;
 }
 
@@ -505,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);
@@ -515,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 ();
@@ -527,7 +481,7 @@ PluginSelector::set_sensitive_widgets ()
 void
 PluginSelector::refill ()
 {
-       if (inhibit_refill) {
+       if (_inhibit_refill) {
                return;
        }
 
@@ -535,6 +489,15 @@ PluginSelector::refill ()
 
        in_row_change = true;
 
+       plugin_display.set_model (Glib::RefPtr<Gtk::TreeStore>(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);
@@ -548,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
@@ -613,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;
                        }
 
@@ -1065,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;