From 8a9e650e757b0931db9a6a35714580b1c9c631c2 Mon Sep 17 00:00:00 2001 From: Matthias Neeracher Date: Fri, 12 Jan 2007 08:59:44 +0000 Subject: [PATCH] Allow nested repeats --- Sources/VLModel.cpp | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/Sources/VLModel.cpp b/Sources/VLModel.cpp index c1c8345..74d1803 100644 --- a/Sources/VLModel.cpp +++ b/Sources/VLModel.cpp @@ -1436,22 +1436,35 @@ void VLSong::DelEnding(size_t beginMeasure, size_t endMeasure) bool VLSong::CanBeRepeat(size_t beginMeasure, size_t endMeasure, int * times) { for (size_t r=0; r 1) { - if (fRepeats[r].fEndings[1].fBegin == endMeasure) + if (rep.fEndings.size() > 1) { + if (rep.fEndings[1].fBegin == endMeasure) return true; - if (fRepeats[r].fEndings[1].fEnd == endMeasure) + if (rep.fEndings[1].fEnd == endMeasure) return true; } } // + // Inclusions and surroundings are OK. Beginnings may match, but + // endings must not. + // + if (rep.fEndings[0].fBegin >= beginMeasure + && rep.fEndings[0].fEnd < endMeasure + ) + continue; + if (rep.fEndings[0].fBegin <= beginMeasure + && rep.fEndings[0].fEnd > endMeasure + ) + continue; + // // Look for overlap and reject // if (fRepeats[r].fEndings[0].fBegin >= beginMeasure