Skip to content

Commit

Permalink
Merge pull request #1498 from MarcSabatella/40356-lower-case-minor
Browse files Browse the repository at this point in the history
fix #40356: lower case minor chord issues
  • Loading branch information
lasconic committed Dec 2, 2014
2 parents f374e06 + 046f665 commit 408c73d
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions libmscore/harmony.cpp
Expand Up @@ -44,8 +44,10 @@ QString Harmony::harmonyName()
if (_rootTpc != Tpc::TPC_INVALID)
r = tpc2name(_rootTpc, _rootSpelling, _rootLowerCase);

if (_textName != "")
e = _textName.remove('=');
if (_textName != "") {
e = _textName;
e.remove('=');
}
else if (!_degreeList.isEmpty()) {
hc.add(_degreeList);
// try to find the chord in chordList
Expand Down Expand Up @@ -204,8 +206,9 @@ void Harmony::write(Xml& xml) const
if (_id > 0)
xml.tag("extension", _id);
// parser uses leading "=" as a hidden specifier for minor
// this may or may not currently be incorporated into _textName
QString writeName = _textName;
if (_parsedForm && _parsedForm->name().startsWith("="))
if (_parsedForm && _parsedForm->name().startsWith("=") && !writeName.startsWith("="))
writeName = "=" + writeName;
if (writeName != "")
xml.tag("name", writeName);
Expand Down Expand Up @@ -598,17 +601,24 @@ const ChordDescription* Harmony::parseHarmony(const QString& ss, int* root, int*
else {
_parsedForm = new ParsedChord();
_parsedForm->parse(s, cl, syntaxOnly, preferMinor);
// parser prepends "=" to name of implied minor chords
// use this here as well
if (preferMinor)
s = _parsedForm->name();
// look up to see if we already have a descriptor (chord has been used before)
cd = descr(s, _parsedForm);
}
if (cd) {
// descriptor found; use its information
_id = cd->id;
if (!cd->names.isEmpty())
_textName = cd->names.front();
}
else
else {
// no descriptor yet; just set textname
// we will generate descriptor later if necessary (when we are done editing this chord)
_textName = s;
}
return cd;
}

Expand Down Expand Up @@ -698,6 +708,8 @@ void Harmony::setHarmony(const QString& s)
int r, b;
const ChordDescription* cd = parseHarmony(s, &r, &b);
if (!cd && _parsedForm && _parsedForm->parseable()) {
// our first time encountering this chord
// generate a descriptor and use it
cd = generateDescription();
_id = cd->id;
}
Expand Down

0 comments on commit 408c73d

Please sign in to comment.