fix #12008: Multi-stave notes will not fully paste on value not matching another stave's value. Also fix #7211

This commit is contained in:
lasconic 2013-06-19 15:02:45 +02:00
parent e1bb948be4
commit dbe62faa6a
2 changed files with 9 additions and 13 deletions

View file

@ -855,18 +855,19 @@ bool Score::makeGap1(int tick, int staffIdx, Fraction len)
break;
}
ChordRest* cr1 = static_cast<ChordRest*>(seg1->element(track));
Fraction srcF = cr1->duration();
Fraction dstF = Fraction::fromTicks(tick - cr1->tick());
len -= cr1->duration() - dstF;
undoChangeChordRestLen(cr1, TDuration(dstF));
setRest(tick, track, srcF - dstF, true, 0);
for (;;) {
seg = seg->next1(Segment::SegChordRestGrace);
if (seg == 0) {
seg1 = seg1->next1(Segment::SegChordRestGrace);
if (seg1 == 0) {
qDebug("2:makeGap1: no segment");
return false;
}
if (seg->element(track)) {
tick = seg->tick();
cr = static_cast<ChordRest*>(seg->element(track));
if (seg1->element(track)) {
tick = seg1->tick();
cr = static_cast<ChordRest*>(seg1->element(track));
break;
}
}

View file

@ -163,14 +163,13 @@ void Score::pasteStaff(XmlReader& e, ChordRest* dst)
int staves = e.intAttribute("staves", 0);
e.setTick(tickStart);
QSet<int> blackList;
for (int i = 0; i < staves; ++i) {
int staffIdx = i + dstStaffStart;
if (staffIdx >= nstaves())
break;
if (!makeGap1(dst->tick(), staffIdx, Fraction::fromTicks(tickLen))) {
qDebug("cannot make gap in staff %d at tick %d", staffIdx, dst->tick());
blackList.insert(staffIdx);
qDebug("cannot make gap in staff %d at tick %d", staffIdx, dst->tick());
return;
}
}
bool pasted = false;
@ -180,10 +179,6 @@ qDebug("cannot make gap in staff %d at tick %d", staffIdx, dst->tick());
break;
}
int srcStaffIdx = e.attribute("id", "0").toInt();
if (blackList.contains(srcStaffIdx)) {
e.skipCurrentElement();
continue;
}
int dstStaffIdx = srcStaffIdx - srcStaffStart + dstStaffStart;
if (dstStaffIdx >= nstaves())
break;