some fixes (maybe, probably) for undo/redo mgmt associated with note drags

This commit is contained in:
Paul Davis 2025-10-31 14:27:45 -06:00
parent ea8d0d1a57
commit bdf7cc7590
2 changed files with 15 additions and 13 deletions

View file

@ -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 ();

View file

@ -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<NoteType> 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<NoteType> note)
{