add new Editor method to toggle all existing automation

Applies to selected tracks if non-empty; all tracks otherwise
This commit is contained in:
Paul Davis 2020-04-03 13:28:27 -06:00
parent 97d1ee9822
commit 9ca9aa8ae1
3 changed files with 39 additions and 7 deletions

View file

@ -1508,6 +1508,8 @@ private:
void remove_location_at_playhead_cursor (); void remove_location_at_playhead_cursor ();
bool select_new_marker; bool select_new_marker;
void toggle_all_existing_automation ();
void reverse_selection (); void reverse_selection ();
void edit_envelope (); void edit_envelope ();

View file

@ -124,6 +124,7 @@ Editor::register_actions ()
ActionManager::register_action (editor_menu_actions, X_("AlignMenu"), _("Align")); ActionManager::register_action (editor_menu_actions, X_("AlignMenu"), _("Align"));
ActionManager::register_action (editor_menu_actions, X_("Autoconnect"), _("Autoconnect")); ActionManager::register_action (editor_menu_actions, X_("Autoconnect"), _("Autoconnect"));
ActionManager::register_action (editor_menu_actions, X_("AutomationMenu"), _("Automation"));
ActionManager::register_action (editor_menu_actions, X_("Crossfades"), _("Crossfades")); ActionManager::register_action (editor_menu_actions, X_("Crossfades"), _("Crossfades"));
ActionManager::register_action (editor_menu_actions, X_("Edit"), _("Edit")); ActionManager::register_action (editor_menu_actions, X_("Edit"), _("Edit"));
ActionManager::register_action (editor_menu_actions, X_("EditCursorMovementOptions"), _("Move Selected Marker")); ActionManager::register_action (editor_menu_actions, X_("EditCursorMovementOptions"), _("Move Selected Marker"));
@ -255,6 +256,8 @@ Editor::register_actions ()
reg_sens (editor_actions, "select-next-stripable", _("Select Next Strip"), sigc::bind (sigc::mem_fun(*this, &Editor::select_next_stripable), false)); reg_sens (editor_actions, "select-next-stripable", _("Select Next Strip"), sigc::bind (sigc::mem_fun(*this, &Editor::select_next_stripable), false));
reg_sens (editor_actions, "select-prev-stripable", _("Select Previous Strip"), sigc::bind (sigc::mem_fun(*this, &Editor::select_prev_stripable), false)); reg_sens (editor_actions, "select-prev-stripable", _("Select Previous Strip"), sigc::bind (sigc::mem_fun(*this, &Editor::select_prev_stripable), false));
reg_sens (editor_actions, "toggle-all-existing-automation", _("Toggle All Existing Automation"), sigc::mem_fun (*this, &Editor::toggle_all_existing_automation));
act = reg_sens (editor_actions, "track-record-enable-toggle", _("Toggle Record Enable"), sigc::mem_fun(*this, &Editor::toggle_record_enable)); act = reg_sens (editor_actions, "track-record-enable-toggle", _("Toggle Record Enable"), sigc::mem_fun(*this, &Editor::toggle_record_enable));
ActionManager::track_selection_sensitive_actions.push_back (act); ActionManager::track_selection_sensitive_actions.push_back (act);
act = reg_sens (editor_actions, "track-solo-toggle", _("Toggle Solo"), sigc::mem_fun(*this, &Editor::toggle_solo)); act = reg_sens (editor_actions, "track-solo-toggle", _("Toggle Solo"), sigc::mem_fun(*this, &Editor::toggle_solo));

View file

@ -8504,3 +8504,30 @@ Editor::bring_all_sources_into_session ()
_session->bring_all_sources_into_session (boost::bind (&Editor::bring_in_callback, this, &msg, _1, _2, _3)); _session->bring_all_sources_into_session (boost::bind (&Editor::bring_in_callback, this, &msg, _1, _2, _3));
} }
void
Editor::toggle_all_existing_automation ()
{
TrackViewList & tvl (selection->tracks.empty() ? track_views : selection->tracks);
bool some_automation_shown = false;
for (TrackViewList::const_iterator t = tvl.begin(); t != tvl.end(); ++t) {
TimeAxisView::Children children = (*t)->get_child_list ();
for (TimeAxisView::Children::const_iterator c = children.begin(); c != children.end(); ++c) {
if (boost::dynamic_pointer_cast<AutomationTimeAxisView> (*c)) {
some_automation_shown = true;
break;
}
}
if (some_automation_shown) {
break;
}
}
if (!some_automation_shown) {
tvl.foreach_stripable_time_axis (boost::bind (&StripableTimeAxisView::show_existing_automation, _1, false));
} else {
tvl.foreach_stripable_time_axis (boost::bind (&StripableTimeAxisView::hide_all_automation, _1, false));
}
}