# HG changeset patch # User Chris Cannam # Date 1395943958 0 # Node ID 03423269a9d0c39b0ad2e39bd9435d0a353546ce # Parent 84e4cf88965959a34e8675138d6bef66ad5ec261 Implement "Form Note from Selection"; remove Snap Notes to Pitch Track because every other editing operation *should* now be doing that automatically diff -r 84e4cf889659 -r 03423269a9d0 layer/FlexiNoteLayer.cpp --- a/layer/FlexiNoteLayer.cpp Thu Mar 27 18:02:12 2014 +0000 +++ b/layer/FlexiNoteLayer.cpp Thu Mar 27 18:12:38 2014 +0000 @@ -1354,15 +1354,22 @@ } void -FlexiNoteLayer::mergeNotes(View *v, Selection s) +FlexiNoteLayer::mergeNotes(View *v, Selection s, bool inclusive) { FlexiNoteModel::PointList points = m_model->getPoints(s.getStartFrame(), s.getEndFrame()); FlexiNoteModel::PointList::iterator i = points.begin(); - while (i != points.end() && i->frame + i->duration < s.getStartFrame()) { - ++i; + if (inclusive) { + while (i != points.end() && i->frame + i->duration < s.getStartFrame()) { + ++i; + } + } else { + while (i != points.end() && i->frame < s.getStartFrame()) { + ++i; + } } + if (i == points.end()) return; FlexiNoteModel::EditCommand *command = @@ -1372,7 +1379,11 @@ while (i != points.end()) { - if (i->frame >= s.getEndFrame()) break; + if (inclusive) { + if (i->frame >= s.getEndFrame()) break; + } else { + if (i->frame + i->duration > s.getEndFrame()) break; + } newNote.duration = i->frame + i->duration - newNote.frame; command->deletePoint(*i); diff -r 84e4cf889659 -r 03423269a9d0 layer/FlexiNoteLayer.h --- a/layer/FlexiNoteLayer.h Thu Mar 27 18:02:12 2014 +0000 +++ b/layer/FlexiNoteLayer.h Thu Mar 27 18:12:38 2014 +0000 @@ -80,7 +80,7 @@ void splitNotesAt(View *v, int frame); void snapSelectedNotesToPitchTrack(View *v, Selection s); - void mergeNotes(View *v, Selection s); + void mergeNotes(View *v, Selection s, bool inclusive); virtual const Model *getModel() const { return m_model; } void setModel(FlexiNoteModel *model);