Skip to content

Commit

Permalink
regression test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
wschweer committed Jan 9, 2013
1 parent 1778f37 commit 2ec2c65
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 45 deletions.
77 changes: 38 additions & 39 deletions libmscore/paste.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,37 +239,6 @@ qDebug("cannot make gap in staff %d at tick %d", staffIdx, dst->tick());
int track = dstStaffIdx * VOICES + voice;
cr->setTrack(track);
int tick = curTick - tickStart + dstTick;
#if 0
//
// check for tuplet
//
if (cr->tuplet()) {
Tuplet* tuplet = cr->tuplet();
if (tuplet->elements().isEmpty()) {
Measure* measure = tick2measure(tick);
int measureEnd = measure->tick() + measure->ticks();
if (tick + tuplet->actualTicks() > measureEnd) {
invalidTuplets.append(tuplet);
cr->setDuration(tuplet->duration());
cr->setDurationType(cr->duration());
cr->setTuplet(0);
tuplet->add(cr);
qDebug("cannot paste tuplet across bar line");
}
}
else {
foreach(Tuplet* t, invalidTuplets) {
if (tuplet == t) {
delete cr;
cr = 0;
break;
}
}
}
}
if (cr == 0)
continue;
#endif
curTick += cr->actualTicks();
pasteChordRest(cr, tick);
}
Expand Down Expand Up @@ -432,16 +401,46 @@ qDebug("cannot make gap in staff %d at tick %d", staffIdx, dst->tick());
_selection.setState(SEL_RANGE);
}
}

/* foreach(Tuplet* t, invalidTuplets) {
t->measure()->remove(t);
delete t;
printf("====end paste\n");
for (Spanner* sp = spanner; sp;) {
Spanner* spNext = sp->next();
printf(" %s %p %p\n", sp->name(), sp->startElement(), sp->endElement());
if (sp->startElement() == 0 || sp->endElement() == 0) {
// spanner is not copied complete, lets remove it:
printf(" remove\n");
switch(sp->anchor()) {
case Spanner::ANCHOR_SEGMENT:
if (sp->startElement())
static_cast<Segment*>(sp->startElement())->removeSpannerFor(sp);
else if (sp->endElement())
static_cast<Segment*>(sp->endElement())->removeSpannerBack(sp);
break;
case Spanner::ANCHOR_MEASURE:
if (sp->startElement())
static_cast<Measure*>(sp->startElement())->removeSpannerFor(sp);
else if (sp->endElement())
static_cast<Measure*>(sp->endElement())->removeSpannerBack(sp);
break;
break;
case Spanner::ANCHOR_CHORD:
if (sp->startElement())
static_cast<ChordRest*>(sp->startElement())->removeSpannerFor(sp);
else if (sp->endElement())
static_cast<ChordRest*>(sp->endElement())->removeSpannerBack(sp);
break;
case Spanner::ANCHOR_NOTE:
if (sp->startElement())
static_cast<Note*>(sp->startElement())->removeSpannerFor(sp);
else if (sp->endElement())
static_cast<Note*>(sp->endElement())->removeSpannerBack(sp);
break;
}
delete sp;
}
sp = spNext;
}
*/
spanner = 0;
connectTies();
// updateNotes(); // TODO: undoable version needed

// layoutFlags |= LAYOUT_FIX_PITCH_VELO;
}

//---------------------------------------------------------
Expand Down
3 changes: 0 additions & 3 deletions mtest/libmscore/copypaste/copypaste1-ref.mscx
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,8 @@
<tpc>19</tpc>
</Note>
</Chord>
<Slur id="3">
</Slur>
<Chord>
<durationType>quarter</durationType>
<Slur type="start" number="3"/>
<Note>
<pitch>72</pitch>
<tpc>14</tpc>
Expand Down
3 changes: 0 additions & 3 deletions mtest/libmscore/copypaste/copypaste2-ref.mscx
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,8 @@
</BarLine>
</Measure>
<Measure number="4">
<Slur id="3">
</Slur>
<Chord>
<durationType>quarter</durationType>
<Slur type="stop" number="3"/>
<Note>
<pitch>74</pitch>
<tpc>16</tpc>
Expand Down
2 changes: 2 additions & 0 deletions mtest/libmscore/copypaste/copypaste3-ref.mscx
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@
<Chord>
<durationType>quarter</durationType>
<Slur type="start" number="3"/>
<Slur type="start" number="2"/>
<Note>
<pitch>69</pitch>
<tpc>17</tpc>
Expand All @@ -201,6 +202,7 @@
<Chord>
<durationType>quarter</durationType>
<Slur type="stop" number="3"/>
<Slur type="stop" number="2"/>
<Note>
<pitch>72</pitch>
<tpc>14</tpc>
Expand Down

0 comments on commit 2ec2c65

Please sign in to comment.