From 7d960d20336d829ee82b635b46f5979babfac270 Mon Sep 17 00:00:00 2001 From: Matthias Neeracher Date: Sat, 10 Sep 2011 05:36:12 +0200 Subject: [PATCH] Inherit lyrics on note replacement --- Sources/VLModel.cpp | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/Sources/VLModel.cpp b/Sources/VLModel.cpp index e4f0adf..2a6d426 100644 --- a/Sources/VLModel.cpp +++ b/Sources/VLModel.cpp @@ -613,15 +613,26 @@ void VLSong::AddNote(VLLyricsNote note, size_t measure, VLFraction at) // if (i->fTied) { // - // Break ties + // Break backward ties, but not forward // - if (i->fTied & VLNote::kTiedWithPrev) + if (i->fTied & VLNote::kTiedWithPrev) { + i->fTied &= ~VLNote::kTiedWithPrev; LastTie(fMeasures[measure-1]) &= ~VLNote::kTiedWithNext; - if (i->fTied & VLNote::kTiedWithNext) - FirstTie(fMeasures[measure+1]) &= ~VLNote::kTiedWithPrev; + } + if (i->fTied & VLNote::kTiedWithNext) { + VLNoteList::iterator j = i; + for (size_t tiedMeas = measure+1; j->fTied & VLNote::kTiedWithNext;++tiedMeas) { + j = fMeasures[tiedMeas].fMelody.begin(); + j->fPitch = note.fPitch; + j->fVisual= note.fVisual; + } + } } - note.fDuration = i->fDuration; - *i = note; + // + // Deliberately leave fLyrics alone + // + i->fPitch = note.fPitch; + i->fVisual = note.fVisual; } else { // // Overlap, split current