From ef77e661fb2f6d35225334df10a04b26427a9e47 Mon Sep 17 00:00:00 2001 From: James Mizen Date: Sun, 18 Aug 2024 13:05:20 +0200 Subject: [PATCH] Infer sticking from lyrics Backport of #24065 --- importexport/musicxml/importmxmlpass2.cpp | 15 +- mtest/musicxml/io/testStickingLyrics.xml | Bin 0 -> 13848 bytes mtest/musicxml/io/testStickingLyrics_ref.mscx | 232 ++++++++++++++++++ mtest/musicxml/io/testSticking_ref.mscx | 6 - 4 files changed, 234 insertions(+), 19 deletions(-) create mode 100644 mtest/musicxml/io/testStickingLyrics.xml create mode 100644 mtest/musicxml/io/testStickingLyrics_ref.mscx diff --git a/importexport/musicxml/importmxmlpass2.cpp b/importexport/musicxml/importmxmlpass2.cpp index 90853ee9c5597..dfd197b7213e8 100644 --- a/importexport/musicxml/importmxmlpass2.cpp +++ b/importexport/musicxml/importmxmlpass2.cpp @@ -3331,10 +3331,9 @@ void MusicXMLParserDirection::direction(const QString& partId, else if (isLikelySticking() && isPercussionStaff) { Sticking* sticking = new Sticking(_score); sticking->setXmlText(_wordsText); - if (!qFuzzyIsNull(_relativeX) || !qFuzzyIsNull(_relativeY)) { + if (!qFuzzyIsNull(_relativeX)) { QPointF offset = sticking->offset(); - offset.setX(!qFuzzyIsNull(_relativeX) ? _relativeX : sticking->offset().x()); - offset.setY(!qFuzzyIsNull(_relativeY) ? _relativeY : sticking->offset().y()); + offset.setX(_relativeX); sticking->setOffset(offset); sticking->setPropertyFlags(Pid::OFFSET, PropertyFlags::UNSTYLED); } @@ -3609,24 +3608,14 @@ void MusicXMLParserDirection::directionType(QList& starts, // Prevent multi-word directions from overwriting y-values. bool hasDefaultXCandidate = false; bool hasRelativeXCandidate = false; - bool hasDefaultYCandidate = false; - bool hasRelativeYCandidate = false; qreal defaultXCandidate = _e.attributes().value("default-x").toDouble(&hasDefaultXCandidate) * -0.1; - qreal defaultYCandidate = _e.attributes().value("default-y").toDouble(&hasDefaultYCandidate) * -0.1; qreal relativeXCandidate =_e.attributes().value("relative-x").toDouble(&hasRelativeXCandidate) * -0.1; - qreal relativeYCandidate =_e.attributes().value("relative-y").toDouble(&hasRelativeYCandidate) * -0.1; if (hasDefaultXCandidate && !_hasDefaultX) _defaultY = defaultXCandidate; if (hasRelativeXCandidate && !_hasRelativeX) _relativeX = relativeXCandidate; _hasDefaultX |= hasDefaultXCandidate; _hasRelativeX |= hasRelativeXCandidate; - if (hasDefaultYCandidate && !_hasDefaultY) - _defaultY = defaultYCandidate; - if (hasRelativeYCandidate && !_hasRelativeY) - _relativeY = relativeYCandidate; - _hasDefaultY |= hasDefaultYCandidate; - _hasRelativeY |= hasRelativeYCandidate; _isBold &= _e.attributes().value("font-weight").toString() == "bold"; _visible = _e.attributes().value("print-object").toString() != "no"; QString number = _e.attributes().value("number").toString(); diff --git a/mtest/musicxml/io/testStickingLyrics.xml b/mtest/musicxml/io/testStickingLyrics.xml new file mode 100644 index 0000000000000000000000000000000000000000..b07b480c6918b690901e2639b186e971332a67ec GIT binary patch literal 13848 zcmeI3+iqJ$6o%)vNW6o&$_+bh(xj!xan&|KfLf>sl|YD##Lh|Bu4Ow7;o*V*o8`&O z?1SxAE+my@wRUILtXb#N-u>tAwtMRSbOYCSE%(lyxUrkK3-{Iy-JaWUTW-@m(05Ba zL)X=MPrE~R=6Bz?pWQdE5Y!_NGjUUQq}`tW?t2_39&V`L8@i|CK6jtFw)?{EyC2;P zo&MFmb_c>f@wmsjrEnvi9t+czZklMNC73tvxqIop)0vhq74E)1KWPt&#{NFevbry< z`+|DqE-@TsKce!`B|$m8iJVxxo!Klhvlb_e?N7 zLHBgi{R-Wiv%QTQzUOmUmA+9N&fk;dE`$?JO!ezjf4bs@-{{Mvd(Qz^)>hnOcOv*x zoxAdqIMK;N;W*Z*zP^!L%WX^V+wP%w-_oZo{;H?YCim6j+}ACA;hYNFSHkm9-=|(~ zt;&6i@s~L&BnfzjdZTqmcJV+rnLUDW-kF^COKET9X`6cPk;I9#ZnDM`jwI`@q!Z+i zh2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Ti1V~OI+tUs}X{Y*H>&E-^nfR>+Wvl z_xw)ehxMf6_T-0k<(EDkxV=5yU72<~TWMDpCW}nA<4km&?Uu`S@8jF+oM$olV@(0q zesOzp-lyCXt$IR`zv;+ZA4K0cDdxFAeDYkL`}3rQCl>aci|IZy_xS!{;oo<%w + + + + 0 + 480 + + 1 + 1 + 1 + 0 + + + + + + + + + + + + + + + stdNormal + + 3 + + Snare Drum + + Snare Drum + S. D. + Marching Snare Drums [5 lines] + + 100 + 100 + + + 100 + 33 + + + 100 + 50 + + + 100 + 67 + + + 100 + 100 + + + 120 + 67 + + + 150 + 100 + + + 150 + 50 + + + 120 + 50 + + + 120 + 100 + + + + + + + + + + 10 + + + + + PERC + PERC + + + 4 + 4 + + + Rlr + + + down + 19 + 17 + + + begin + eighth + + articAccentAbove + + + 38 + 16 + + + + R + + + mid + eighth + + 38 + 16 + + + + l + + + mid + eighth + + articAccentAbove + + + 48 + 14 + + + + r + + + eighth + + 48 + 14 + + + + B + + + down + 38 + 42 + + + begin + eighth + + 38 + 16 + + + + lr + + + mid + eighth + + articAccentAbove + + + 38 + 16 + + + + B + + + mid + eighth + + 43 + 15 + + + + l + + + eighth + + 43 + 15 + + + + end + + + + + + diff --git a/mtest/musicxml/io/testSticking_ref.mscx b/mtest/musicxml/io/testSticking_ref.mscx index a8a2e1e6dddfd..882de6231d20f 100644 --- a/mtest/musicxml/io/testSticking_ref.mscx +++ b/mtest/musicxml/io/testSticking_ref.mscx @@ -423,7 +423,6 @@ - L @@ -506,7 +505,6 @@ - L @@ -562,19 +560,15 @@ - l - r - l - r