Skip to content

Commit

Permalink
fix #32026 and #32691
Browse files Browse the repository at this point in the history
  • Loading branch information
lvinken committed Sep 9, 2014
1 parent 1033088 commit aafac2e
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 17 deletions.
50 changes: 33 additions & 17 deletions mscore/importxml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,36 @@ void MusicXml::import(Score* s)
{
tupletAssert();
score = s;

// TODO only if multi-measure rests used ???
// score->style()->set(StyleIdx::createMultiMeasureRests, true);

for (QDomElement e = doc->documentElement(); !e.isNull(); e = e.nextSiblingElement()) {
if (e.tagName() == "score-partwise")
scorePartwise(e.firstChildElement());
else
domError(e);
}
}

//---------------------------------------------------------
// initPartState
//---------------------------------------------------------

/**
Initialize members as required for reading the MusicXML part element.
TODO: factor out part reading into a separate
*/

void MusicXml::initPartState()
{
fractionTSig = Fraction(0, 1);
tick = 0;
maxtick = 0;
prevtick = 0;
lastMeasureLen = 0;
multiMeasureRestCount = -1;
startMultiMeasureRest = false;
tie = 0;
for (int i = 0; i < MAX_NUMBER_LEVEL; ++i)
slur[i] = 0;
Expand All @@ -739,16 +769,6 @@ void MusicXml::import(Score* s)
hairpin = 0;
figBass = 0;
figBassExtend = false;

// TODO only if multi-measure rests used ???
// score->style()->set(StyleIdx::createMultiMeasureRests, true);

for (QDomElement e = doc->documentElement(); !e.isNull(); e = e.nextSiblingElement()) {
if (e.tagName() == "score-partwise")
scorePartwise(e.firstChildElement());
else
domError(e);
}
}

//---------------------------------------------------------
Expand Down Expand Up @@ -1714,13 +1734,9 @@ void MusicXml::xmlPart(QDomElement e, QString id)
qDebug("Import MusicXml:xmlPart: cannot find part %s", id.toLatin1().data());
return;
}
fractionTSig = Fraction(0, 1);
tick = 0;
maxtick = 0;
prevtick = 0;
lastMeasureLen = 0;
multiMeasureRestCount = -1;
startMultiMeasureRest = false;

initPartState();

KeySigEvent ev;
KeySig currKeySig;
currKeySig.setKeySigEvent(ev);
Expand Down
1 change: 1 addition & 0 deletions mscore/musicxml.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ class MusicXml {
void readPageFormat(PageFormat* pf, QDomElement de, qreal conversion);
QList<QDomElement> findSlurElements(QDomElement);
void addGraceNoteAfter(Chord*, Segment*);
void initPartState();
public:
MusicXml(QDomDocument* d, MxmlReaderFirstPass const& p1);
void import(Score*);
Expand Down

0 comments on commit aafac2e

Please sign in to comment.