diff options
author | Robin Gareus <robin@gareus.org> | 2020-02-27 22:25:37 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2020-02-27 22:25:37 +0100 |
commit | e5c819956a95a1dc9dee8f805dc55757dc51233d (patch) | |
tree | 4aff23fcfa478134704cbc3080ea371fef024181 /gtk2_ardour | |
parent | 0b027f7678379b6548b394a87506f09579c68268 (diff) |
Punch/Loop GUI control sensitivity
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/ardour_ui.h | 1 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui2.cc | 8 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui_dialogs.cc | 3 | ||||
-rw-r--r-- | gtk2_ardour/transport_control_ui.cc | 3 |
4 files changed, 14 insertions, 1 deletions
diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index 58a216a93b..bc61f054d5 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -646,6 +646,7 @@ private: void import_metadata (); void set_transport_sensitivity (bool); + void set_punch_sensitivity (); //stuff for ProTools-style numpad void transport_numpad_event (int num); diff --git a/gtk2_ardour/ardour_ui2.cc b/gtk2_ardour/ardour_ui2.cc index 70ff8f7c39..e7306bea00 100644 --- a/gtk2_ardour/ardour_ui2.cc +++ b/gtk2_ardour/ardour_ui2.cc @@ -811,6 +811,14 @@ ARDOUR_UI::set_transport_sensitivity (bool yn) } void +ARDOUR_UI::set_punch_sensitivity () +{ + bool can_punch = _session && _session->punch_is_possible() && _session->locations()->auto_punch_location (); + ActionManager::get_action ("Transport", "TogglePunchIn")->set_sensitive (can_punch); + ActionManager::get_action ("Transport", "TogglePunchOut")->set_sensitive (can_punch); +} + +void ARDOUR_UI::editor_realized () { boost::function<void (string)> pc (boost::bind (&ARDOUR_UI::parameter_changed, this, _1)); diff --git a/gtk2_ardour/ardour_ui_dialogs.cc b/gtk2_ardour/ardour_ui_dialogs.cc index dcdbb3f3b1..e826f9500a 100644 --- a/gtk2_ardour/ardour_ui_dialogs.cc +++ b/gtk2_ardour/ardour_ui_dialogs.cc @@ -192,6 +192,9 @@ ARDOUR_UI::set_session (Session *s) _session->TransportStateChange.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::map_transport_state, this), gui_context()); _session->DirtyChanged.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::session_dirty_changed, this), gui_context()); + _session->PunchLoopConstraintChange.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::set_punch_sensitivity, this), gui_context()); + _session->auto_punch_location_changed.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::set_punch_sensitivity, this), gui_context ()); + _session->Xrun.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::xrun_handler, this, _1), gui_context()); _session->SoloActive.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::soloing_changed, this, _1), gui_context()); _session->AuditionActive.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::auditioning_changed, this, _1), gui_context()); diff --git a/gtk2_ardour/transport_control_ui.cc b/gtk2_ardour/transport_control_ui.cc index 05c91f3f6b..c3b6fb552a 100644 --- a/gtk2_ardour/transport_control_ui.cc +++ b/gtk2_ardour/transport_control_ui.cc @@ -179,6 +179,7 @@ TransportControlUI::set_session (ARDOUR::Session *s) _session->StepEditStatusChange.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&TransportControlUI::step_edit_status_change, this, _1), gui_context()); _session->TransportStateChange.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&TransportControlUI::map_transport_state, this), gui_context()); _session->auto_loop_location_changed.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&TransportControlUI::set_loop_sensitivity, this), gui_context ()); + _session->PunchLoopConstraintChange.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&TransportControlUI::set_loop_sensitivity, this), gui_context ()); rec_button.set_sensitive (true); } @@ -287,7 +288,7 @@ TransportControlUI::set_loop_sensitivity () if (!_session || _session->config.get_external_sync()) { auto_loop_button.set_sensitive (false); } else { - auto_loop_button.set_sensitive (_session && _session->locations()->auto_loop_location()); + auto_loop_button.set_sensitive (_session && _session->loop_is_possible() && _session->locations()->auto_loop_location()); } } |