From 0a17d8e66ad82e612b1cefb83c7bec2a0ab1d6af Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 1 Jan 2022 15:34:47 +0100 Subject: [PATCH] Use shared static method to count plugins This moves MixersStrip::help_count_plugins to RouteUI, so that it can be shared with other Strip implementations. --- gtk2_ardour/mixer_strip.cc | 26 +++----------------------- gtk2_ardour/mixer_strip.h | 3 --- gtk2_ardour/route_ui.cc | 17 +++++++++++++++++ gtk2_ardour/route_ui.h | 2 ++ 4 files changed, 22 insertions(+), 26 deletions(-) diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index 3fb9f92be4..08ec1708e2 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -123,7 +123,6 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session* sess, bool in_mixer) , output_button (false) , monitor_section_button (0) , midi_input_enable_button (0) - , _plugin_insert_cnt (0) , _tmaster_widget (-1, 16) , _comment_button (_("Comments")) , trim_control (ArdourKnob::default_elements, ArdourKnob::Flags (ArdourKnob::Detent | ArdourKnob::ArcToZero)) @@ -163,7 +162,6 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session* sess, boost::shared_ptr rt , output_button (false) , monitor_section_button (0) , midi_input_enable_button (0) - , _plugin_insert_cnt (0) , _tmaster_widget (-1, 16) , _comment_button (_("Comments")) , trim_control (ArdourKnob::default_elements, ArdourKnob::Flags (ArdourKnob::Detent | ArdourKnob::ArcToZero)) @@ -1066,24 +1064,6 @@ MixerStrip::show_passthru_color () reset_strip_style (); } - -void -MixerStrip::help_count_plugins (boost::weak_ptr p) -{ - boost::shared_ptr processor (p.lock ()); - if (!processor || !processor->display_to_user()) { - return; - } - boost::shared_ptr pi = boost::dynamic_pointer_cast (processor); -#ifdef MIXBUS - if (pi && pi->is_channelstrip ()) { - return; - } -#endif - if (pi) { - ++_plugin_insert_cnt; - } -} void MixerStrip::build_route_ops_menu () { @@ -1171,9 +1151,9 @@ MixerStrip::build_route_ops_menu () items.push_back (SeparatorElem()); } - _plugin_insert_cnt = 0; - _route->foreach_processor (sigc::mem_fun (*this, &MixerStrip::help_count_plugins)); - if (active && _plugin_insert_cnt > 0) { + uint32_t plugin_insert_cnt = 0; + _route->foreach_processor (boost::bind (RouteUI::help_count_plugins, _1, & plugin_insert_cnt)); + if (active && plugin_insert_cnt > 0) { items.push_back (MenuElem (_("Pin Connections..."), sigc::mem_fun (*this, &RouteUI::manage_pins))); } diff --git a/gtk2_ardour/mixer_strip.h b/gtk2_ardour/mixer_strip.h index fe69cff0c7..30721aff92 100644 --- a/gtk2_ardour/mixer_strip.h +++ b/gtk2_ardour/mixer_strip.h @@ -225,9 +225,6 @@ private: bool input_active_button_press (GdkEventButton*); bool input_active_button_release (GdkEventButton*); - void help_count_plugins (boost::weak_ptr); - uint32_t _plugin_insert_cnt; - gint mark_update_safe (); guint32 mode_switch_in_progress; diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc index adf24ad36f..1df8cc2074 100644 --- a/gtk2_ardour/route_ui.cc +++ b/gtk2_ardour/route_ui.cc @@ -2254,6 +2254,23 @@ RouteUI::route_group() const return _route->route_group(); } +void +RouteUI::help_count_plugins (boost::weak_ptr p, uint32_t* plugin_insert_cnt) +{ + boost::shared_ptr processor (p.lock ()); + if (!processor || !processor->display_to_user()) { + return; + } + boost::shared_ptr pi = boost::dynamic_pointer_cast (processor); +#ifdef MIXBUS + if (pi && pi->is_channelstrip ()) { + return; + } +#endif + if (pi) { + ++(*plugin_insert_cnt); + } +} RoutePinWindowProxy::RoutePinWindowProxy(std::string const &name, boost::shared_ptr route) : WM::ProxyBase (name, string()) diff --git a/gtk2_ardour/route_ui.h b/gtk2_ardour/route_ui.h index 7337cab7ea..926ffbe220 100644 --- a/gtk2_ardour/route_ui.h +++ b/gtk2_ardour/route_ui.h @@ -217,6 +217,8 @@ protected: static void delete_ioselector (IOSelectorMap&, boost::shared_ptr); + static void help_count_plugins (boost::weak_ptr p, uint32_t*); + PBD::ScopedConnectionList route_connections; bool self_destruct;