Corrected both reading and writing.

A slur is not equivalent to most of the other spanner elements since it
is related to specific voices, not once but twice.
This commit is contained in:
Mark Stanton 2014-01-21 21:30:59 +00:00
parent 129e12271b
commit aa2e677bc6
2 changed files with 14 additions and 2 deletions

View file

@ -662,7 +662,7 @@ void Element::writeProperties(Xml& xml) const
else
xml.tag("pos", pos() / spatium());
}
if ((track() != xml.curTrack) && (track() != -1)) {
if (((track() != xml.curTrack) || (type() == SLUR)) && (track() != -1)) {
int t;
t = track() + xml.trackDiff;
xml.tag("track", t);

View file

@ -1953,12 +1953,24 @@ void Measure::read(XmlReader& e, int staffIdx)
}
e.readNext();
}
else if (tag == "Slur") {
Slur *sl = new Slur(score());
sl->setTick(e.tick());
sl->read(e);
score()->addSpanner(sl);
//
// check if we already saw "endSpanner"
//
const SpannerValues* sv = e.spannerValues(sl->id());
if (sv) {
sl->setTick2(sv->tick2);
}
}
else if (tag == "HairPin"
|| tag == "Pedal"
|| tag == "Ottava"
|| tag == "Trill"
|| tag == "TextLine"
|| tag == "Slur"
|| tag == "Volta") {
Spanner* sp = static_cast<Spanner*>(Element::name2Element(tag, score()));
sp->setTrack(e.track());