From 6120d4d43a4a5ff96126ec9093ab652105717ed2 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 2 Mar 2020 19:06:40 +0100 Subject: [PATCH] Improve RouteUI API consistency This is an effective NO-OP * Some methods have been re-named to improve consistency * Duplicate function calls were removed: RouteUI::set_route() already updates mute/solo MixerStrip does not have to update it again * virtual methods have been protected --- gtk2_ardour/foldback_strip.cc | 2 -- gtk2_ardour/mixer_strip.cc | 2 -- gtk2_ardour/route_ui.cc | 19 +++---------------- gtk2_ardour/route_ui.h | 17 +++++++---------- 4 files changed, 10 insertions(+), 30 deletions(-) diff --git a/gtk2_ardour/foldback_strip.cc b/gtk2_ardour/foldback_strip.cc index 17fd37c1b2..becb55fb5f 100644 --- a/gtk2_ardour/foldback_strip.cc +++ b/gtk2_ardour/foldback_strip.cc @@ -569,8 +569,6 @@ FoldbackStrip::set_route (boost::shared_ptr rt) name_changed (); update_send_box (); _session->FBSendsChanged.connect (route_connections, invalidator (*this), boost::bind (&FoldbackStrip::update_send_box, this), gui_context()); - update_mute_display (); - update_solo_display (); comment_changed (); connect_to_pan (); panners.setup_pan (); diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index 91bc5c45c7..fbdb7bf899 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -690,8 +690,6 @@ MixerStrip::set_route (boost::shared_ptr rt) /* now force an update of all the various elements */ - update_mute_display (); - update_solo_display (); name_changed (); comment_changed (); route_group_changed (); diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc index 08d9cb2929..e1b9da4b89 100644 --- a/gtk2_ardour/route_ui.cc +++ b/gtk2_ardour/route_ui.cc @@ -340,7 +340,7 @@ RouteUI::set_route (boost::shared_ptr rp) _route->solo_control()->Changed.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::update_solo_display, this), gui_context()); _route->solo_safe_control()->Changed.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::update_solo_display, this), gui_context()); _route->solo_isolate_control()->Changed.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::update_solo_display, this), gui_context()); - _route->phase_control()->Changed.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::polarity_changed, this), gui_context()); + _route->phase_control()->Changed.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::update_polarity_display, this), gui_context()); _route->fan_out.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::fan_out, this, false, true), gui_context()); if (is_track()) { @@ -395,7 +395,6 @@ RouteUI::set_route (boost::shared_ptr rp) map_frozen (); setup_invert_buttons (); - set_invert_button_state (); boost::shared_ptr s = _showing_sends_to.lock (); bus_send_display_changed (s); @@ -413,16 +412,6 @@ RouteUI::set_route (boost::shared_ptr rp) route_gui_changed (PropertyChange (Properties::selected)); } -void -RouteUI::polarity_changed () -{ - if (!_route) { - return; - } - - set_invert_button_state (); -} - bool RouteUI::mute_press (GdkEventButton* ev) { @@ -2063,11 +2052,11 @@ RouteUI::setup_invert_buttons () _invert_button_box.set_spacing (1); _invert_button_box.show_all (); - set_invert_button_state (); + update_polarity_display (); } void -RouteUI::set_invert_button_state () +RouteUI::update_polarity_display () { uint32_t const N = _route->phase_control()->size(); if (N > _max_invert_buttons) { @@ -2112,7 +2101,6 @@ RouteUI::invert_release (GdkEventButton* ev, uint32_t i) return false; } - bool RouteUI::invert_press (GdkEventButton* ev) { @@ -2152,7 +2140,6 @@ RouteUI::invert_menu_toggled (uint32_t c) return; } - _route->phase_control()->set_phase_invert (c, !_route->phase_control()->inverted (c)); } diff --git a/gtk2_ardour/route_ui.h b/gtk2_ardour/route_ui.h index 82a0ee1ec4..59bae48549 100644 --- a/gtk2_ardour/route_ui.h +++ b/gtk2_ardour/route_ui.h @@ -235,8 +235,6 @@ public: Gtk::CheckMenuItem *rec_safe_item; void toggle_rec_safe (); - virtual void polarity_changed (); - Gtk::CheckMenuItem *denormal_menu_item; void toggle_denormal_protection(); virtual void denormal_protection_changed (); @@ -244,13 +242,6 @@ public: void disconnect_input (); void disconnect_output (); - virtual void blink_rec_display (bool onoff); - void update_mute_display (); - - void update_solo_display (); - - virtual void map_frozen (); - void save_as_template_dialog_response (int response, SaveTemplateDialog* d); void save_as_template (); @@ -290,6 +281,9 @@ protected: void init (); void reset (); + virtual void blink_rec_display (bool onoff); + virtual void map_frozen (); + void self_delete (); virtual void start_step_editing () {} virtual void stop_step_editing() {} @@ -340,11 +334,14 @@ protected: private: void setup_invert_buttons (); - void set_invert_button_state (); void invert_menu_toggled (uint32_t); bool invert_press (GdkEventButton *); bool invert_release (GdkEventButton *, uint32_t i); + void update_solo_display (); + void update_mute_display (); + void update_polarity_display (); + int _i_am_the_modifier; std::vector _invert_buttons; Gtk::Menu* _invert_menu;