Fix paste bugs

This commit is contained in:
Matthias Neeracher 2011-09-26 04:50:36 +02:00
parent 6fcf53935e
commit 42309d76c0

View File

@ -2035,21 +2035,25 @@ void VLSong::PasteMeasures(size_t beginMeasure, const VLSong & measures, int mod
if (mode == kInsert) {
int propAt = fMeasures[beginMeasure].fPropIdx;
int propOffset = 0;
bool sectionBreak= false;
VLPropertyList::const_iterator beginProp = measures.fProperties.begin();
VLPropertyList::const_iterator endProp = measures.fProperties.end();
if (beginMeasure) {
propOffset = fMeasures[beginMeasure-1].fPropIdx;
sectionBreak= propAt > propOffset;
if (fProperties[propOffset] == beginProp[0])
++beginProp;
else
++propOffset;
if (endProp > beginProp && fProperties[propAt] == endProp[-1])
--endProp;
}
if (endProp > beginProp && fProperties[propAt] == endProp[-1]
&& (sectionBreak || (endProp-beginProp) == 1)
)
--endProp;
ptrdiff_t postOffset = endProp - beginProp;
fProperties.insert(fProperties.begin()+propAt, beginProp, endProp);
fProperties.insert(fProperties.begin()+propAt+!sectionBreak, beginProp, endProp);
fMeasures.insert(fMeasures.begin()+beginMeasure,
measures.fMeasures.begin(), measures.fMeasures.end());
if (propOffset)