From bdf7cc7590ce76ec5edfd8ed921a0314da6eb3dd Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 31 Oct 2025 14:27:45 -0600 Subject: [PATCH] some fixes (maybe, probably) for undo/redo mgmt associated with note drags --- gtk2_ardour/editor_drag.cc | 2 +- gtk2_ardour/midi_view.cc | 26 ++++++++++++++------------ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index ebfebdf86e..c7ec707daf 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -7026,7 +7026,7 @@ HitBrushDrag::motion (GdkEvent* event, bool first_move) } if (first_move) { - _midi_view->start_note_diff_command (_("brush notes"), true); + editing_context.begin_reversible_command (_("brush notes")); } const timepos_t pos = _drags->current_pointer_time (); diff --git a/gtk2_ardour/midi_view.cc b/gtk2_ardour/midi_view.cc index 8b879670b9..ad9a6b4de1 100644 --- a/gtk2_ardour/midi_view.cc +++ b/gtk2_ardour/midi_view.cc @@ -921,13 +921,15 @@ MidiView::start_note_diff_command (string name, bool with_reversible_command) return; } + if (with_reversible_command) { + _editing_context.begin_reversible_command (name); + } + if (!_note_diff_command) { - if (with_reversible_command) { - _editing_context.begin_reversible_command (name); - } _note_diff_command = _model->new_note_diff_command (name); } else { std::cerr << "ERROR: start_note_diff_command command called, but a note_diff_command was already underway" << std::endl; + PBD::stacktrace (std::cerr, 19); } } @@ -942,6 +944,15 @@ MidiView::end_note_diff_command () _note_diff_command = nullptr; } +void +MidiView::abort_note_diff() +{ + delete _note_diff_command; + _note_diff_command = nullptr; + _editing_context.abort_reversible_command(); + clear_selection_internal (); +} + void MidiView::note_diff_add_note (const std::shared_ptr note, bool selected, bool show_velocity) { @@ -1024,15 +1035,6 @@ MidiView::apply_note_diff (bool as_subcommand, bool was_copy) } -void -MidiView::abort_note_diff() -{ - delete _note_diff_command; - _note_diff_command = 0; - _editing_context.abort_reversible_command(); - clear_selection_internal (); -} - NoteBase* MidiView::find_canvas_note (std::shared_ptr note) {