This commit is contained in:
Leon Vinken 2014-09-14 21:13:00 +02:00
parent 8cf7751728
commit 39895c9189
8 changed files with 205 additions and 9 deletions

View file

@ -592,24 +592,30 @@ void SlurHandler::doSlurStop(Chord* chord, Notations& notations, Xml& xml)
// <glissando line-type="wavy" number="1" type="start"/>
// </notations>
static void glissando(Glissando* gli, int number, bool start, Notations& notations, Xml& xml)
static void glissando(const Glissando* gli, int number, bool start, Notations& notations, Xml& xml)
{
Glissando::Type st = gli->glissandoType();
QString tagName;
switch (st) {
case Glissando::Type::STRAIGHT:
notations.tag(xml);
xml.tagE("slide line-type=\"solid\" number=\"%d\" type=\"%s\"",
number, start ? "start" : "stop");
tagName = "slide line-type=\"solid\"";
break;
case Glissando::Type::WAVY:
notations.tag(xml);
xml.tagE("glissando line-type=\"wavy\" number=\"%d\" type=\"%s\"",
number, start ? "start" : "stop");
tagName = "glissando line-type=\"wavy\"";
break;
default:
qDebug("unknown glissando subtype %hhd", st);
return;
break;
}
tagName += QString(" number=\"%1\" type=\"%2\"").arg(number).arg(start ? "start" : "stop");
if (gli->color() != MScore::defaultColor)
tagName += " color=\"" + gli->color().name().toUpper() + "\"";
notations.tag(xml);
if (start && gli->showText() && gli->text() != "")
xml.tag(tagName, gli->text());
else
xml.tagE(tagName);
}
//---------------------------------------------------------

View file

@ -769,6 +769,8 @@ void MusicXml::initPartState()
hairpin = 0;
figBass = 0;
figBassExtend = false;
glissandoText = "";
glissandoColor = "";
}
//---------------------------------------------------------
@ -4412,11 +4414,20 @@ void MusicXml::xmlNotations(Note* note, ChordRest* cr, int trk, int tick, int ti
else if (ee.tagName() == "non-arpeggiate")
arpeggioType = "non-arpeggiate";
// glissando and slide are added to the "stop" chord only
// but text and color are read at start
else if (ee.tagName() == "glissando") {
if (ee.attribute("type") == "stop") glissandoType = "glissando";
if (ee.attribute("type") == "start") {
glissandoText = ee.text();
glissandoColor = ee.attribute("color");
}
else if (ee.attribute("type") == "stop") glissandoType = "glissando";
}
else if (ee.tagName() == "slide") {
if (ee.attribute("type") == "stop") glissandoType = "slide";
if (ee.attribute("type") == "start") {
glissandoText = ee.text();
glissandoColor = ee.attribute("color");
}
else if (ee.attribute("type") == "stop") glissandoType = "slide";
}
else
domError(ee);
@ -4457,6 +4468,21 @@ void MusicXml::xmlNotations(Note* note, ChordRest* cr, int trk, int tick, int ti
delete g;
g = 0;
}
if (g) {
if (glissandoText == "")
g->setShowText(false);
else {
g->setShowText(true);
g->setText(glissandoText);
glissandoText = "";
}
if (glissandoColor != "") {
QColor color(glissandoColor);
if (color.isValid())
g->setColor(color);
glissandoColor = "";
}
}
if ((static_cast<Chord*>(cr))->glissando()) {
// there can be only one
delete g;

View file

@ -189,6 +189,8 @@ class MusicXml {
FiguredBass* figBass; ///< Current figured bass element (to attach to next note)
bool figBassExtend; ///< Current figured bass extend
Beam::Mode beamMode; ///< Current beam mode
QString glissandoText; ///< Glissando text at glissando start
QString glissandoColor; ///< Glissando color at glissando start
int pageWidth; ///< Page width read from defaults
int pageHeight; ///< Page height read from defaults

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,161 @@
<?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>Arpeggio/glissando 3</work-title>
</work>
<identification>
<creator type="composer">Simon Giddings</creator>
<encoding>
<software>MuseScore 0.7.0</software>
<encoding-date>2007-09-10</encoding-date>
</encoding>
</identification>
<part-list>
<score-part id="P1">
<part-name>Voice</part-name>
<score-instrument id="P1-I3">
<instrument-name>Voice</instrument-name>
</score-instrument>
<midi-instrument id="P1-I3">
<midi-channel>1</midi-channel>
<midi-program>53</midi-program>
<volume>78.7402</volume>
<pan>0</pan>
</midi-instrument>
</score-part>
</part-list>
<part id="P1">
<measure number="1">
<attributes>
<divisions>1</divisions>
<key>
<fifths>0</fifths>
<mode>major</mode>
</key>
<time>
<beats>4</beats>
<beat-type>4</beat-type>
</time>
<clef>
<sign>G</sign>
<line>2</line>
</clef>
</attributes>
<note>
<pitch>
<step>D</step>
<octave>5</octave>
</pitch>
<duration>2</duration>
<voice>1</voice>
<type>half</type>
<stem>down</stem>
<notations>
<glissando line-type="wavy" number="1" type="start">gliss.</glissando>
</notations>
</note>
<note>
<pitch>
<step>G</step>
<octave>4</octave>
</pitch>
<duration>2</duration>
<voice>1</voice>
<type>half</type>
<stem>up</stem>
<notations>
<glissando line-type="wavy" number="1" type="stop"/>
</notations>
</note>
</measure>
<measure number="2">
<note>
<pitch>
<step>G</step>
<octave>4</octave>
</pitch>
<duration>2</duration>
<voice>1</voice>
<type>half</type>
<stem>up</stem>
<notations>
<glissando line-type="wavy" number="1" type="start" color="#005500"/>
</notations>
</note>
<note>
<pitch>
<step>F</step>
<octave>5</octave>
</pitch>
<duration>2</duration>
<voice>1</voice>
<type>half</type>
<stem>down</stem>
<notations>
<glissando line-type="wavy" number="1" type="stop" color="#005500"/>
</notations>
</note>
</measure>
<measure number="3">
<note>
<pitch>
<step>F</step>
<octave>5</octave>
</pitch>
<duration>2</duration>
<voice>1</voice>
<type>half</type>
<stem>down</stem>
<notations>
<slide line-type="solid" number="1" type="start">gliss.</slide>
</notations>
</note>
<note>
<pitch>
<step>E</step>
<octave>4</octave>
</pitch>
<duration>2</duration>
<voice>1</voice>
<type>half</type>
<stem>up</stem>
<notations>
<slide line-type="solid" number="1" type="stop"/>
</notations>
</note>
</measure>
<measure number="4">
<note>
<pitch>
<step>C</step>
<octave>4</octave>
</pitch>
<duration>2</duration>
<voice>1</voice>
<type>half</type>
<stem>up</stem>
<notations>
<slide line-type="solid" number="1" type="start" color="#AA0000"/>
</notations>
</note>
<note>
<pitch>
<step>D</step>
<octave>5</octave>
</pitch>
<duration>2</duration>
<voice>1</voice>
<type>half</type>
<stem>down</stem>
<notations>
<slide line-type="solid" number="1" type="stop" color="#AA0000"/>
</notations>
</note>
<barline location="right">
<bar-style>light-heavy</bar-style>
</barline>
</measure>
</part>
</score-partwise>

View file

@ -57,6 +57,7 @@ private slots:
void accidentals3() { mxmlIoTest("testAccidentals3"); }
void arpGliss1() { mxmlIoTest("testArpGliss1"); }
void arpGliss2() { mxmlIoTest("testArpGliss2"); }
void arpGliss3() { mxmlIoTest("testArpGliss3"); }
void barStyles() { mxmlIoTest("testBarStyles"); }
void chordDiagrams1() { mxmlIoTest("testChordDiagrams1"); }
void chordNoVoice() { mxmlIoTestRef("testChordNoVoice"); }