diff --git a/libmscore/measure.cpp b/libmscore/measure.cpp index 4866ba9c36067..7f151495e1552 100644 --- a/libmscore/measure.cpp +++ b/libmscore/measure.cpp @@ -1790,9 +1790,9 @@ void Measure::adjustToLen(Fraction nf, bool appendRestsIfNecessary) startTick += diff; score()->undoInsertTime(startTick, diff); - score()->undo(new InsertTime(score(), startTick, diff)); for (Score* s : score()->scoreList()) { + s->undo(new InsertTime(s, startTick, diff)); Measure* m = s->tick2measure(tick()); s->undo(new ChangeMeasureLen(m, nf)); if (nl > ol) { diff --git a/libmscore/noteentry.cpp b/libmscore/noteentry.cpp index 8c020d1600dc6..1eeb117baf249 100644 --- a/libmscore/noteentry.cpp +++ b/libmscore/noteentry.cpp @@ -615,9 +615,9 @@ void Score::localInsertChord(const Position& pos) // The approach is similar to that in Measure::adjustToLen() but does // insert time to the middle of the measure rather than to the end. undoInsertTime(tick, len); - undo(new InsertTime(this, tick, len)); for (Score* score : scoreList()) { + undo(new InsertTime(score, tick, len)); Measure* m = score->tick2measure(tick); undo(new ChangeMeasureLen(m, targetMeasureLen)); Segment* scoreSeg = m->tick2segment(tick); diff --git a/mtest/libmscore/measure/measureSplit-ref.mscx b/mtest/libmscore/measure/measureSplit-ref.mscx new file mode 100644 index 0000000000000..25ac7fab32831 --- /dev/null +++ b/mtest/libmscore/measure/measureSplit-ref.mscx @@ -0,0 +1,2750 @@ + + + + + 0 + 480 + + 1 + 1 + 1 + 0 + + + Composer / arranger + + + + + + + + Subtitle + + + Untitled score + + Orchestra + + Flutes + + + Oboes + +
+ flutes + oboes + clarinets + saxophones + bassoons + +
+
+ horns + trumpets + cornets + flugelhorns + trombones + baritone-horns + euphoniums + tubas +
+
+ timpani +
+
+ keyboard-percussion + drums + unpitched-metal-percussion + unpitched-wooden-percussion + other-percussion +
+ keyboards + harps + organs + synths +
+ plucked-strings +
+ +
+ voices +
+
+ orchestral-strings +
+ +
+ + + + stdNormal + + + 1 + + Flute + + Flute + Fl. + Flute + 59 + 98 + 60 + 93 + wind.flutes.flute + + + + + + + + + stdNormal + + + Oboe + + Oboe + Ob. + Oboe + 58 + 96 + 58 + 87 + wind.reed.oboe + + + + + + + + 10 + + + + + Untitled score + + + + + Subtitle + + + + + Composer / arranger + + + + + + + 4 + 4 + + + + quarter + + + 67 + 15 + + + + + quarter + + + 67 + 15 + + + + + quarter + + + 67 + 15 + + + + + quarter + + + 67 + 15 + + + + + + + + + quarter + + + 67 + 15 + + + + + + + + + quarter + + + 67 + 15 + + + + + quarter + + + 67 + 15 + + + + + quarter + + + 67 + 15 + + + + + + + + + quarter + + + 67 + 15 + + + + + quarter + + + 67 + 15 + + + + + quarter + + + 67 + 15 + + + + + quarter + + + 67 + 15 + + + + + + + + + quarter + + + 67 + 15 + + + + + quarter + + + 67 + 15 + + + + + quarter + + + 67 + 15 + + + + + quarter + + + 67 + 15 + + + + + + + + + quarter + + + 67 + 15 + + + + + quarter + + + 67 + 15 + + + + + quarter + + + 67 + 15 + + + + + quarter + + + 67 + 15 + + + + + + + + + quarter + + + 67 + 15 + + + + + quarter + + + 67 + 15 + + + + + quarter + + + 67 + 15 + + + + + quarter + + + 67 + 15 + + + + + + + + + quarter + + + 67 + 15 + + + + + quarter + + + 67 + 15 + + + + + quarter + + + 67 + 15 + + + + + quarter + + + 67 + 15 + + + + + + + + + quarter + + + 67 + 15 + + + + + quarter + + + 67 + 15 + + + + + quarter + + + 67 + 15 + + + + + quarter + + + 67 + 15 + + + + + + + + + measure + 4/4 + + + + + + + + measure + 4/4 + + + + + + + + measure + 4/4 + + + + + + + + measure + 4/4 + + + + + + + + measure + 4/4 + + + + + + + + measure + 4/4 + + + + + + + + measure + 4/4 + + + + + + + + measure + 4/4 + + + + + + + + measure + 4/4 + + + + + + + + measure + 4/4 + + + + + + + + measure + 4/4 + + + + + + + + measure + 4/4 + + + + + + + + measure + 4/4 + + + + + + + + measure + 4/4 + + + + + + + + measure + 4/4 + + + + + + + + measure + 4/4 + + + + + + + + measure + 4/4 + + + + + + + + measure + 4/4 + + + + + + + + measure + 4/4 + + + + + + + + measure + 4/4 + + + + + + + + measure + 4/4 + + + + + + + + measure + 4/4 + + + + + + + + measure + 4/4 + + + + + + + + measure + 4/4 + + + + + + + + + + 4 + 4 + + + + quarter + + + 71 + 19 + + + + + quarter + + + 71 + 19 + + + + + quarter + + + 71 + 19 + + + + + quarter + + + 71 + 19 + + + + + + + + + quarter + + + 71 + 19 + + + + + + + + + quarter + + + 71 + 19 + + + + + quarter + + + 71 + 19 + + + + + quarter + + + 71 + 19 + + + + + + + + + quarter + + + 71 + 19 + + + + + quarter + + + 71 + 19 + + + + + quarter + + + 71 + 19 + + + + + quarter + + + 71 + 19 + + + + + + + + + quarter + + + 71 + 19 + + + + + quarter + + + 71 + 19 + + + + + quarter + + + 71 + 19 + + + + + quarter + + + 71 + 19 + + + + C4 + C4 + + + + + + + + + quarter + + + 71 + 19 + + + + + quarter + + + + + + + 1 + + + + + + 71 + 19 + + + + + quarter + + + 71 + 19 + + + + + quarter + + + 71 + 19 + + + + + + + + + quarter + + + 71 + 19 + + + + + quarter + + + + -1 + + + + + + 71 + 19 + + + + + quarter + + + 71 + 19 + + + + + quarter + + + + + + + + + + 1 + -3/4 + + + + + + 71 + 19 + + + + G + G + + + + + + + + + quarter + + + + -1 + 3/4 + + + + + + 71 + 19 + + + + + quarter + + + 71 + 19 + + + + + quarter + + + 71 + 19 + + + + + quarter + + + 71 + 19 + + + + + + + + + quarter + + + 71 + 19 + + + + + quarter + + + 71 + 19 + + + + + quarter + + + 71 + 19 + + + + + quarter + + + 71 + 19 + + + + + + + + + measure + 4/4 + + + + + + + + measure + 4/4 + + + + + + + + measure + 4/4 + + + + + + + + measure + 4/4 + + + + + + + + measure + 4/4 + + + + + + + + measure + 4/4 + + + + + + + + measure + 4/4 + + + + + + + + measure + 4/4 + + + + + + + + measure + 4/4 + + + + + + + + measure + 4/4 + + + + + + + + measure + 4/4 + + + + + + + + measure + 4/4 + + + + + + + + measure + 4/4 + + + + + + + + measure + 4/4 + + + + + + + + measure + 4/4 + + + + + + + + measure + 4/4 + + + + + + + + measure + 4/4 + + + + + + + + measure + 4/4 + + + + + + + + measure + 4/4 + + + + + + + + measure + 4/4 + + + + + + + + measure + 4/4 + + + + + + + + measure + 4/4 + + + + + + + + measure + 4/4 + + + + + + + + measure + 4/4 + + + + + + + 0 + 480 + + 1 + 1 + 1 + 0 + Flute + + + 1 + + stdNormal + + + Flute + + Flute + Fl. + Flute + 59 + 98 + 60 + 93 + wind.flutes.flute + + + + + + + + 10 + + + + + + + Untitled score + + + + + + Subtitle + + + + + + Composer / arranger + + + + Flute + + + + + + + + 4 + 4 + + + + + quarter + + + + 67 + 15 + + + + + + quarter + + + + 67 + 15 + + + + + + quarter + + + + 67 + 15 + + + + + + quarter + + + + 67 + 15 + + + + + + + + + + quarter + + + + 67 + 15 + + + + + + + + + + quarter + + + + 67 + 15 + + + + + + quarter + + + + 67 + 15 + + + + + + quarter + + + + 67 + 15 + + + + + + + + + + quarter + + + + 67 + 15 + + + + + + quarter + + + + 67 + 15 + + + + + + quarter + + + + 67 + 15 + + + + + + quarter + + + + 67 + 15 + + + + + + + + + + quarter + + + + 67 + 15 + + + + + + quarter + + + + 67 + 15 + + + + + + quarter + + + + 67 + 15 + + + + + + quarter + + + + 67 + 15 + + + + + + + + + + quarter + + + + 67 + 15 + + + + + + quarter + + + + 67 + 15 + + + + + + quarter + + + + 67 + 15 + + + + + + quarter + + + + 67 + 15 + + + + + + + + + + quarter + + + + 67 + 15 + + + + + + quarter + + + + 67 + 15 + + + + + + quarter + + + + 67 + 15 + + + + + + quarter + + + + 67 + 15 + + + + + + + + + + quarter + + + + 67 + 15 + + + + + + quarter + + + + 67 + 15 + + + + + + quarter + + + + 67 + 15 + + + + + + quarter + + + + 67 + 15 + + + + + + + + + + quarter + + + + 67 + 15 + + + + + + quarter + + + + 67 + 15 + + + + + + quarter + + + + 67 + 15 + + + + + + quarter + + + + 67 + 15 + + + + + + + + + + measure + 4/4 + + + + + + + + + measure + 4/4 + + + + + + + + + measure + 4/4 + + + + + + + + + measure + 4/4 + + + + + + + + + measure + 4/4 + + + + + + + + + measure + 4/4 + + + + + + + + + measure + 4/4 + + + + + + + + + measure + 4/4 + + + + + + + + + measure + 4/4 + + + + + + + + + measure + 4/4 + + + + + + + + + measure + 4/4 + + + + + + + + + measure + 4/4 + + + + + + + + + measure + 4/4 + + + + + + + + + measure + 4/4 + + + + + + + + + measure + 4/4 + + + + + + + + + measure + 4/4 + + + + + + + + + measure + 4/4 + + + + + + + + + measure + 4/4 + + + + + + + + + measure + 4/4 + + + + + + + + + measure + 4/4 + + + + + + + + + measure + 4/4 + + + + + + + + + measure + 4/4 + + + + + + + + + measure + 4/4 + + + + + + + + + measure + 4/4 + + + + + Flute + + + + 0 + 480 + + 1 + 1 + 1 + 0 + Oboe + + + 2 + + stdNormal + + + Oboe + + Oboe + Ob. + Oboe + 58 + 96 + 58 + 87 + wind.reed.oboe + + + + + + + + 10 + + + -1 + + + + + + -1 + + + + Untitled score + + + + + -1 + + + + Subtitle + + + + + -1 + + + + Composer / arranger + + + + Oboe + + + + + + + + 4 + 4 + + + + + quarter + + + + 71 + 19 + + + + + + quarter + + + + 71 + 19 + + + + + + quarter + + + + 71 + 19 + + + + + + quarter + + + + 71 + 19 + + + + + + + + + + quarter + + + + 71 + 19 + + + + + + + + + + quarter + + + + 71 + 19 + + + + + + quarter + + + + 71 + 19 + + + + + + quarter + + + + 71 + 19 + + + + + + + + + + quarter + + + + 71 + 19 + + + + + + quarter + + + + 71 + 19 + + + + + + quarter + + + + 71 + 19 + + + + + + quarter + + + + 71 + 19 + + + + + + + + + + quarter + + + + 71 + 19 + + + + + + quarter + + + + 71 + 19 + + + + + + quarter + + + + 71 + 19 + + + + + + quarter + + + + 71 + 19 + + + + C4 + C4 + + + + + + + + + + + quarter + + + + 71 + 19 + + + + + + quarter + + + + + + + + 1 + + + + + + + 71 + 19 + + + + + + quarter + + + + 71 + 19 + + + + + + quarter + + + + 71 + 19 + + + + + + + + + + quarter + + + + 71 + 19 + + + + + + quarter + + + + -1 + + + + + + + 71 + 19 + + + + + + quarter + + + + 71 + 19 + + + + + + quarter + + + + + + + + + + + 1 + -3/4 + + + + + + + 71 + 19 + + + + G + G + + + + + + + + + + + quarter + + + + -1 + 3/4 + + + + + + + 71 + 19 + + + + + + quarter + + + + 71 + 19 + + + + + + quarter + + + + 71 + 19 + + + + + + quarter + + + + 71 + 19 + + + + + + + + + + quarter + + + + 71 + 19 + + + + + + quarter + + + + 71 + 19 + + + + + + quarter + + + + 71 + 19 + + + + + + quarter + + + + 71 + 19 + + + + + + + + + + measure + 4/4 + + + + + + + + + measure + 4/4 + + + + + + + + + measure + 4/4 + + + + + + + + + measure + 4/4 + + + + + + + + + measure + 4/4 + + + + + + + + + measure + 4/4 + + + + + + + + + measure + 4/4 + + + + + + + + + measure + 4/4 + + + + + + + + + measure + 4/4 + + + + + + + + + measure + 4/4 + + + + + + + + + measure + 4/4 + + + + + + + + + measure + 4/4 + + + + + + + + + measure + 4/4 + + + + + + + + + measure + 4/4 + + + + + + + + + measure + 4/4 + + + + + + + + + measure + 4/4 + + + + + + + + + measure + 4/4 + + + + + + + + + measure + 4/4 + + + + + + + + + measure + 4/4 + + + + + + + + + measure + 4/4 + + + + + + + + + measure + 4/4 + + + + + + + + + measure + 4/4 + + + + + + + + + measure + 4/4 + + + + + + + + + measure + 4/4 + + + + + Oboe + +
+
diff --git a/mtest/libmscore/measure/measureSplit.mscx b/mtest/libmscore/measure/measureSplit.mscx new file mode 100644 index 0000000000000..8e3d82512f27c --- /dev/null +++ b/mtest/libmscore/measure/measureSplit.mscx @@ -0,0 +1,1099 @@ + + + + + 0 + 480 + + 1 + 1 + 1 + 0 + + + Composer / arranger + + 2024-07-18 + + + + Apple Macintosh + + + + Subtitle + + + Untitled score + + Orchestra + + Flutes + + + Oboes + +
+ flutes + oboes + clarinets + saxophones + bassoons + +
+
+ horns + trumpets + cornets + flugelhorns + trombones + baritone-horns + euphoniums + tubas +
+
+ timpani +
+
+ keyboard-percussion + drums + unpitched-metal-percussion + unpitched-wooden-percussion + other-percussion +
+ keyboards + harps + organs + synths +
+ plucked-strings +
+ +
+ voices +
+
+ orchestral-strings +
+ +
+ + + + stdNormal + + + 1 + + Flute + + Flute + Fl. + Flute + 59 + 98 + 60 + 93 + wind.flutes.flute + + + + Fluid + + + + + + + stdNormal + + + Oboe + + Oboe + Ob. + Oboe + 58 + 96 + 58 + 87 + wind.reed.oboe + + + + Fluid + + + + + + 10 + + + Untitled score + + + + Subtitle + + + + Composer / arranger + + + + + + 4 + 4 + + + quarter + + 67 + 15 + + + + quarter + + 67 + 15 + + + + quarter + + 67 + 15 + + + + quarter + + 67 + 15 + + + + + + + + quarter + + 67 + 15 + + + + quarter + + 67 + 15 + + + + quarter + + 67 + 15 + + + + quarter + + 67 + 15 + + + + + + + + quarter + + 67 + 15 + + + + quarter + + 67 + 15 + + + + quarter + + 67 + 15 + + + + quarter + + 67 + 15 + + + + + + + + quarter + + 67 + 15 + + + + quarter + + 67 + 15 + + + + quarter + + 67 + 15 + + + + quarter + + 67 + 15 + + + + + + + + quarter + + 67 + 15 + + + + quarter + + 67 + 15 + + + + quarter + + 67 + 15 + + + + quarter + + 67 + 15 + + + + + + + + quarter + + 67 + 15 + + + + quarter + + 67 + 15 + + + + quarter + + 67 + 15 + + + + quarter + + 67 + 15 + + + + + + + + quarter + + 67 + 15 + + + + quarter + + 67 + 15 + + + + quarter + + 67 + 15 + + + + quarter + + 67 + 15 + + + + + + + + quarter + + 67 + 15 + + + + quarter + + 67 + 15 + + + + quarter + + 67 + 15 + + + + quarter + + 67 + 15 + + + + + + + + measure + 4/4 + + + + + + + measure + 4/4 + + + + + + + measure + 4/4 + + + + + + + measure + 4/4 + + + + + + + measure + 4/4 + + + + + + + measure + 4/4 + + + + + + + measure + 4/4 + + + + + + + measure + 4/4 + + + + + + + measure + 4/4 + + + + + + + measure + 4/4 + + + + + + + measure + 4/4 + + + + + + + measure + 4/4 + + + + + + + measure + 4/4 + + + + + + + measure + 4/4 + + + + + + + measure + 4/4 + + + + + + + measure + 4/4 + + + + + + + measure + 4/4 + + + + + + + measure + 4/4 + + + + + + + measure + 4/4 + + + + + + + measure + 4/4 + + + + + + + measure + 4/4 + + + + + + + measure + 4/4 + + + + + + + measure + 4/4 + + + + + + + measure + 4/4 + + + + + + + + + 4 + 4 + + + quarter + + 71 + 19 + + + + quarter + + 71 + 19 + + + + quarter + + 71 + 19 + + + + quarter + + 71 + 19 + + + + + + + + quarter + + 71 + 19 + + + + quarter + + 71 + 19 + + + + quarter + + 71 + 19 + + + + quarter + + 71 + 19 + + + + + + + + quarter + + 71 + 19 + + + + quarter + + 71 + 19 + + + + quarter + + 71 + 19 + + + + quarter + + 71 + 19 + + + + + + + + quarter + + 71 + 19 + + + + quarter + + 71 + 19 + + + + quarter + + 71 + 19 + + + + quarter + + 71 + 19 + + + + C4 + C4 + + + + + + + quarter + + 71 + 19 + + + + quarter + + + + + + 1 + + + + + 71 + 19 + + + + quarter + + 71 + 19 + + + + quarter + + 71 + 19 + + + + + + + + quarter + + 71 + 19 + + + + quarter + + + + -1 + + + + + 71 + 19 + + + + quarter + + 71 + 19 + + + + quarter + + + + + + + + + 1 + -3/4 + + + + + 71 + 19 + + + + G + G + + + + + + + quarter + + + + -1 + 3/4 + + + + + 71 + 19 + + + + quarter + + 71 + 19 + + + + quarter + + 71 + 19 + + + + quarter + + 71 + 19 + + + + + + + + quarter + + 71 + 19 + + + + quarter + + 71 + 19 + + + + quarter + + 71 + 19 + + + + quarter + + 71 + 19 + + + + + + + + measure + 4/4 + + + + + + + measure + 4/4 + + + + + + + measure + 4/4 + + + + + + + measure + 4/4 + + + + + + + measure + 4/4 + + + + + + + measure + 4/4 + + + + + + + measure + 4/4 + + + + + + + measure + 4/4 + + + + + + + measure + 4/4 + + + + + + + measure + 4/4 + + + + + + + measure + 4/4 + + + + + + + measure + 4/4 + + + + + + + measure + 4/4 + + + + + + + measure + 4/4 + + + + + + + measure + 4/4 + + + + + + + measure + 4/4 + + + + + + + measure + 4/4 + + + + + + + measure + 4/4 + + + + + + + measure + 4/4 + + + + + + + measure + 4/4 + + + + + + + measure + 4/4 + + + + + + + measure + 4/4 + + + + + + + measure + 4/4 + + + + + + + measure + 4/4 + + + + +
+
diff --git a/mtest/libmscore/measure/tst_measure.cpp b/mtest/libmscore/measure/tst_measure.cpp index ec438a74f56bb..1223a447bf86f 100644 --- a/mtest/libmscore/measure/tst_measure.cpp +++ b/mtest/libmscore/measure/tst_measure.cpp @@ -17,6 +17,7 @@ #include "libmscore/measure.h" #include "libmscore/measurenumber.h" #include "libmscore/mmrestrange.h" +#include "libmscore/part.h" #include "libmscore/score.h" #include "libmscore/system.h" #include "libmscore/undo.h" @@ -35,6 +36,9 @@ class TestMeasure : public QObject, public MTest { Q_OBJECT + public: + void createParts(MasterScore* masterScore); + private slots: void initTestCase(); @@ -59,8 +63,44 @@ class TestMeasure : public QObject, public MTest void gap(); void checkMeasure(); void changeMeasureLen(); + void measureSplit(); }; +void TestMeasure::createParts(MasterScore* masterScore) +{ + // + // create first part + // + QList parts; + parts.push_back(masterScore->parts().at(0)); + //Score* nscore = masterScore->createScore(); + + Excerpt* ex = new Excerpt(masterScore); + //ex->setExcerptScore(nscore); + ex->setParts(parts); + //ex->setName(parts.front()->partName()); + Excerpt::createExcerpt(ex); + masterScore->excerpts().push_back(ex); + //QVERIFY(nscore); + + // + // create second part + // + parts.clear(); + parts.push_back(masterScore->parts().at(1)); + //nscore = masterScore->createScore(); + + ex = new Excerpt(masterScore); + //(ex->setExcerptScore(nscore); + ex->setParts(parts); + //ex->setName(parts.front()->partName()); + Excerpt::createExcerpt(ex); + masterScore->excerpts().push_back(ex); + //QVERIFY(nscore); + + masterScore->setExcerptsChanged(true); +} + //--------------------------------------------------------- // initTestCase //--------------------------------------------------------- @@ -633,6 +673,28 @@ void TestMeasure::changeMeasureLen() QVERIFY(saveCompareScore(score, "changeMeasureLen.mscx", DIR + "changeMeasureLen-ref.mscx")); } + +void TestMeasure::measureSplit() + { + MasterScore* score = readScore(DIR + "measureSplit.mscx"); + QVERIFY(score); + + createParts(score); + score->startCmd(); + + Measure* m = score->firstMeasure()->nextMeasure(); + QVERIFY(m); + ChordRest* cr = m->first(SegmentType::ChordRest)->next()->nextChordRest(0); + QVERIFY(cr); + + score->cmdSplitMeasure(cr); + + score->setLayoutAll(); + score->endCmd(); + + QVERIFY(saveCompareScore(score, "measureSplit.mscx", DIR + "measureSplit-ref.mscx")); + } + QTEST_MAIN(TestMeasure) #if __has_include("tst_measure.moc")