From cf838151336b5ff66313b9a95e9c52f13ed08242 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 21 Oct 2022 07:52:23 -0600 Subject: [PATCH] add clear-all-cues item to cue marker ruler context menu --- gtk2_ardour/editor.h | 1 + gtk2_ardour/editor_ops.cc | 22 ++++++++++++++++++++++ gtk2_ardour/editor_rulers.cc | 1 + 3 files changed, 24 insertions(+) diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 17cc345e5a..7ac34c6de0 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -1559,6 +1559,7 @@ private: void clear_markers (); void clear_xrun_markers (); void clear_ranges (); + void clear_cues (); void clear_locations (); void unhide_markers (); void unhide_ranges (); diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 99accd7a90..f06386729b 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -2562,6 +2562,28 @@ Editor::clear_ranges () } } +void +Editor::clear_cues () +{ + if (!_session) { + return; + } + + begin_reversible_command (_("clear cues")); + + XMLNode &before = _session->locations()->get_state(); + + if (_session->locations()->clear_cue_markers (0, max_samplepos)) { + + XMLNode &after = _session->locations()->get_state(); + _session->add_command(new MementoCommand(*(_session->locations()), &before, &after)); + + commit_reversible_command (); + } else { + abort_reversible_command (); + } +} + void Editor::clear_locations () { diff --git a/gtk2_ardour/editor_rulers.cc b/gtk2_ardour/editor_rulers.cc index 2bca419230..891cbee5ac 100644 --- a/gtk2_ardour/editor_rulers.cc +++ b/gtk2_ardour/editor_rulers.cc @@ -247,6 +247,7 @@ Editor::popup_ruler_menu (timepos_t const & where, ItemType t) case CueMarkerBarItem: ruler_items.push_back (MenuElem (_("Stop All Cues"), sigc::bind (sigc::mem_fun (*this, &Editor::mouse_add_new_marker), where, Location::IsCueMarker, CueRecord::stop_all))); + ruler_items.push_back (MenuElem (_("Clear All Cues"), sigc::mem_fun (*this, &Editor::clear_cues))); for (int32_t n = 0; n < TriggerBox::default_triggers_per_box; ++n) { ruler_items.push_back (MenuElem (string_compose (_("Cue %1"), cue_marker_name (n)), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_add_new_marker), where, Location::IsCueMarker, n))); }