From efbfbb8330b06c6b2d9253c87e270bb708c5fd10 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 19 Mar 2018 18:13:37 +0100 Subject: Speed up plugin-selector refill. * Detach model from treeview and disable sorting during refill. * Prevent multiple re-fills due to sensitivity updates of ComboBoxes: gtk_widget_set_sensitive() -> CairoWidget::on_state_changed () -> CairoWidget::set_visual_state () -> StateChanged Signal --- gtk2_ardour/plugin_selector.cc | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'gtk2_ardour/plugin_selector.cc') diff --git a/gtk2_ardour/plugin_selector.cc b/gtk2_ardour/plugin_selector.cc index 9796107f02..e01f4872ec 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); @@ -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(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 @@ -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; -- cgit v1.2.3