diff options
author | Carl Hetherington <carl@carlh.net> | 2011-11-03 00:42:16 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2011-11-03 00:42:16 +0000 |
commit | 22d87a18dc602ef29a82f5c1fa68ba00ecacfe4b (patch) | |
tree | e726f9cb19487b1945ee1dc30b18463b429ac6f5 /gtk2_ardour | |
parent | bcac4f1c96c6c5d67a145c38d2cb56429f0040da (diff) |
Tidy up send-to button handling a bit, should fix #4426 and #4427.
git-svn-id: svn://localhost/ardour2/branches/3.0@10406 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/mixer_strip.cc | 47 | ||||
-rw-r--r-- | gtk2_ardour/mixer_strip.h | 3 | ||||
-rw-r--r-- | gtk2_ardour/route_ui.cc | 47 | ||||
-rw-r--r-- | gtk2_ardour/route_ui.h | 11 |
4 files changed, 56 insertions, 52 deletions
diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index 7021e06b4e..4f4d400a56 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -73,8 +73,6 @@ using namespace Gtk; using namespace Gtkmm2ext; using namespace std; -sigc::signal<void,boost::shared_ptr<Route> > MixerStrip::SwitchIO; - int MixerStrip::scrollbar_height = 0; PBD::Signal1<void,MixerStrip*> MixerStrip::CatchDeletion; @@ -331,8 +329,6 @@ MixerStrip::init () set_flags (get_flags() | Gtk::CAN_FOCUS); - SwitchIO.connect (sigc::mem_fun (*this, &MixerStrip::switch_io)); - AudioEngine::instance()->PortConnectedOrDisconnected.connect ( *this, invalidator (*this), boost::bind (&MixerStrip::port_connected_or_disconnected, this, _1, _3), gui_context () ); @@ -1647,36 +1643,21 @@ MixerStrip::meter_changed () gpm.reset_peak_display(); } +/** The bus that we are displaying sends to has changed, or been turned off. + * @param send_to New bus that we are displaying sends to, or 0. + */ void -MixerStrip::switch_io (boost::shared_ptr<Route> target) +MixerStrip::bus_send_display_changed (boost::shared_ptr<Route> send_to) { - /* don't respond to switch IO signal outside of the mixer window */ - - if (!_mixer_owned) { - return; - } - - if (_route == target || _route->is_master()) { - /* don't change the display for the target or the master bus */ - return; - } else if (!is_track() && show_sends_button) { - /* make sure our show sends button is inactive, and we no longer blink, - since we're not the target. - */ - send_blink_connection.disconnect (); - show_sends_button->unset_active_state (); - } - - if (!target) { - /* switch back to default */ - revert_to_default_display (); - return; - } + RouteUI::bus_send_display_changed (send_to); - boost::shared_ptr<Send> send = _route->internal_send_for (target); - - if (send) { - show_send (send); + if (send_to) { + boost::shared_ptr<Send> send = _route->internal_send_for (send_to); + if (send) { + show_send (send); + } else { + revert_to_default_display (); + } } else { revert_to_default_display (); } @@ -1755,10 +1736,6 @@ MixerStrip::show_send (boost::shared_ptr<Send> send) void MixerStrip::revert_to_default_display () { - if (show_sends_button) { - show_sends_button->unset_active_state (); - } - drop_send (); set_current_delivery (_route->main_outs ()); diff --git a/gtk2_ardour/mixer_strip.h b/gtk2_ardour/mixer_strip.h index 07011eab92..6cb084922a 100644 --- a/gtk2_ardour/mixer_strip.h +++ b/gtk2_ardour/mixer_strip.h @@ -116,7 +116,6 @@ class MixerStrip : public RouteUI, public Gtk::EventBox /** The delivery that we are handling the level for with our fader has changed */ PBD::Signal1<void, boost::weak_ptr<ARDOUR::Delivery> > DeliveryChanged; - static sigc::signal<void,boost::shared_ptr<ARDOUR::Route> > SwitchIO; static PBD::Signal1<void,MixerStrip*> CatchDeletion; std::string state_id() const; @@ -279,7 +278,7 @@ class MixerStrip : public RouteUI, public Gtk::EventBox void engine_running(); void engine_stopped(); - void switch_io (boost::shared_ptr<ARDOUR::Route>); + virtual void bus_send_display_changed (boost::shared_ptr<ARDOUR::Route>); void set_current_delivery (boost::shared_ptr<ARDOUR::Delivery>); boost::shared_ptr<ARDOUR::Delivery> _current_delivery; diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc index 9bedb9b521..112b3eb73e 100644 --- a/gtk2_ardour/route_ui.cc +++ b/gtk2_ardour/route_ui.cc @@ -64,6 +64,8 @@ using namespace ARDOUR; using namespace PBD; uint32_t RouteUI::_max_invert_buttons = 3; +sigc::signal<void, boost::shared_ptr<Route> > RouteUI::BusSendDisplayChanged; +boost::weak_ptr<Route> RouteUI::_showing_sends_to; RouteUI::RouteUI (ARDOUR::Session* sess) : AxisView(sess) @@ -165,6 +167,8 @@ RouteUI::init () monitor_disk_button->signal_button_press_event().connect (sigc::mem_fun(*this, &RouteUI::monitor_disk_press)); monitor_disk_button->signal_button_release_event().connect (sigc::mem_fun(*this, &RouteUI::monitor_disk_release)); + + BusSendDisplayChanged.connect (sigc::mem_fun (*this, &RouteUI::bus_send_display_changed)); } void @@ -258,6 +262,9 @@ RouteUI::set_route (boost::shared_ptr<Route> rp) setup_invert_buttons (); set_invert_button_state (); + + boost::shared_ptr<Route> s = _showing_sends_to.lock (); + bus_send_display_changed (s); } void @@ -888,22 +895,13 @@ RouteUI::show_sends_press(GdkEventButton* ev) } else { - /* change button state */ - - show_sends_button->set_active_state (Active); - - /* start blinking */ + boost::shared_ptr<Route> s = _showing_sends_to.lock (); - if (show_sends_button->active_state()) { - /* show sends to this bus */ - MixerStrip::SwitchIO (_route); - send_blink_connection = ARDOUR_UI::instance()->Blink.connect (sigc::mem_fun(*this, &RouteUI::send_blink)); + if (s == _route) { + set_showing_sends_to (boost::shared_ptr<Route> ()); } else { - /* everybody back to normal */ - send_blink_connection.disconnect (); - MixerStrip::SwitchIO (boost::shared_ptr<Route>()); + set_showing_sends_to (_route); } - } } @@ -924,9 +922,9 @@ RouteUI::send_blink (bool onoff) } if (onoff) { - show_sends_button->set_state (STATE_ACTIVE); + show_sends_button->set_active_state (Gtkmm2ext::Active); } else { - show_sends_button->set_state (STATE_NORMAL); + show_sends_button->unset_active_state (); } } @@ -1923,3 +1921,22 @@ RouteUI::color () const return _color; } + +void +RouteUI::set_showing_sends_to (boost::shared_ptr<Route> send_to) +{ + _showing_sends_to = send_to; + BusSendDisplayChanged (send_to); /* EMIT SIGNAL */ +} + +void +RouteUI::bus_send_display_changed (boost::shared_ptr<Route> send_to) +{ + if (_route == send_to) { + show_sends_button->set_active_state (Gtkmm2ext::Active); + send_blink_connection = ARDOUR_UI::instance()->Blink.connect (sigc::mem_fun (*this, &RouteUI::send_blink)); + } else { + show_sends_button->unset_active_state (); + send_blink_connection.disconnect (); + } +} diff --git a/gtk2_ardour/route_ui.h b/gtk2_ardour/route_ui.h index 82b19c7b73..8c774522ee 100644 --- a/gtk2_ardour/route_ui.h +++ b/gtk2_ardour/route_ui.h @@ -219,6 +219,12 @@ class RouteUI : public virtual AxisView static Gtkmm2ext::ActiveState solo_safe_active_state (boost::shared_ptr<ARDOUR::Route>); static Gtkmm2ext::ActiveState mute_active_state (ARDOUR::Session*, boost::shared_ptr<ARDOUR::Route>); + /** Emitted when a bus has been set or unset from `display sends to this bus' mode + * by a click on the `Sends' button. The parameter is the route that the sends are + * to, or 0 if no route is now in this mode. + */ + static sigc::signal<void, boost::shared_ptr<ARDOUR::Route> > BusSendDisplayChanged; + protected: PBD::ScopedConnectionList route_connections; bool self_destruct; @@ -236,6 +242,8 @@ class RouteUI : public virtual AxisView void route_gui_changed (std::string); virtual void route_color_changed () {} + virtual void bus_send_display_changed (boost::shared_ptr<ARDOUR::Route>); + private: void check_rec_enable_sensitivity (); void parameter_changed (std::string const &); @@ -269,6 +277,9 @@ class RouteUI : public virtual AxisView std::list<BindableToggleButton*> _invert_buttons; Gtk::Menu* _invert_menu; + static void set_showing_sends_to (boost::shared_ptr<ARDOUR::Route>); + static boost::weak_ptr<ARDOUR::Route> _showing_sends_to; + static uint32_t _max_invert_buttons; }; |