Punch/Loop GUI control sensitivity

This commit is contained in:
Robin Gareus 2020-02-27 22:25:37 +01:00
parent 0b027f7678
commit e5c819956a
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
4 changed files with 14 additions and 1 deletions

View file

@ -646,6 +646,7 @@ private:
void import_metadata (); void import_metadata ();
void set_transport_sensitivity (bool); void set_transport_sensitivity (bool);
void set_punch_sensitivity ();
//stuff for ProTools-style numpad //stuff for ProTools-style numpad
void transport_numpad_event (int num); void transport_numpad_event (int num);

View file

@ -810,6 +810,14 @@ ARDOUR_UI::set_transport_sensitivity (bool yn)
shuttle_box.set_sensitive (yn); shuttle_box.set_sensitive (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 void
ARDOUR_UI::editor_realized () ARDOUR_UI::editor_realized ()
{ {

View file

@ -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->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->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->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->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()); _session->AuditionActive.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::auditioning_changed, this, _1), gui_context());

View file

@ -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->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->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->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); rec_button.set_sensitive (true);
} }
@ -287,7 +288,7 @@ TransportControlUI::set_loop_sensitivity ()
if (!_session || _session->config.get_external_sync()) { if (!_session || _session->config.get_external_sync()) {
auto_loop_button.set_sensitive (false); auto_loop_button.set_sensitive (false);
} else { } 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());
} }
} }