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 ();
bool select_new_marker;
void toggle_all_existing_automation ();
void reverse_selection ();
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_("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_("Edit"), _("Edit"));
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-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));
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));

View file

@ -293,13 +293,13 @@ Editor::split_regions_at (MusicSample where, RegionSelection& regions)
selection->clear_time();
//but leave track selection intact
}
//if the user doesn't want to preserve the "Existing" selection, then clear the selection
if (!(rsas & Existing)) {
selection->clear_objects();
selection->clear_time();
}
//if the user wants newly-created regions to be selected, then select them:
if (mouse_mode == MouseObject) {
for (RegionSelection::iterator ri = latest_regionviews.begin(); ri != latest_regionviews.end(); ri++) {
@ -3234,7 +3234,7 @@ Editor::separate_regions_between (const TimeSelection& ts)
//but leave track selection intact
} else if (rsas == ForceSel) {
//note: forcing the regions to be selected *might* force a tool-change to Object here
selection->set(new_selection);
selection->set(new_selection);
}
commit_reversible_command ();
@ -4519,7 +4519,7 @@ Editor::recover_regions (ARDOUR::RegionList regions)
if (track) {
//ToDo
if (source->captured_for() == track->) {
//_session->add_command(new StatefulDiffCommand (playlist));
//_session->add_command(new StatefulDiffCommand (playlist));
}
}
}
@ -5230,12 +5230,12 @@ Editor::tag_regions (RegionList regions)
std::string tagstr = entry.get_text();
strip_whitespace_edges (tagstr);
if (!tagstr.empty()) {
for (RegionList::iterator r = regions.begin(); r != regions.end(); r++) {
(*r)->set_tags(tagstr);
}
_regions->redisplay ();
}
}
@ -5276,7 +5276,7 @@ Editor::tag_last_capture ()
}
}
tag_regions(rlist);
}
@ -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));
}
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));
}
}