Add method to show/hide VCA (and Mixbus) Mixer pane
[ardour.git] / gtk2_ardour / plugin_selector.cc
index 785c4ebedaad9d13efd85f64be5624b952fdc6de..cbf9aba525ef486419a54bc4c12ac13babfd20c4 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"));
 
@@ -433,7 +434,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;
        }
 
@@ -505,9 +506,11 @@ 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 +518,11 @@ 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 +532,7 @@ PluginSelector::set_sensitive_widgets ()
 void
 PluginSelector::refill ()
 {
-       if (inhibit_refill) {
+       if (_inhibit_refill) {
                return;
        }
 
@@ -535,6 +540,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 +562,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 +632,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;
                        }
 
@@ -862,7 +881,7 @@ PluginSelector::tag_entry_changed ()
                TreeModel::Row row = *(plugin_display.get_selection()->get_selected());
 
                ARDOUR::PluginInfoPtr pi = row[plugin_columns.plugin];
-               manager.set_tags (pi->name, 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;
@@ -1065,11 +1084,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;