This commit is contained in:
ws 2014-08-24 13:10:51 +02:00
parent 02353b5bfa
commit 9b27beff0c
2 changed files with 16 additions and 7 deletions

View file

@ -2070,13 +2070,20 @@ void Measure::read(XmlReader& e, int staffIdx)
KeySig* ks = new KeySig(score());
ks->setTrack(e.track());
ks->read(e);
// if key sig not at beginning of measure => courtesy key sig
int currTick = e.tick();
bool courtesySig = (currTick > tick());
segment = getSegment(courtesySig ? Segment::Type::KeySigAnnounce : Segment::Type::KeySig, currTick);
segment->add(ks);
if (!courtesySig)
staff->setKey(currTick, ks->key());
int curTick = e.tick();
if (ks->key() == Key::C && curTick == 0) {
// ignore empty key signature
qDebug("remove keysig c at tick 0");
delete ks;
}
else {
// if key sig not at beginning of measure => courtesy key sig
bool courtesySig = (curTick > tick());
segment = getSegment(courtesySig ? Segment::Type::KeySigAnnounce : Segment::Type::KeySig, curTick);
segment->add(ks);
if (!courtesySig)
staff->setKey(curTick, ks->key());
}
}
else if (tag == "Lyrics") { // obsolete, keep for compatibility with version 114
Element* element = Element::name2Element(tag, score());

View file

@ -565,6 +565,8 @@ Score::FileError Score::read114(XmlReader& e)
qDebug("read114: Key tick %d", tick);
continue;
}
if (tick == 0 && i->second == Key::C)
continue;
Measure* m = tick2measure(tick);
if (!m) //empty score
break;