diff --git a/libmscore/paste.cpp b/libmscore/paste.cpp
index 56eb2dd671c20..4d08fea871ee5 100644
--- a/libmscore/paste.cpp
+++ b/libmscore/paste.cpp
@@ -107,12 +107,9 @@ void Score::pasteStaff(XmlReader& e, ChordRest* dst)
done = true; // break main loop, nothing more to paste
break;
}
- if (!makeGap1(dstTick, dstStaffIdx, Fraction::fromTicks(tickLen))) {
- qDebug("cannot make gap in staff %d at tick %d", dstStaffIdx, dstTick);
- done = true; // break main loop, cannot make gap
- break;
- }
+
e.tuplets().clear();
+ bool makeGap = true;
while (e.readNextStartElement()) {
pasted = true;
const QStringRef& tag(e.name());
@@ -120,6 +117,13 @@ void Score::pasteStaff(XmlReader& e, ChordRest* dst)
if (tag == "tick") {
int tick = e.readInt();
e.setTick(tick);
+ int shift = tick - tickStart;
+ if (makeGap && !makeGap1(dstTick + shift, dstStaffIdx, Fraction::fromTicks(tickLen - shift))) {
+ qDebug("cannot make gap in staff %d at tick %d", dstStaffIdx, dstTick + shift);
+ done = true; // break main loop, cannot make gap
+ break;
+ }
+ makeGap = false; // create gap only once per staff
}
else if (tag == "Tuplet") {
Tuplet* tuplet = new Tuplet(this);
diff --git a/mtest/libmscore/copypaste/copypaste12-ref.mscx b/mtest/libmscore/copypaste/copypaste12-ref.mscx
new file mode 100644
index 0000000000000..b5acccb37764a
--- /dev/null
+++ b/mtest/libmscore/copypaste/copypaste12-ref.mscx
@@ -0,0 +1,238 @@
+
+
+
+
+ 0
+ 480
+
+ 1
+ 1
+ 1
+ 0
+ X11
+
+
+
+
+
+ Test
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+ Voice
+
+ Voice
+ 36
+ 94
+ 40
+ 79
+
+ 100
+ 100
+
+
+ 100
+ 85
+
+
+ 100
+ 100
+
+
+ 120
+ 100
+
+
+
+
+
+
+
+ 10
+
+
+ Test
+
+
+
+ Copy-Paste
+
+
+
+
+ G
+ G
+
+
+ 4
+ 4
+ 1
+
+
+ measure
+
+
+
+
+
+ quarter
+
+ 67
+ 15
+
+
+
+ quarter
+
+ 74
+ 16
+
+
+
+ quarter
+
+ 71
+ 19
+
+
+
+ quarter
+
+ 72
+ 14
+
+
+
+ normal
+ 1
+
+ 1920
+
+
+ quarter
+
+
+ 60
+ 14
+
+
+
+
+ quarter
+
+
+
+ quarter
+
+
+ 60
+ 14
+
+
+
+
+ quarter
+
+
+
+
+ measure
+
+
+
+ normal
+ 1
+
+
+
+
+ quarter
+
+ 67
+ 15
+
+
+
+ quarter
+
+ 74
+ 16
+
+
+
+ quarter
+
+ 71
+ 19
+
+
+
+ quarter
+
+ 72
+ 14
+
+
+
+ end
+ 1
+
+ 5760
+
+
+ quarter
+
+
+ 60
+ 14
+
+
+
+
+ quarter
+
+
+
+ quarter
+
+
+ 60
+ 14
+
+
+
+
+ quarter
+
+
+
+
+
diff --git a/mtest/libmscore/copypaste/copypaste12.mscx b/mtest/libmscore/copypaste/copypaste12.mscx
new file mode 100644
index 0000000000000..aeb5054b7ecfa
--- /dev/null
+++ b/mtest/libmscore/copypaste/copypaste12.mscx
@@ -0,0 +1,187 @@
+
+
+
+
+ 0
+ 480
+
+ 1
+ 1
+ 1
+ 0
+ X11
+
+
+
+
+
+ Test
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+ Voice
+
+ Voice
+ 36
+ 94
+ 40
+ 79
+
+ 100
+ 100
+
+
+ 100
+ 85
+
+
+ 100
+ 100
+
+
+ 120
+ 100
+
+
+
+
+
+
+
+ 10
+
+
+ Test
+
+
+
+ Copy-Paste
+
+
+
+
+ G
+ G
+
+
+ 4
+ 4
+ 1
+
+
+ measure
+
+
+
+
+
+ quarter
+
+ 67
+ 15
+
+
+
+ quarter
+
+ 74
+ 16
+
+
+
+ quarter
+
+ 71
+ 19
+
+
+
+ quarter
+
+ 72
+ 14
+
+
+
+ normal
+ 1
+
+ 1920
+
+
+ quarter
+
+
+ 60
+ 14
+
+
+
+
+ quarter
+
+
+
+ quarter
+
+
+ 60
+ 14
+
+
+
+
+ quarter
+
+
+
+
+ measure
+
+
+
+ normal
+ 1
+
+
+
+
+ measure
+
+
+
+ end
+ 1
+
+
+
+
+
diff --git a/mtest/libmscore/copypaste/copypaste_partial_01-ref.mscx b/mtest/libmscore/copypaste/copypaste_partial_01-ref.mscx
new file mode 100644
index 0000000000000..21f74b0483648
--- /dev/null
+++ b/mtest/libmscore/copypaste/copypaste_partial_01-ref.mscx
@@ -0,0 +1,195 @@
+
+
+
+
+ 0
+ 480
+
+ 1
+ 1
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+ 2
+
+
+ 0
+
+ 0
+
+ Piano
+
+ Piano
+ 21
+ 108
+ 21
+ 108
+
+ 100
+ 70
+
+
+ 100
+ 40
+
+
+ 100
+ 100
+
+
+ 120
+ 100
+
+
+
+
+
+
+
+
+
+ G
+ G
+
+
+ 0
+
+
+ 4
+ 4
+ 1
+
+
+ 16th
+
+
+ 16th
+
+ 57
+ 17
+
+
+ 60
+ 14
+
+
+ 69
+ 17
+
+
+
+ 16th
+
+
+ 16th
+
+
+ 16th
+
+ 57
+ 17
+
+
+ 60
+ 14
+
+
+ 69
+ 17
+
+
+
+ 16th
+
+
+ eighth
+
+
+ half
+
+
+ end
+ 2
+
+
+
+
+
+
+ F
+ F
+
+
+ 0
+
+
+ 4
+ 4
+ 1
+
+
+ 16th
+
+
+ 16th
+
+ 48
+ 14
+
+
+
+ eighth
+
+
+ 16th
+
+ 48
+ 14
+
+
+
+ 16th
+
+
+ eighth
+
+
+ half
+
+
+
+
+
diff --git a/mtest/libmscore/copypaste/copypaste_partial_01.mscx b/mtest/libmscore/copypaste/copypaste_partial_01.mscx
new file mode 100644
index 0000000000000..22ba9455cb4a7
--- /dev/null
+++ b/mtest/libmscore/copypaste/copypaste_partial_01.mscx
@@ -0,0 +1,168 @@
+
+
+
+
+ 0
+ 480
+
+ 1
+ 1
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+ 2
+
+
+ 0
+
+ 0
+
+ Piano
+
+ Piano
+ 21
+ 108
+ 21
+ 108
+
+ 100
+ 70
+
+
+ 100
+ 40
+
+
+ 100
+ 100
+
+
+ 120
+ 100
+
+
+
+
+
+
+
+
+
+ G
+ G
+
+
+ 0
+
+
+ 4
+ 4
+ 1
+
+
+ 1
+ eighth
+
+
+ 16th
+
+
+ 16th
+
+ 57
+ 17
+
+
+ 60
+ 14
+
+
+ 69
+ 17
+
+
+
+ 16th
+
+
+ eighth
+
+
+ half
+
+
+ end
+ 2
+
+
+
+
+
+
+ F
+ F
+
+
+ 0
+
+
+ 4
+ 4
+ 1
+
+
+ quarter
+
+
+ 16th
+
+ 48
+ 14
+
+
+
+ 16th
+
+
+ eighth
+
+
+ half
+
+
+
+
+
diff --git a/mtest/libmscore/copypaste/tst_copypaste.cpp b/mtest/libmscore/copypaste/tst_copypaste.cpp
index 811c0021b169e..d7cce2e750c47 100644
--- a/mtest/libmscore/copypaste/tst_copypaste.cpp
+++ b/mtest/libmscore/copypaste/tst_copypaste.cpp
@@ -46,6 +46,9 @@ class TestCopyPaste : public QObject, public MTest
void copypaste09() { copypaste("09"); } // ottava
void copypaste10() { copypaste("10"); } // two slurs
void copypaste11() { copypaste("11"); } // grace notes
+ void copypaste12() { copypaste("12"); } // voices
+
+ void copyPastePartial();
};
//---------------------------------------------------------
@@ -167,6 +170,35 @@ void TestCopyPaste::copypaste(const char* idx)
delete score;
}
+void TestCopyPaste::copyPastePartial() {
+ Score* score = readScore(DIR + QString("copypaste_partial_01.mscx"));
+ score->doLayout();
+
+ Measure* m1 = score->firstMeasure();
+
+ Segment* s = m1->first(Segment::SegChordRest);
+ s = s->next(Segment::SegChordRest);
+ score->select(s->element(0));
+ s = s->next(Segment::SegChordRest);
+ score->select(s->element(4), SelectType::SELECT_RANGE);
+
+ QVERIFY(score->selection().canCopy());
+ QString mimeType = score->selection().mimeType();
+ QVERIFY(!mimeType.isEmpty());
+ QMimeData* mimeData = new QMimeData;
+ mimeData->setData(mimeType, score->selection().mimeData());
+ QApplication::clipboard()->setMimeData(mimeData);
+
+ score->select(m1->first(Segment::SegChordRest)->element(0));
+ paste(score);
+ score->doLayout();
+
+ QVERIFY(saveCompareScore(score, QString("copypaste_partial_01.mscx"),
+ DIR + QString("copypaste_partial_01-ref.mscx")));
+ delete score;
+}
+
+
QTEST_MAIN(TestCopyPaste)
#include "tst_copypaste.moc"
diff --git a/mtest/libmscore/copypaste/updateReference b/mtest/libmscore/copypaste/updateReference
index 89f1af88944cf..ba1c89ceb6b3b 100755
--- a/mtest/libmscore/copypaste/updateReference
+++ b/mtest/libmscore/copypaste/updateReference
@@ -1,8 +1,9 @@
#!/bin/bash
-for a in 01 02 03 04 05 06 07 08 9 10 11; do
+for a in 01 02 03 04 05 06 07 08 9 10 11 12; do
echo cp ../../../build.debug/mtest/libmscore/copypaste/copypaste${a}.mscx copypaste${a}-ref.mscx
cp ../../../build.debug/mtest/libmscore/copypaste/copypaste${a}.mscx copypaste${a}-ref.mscx
done
+cp ../../../build.debug/mtest/libmscore/copypaste/copypaste_partial_01.mscx copypaste_partial_01-ref.mscx
diff --git a/mtest/libmscore/link/tst_parts.cpp b/mtest/libmscore/link/tst_parts.cpp
index fee227f462730..bca5a20b0afb0 100644
--- a/mtest/libmscore/link/tst_parts.cpp
+++ b/mtest/libmscore/link/tst_parts.cpp
@@ -249,7 +249,7 @@ Score* TestParts::doAddBreath()
Measure* m = score->firstMeasure();
Segment* s = m->tick2segment(480);
- Chord* chord = static_cast(s->element(0));
+ Ms::Chord* chord = static_cast(s->element(0));
Note* note = chord->upNote();
DropData dd;
dd.view = 0;
@@ -385,7 +385,7 @@ Score* TestParts::doAddFingering()
Measure* m = score->firstMeasure();
Segment* s = m->tick2segment(480);
- Chord* chord = static_cast(s->element(0));
+ Ms::Chord* chord = static_cast(s->element(0));
Note* note = chord->upNote();
DropData dd;
dd.view = 0;
@@ -521,7 +521,7 @@ Score* TestParts::doAddSymbol()
Measure* m = score->firstMeasure();
Segment* s = m->tick2segment(480);
- Chord* chord = static_cast(s->element(0));
+ Ms::Chord* chord = static_cast(s->element(0));
Note* note = chord->upNote();
DropData dd;
dd.view = 0;