diff --git a/importexport/musicxml/importmxmlpass1.cpp b/importexport/musicxml/importmxmlpass1.cpp index a412147fa8d50..b0ad690510e3c 100644 --- a/importexport/musicxml/importmxmlpass1.cpp +++ b/importexport/musicxml/importmxmlpass1.cpp @@ -672,17 +672,9 @@ static Tid tidForCreditWords(const CreditWords* const word, std::vector vboxHeight) // and size is reasonable - vboxHeight = diff; - vboxHeight /= 10; // height in spatium - vboxHeight += 2.5; // guesstimated correction for last line - - vbox->setBoxHeight(Spatium(vboxHeight)); score->measures()->add(vbox); return vbox; } @@ -764,8 +756,7 @@ static void inferFromTitle(QString& title, QString& inferredSubtitle, QString& i // addCreditWords //--------------------------------------------------------- -static VBox* addCreditWords(Score* const score, const CreditWordsList& crWords, - const int pageNr, const QSize pageSize, +static VBox* addCreditWords(Score* const score, const CreditWordsList& crWords, const QSize pageSize, const bool top, const bool isSibeliusScore) { VBox* vbox = nullptr; @@ -773,7 +764,7 @@ static VBox* addCreditWords(Score* const score, const CreditWordsList& crWords, std::vector headerWords; std::vector footerWords; for (const CreditWords* w : crWords) { - if (w->page == pageNr) { + if (w->page == 1) { if (w->defaultY > (pageSize.height() / 2)) headerWords.push_back(w); else @@ -782,23 +773,16 @@ static VBox* addCreditWords(Score* const score, const CreditWordsList& crWords, } std::vector words; - if (pageNr == 1) { - // if there are more credit words in the footer than in header, - // swap heaer and footer, assuming this will result in a vertical - // frame with the title on top of the page. - // Sibelius (direct export) typically exports no header - // and puts the title etc. in the footer - const bool doSwap = footerWords.size() > headerWords.size() && isSibeliusScore; - if (top) { - words = doSwap ? footerWords : headerWords; - } - else { - words = doSwap ? headerWords : footerWords; - } - } - else { - words = top ? headerWords : footerWords; - } + // if there are more credit words in the footer than in header, + // swap heaer and footer, assuming this will result in a vertical + // frame with the title on top of the page. + // Sibelius (direct export) typically exports no header + // and puts the title etc. in the footer + const bool doSwap = footerWords.size() > headerWords.size() && isSibeliusScore; + if (top) + words = doSwap ? footerWords : headerWords; + else + words = doSwap ? headerWords : footerWords; int miny = 0; int maxy = 0; @@ -806,11 +790,11 @@ static VBox* addCreditWords(Score* const score, const CreditWordsList& crWords, for (const CreditWords* w : words) { if (mustAddWordToVbox(w->type)) { - const Tid tid = (pageNr == 1 && top) ? tidForCreditWords(w, words, pageSize.width()) : Tid::DEFAULT; + const Tid tid = top ? tidForCreditWords(w, words, pageSize.width()) : Tid::DEFAULT; const Align align = alignForCreditWords(w, pageSize.width(), tid); double yoffs = tid == Tid::COMPOSER ? 0.0 : (maxy - w->defaultY) * score->spatium() / 10; if (!vbox) - vbox = MusicXMLParserPass1::createAndAddVBoxForCreditWords(score, miny, maxy); + vbox = MusicXMLParserPass1::createAndAddVBoxForCreditWords(score); addText2(vbox, score, w->words, tid, align, yoffs); } else if (w->type == "rights" && score->metaTag("copyright").isEmpty()) { @@ -900,7 +884,11 @@ void MusicXMLParserPass1::createMeasuresAndVboxes(Score* const score, // add a header vbox if the this measure is the first in the score or the first on a new page if (pageStartMeasureNrs.count(i) || i == 0) { ++pageNr; - vbox = addCreditWords(score, crWords, pageNr, pageSize, true, _exporterString.contains("sibelius")); + if (pageNr == 1) { + vbox = addCreditWords(score, crWords, pageSize, true, _exporterString.contains("sibelius")); + //if (i == 0 && vbox) + // vbox->setExcludeFromOtherParts(false); + } } // create and add the measure @@ -919,8 +907,8 @@ void MusicXMLParserPass1::createMeasuresAndVboxes(Score* const score, addBreakToPreviousMeasureBase(score, mb, LayoutBreak::Type::LINE); // add a footer vbox if the next measure is on a new page or end of score has been reached - if (pageStartMeasureNrs.count(i+1) || i == (ml.size() - 1)) - addCreditWords(score, crWords, pageNr, pageSize, false, _exporterString.contains("sibelius")); + if ((pageStartMeasureNrs.count(i + 1) || i == (ml.size() - 1)) && pageNr == 1) + addCreditWords(score, crWords, pageSize, false, _exporterString.contains("sibelius")); } } diff --git a/importexport/musicxml/importmxmlpass1.h b/importexport/musicxml/importmxmlpass1.h index fb5fb9391db3c..77fe25d28ad41 100644 --- a/importexport/musicxml/importmxmlpass1.h +++ b/importexport/musicxml/importmxmlpass1.h @@ -175,7 +175,7 @@ class MusicXMLParserPass1 { const CreditWordsList& credits() const { return _credits; } bool hasBeamingInfo() const { return _hasBeamingInfo; } bool isVocalStaff(const QString& id) const { return _parts[id].isVocalStaff(); } - static VBox* createAndAddVBoxForCreditWords(Score* const score, const int miny = 0, const int maxy = 75); + static VBox* createAndAddVBoxForCreditWords(Score* const score); int maxDiff() const { return _maxDiff; } void insertAdjustedDuration(Fraction key, Fraction value) { _adjustedDurations.insert(key, value); } QMap& adjustedDurations() { return _adjustedDurations; } diff --git a/importexport/musicxml/importmxmlpass2.cpp b/importexport/musicxml/importmxmlpass2.cpp index d9742f9d26ac8..058f03d58b2a9 100644 --- a/importexport/musicxml/importmxmlpass2.cpp +++ b/importexport/musicxml/importmxmlpass2.cpp @@ -1625,53 +1625,6 @@ static void cleanFretDiagrams(Measure* measure) } } -//--------------------------------------------------------- -// reformatHeaderVBox -//--------------------------------------------------------- -/** - Due to inconsistencies with spacing and inferred text, - the header VBox frequently has collisions. This cleans - those (as a temporary fix for a more robust collision-prevention - system in Boxes). - */ - -static void reformatHeaderVBox(MeasureBase* mb) - { - if (!mb->isVBox()) - return; - - VBox* headerVBox = toVBox(mb); - Score* score = mb->score(); - qreal totalHeight = 0; - qreal offsetHeight = 0; - qreal lineSpacingMultiplier = 1.2; - - for (auto e : headerVBox->el()) { - if (!e->isText()) - continue; - Text* t = toText(e); - t->layout(); - - totalHeight += t->height(); - if (Align(t->align() & Align::VMASK) == Align::TOP) { - totalHeight += t->lineHeight() * lineSpacingMultiplier; - t->setOffset(t->offset().x(), offsetHeight); - t->setPropertyFlags(Pid::OFFSET, PropertyFlags::UNSTYLED); - offsetHeight += t->height(); - offsetHeight += t->lineHeight() * lineSpacingMultiplier; - } - } - - // 1mm of - static const double VBOX_BOTTOM_PADDING = 1; - totalHeight += VBOX_BOTTOM_PADDING; - headerVBox->setBottomMargin(VBOX_BOTTOM_PADDING); - headerVBox->setPropertyFlags(Pid::BOTTOM_MARGIN, PropertyFlags::UNSTYLED); - - headerVBox->setBoxHeight(Spatium(totalHeight / score->spatium())); - headerVBox->setPropertyFlags(Pid::BOX_HEIGHT, PropertyFlags::UNSTYLED); - } - //--------------------------------------------------------- // initPartState //--------------------------------------------------------- @@ -2171,11 +2124,6 @@ void MusicXMLParserPass2::scorePartwise() cleanUpLayoutBreaks(_score, _logger); addError(checkAtEndElement(_e, "score-partwise")); - - // This method relies heavily on text metrics which differ from system to system and can be very volatile - // To avoid having to update the majority of musicxml tests on every change to engraving, don't run this during testing - if (!MScore::testMode) - reformatHeaderVBox(_score->measures()->first()); } //--------------------------------------------------------- diff --git a/mtest/musicxml/io/testAdditionalFermatas_ref.mscx b/mtest/musicxml/io/testAdditionalFermatas_ref.mscx index fe223966b9142..aedfee481693c 100644 --- a/mtest/musicxml/io/testAdditionalFermatas_ref.mscx +++ b/mtest/musicxml/io/testAdditionalFermatas_ref.mscx @@ -117,7 +117,7 @@ - 12.5 + 10 diff --git a/mtest/musicxml/io/testBarlineLoc_ref.mscx b/mtest/musicxml/io/testBarlineLoc_ref.mscx index 4c8599a87af9d..9e9fbfa29a5c6 100644 --- a/mtest/musicxml/io/testBarlineLoc_ref.mscx +++ b/mtest/musicxml/io/testBarlineLoc_ref.mscx @@ -128,7 +128,7 @@ - 12.5 + 10 diff --git a/mtest/musicxml/io/testBeamModes_ref.mscx b/mtest/musicxml/io/testBeamModes_ref.mscx index 417a88f4d1f9c..80e547bb0385a 100644 --- a/mtest/musicxml/io/testBeamModes_ref.mscx +++ b/mtest/musicxml/io/testBeamModes_ref.mscx @@ -117,7 +117,7 @@ - 12.5 + 10 diff --git a/mtest/musicxml/io/testBracketTypes_ref.mscx b/mtest/musicxml/io/testBracketTypes_ref.mscx index 4c87369fce224..28640b5bf3e67 100644 --- a/mtest/musicxml/io/testBracketTypes_ref.mscx +++ b/mtest/musicxml/io/testBracketTypes_ref.mscx @@ -117,7 +117,7 @@ - 12.5 + 10 diff --git a/mtest/musicxml/io/testConnectedArpeggios_ref.mscx b/mtest/musicxml/io/testConnectedArpeggios_ref.mscx index cf93437af026c..517ee2ec4ddad 100644 --- a/mtest/musicxml/io/testConnectedArpeggios_ref.mscx +++ b/mtest/musicxml/io/testConnectedArpeggios_ref.mscx @@ -117,7 +117,7 @@ - 12.5 + 10 diff --git a/mtest/musicxml/io/testCueGraceNotes_ref.mscx b/mtest/musicxml/io/testCueGraceNotes_ref.mscx index f5e60fc41676e..b3eb2cb7401ee 100644 --- a/mtest/musicxml/io/testCueGraceNotes_ref.mscx +++ b/mtest/musicxml/io/testCueGraceNotes_ref.mscx @@ -117,7 +117,7 @@ - 12.5 + 10 diff --git a/mtest/musicxml/io/testCueNotes3_ref.mscx b/mtest/musicxml/io/testCueNotes3_ref.mscx index c850606743b29..a09bcd8371592 100644 --- a/mtest/musicxml/io/testCueNotes3_ref.mscx +++ b/mtest/musicxml/io/testCueNotes3_ref.mscx @@ -117,7 +117,7 @@ - 12.5 + 10 diff --git a/mtest/musicxml/io/testDSalCodaMisplaced_ref.mscx b/mtest/musicxml/io/testDSalCodaMisplaced_ref.mscx index 1f5da08e28d6e..7deed6df36d8b 100644 --- a/mtest/musicxml/io/testDSalCodaMisplaced_ref.mscx +++ b/mtest/musicxml/io/testDSalCodaMisplaced_ref.mscx @@ -117,7 +117,7 @@ - 12.5 + 10 diff --git a/mtest/musicxml/io/testDSalCoda_ref.mscx b/mtest/musicxml/io/testDSalCoda_ref.mscx index cb89404688178..2bef2b0cf1a90 100644 --- a/mtest/musicxml/io/testDSalCoda_ref.mscx +++ b/mtest/musicxml/io/testDSalCoda_ref.mscx @@ -96,7 +96,7 @@ - 12.5 + 10 diff --git a/mtest/musicxml/io/testExcessHiddenStaves_ref.mscx b/mtest/musicxml/io/testExcessHiddenStaves_ref.mscx index f38ee08207d5a..9a744123e06ba 100644 --- a/mtest/musicxml/io/testExcessHiddenStaves_ref.mscx +++ b/mtest/musicxml/io/testExcessHiddenStaves_ref.mscx @@ -127,7 +127,7 @@ - 12.5 + 10 diff --git a/mtest/musicxml/io/testExcessiveFretDiagrams1_ref.mscx b/mtest/musicxml/io/testExcessiveFretDiagrams1_ref.mscx index e33871290119d..12691ca57b0f4 100644 --- a/mtest/musicxml/io/testExcessiveFretDiagrams1_ref.mscx +++ b/mtest/musicxml/io/testExcessiveFretDiagrams1_ref.mscx @@ -117,7 +117,7 @@ - 12.5 + 10 diff --git a/mtest/musicxml/io/testExcessiveFretDiagrams2_ref.mscx b/mtest/musicxml/io/testExcessiveFretDiagrams2_ref.mscx index a7480358cd72a..ab12a8ec1c0e6 100644 --- a/mtest/musicxml/io/testExcessiveFretDiagrams2_ref.mscx +++ b/mtest/musicxml/io/testExcessiveFretDiagrams2_ref.mscx @@ -117,7 +117,7 @@ - 12.5 + 10 diff --git a/mtest/musicxml/io/testFretDiagramLayoutOrder_ref.mscx b/mtest/musicxml/io/testFretDiagramLayoutOrder_ref.mscx index 91722ef59014a..0268992027250 100644 --- a/mtest/musicxml/io/testFretDiagramLayoutOrder_ref.mscx +++ b/mtest/musicxml/io/testFretDiagramLayoutOrder_ref.mscx @@ -117,7 +117,7 @@ - 12.5 + 10 diff --git a/mtest/musicxml/io/testFretboardDiagrams_ref.mscx b/mtest/musicxml/io/testFretboardDiagrams_ref.mscx index 18793ce457af0..c2a423ed55f8b 100644 --- a/mtest/musicxml/io/testFretboardDiagrams_ref.mscx +++ b/mtest/musicxml/io/testFretboardDiagrams_ref.mscx @@ -118,7 +118,7 @@ - 12.5 + 10 diff --git a/mtest/musicxml/io/testInferredCredits1_ref.mscx b/mtest/musicxml/io/testInferredCredits1_ref.mscx index 203188d812e1f..3d403d5b3b959 100644 --- a/mtest/musicxml/io/testInferredCredits1_ref.mscx +++ b/mtest/musicxml/io/testInferredCredits1_ref.mscx @@ -118,7 +118,7 @@ the video game: a tone poem - 12.3698 + 18.8698 diff --git a/mtest/musicxml/io/testInferredDynamics_ref.mscx b/mtest/musicxml/io/testInferredDynamics_ref.mscx index 11723bd1ea64d..b604de78669ff 100644 --- a/mtest/musicxml/io/testInferredDynamics_ref.mscx +++ b/mtest/musicxml/io/testInferredDynamics_ref.mscx @@ -117,7 +117,7 @@ - 12.5 + 10 diff --git a/mtest/musicxml/io/testInferredFingerings_ref.mscx b/mtest/musicxml/io/testInferredFingerings_ref.mscx index a161a8c8190e3..2771f6874d0b6 100644 --- a/mtest/musicxml/io/testInferredFingerings_ref.mscx +++ b/mtest/musicxml/io/testInferredFingerings_ref.mscx @@ -125,7 +125,7 @@ - 12.5 + 10 diff --git a/mtest/musicxml/io/testLayoutCleanup1_ref.mscx b/mtest/musicxml/io/testLayoutCleanup1_ref.mscx index f6552f3bd0409..e99320bba08ef 100644 --- a/mtest/musicxml/io/testLayoutCleanup1_ref.mscx +++ b/mtest/musicxml/io/testLayoutCleanup1_ref.mscx @@ -117,7 +117,7 @@ - 12.5 + 10 diff --git a/mtest/musicxml/io/testLayoutCleanup2_ref.mscx b/mtest/musicxml/io/testLayoutCleanup2_ref.mscx index 2fefc9b834f05..85ad9ab779335 100644 --- a/mtest/musicxml/io/testLayoutCleanup2_ref.mscx +++ b/mtest/musicxml/io/testLayoutCleanup2_ref.mscx @@ -117,7 +117,7 @@ - 12.5 + 10 diff --git a/mtest/musicxml/io/testLyricBracket_ref.mscx b/mtest/musicxml/io/testLyricBracket_ref.mscx index dfc080c1c60ca..629b20c2c69e4 100644 --- a/mtest/musicxml/io/testLyricBracket_ref.mscx +++ b/mtest/musicxml/io/testLyricBracket_ref.mscx @@ -117,7 +117,7 @@ - 12.5 + 10 diff --git a/mtest/musicxml/io/testMeasureStyleSlash_ref.mscx b/mtest/musicxml/io/testMeasureStyleSlash_ref.mscx index 4d9a2e8a66483..b436f2c618cab 100644 --- a/mtest/musicxml/io/testMeasureStyleSlash_ref.mscx +++ b/mtest/musicxml/io/testMeasureStyleSlash_ref.mscx @@ -120,7 +120,7 @@ - 3.5 + 10 diff --git a/mtest/musicxml/io/testNegativeOffset_ref.mscx b/mtest/musicxml/io/testNegativeOffset_ref.mscx index 44a6438951710..6a9330fbb9889 100644 --- a/mtest/musicxml/io/testNegativeOffset_ref.mscx +++ b/mtest/musicxml/io/testNegativeOffset_ref.mscx @@ -125,7 +125,7 @@ - 12.5 + 10 diff --git a/mtest/musicxml/io/testPartNames_ref.mscx b/mtest/musicxml/io/testPartNames_ref.mscx index 5a93699359435..b7ef596390c7b 100644 --- a/mtest/musicxml/io/testPartNames_ref.mscx +++ b/mtest/musicxml/io/testPartNames_ref.mscx @@ -249,7 +249,7 @@ - 12.5 + 10 diff --git a/mtest/musicxml/io/testPedalChangesBroken_ref.mscx b/mtest/musicxml/io/testPedalChangesBroken_ref.mscx index 2745056e4e8f7..a72ec37b42435 100644 --- a/mtest/musicxml/io/testPedalChangesBroken_ref.mscx +++ b/mtest/musicxml/io/testPedalChangesBroken_ref.mscx @@ -117,7 +117,7 @@ - 12.5 + 10 diff --git a/mtest/musicxml/io/testPlacementDefaults_ref.mscx b/mtest/musicxml/io/testPlacementDefaults_ref.mscx index ea38f906e0a02..cbccb095fd9a0 100644 --- a/mtest/musicxml/io/testPlacementDefaults_ref.mscx +++ b/mtest/musicxml/io/testPlacementDefaults_ref.mscx @@ -184,7 +184,7 @@ - 12.5 + 10 diff --git a/mtest/musicxml/io/testSecondVoiceMelismata_ref.mscx b/mtest/musicxml/io/testSecondVoiceMelismata_ref.mscx index 6eb072ca33f04..475c2795d1eb6 100644 --- a/mtest/musicxml/io/testSecondVoiceMelismata_ref.mscx +++ b/mtest/musicxml/io/testSecondVoiceMelismata_ref.mscx @@ -117,7 +117,7 @@ - 12.5 + 10 diff --git a/mtest/musicxml/io/testStaffEmptiness_ref.mscx b/mtest/musicxml/io/testStaffEmptiness_ref.mscx index ee6c0716fc39b..5be357aa849e6 100644 --- a/mtest/musicxml/io/testStaffEmptiness_ref.mscx +++ b/mtest/musicxml/io/testStaffEmptiness_ref.mscx @@ -125,7 +125,7 @@ - 12.5 + 10 diff --git a/mtest/musicxml/io/testTempoTextSpace1_ref.mscx b/mtest/musicxml/io/testTempoTextSpace1_ref.mscx index c13f5ad1197d1..980aa16dfc3d9 100644 --- a/mtest/musicxml/io/testTempoTextSpace1_ref.mscx +++ b/mtest/musicxml/io/testTempoTextSpace1_ref.mscx @@ -125,7 +125,7 @@ - 12.5 + 10 diff --git a/mtest/musicxml/io/testTempoTextSpace2_ref.mscx b/mtest/musicxml/io/testTempoTextSpace2_ref.mscx index 179a26f6d382e..dbbda7ca4d04f 100644 --- a/mtest/musicxml/io/testTempoTextSpace2_ref.mscx +++ b/mtest/musicxml/io/testTempoTextSpace2_ref.mscx @@ -125,7 +125,7 @@ - 12.5 + 10 diff --git a/mtest/musicxml/io/testTextOrder_ref.mscx b/mtest/musicxml/io/testTextOrder_ref.mscx index 5388a64fe6917..85c39ff00a19a 100644 --- a/mtest/musicxml/io/testTextOrder_ref.mscx +++ b/mtest/musicxml/io/testTextOrder_ref.mscx @@ -117,7 +117,7 @@ - 12.5 + 10 diff --git a/mtest/musicxml/io/testTextQuirkInference_ref.mscx b/mtest/musicxml/io/testTextQuirkInference_ref.mscx index 049f6c248863b..9d21031b017d8 100644 --- a/mtest/musicxml/io/testTextQuirkInference_ref.mscx +++ b/mtest/musicxml/io/testTextQuirkInference_ref.mscx @@ -117,7 +117,7 @@ - 12.5 + 10 diff --git a/mtest/musicxml/io/testTitleSwapMu_ref.mscx b/mtest/musicxml/io/testTitleSwapMu_ref.mscx index 96f6d10edc6a1..d1e731afc9260 100644 --- a/mtest/musicxml/io/testTitleSwapMu_ref.mscx +++ b/mtest/musicxml/io/testTitleSwapMu_ref.mscx @@ -353,7 +353,7 @@ - 3.5 + 10 @@ -380,7 +380,7 @@ - 19.5 + 10 2 diff --git a/mtest/musicxml/io/testTitleSwapSib_ref.mscx b/mtest/musicxml/io/testTitleSwapSib_ref.mscx index b56fd6b1417d8..113866025f0e8 100644 --- a/mtest/musicxml/io/testTitleSwapSib_ref.mscx +++ b/mtest/musicxml/io/testTitleSwapSib_ref.mscx @@ -353,7 +353,7 @@ - 19.5 + 10 left,top @@ -381,7 +381,7 @@ - 3.5 + 10 center,top diff --git a/mtest/musicxml/io/testUnterminatedTies_ref.mscx b/mtest/musicxml/io/testUnterminatedTies_ref.mscx index a249ecb205bab..baccb7515b5df 100644 --- a/mtest/musicxml/io/testUnterminatedTies_ref.mscx +++ b/mtest/musicxml/io/testUnterminatedTies_ref.mscx @@ -117,7 +117,7 @@ - 12.5 + 10 diff --git a/mtest/musicxml/io/testVoltaHiding_ref.mscx b/mtest/musicxml/io/testVoltaHiding_ref.mscx index 6f3f91a0c6822..51b36ca54ec2f 100644 --- a/mtest/musicxml/io/testVoltaHiding_ref.mscx +++ b/mtest/musicxml/io/testVoltaHiding_ref.mscx @@ -189,7 +189,7 @@ - 12.5 + 10 diff --git a/mtest/musicxml/io/testWedgeOffset_ref.mscx b/mtest/musicxml/io/testWedgeOffset_ref.mscx index f4f04cfcc151d..3e3654cd10abb 100644 --- a/mtest/musicxml/io/testWedgeOffset_ref.mscx +++ b/mtest/musicxml/io/testWedgeOffset_ref.mscx @@ -117,7 +117,7 @@ - 12.5 + 10 diff --git a/mtest/musicxml/io/tst_mxml_io.cpp b/mtest/musicxml/io/tst_mxml_io.cpp index 4e38bbfc4f545..0d2f3f242290b 100644 --- a/mtest/musicxml/io/tst_mxml_io.cpp +++ b/mtest/musicxml/io/tst_mxml_io.cpp @@ -171,7 +171,7 @@ private slots: void inferredDynamicsExpressiont() { mxmlImportTestRef("testInferredDynamicsExpression"); } void inferreFractions() { mxmlImportTestRef("testInferFraction"); } void inferredFingerings() { mxmlImportTestRef("testInferredFingerings"); } - void inferredRights() { mxmlImportTestRef("testInferredFingerings"); } + void inferredRights() { mxmlImportTestRef("testInferredRights"); } void inferredTempoText() { mxmlImportTestRef("testInferredTempoText"); } void inferredTempoText2() { mxmlImportTestRef("testInferredTempoText2"); } void inferredTransposition() { mxmlImportTestRef("testInferredRights"); }