diff --git a/importexport/musicxml/importmxmlpass2.cpp b/importexport/musicxml/importmxmlpass2.cpp index 22689ea638b8f..a6ee578a95e82 100644 --- a/importexport/musicxml/importmxmlpass2.cpp +++ b/importexport/musicxml/importmxmlpass2.cpp @@ -2716,7 +2716,7 @@ void MusicXMLParserDirection::direction(const QString& partId, else { // Add element to score later, after collecting all the others and sorting by default-y // This allows default-y to be at least respected by the order of elements - MusicXMLDelayedDirectionElement* delayedDirection = new MusicXMLDelayedDirectionElement(hasTotalY() ? totalY() : 100, t, track, wordsPlacement, measure, tick + _offset); + MusicXMLDelayedDirectionElement* delayedDirection = new MusicXMLDelayedDirectionElement(totalY(), t, track, wordsPlacement, measure, tick + _offset); delayedDirections.push_back(delayedDirection); } } @@ -2763,7 +2763,7 @@ void MusicXMLParserDirection::direction(const QString& partId, // Add element to score later, after collecting all the others and sorting by default-y // This allows default-y to be at least respected by the order of elements - MusicXMLDelayedDirectionElement* delayedDirection = new MusicXMLDelayedDirectionElement(hasTotalY() ? totalY() : 100, dyn, track, dynamicsPlacement, measure, tick + _offset); + MusicXMLDelayedDirectionElement* delayedDirection = new MusicXMLDelayedDirectionElement(totalY(), dyn, track, dynamicsPlacement, measure, tick + _offset); delayedDirections.push_back(delayedDirection); } @@ -2771,7 +2771,7 @@ void MusicXMLParserDirection::direction(const QString& partId, foreach( auto elem, _elems) { // Add element to score later, after collecting all the others and sorting by default-y // This allows default-y to be at least respected by the order of elements - MusicXMLDelayedDirectionElement* delayedDirection = new MusicXMLDelayedDirectionElement(hasTotalY() ? totalY() : 100, elem, track, placement(), measure, tick + _offset); + MusicXMLDelayedDirectionElement* delayedDirection = new MusicXMLDelayedDirectionElement(totalY(), elem, track, placement(), measure, tick + _offset); delayedDirections.push_back(delayedDirection); } @@ -2838,8 +2838,17 @@ void MusicXMLParserDirection::directionType(QList& starts, Q_ASSERT(_e.isStartElement() && _e.name() == "direction-type"); while (_e.readNextStartElement()) { - _defaultY = _e.attributes().value("default-y").toDouble(&_hasDefaultY) * -0.1; - _relativeY = _e.attributes().value("relative-y").toDouble(&_hasRelativeY) * -0.1; + // Prevent multi-word directions from overwriting y-values. + bool hasDefaultYCandidate = false; + bool hasRelativeYCandidate = false; + qreal defaultYCandidate = _e.attributes().value("default-y").toDouble(&hasDefaultYCandidate) * -0.1; + qreal relativeYCandidate =_e.attributes().value("relative-y").toDouble(&hasRelativeYCandidate) * -0.1; + if (hasDefaultYCandidate && !_hasDefaultY) + _defaultY = defaultYCandidate; + if (hasRelativeYCandidate && !_hasRelativeY) + _relativeY = relativeYCandidate; + _hasDefaultY |= hasDefaultYCandidate; + _hasRelativeY |= hasRelativeYCandidate; QString number = _e.attributes().value("number").toString(); int n = 0; if (number != "") { @@ -5430,18 +5439,15 @@ FiguredBass* MusicXMLParserPass2::figuredBass() which affects both single strings and barres */ -FretDiagram* MusicXMLParserPass2::frame(qreal& defaultY, qreal& relativeY, bool& hasTotalY) +FretDiagram* MusicXMLParserPass2::frame(qreal& defaultY, qreal& relativeY) { Q_ASSERT(_e.isStartElement() && _e.name() == "frame"); FretDiagram* fd = new FretDiagram(_score); int fretOffset = 0; - bool tempHasY = false; - defaultY += _e.attributes().value("default-y").toDouble(&tempHasY) * -0.1; - hasTotalY |= tempHasY; - relativeY += _e.attributes().value("relative-y").toDouble(&tempHasY) * -0.1; - hasTotalY |= tempHasY; + defaultY += _e.attributes().value("default-y").toDouble() * -0.1; + relativeY += _e.attributes().value("relative-y").toDouble() * -0.1; // Format: fret: string std::map bStarts; @@ -5714,7 +5720,7 @@ void MusicXMLParserPass2::harmony(const QString& partId, Measure* measure, const } } else if (_e.name() == "frame") - fd = frame(defaultY, relativeY, hasTotalY); + fd = frame(defaultY, relativeY); else if (_e.name() == "level") skipLogCurrElem(); else if (_e.name() == "offset") { @@ -5771,7 +5777,7 @@ void MusicXMLParserPass2::harmony(const QString& partId, Measure* measure, const } // Add element to score later, after collecting all the others and sorting by default-y // This allows default-y to be at least respected by the order of elements - MusicXMLDelayedDirectionElement* delayedDirection = new MusicXMLDelayedDirectionElement(hasTotalY ? totalY : 100, se, track, placement, measure, sTime + offset); + MusicXMLDelayedDirectionElement* delayedDirection = new MusicXMLDelayedDirectionElement(totalY, se, track, placement, measure, sTime + offset); delayedDirections.push_back(delayedDirection); } diff --git a/importexport/musicxml/importmxmlpass2.h b/importexport/musicxml/importmxmlpass2.h index ad0c6c968cade..cf45cd962db3a 100644 --- a/importexport/musicxml/importmxmlpass2.h +++ b/importexport/musicxml/importmxmlpass2.h @@ -285,7 +285,7 @@ class MusicXMLParserPass2 { void notePrintSpacingNo(Fraction& dura); FiguredBassItem* figure(const int idx, const bool paren); FiguredBass* figuredBass(); - FretDiagram* frame(qreal& defaultY, qreal& relativeY, bool& hasTotalY); + FretDiagram* frame(qreal& defaultY, qreal& relativeY); void harmony(const QString& partId, Measure* measure, const Fraction sTime, DelayedDirectionsList& delayedDirections); Accidental* accidental(); void beam(QMap& beamTypes); diff --git a/mtest/musicxml/io/testFretDiagramLayoutOrder_ref.mscx b/mtest/musicxml/io/testFretDiagramLayoutOrder_ref.mscx index 53e7c3a0e63cf..19055619f0f91 100644 --- a/mtest/musicxml/io/testFretDiagramLayoutOrder_ref.mscx +++ b/mtest/musicxml/io/testFretDiagramLayoutOrder_ref.mscx @@ -145,11 +145,6 @@ 4 4 - - 4 - 1 - metNoteHalfUp metAugmentationDot = 80 - 2 4 @@ -186,6 +181,11 @@ 2 + + 4 + 1 + metNoteHalfUp metAugmentationDot = 80 + quarter down diff --git a/mtest/musicxml/io/testTextOrder.pdf b/mtest/musicxml/io/testTextOrder.pdf index 2015a9c8e082e..a263ebf246b6c 100644 Binary files a/mtest/musicxml/io/testTextOrder.pdf and b/mtest/musicxml/io/testTextOrder.pdf differ diff --git a/mtest/musicxml/io/testTextOrder.xml b/mtest/musicxml/io/testTextOrder.xml index 58d7ff2def9b0..31bc712a0607d 100644 --- a/mtest/musicxml/io/testTextOrder.xml +++ b/mtest/musicxml/io/testTextOrder.xml @@ -103,7 +103,8 @@ - 3rd time senza Invisalign + 3rd time senza + Invisalign diff --git a/mtest/musicxml/io/testTextOrder_ref.mscx b/mtest/musicxml/io/testTextOrder_ref.mscx index d0e22a4232b03..7462585549388 100644 --- a/mtest/musicxml/io/testTextOrder_ref.mscx +++ b/mtest/musicxml/io/testTextOrder_ref.mscx @@ -149,7 +149,7 @@ 4 - 3rd time senza Invisalign + 3rd time senza Invisalign 2nd time ad lib.