diff --git a/importexport/musicxml/exportxml.cpp b/importexport/musicxml/exportxml.cpp index 75d8ca18165ab..27914f218bf92 100644 --- a/importexport/musicxml/exportxml.cpp +++ b/importexport/musicxml/exportxml.cpp @@ -4450,6 +4450,8 @@ static void wordsMetronome(XmlWriter& xml, Score* s, TextBase const* const text, QString tagName = QString("metronome parentheses=\"%1\"").arg(hasParen ? "yes" : "no"); tagName += color2xml(text); tagName += positioningAttributes(text); + if (!text->visible()) + tagName += " print-object=\"no\""; xml.stag(tagName); int len1 = 0; TDuration dur; diff --git a/importexport/musicxml/importmxmlpass2.cpp b/importexport/musicxml/importmxmlpass2.cpp index 7864a6c3e0e5d..4716756389dca 100644 --- a/importexport/musicxml/importmxmlpass2.cpp +++ b/importexport/musicxml/importmxmlpass2.cpp @@ -3257,6 +3257,7 @@ void MusicXMLParserDirection::direction(const QString& partId, if (tt->plainText().contains('=')) tt->setFollowText(true); } + tt->setVisible(_visible); addElemOffset(tt, track, placement(), measure, tick + _offset); } @@ -3325,6 +3326,8 @@ void MusicXMLParserDirection::direction(const QString& partId, t->setPropertyFlags(Pid::COLOR, PropertyFlags::UNSTYLED); } + t->setVisible(_visible); + QString wordsPlacement = placement(); // Case-based defaults if (wordsPlacement.isEmpty()) { @@ -3382,9 +3385,11 @@ void MusicXMLParserDirection::direction(const QString& partId, dynaValue = 127; else if (dynaValue < 0) dynaValue = 0; - dyn->setVelocity( dynaValue ); + dyn->setVelocity(dynaValue); } + dyn->setVisible(_visible); + QString dynamicsPlacement = placement(); // Case-based defaults if (dynamicsPlacement.isEmpty()) @@ -3473,6 +3478,7 @@ void MusicXMLParserDirection::direction(const QString& partId, else spannerPlacement = totalY() < 0 ? "above" : "below"; } + desc._sp->setVisible(_visible); if (spdesc._isStopped) { _pass2.addSpanner(desc); // handleSpannerStart and handleSpannerStop must be called in order @@ -3514,6 +3520,7 @@ void MusicXMLParserDirection::directionType(QList& starts, _hasDefaultY |= hasDefaultYCandidate; _hasRelativeY |= hasRelativeYCandidate; _isBold &= _e.attributes().value("font-weight").toString() == "bold"; + _visible = _e.attributes().value("print-object") != "no"; QString number = _e.attributes().value("number").toString(); int n = 0; if (!number.isEmpty()) { @@ -4202,6 +4209,7 @@ void MusicXMLParserDirection::handleRepeats(Measure* measure, const int track, c measure = measure->prevMeasure(); else if (tb->tid() == Tid::REPEAT_LEFT && !closerToLeft && measure->nextMeasure()) measure = measure->nextMeasure(); + tb->setVisible(_visible); measure->add(tb); } } diff --git a/importexport/musicxml/importmxmlpass2.h b/importexport/musicxml/importmxmlpass2.h index 6f7131b73af67..44604704b506e 100644 --- a/importexport/musicxml/importmxmlpass2.h +++ b/importexport/musicxml/importmxmlpass2.h @@ -421,6 +421,7 @@ class MusicXMLParserDirection { bool _isBold; double _tpoMetro; // tempo according to metronome double _tpoSound; // tempo according to sound + bool _visible = true; QList _elems; Fraction _offset; diff --git a/mtest/musicxml/io/testInvisibleDirection.xml b/mtest/musicxml/io/testInvisibleDirection.xml new file mode 100644 index 0000000000000..8bd311bd05599 --- /dev/null +++ b/mtest/musicxml/io/testInvisibleDirection.xml @@ -0,0 +1,84 @@ + + + + + Untitled score + + + Composer / arranger + + MuseScore 0.7.0 + 2007-09-10 + + + + + + + + + + Flute + Fl. + + Flute + + + + 1 + 74 + 78.7402 + 0 + + + + + + + 1 + + 0 + + + + G + 2 + + + + + + quarter + 64 + + + + + + + 4 + 1 + + + + + + 4 + 1 + + + + + + 4 + 1 + + + light-heavy + + + + diff --git a/mtest/musicxml/io/tst_mxml_io.cpp b/mtest/musicxml/io/tst_mxml_io.cpp index 5f922deb3b247..a7da7f5e440cd 100644 --- a/mtest/musicxml/io/tst_mxml_io.cpp +++ b/mtest/musicxml/io/tst_mxml_io.cpp @@ -169,6 +169,7 @@ private slots: void instrumentSound() { mxmlIoTestRef("testInstrumentSound"); } void invalidLayout() { mxmlMscxExportTestRef("testInvalidLayout"); } void invalidTimesig() { mxmlIoTestRef("testInvalidTimesig"); } + void invisibleDirection() { mxmlIoTest("testInvisibleDirection"); } void invisibleElements() { mxmlIoTest("testInvisibleElements"); } void keysig1() { mxmlIoTest("testKeysig1"); } void keysig2() { mxmlIoTest("testKeysig2"); }