From a0b5616c85f25d0f6759c7cc80cc1adb68ef9a22 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 25 May 2019 00:14:50 +0200 Subject: Speed up Plugin status changes Postpone menu rebuild when plugin status changes while the PluginManager Dialog is visible. Since the dialog is modal, the menus cannot be used while the dialog is visible, so updating them once when the dialog is hidden is sufficient. --- gtk2_ardour/plugin_selector.cc | 11 +++++++++++ gtk2_ardour/plugin_selector.h | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/gtk2_ardour/plugin_selector.cc b/gtk2_ardour/plugin_selector.cc index 338d3aa9ee..a06e24893a 100644 --- a/gtk2_ardour/plugin_selector.cc +++ b/gtk2_ardour/plugin_selector.cc @@ -61,6 +61,9 @@ PluginSelector::PluginSelector (PluginManager& mgr) : ArdourDialog (_("Plugin Manager"), true, false) , search_clear_button (Stock::CLEAR) , manager (mgr) + , _need_tag_save (false) + , _need_status_save (false) + , _need_menu_rebuild (false) , _inhibit_refill (false) { set_name ("PluginSelectorWindow"); @@ -786,6 +789,9 @@ PluginSelector::run () if (_need_status_save) { manager.save_statuses(); } + if (_need_menu_rebuild) { + build_plugin_menu (); + } return (int) r; } @@ -929,6 +935,11 @@ PluginSelector::plugin_menu() void PluginSelector::build_plugin_menu () { + if (is_visible ()) { + _need_menu_rebuild = true; + return; + } + _need_menu_rebuild = false; PluginInfoList all_plugs; all_plugs.insert (all_plugs.end(), manager.ladspa_plugin_info().begin(), manager.ladspa_plugin_info().end()); diff --git a/gtk2_ardour/plugin_selector.h b/gtk2_ardour/plugin_selector.h index ba09b08f7f..f1be052028 100644 --- a/gtk2_ardour/plugin_selector.h +++ b/gtk2_ardour/plugin_selector.h @@ -186,7 +186,7 @@ private: bool _need_tag_save; bool _need_status_save; - + bool _need_menu_rebuild; bool _inhibit_refill; }; -- cgit v1.2.3