From c5ad6c9ba63ea7844bd97859029fbcde8cada469 Mon Sep 17 00:00:00 2001 From: Matthias Neeracher Date: Thu, 8 Sep 2011 04:10:19 +0200 Subject: [PATCH] Properly handle coda on insert/delete --- Sources/VLModel.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Sources/VLModel.cpp b/Sources/VLModel.cpp index 8cc169e..447801f 100644 --- a/Sources/VLModel.cpp +++ b/Sources/VLModel.cpp @@ -1913,6 +1913,10 @@ void VLSong::PasteMeasures(size_t beginMeasure, const VLSong & measures, int mod } fRepeats.push_back(repeat); } + if (fGoToCoda >= (int)beginMeasure) + fGoToCoda += numMeas; + if (fCoda >= (int)beginMeasure) + fCoda += numMeas; } else { if (CountMeasures() < nextMeasure) { VLMeasure rest; @@ -1992,6 +1996,17 @@ void VLSong::DeleteMeasures(size_t beginMeasure, size_t endMeasure, int mode) ++r; } } + if (fGoToCoda >= (int)beginMeasure) + if (fGoToCoda < endMeasure) + fGoToCoda = -1; + else + fGoToCoda -= delta; + if (fCoda >= (int)beginMeasure) + if (fCoda < endMeasure) + fCoda = -1; + else + fCoda -= delta; + // // Keep an empty measure at the end //