13
0

Fix note resize double undo bug.

Newly drawn notes are selected.
Clear midi note selection on Selection::set_state().
This commit is contained in:
nick_m 2015-01-17 04:55:05 +11:00
parent 4166b05bda
commit ade1c4923c
3 changed files with 16 additions and 8 deletions

View File

@ -1963,6 +1963,8 @@ NoteResizeDrag::start_grab (GdkEvent* event, Gdk::Cursor* /*ignored*/)
*/ */
region->note_selected (cnote, cnote->selected ()); region->note_selected (cnote, cnote->selected ());
_editor->begin_reversible_command (_("resize notes"));
for (MidiRegionSelection::iterator r = ms.begin(); r != ms.end(); ) { for (MidiRegionSelection::iterator r = ms.begin(); r != ms.end(); ) {
MidiRegionSelection::iterator next; MidiRegionSelection::iterator next;
next = r; next = r;
@ -2001,6 +2003,8 @@ NoteResizeDrag::finished (GdkEvent*, bool /*movement_occurred*/)
mrv->commit_resizing (nb, at_front, _drags->current_pointer_x() - grab_x(), relative); mrv->commit_resizing (nb, at_front, _drags->current_pointer_x() - grab_x(), relative);
} }
} }
_editor->commit_reversible_command ();
} }
void void

View File

@ -951,11 +951,12 @@ MidiRegionView::create_note_at (framepos_t t, double y, Evoral::Beats length, bo
view->update_note_range(new_note->note()); view->update_note_range(new_note->note());
trackview.editor().begin_reversible_command(_("add note")); start_note_diff_command(_("add note"));
MidiModel::NoteDiffCommand* cmd = _model->new_note_diff_command(_("add note"));
cmd->add (new_note); clear_selection ();
_model->apply_command(*trackview.session(), cmd); note_diff_add_note (new_note, true, false);
trackview.editor().commit_reversible_command();
apply_diff();
play_midi_note (new_note); play_midi_note (new_note);
} }
@ -1852,10 +1853,12 @@ MidiRegionView::step_add_note (uint8_t channel, uint8_t number, uint8_t velocity
view->update_note_range(new_note->note()); view->update_note_range(new_note->note());
_marked_for_selection.clear (); _marked_for_selection.clear ();
clear_selection ();
start_note_diff_command (_("step add")); start_note_diff_command (_("step add"));
clear_selection ();
note_diff_add_note (new_note, true, false); note_diff_add_note (new_note, true, false);
apply_diff(); apply_diff();
// last_step_edit_note = new_note; // last_step_edit_note = new_note;
@ -2779,7 +2782,7 @@ MidiRegionView::update_resizing (NoteBase* primary, bool at_front, double delta_
void void
MidiRegionView::commit_resizing (NoteBase* primary, bool at_front, double delta_x, bool relative) MidiRegionView::commit_resizing (NoteBase* primary, bool at_front, double delta_x, bool relative)
{ {
start_note_diff_command (_("resize notes")); _note_diff_command = _model->new_note_diff_command (_("resize notes"));
for (std::vector<NoteResizeData *>::iterator i = _resize_data.begin(); i != _resize_data.end(); ++i) { for (std::vector<NoteResizeData *>::iterator i = _resize_data.begin(); i != _resize_data.end(); ++i) {
Note* canvas_note = (*i)->note; Note* canvas_note = (*i)->note;
@ -2840,7 +2843,7 @@ MidiRegionView::commit_resizing (NoteBase* primary, bool at_front, double delta_
} }
_resize_data.clear(); _resize_data.clear();
apply_diff(); apply_diff(true);
} }
void void

View File

@ -1310,6 +1310,7 @@ Selection::set_state (XMLNode const & node, int)
} }
clear_regions (); clear_regions ();
clear_midi_notes ();
clear_points (); clear_points ();
clear_time (); clear_time ();
clear_tracks (); clear_tracks ();