Set remove-last-capture sensitivity

This commit is contained in:
Robin Gareus 2025-03-01 23:27:23 +01:00
parent fe81f8de18
commit b3ee25f812
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
3 changed files with 16 additions and 0 deletions

View file

@ -1300,6 +1300,8 @@ Editor::set_session (Session *t)
_session->locations()->removed.connect (_session_connections, invalidator (*this), std::bind (&Editor::location_gone, this, _1), gui_context());
_session->locations()->changed.connect (_session_connections, invalidator (*this), std::bind (&Editor::refresh_location_display, this), gui_context());
_session->auto_loop_location_changed.connect (_session_connections, invalidator (*this), std::bind (&Editor::loop_location_changed, this, _1), gui_context ());
_session->RecordPassCompleted.connect (_session_connections, invalidator (*this), std::bind (&Editor::capture_sources_changed, this, false), gui_context ());
_session->ClearedLastCaptureSources.connect (_session_connections, invalidator (*this), std::bind (&Editor::capture_sources_changed, this, true), gui_context ());
Location::flags_changed.connect (_session_connections, invalidator (*this), std::bind (&Editor::update_section_rects, this), gui_context ());
_session->history().Changed.connect (_session_connections, invalidator (*this), std::bind (&Editor::history_changed, this), gui_context());
@ -1315,6 +1317,7 @@ Editor::set_session (Session *t)
_session->config.map_parameters (pc);
loop_location_changed (_session->locations()->auto_loop_location ());
capture_sources_changed (true);
//tempo_map_changed (PropertyChange (0));
reset_metric_marks ();

View file

@ -622,6 +622,7 @@ private:
void set_marker_line_visibility (bool);
void update_selection_markers ();
void update_section_box ();
void capture_sources_changed (bool);
void jump_forward_to_mark_flagged (ARDOUR::Location::Flags, ARDOUR::Location::Flags, ARDOUR::Location::Flags);
void jump_backward_to_mark_flagged (ARDOUR::Location::Flags, ARDOUR::Location::Flags, ARDOUR::Location::Flags);

View file

@ -1015,6 +1015,18 @@ Editor::marker_click_behavior_chosen (Editing::MarkerClickBehavior m)
}
}
void
Editor::capture_sources_changed (bool cleared)
{
if (cleared || !_session) {
ActionManager::get_action (X_("Editor"), X_("remove-last-capture"))->set_sensitive (false);
} else {
std::list<std::shared_ptr<ARDOUR::Source> > srcs;
_session->get_last_capture_sources (srcs);
ActionManager::get_action (X_("Editor"), X_("remove-last-capture"))->set_sensitive (!srcs.empty ());
}
}
/** A Configuration parameter has changed.
* @param parameter_name Name of the changed parameter.
*/