Properly handle coda on insert/delete

This commit is contained in:
Matthias Neeracher 2011-09-08 04:10:19 +02:00
parent 09c3d25dcf
commit c5ad6c9ba6

View File

@ -1913,6 +1913,10 @@ void VLSong::PasteMeasures(size_t beginMeasure, const VLSong & measures, int mod
} }
fRepeats.push_back(repeat); fRepeats.push_back(repeat);
} }
if (fGoToCoda >= (int)beginMeasure)
fGoToCoda += numMeas;
if (fCoda >= (int)beginMeasure)
fCoda += numMeas;
} else { } else {
if (CountMeasures() < nextMeasure) { if (CountMeasures() < nextMeasure) {
VLMeasure rest; VLMeasure rest;
@ -1992,6 +1996,17 @@ void VLSong::DeleteMeasures(size_t beginMeasure, size_t endMeasure, int mode)
++r; ++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 // Keep an empty measure at the end
// //