Punch/Loop GUI control sensitivity

This commit is contained in:
Robin Gareus 2020-02-27 22:25:37 +01:00
parent 0b027f7678
commit e5c819956a
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
4 changed files with 14 additions and 1 deletions

View File

@ -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);

View File

@ -810,6 +810,14 @@ ARDOUR_UI::set_transport_sensitivity (bool 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
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->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());

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->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());
}
}