fix #88376 - MusicXML export does not export clefs after removing first measures

This commit is contained in:
Leon Vinken 2016-01-24 15:57:45 +01:00
parent 6b3a85e3c1
commit e5978529ca
4 changed files with 95 additions and 1 deletions

View file

@ -4715,9 +4715,11 @@ void ExportMusicXml::write(QIODevice* dev)
{
// make sure clefs at end of measure get exported at start of next measure
Measure* prevMeasure = m->prevMeasure();
Measure* mmR = m->mmRest(); // the replacing measure in a multi-measure rest
int tick = m->tick();
Segment* cs1;
Segment* cs2 = m->findSegment(Segment::Type::Clef, tick);
Segment* cs3;
Segment* seg = 0;
if (prevMeasure)
@ -4725,6 +4727,11 @@ void ExportMusicXml::write(QIODevice* dev)
else
cs1 = 0;
if (mmR)
cs3 = mmR->findSegment(Segment::Type::Clef, tick);
else
cs3 = 0;
if (cs1 && cs2) {
// should only happen at begin of new system
// when previous system ends with a non-generated clef
@ -4732,9 +4739,14 @@ void ExportMusicXml::write(QIODevice* dev)
}
else if (cs1)
seg = cs1;
else if (cs3) {
// happens when the first measure is a multi-measure rest
// containing a generated clef
seg = cs3;
}
else
seg = cs2;
clefDebug("exportxml: clef segments cs1=%p cs2=%p seg=%p", cs1, cs2, seg);
clefDebug("exportxml: clef segments cs1=%p cs2=%p cs3=%p seg=%p", cs1, cs2, cs3, seg);
// output attribute at start of measure: clef
if (seg) {

Binary file not shown.

View file

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 3.0 Partwise//EN" "http://www.musicxml.org/dtds/partwise.dtd">
<score-partwise>
<work>
<work-number>MuseScore testfile</work-number>
<work-title>Multi-Measure Rests 2</work-title>
</work>
<identification>
<creator type="composer">Leon Vinken</creator>
<encoding>
<software>MuseScore 0.7.0</software>
<encoding-date>2007-09-10</encoding-date>
<supports element="accidental" type="yes"/>
<supports element="beam" type="yes"/>
<supports element="print" attribute="new-page" type="no"/>
<supports element="print" attribute="new-system" type="no"/>
<supports element="stem" type="yes"/>
</encoding>
<miscellaneous>
<miscellaneous-field name="description">
Test multi-measure rest handling. When exporting to MusicXML, the global
"create multi-measure rest" flag must be set.
As this file does not contain a clef, MuseScore will add a default one,
which should be exported.
</miscellaneous-field>
</miscellaneous>
</identification>
<part-list>
<score-part id="P1">
<part-name>Piano</part-name>
<part-abbreviation>Pno.</part-abbreviation>
<score-instrument id="P1-I1">
<instrument-name>Piano</instrument-name>
</score-instrument>
<midi-device id="P1-I1" port="1"></midi-device>
<midi-instrument id="P1-I1">
<midi-channel>1</midi-channel>
<midi-program>1</midi-program>
<volume>78.7402</volume>
<pan>0</pan>
</midi-instrument>
</score-part>
</part-list>
<part id="P1">
<measure number="1">
<barline location="left">
<bar-style>heavy-light</bar-style>
<repeat direction="forward"/>
</barline>
<attributes>
<divisions>1</divisions>
<key>
<fifths>1</fifths>
</key>
<time>
<beats>3</beats>
<beat-type>4</beat-type>
</time>
<measure-style>
<multiple-rest>2</multiple-rest>
</measure-style>
</attributes>
<note>
<rest/>
<duration>3</duration>
<voice>1</voice>
</note>
</measure>
<measure number="2">
<note>
<rest/>
<duration>3</duration>
<voice>1</voice>
</note>
<barline location="right">
<bar-style>light-heavy</bar-style>
<repeat direction="backward"/>
</barline>
</measure>
</part>
</score-partwise>

View file

@ -109,6 +109,7 @@ private slots:
void multiInstrumentPart1() { mxmlIoTest("testMultiInstrumentPart1"); }
//void multiInstrumentPart2() { mxmlIoTest("testMultiInstrumentPart2"); } must also fix exportxml.cpp
void multiMeasureRest1() { mxmlIoTestRef("testMultiMeasureRest1"); }
//void multiMeasureRest2() { mxmlIoTestRef("testMultiMeasureRest2"); } end repeat missing
void multiMeasureRest3() { mxmlIoTestRef("testMultiMeasureRest3"); }
void multipleNotations() { mxmlIoTestRef("testMultipleNotations"); }
void nonStandardKeySig1() { mxmlIoTest("testNonStandardKeySig1"); }