From 92cfed14cf3ab5cdf2d0f5b0c5d8662aaeb73c5c Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 25 May 2019 00:12:55 +0200 Subject: [PATCH] Re-use the Mixer's PluginManager (singleton) Previously there were three plugin-manager instances (two of which were never destroyed). There were also 3 sets of context-menus (favorites, by tag, by author..), all of which were re-built when plugin stati changed. Since the Plugin-manager is a modal dialog, it can be re-used in all contexts (route-ui, monitor-section, mixer). --- gtk2_ardour/monitor_section.cc | 8 ++++++-- gtk2_ardour/monitor_section.h | 6 +++--- gtk2_ardour/route_params_ui.cc | 8 ++++++-- gtk2_ardour/route_params_ui.h | 3 +-- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/gtk2_ardour/monitor_section.cc b/gtk2_ardour/monitor_section.cc index e618b3a7a0..b1924eafae 100644 --- a/gtk2_ardour/monitor_section.cc +++ b/gtk2_ardour/monitor_section.cc @@ -108,7 +108,6 @@ MonitorSection::MonitorSection () channel_size_group = SizeGroup::create (SIZE_GROUP_HORIZONTAL); - _plugin_selector = new PluginSelector (PluginManager::instance()); insert_box = new ProcessorBox (0, boost::bind (&MonitorSection::plugin_selector, this), _rr_selection, 0); insert_box->set_no_show_all (); insert_box->show (); @@ -587,7 +586,6 @@ void MonitorSection::set_session (Session* s) { RouteUI::set_session (s); - _plugin_selector->set_session (_session); insert_box->set_session (_session); Glib::RefPtr global_monitor_actions = ActionManager::get_action_group (X_("Monitor Section")); @@ -1613,6 +1611,12 @@ MonitorSection::processors_changed (ARDOUR::RouteProcessorChange) update_processor_box (); } +PluginSelector* +MonitorSection::plugin_selector () +{ + return Mixer_UI::instance()->plugin_selector (); +} + void MonitorSection::use_others_actions () { diff --git a/gtk2_ardour/monitor_section.h b/gtk2_ardour/monitor_section.h index 0a0a0fd7a2..c08513717b 100644 --- a/gtk2_ardour/monitor_section.h +++ b/gtk2_ardour/monitor_section.h @@ -36,7 +36,6 @@ #include "route_ui.h" #include "monitor_selector.h" -#include "plugin_selector.h" #include "processor_box.h" #include "processor_selection.h" @@ -44,6 +43,8 @@ namespace ArdourWidgets { class TearOff; } +class PluginSelector; + class MonitorSection : public RouteUI, public Gtk::EventBox { public: @@ -56,7 +57,7 @@ public: std::string state_id() const; - PluginSelector* plugin_selector() { return _plugin_selector; } + PluginSelector* plugin_selector(); void use_others_actions (); @@ -177,7 +178,6 @@ private: void route_property_changed (const PBD::PropertyChange&) {} ProcessorBox* insert_box; - PluginSelector* _plugin_selector; ProcessorSelection _rr_selection; void help_count_processors (boost::weak_ptr p, uint32_t* cnt) const; uint32_t count_processors (); diff --git a/gtk2_ardour/route_params_ui.cc b/gtk2_ardour/route_params_ui.cc index 33a71f8757..95a945d27c 100644 --- a/gtk2_ardour/route_params_ui.cc +++ b/gtk2_ardour/route_params_ui.cc @@ -41,6 +41,7 @@ #include "gui_thread.h" #include "io_selector.h" #include "keyboard.h" +#include "mixer_ui.h" #include "mixer_strip.h" #include "port_insert_ui.h" #include "plugin_selector.h" @@ -140,7 +141,6 @@ RouteParams_UI::RouteParams_UI () add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::BUTTON_RELEASE_MASK); - _plugin_selector = new PluginSelector (PluginManager::instance()); show_all(); } @@ -228,6 +228,11 @@ RouteParams_UI::map_frozen() } } +PluginSelector* +RouteParams_UI::plugin_selector() { + return Mixer_UI::instance()->plugin_selector (); +} + void RouteParams_UI::setup_processor_boxes() { @@ -406,7 +411,6 @@ RouteParams_UI::set_session (Session *sess) ArdourWindow::set_session (sess); route_display_model->clear(); - _plugin_selector->set_session (_session); if (_session) { boost::shared_ptr r = _session->get_routes(); diff --git a/gtk2_ardour/route_params_ui.h b/gtk2_ardour/route_params_ui.h index 6b047356fc..1bd850daf9 100644 --- a/gtk2_ardour/route_params_ui.h +++ b/gtk2_ardour/route_params_ui.h @@ -64,7 +64,7 @@ public: void set_session (ARDOUR::Session*); void session_going_away (); - PluginSelector* plugin_selector() { return _plugin_selector; } + PluginSelector* plugin_selector(); private: Gtk::VBox list_vpacker; @@ -112,7 +112,6 @@ private: IOSelector * _input_iosel; IOSelector * _output_iosel; - PluginSelector *_plugin_selector; ProcessorSelection _p_selection; boost::shared_ptr _route;