Mercurial > hg > svgui
changeset 749:03423269a9d0 tonioni
Implement "Form Note from Selection"; remove Snap Notes to Pitch Track because every other editing operation *should* now be doing that automatically
author | Chris Cannam |
---|---|
date | Thu, 27 Mar 2014 18:12:38 +0000 |
parents | 84e4cf889659 |
children | 394caa98d21a |
files | layer/FlexiNoteLayer.cpp layer/FlexiNoteLayer.h |
diffstat | 2 files changed, 16 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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);
--- 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);