Skip to content

Commit

Permalink
fix #9351: add open key signature
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcSabatella committed Feb 8, 2015
1 parent 39f86a2 commit a123d3c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
16 changes: 13 additions & 3 deletions libmscore/keysig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ const char* keyNames[] = {
QT_TRANSLATE_NOOP("MuseScore", "Bb major, G minor"),
QT_TRANSLATE_NOOP("MuseScore", "C# major, A# minor"),
QT_TRANSLATE_NOOP("MuseScore", "F major, D minor"),
QT_TRANSLATE_NOOP("MuseScore", "C major, A minor")
QT_TRANSLATE_NOOP("MuseScore", "C major, A minor"),
QT_TRANSLATE_NOOP("MuseScore", "Open key signature")
};

//---------------------------------------------------------
Expand Down Expand Up @@ -251,6 +252,11 @@ void KeySig::draw(QPainter* p) const
p->setPen(curColor());
for (const KeySym& ks: _sig.keySymbols())
drawSymbol(ks.sym, p, QPointF(ks.pos.x(), ks.pos.y()));
if (!parent() && isCustom() && _sig.keySymbols().isEmpty()) {
// atonal key signature - draw something for palette
p->setPen(Qt::gray);
drawSymbol(SymId::timeSigX, p, QPointF(symWidth(SymId::timeSigX) * -0.5, 2.0 * spatium()));
}
}

//---------------------------------------------------------
Expand Down Expand Up @@ -545,8 +551,12 @@ Element* KeySig::prevElement()
QString KeySig::accessibleInfo()
{
QString keySigType;
if (isCustom())
return tr("%1: Custom").arg(Element::accessibleInfo());
if (isCustom()) {
if (keySigEvent().keySymbols().isEmpty())
return tr("%1: Open").arg(Element::accessibleInfo());
else
return tr("%1: Custom").arg(Element::accessibleInfo());
}

if (key() == Key::C)
return QString("%1: %2").arg(Element::accessibleInfo()).arg(qApp->translate("MuseScore", keyNames[14]));
Expand Down
2 changes: 1 addition & 1 deletion mscore/file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ void MuseScore::newFile()
// transpose key
//
KeySigEvent nKey = ks;
if (part->instr()->transpose().chromatic && !score->styleB(StyleIdx::concertPitch)) {
if (!nKey.custom() && part->instr()->transpose().chromatic && !score->styleB(StyleIdx::concertPitch)) {
int diff = -part->instr()->transpose().chromatic;
nKey.setKey(transposeKey(nKey.key(), diff));
}
Expand Down
6 changes: 6 additions & 0 deletions mscore/menus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,12 @@ Palette* MuseScore::newKeySigPalette()
KeySig* k = new KeySig(gscore);
k->setKey(Key::C);
sp->append(k, qApp->translate("MuseScore", keyNames[14]));
// atonal key signature
KeySigEvent nke;
nke.setCustom(true);
KeySig* nk = new KeySig(gscore);
nk->setKeySigEvent(nke);
sp->append(nk, qApp->translate("MuseScore", keyNames[15]));
return sp;
}

Expand Down

0 comments on commit a123d3c

Please sign in to comment.