move enums Accidental::Role and ::Type
This commit is contained in:
parent
42bdb5f01e
commit
e9222d1b45
16 changed files with 290 additions and 324 deletions
|
@ -79,9 +79,9 @@ Accidental::Accidental(Score* s)
|
|||
{
|
||||
setFlags(ElementFlag::MOVABLE | ElementFlag::SELECTABLE);
|
||||
_hasBracket = false;
|
||||
_role = Role::AUTO;
|
||||
_role = AccidentalRole::AUTO;
|
||||
_small = false;
|
||||
_accidentalType = Type::NONE;
|
||||
_accidentalType = AccidentalType::NONE;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
@ -104,121 +104,121 @@ void Accidental::read(XmlReader& e)
|
|||
if (isInt) {
|
||||
_hasBracket = i & 0x8000;
|
||||
i &= ~0x8000;
|
||||
Type at;
|
||||
AccidentalType at;
|
||||
switch(i) {
|
||||
case 0:
|
||||
at = Type::NONE;
|
||||
at = AccidentalType::NONE;
|
||||
break;
|
||||
case 1:
|
||||
case 11:
|
||||
at = Type::SHARP;
|
||||
at = AccidentalType::SHARP;
|
||||
break;
|
||||
case 2:
|
||||
case 12:
|
||||
at = Type::FLAT;
|
||||
at = AccidentalType::FLAT;
|
||||
break;
|
||||
case 3:
|
||||
case 13:
|
||||
at = Type::SHARP2;
|
||||
at = AccidentalType::SHARP2;
|
||||
break;
|
||||
case 4:
|
||||
case 14:
|
||||
at = Type::FLAT2;
|
||||
at = AccidentalType::FLAT2;
|
||||
break;
|
||||
case 5:
|
||||
case 15:
|
||||
at = Type::NATURAL;
|
||||
at = AccidentalType::NATURAL;
|
||||
break;
|
||||
case 6:
|
||||
at = Type::SHARP;
|
||||
at = AccidentalType::SHARP;
|
||||
_hasBracket = true;
|
||||
break;
|
||||
case 7:
|
||||
at = Type::FLAT;
|
||||
at = AccidentalType::FLAT;
|
||||
_hasBracket = true;
|
||||
break;
|
||||
case 8:
|
||||
at = Type::SHARP2;
|
||||
at = AccidentalType::SHARP2;
|
||||
_hasBracket = true;
|
||||
break;
|
||||
case 9:
|
||||
at = Type::FLAT2;
|
||||
at = AccidentalType::FLAT2;
|
||||
_hasBracket = true;
|
||||
break;
|
||||
case 10:
|
||||
at = Type::NATURAL;
|
||||
at = AccidentalType::NATURAL;
|
||||
_hasBracket = true;
|
||||
break;
|
||||
case 16:
|
||||
at = Type::FLAT_SLASH;
|
||||
at = AccidentalType::FLAT_SLASH;
|
||||
break;
|
||||
case 17:
|
||||
at = Type::FLAT_SLASH2;
|
||||
at = AccidentalType::FLAT_SLASH2;
|
||||
break;
|
||||
case 18:
|
||||
at = Type::MIRRORED_FLAT2;
|
||||
at = AccidentalType::MIRRORED_FLAT2;
|
||||
break;
|
||||
case 19:
|
||||
at = Type::MIRRORED_FLAT;
|
||||
at = AccidentalType::MIRRORED_FLAT;
|
||||
break;
|
||||
case 20:
|
||||
at = Type::MIRRORED_FLAT_SLASH;
|
||||
at = AccidentalType::MIRRORED_FLAT_SLASH;
|
||||
break;
|
||||
case 21:
|
||||
at = Type::FLAT_FLAT_SLASH;
|
||||
at = AccidentalType::FLAT_FLAT_SLASH;
|
||||
break;
|
||||
case 22:
|
||||
at = Type::SHARP_SLASH;
|
||||
at = AccidentalType::SHARP_SLASH;
|
||||
break;
|
||||
case 23:
|
||||
at = Type::SHARP_SLASH2;
|
||||
at = AccidentalType::SHARP_SLASH2;
|
||||
break;
|
||||
case 24:
|
||||
at = Type::SHARP_SLASH3;
|
||||
at = AccidentalType::SHARP_SLASH3;
|
||||
break;
|
||||
case 25:
|
||||
at = Type::SHARP_SLASH4;
|
||||
at = AccidentalType::SHARP_SLASH4;
|
||||
break;
|
||||
case 26:
|
||||
at = Type::SHARP_ARROW_UP;
|
||||
at = AccidentalType::SHARP_ARROW_UP;
|
||||
break;
|
||||
case 27:
|
||||
at = Type::SHARP_ARROW_DOWN;
|
||||
at = AccidentalType::SHARP_ARROW_DOWN;
|
||||
break;
|
||||
case 28:
|
||||
at = Type::SHARP_ARROW_BOTH;
|
||||
at = AccidentalType::SHARP_ARROW_BOTH;
|
||||
break;
|
||||
case 29:
|
||||
at = Type::FLAT_ARROW_UP;
|
||||
at = AccidentalType::FLAT_ARROW_UP;
|
||||
break;
|
||||
case 30:
|
||||
at = Type::FLAT_ARROW_DOWN;
|
||||
at = AccidentalType::FLAT_ARROW_DOWN;
|
||||
break;
|
||||
case 31:
|
||||
at = Type::FLAT_ARROW_BOTH;
|
||||
at = AccidentalType::FLAT_ARROW_BOTH;
|
||||
break;
|
||||
case 32:
|
||||
at = Type::NATURAL_ARROW_UP;
|
||||
at = AccidentalType::NATURAL_ARROW_UP;
|
||||
break;
|
||||
case 33:
|
||||
at = Type::NATURAL_ARROW_DOWN;
|
||||
at = AccidentalType::NATURAL_ARROW_DOWN;
|
||||
break;
|
||||
case 34:
|
||||
at = Type::NATURAL_ARROW_BOTH;
|
||||
at = AccidentalType::NATURAL_ARROW_BOTH;
|
||||
break;
|
||||
default:
|
||||
at = Type::NONE;
|
||||
at = AccidentalType::NONE;
|
||||
break;
|
||||
}
|
||||
setAccidentalType(Type(at));
|
||||
setAccidentalType(AccidentalType(at));
|
||||
}
|
||||
else
|
||||
setSubtype(text);
|
||||
}
|
||||
else if (tag == "role") {
|
||||
int i = e.readInt();
|
||||
if (i == int(Role::AUTO) || i == int(Role::USER))
|
||||
_role = Role(i);
|
||||
if (i == int(AccidentalRole::AUTO) || i == int(AccidentalRole::USER))
|
||||
_role = AccidentalRole(i);
|
||||
}
|
||||
else if (tag == "small")
|
||||
_small = e.readInt();
|
||||
|
@ -274,7 +274,7 @@ SymId Accidental::symbol() const
|
|||
// returns the resulting pitch offset
|
||||
//---------------------------------------------------------
|
||||
|
||||
AccidentalVal Accidental::subtype2value(Type st)
|
||||
AccidentalVal Accidental::subtype2value(AccidentalType st)
|
||||
{
|
||||
return accList[int(st)].offset;
|
||||
}
|
||||
|
@ -283,7 +283,7 @@ AccidentalVal Accidental::subtype2value(Type st)
|
|||
// subtype2name
|
||||
//---------------------------------------------------------
|
||||
|
||||
const char* Accidental::subtype2name(Type st)
|
||||
const char* Accidental::subtype2name(AccidentalType st)
|
||||
{
|
||||
return accList[int(st)].tag;
|
||||
}
|
||||
|
@ -292,15 +292,15 @@ const char* Accidental::subtype2name(Type st)
|
|||
// name2subtype
|
||||
//---------------------------------------------------------
|
||||
|
||||
Accidental::Type Accidental::name2subtype(const QString& tag)
|
||||
AccidentalType Accidental::name2subtype(const QString& tag)
|
||||
{
|
||||
int i = 0;
|
||||
for (const Acc& acc : accList) {
|
||||
if (acc.tag == tag)
|
||||
return Type(i);
|
||||
return AccidentalType(i);
|
||||
++i;
|
||||
}
|
||||
return Type::NONE;
|
||||
return AccidentalType::NONE;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
@ -359,18 +359,18 @@ void Accidental::layout()
|
|||
// value2subtype
|
||||
//---------------------------------------------------------
|
||||
|
||||
Accidental::Type Accidental::value2subtype(AccidentalVal v)
|
||||
AccidentalType Accidental::value2subtype(AccidentalVal v)
|
||||
{
|
||||
switch(v) {
|
||||
case AccidentalVal::NATURAL: return Type::NONE;
|
||||
case AccidentalVal::SHARP: return Type::SHARP;
|
||||
case AccidentalVal::SHARP2: return Type::SHARP2;
|
||||
case AccidentalVal::FLAT: return Type::FLAT;
|
||||
case AccidentalVal::FLAT2: return Type::FLAT2;
|
||||
case AccidentalVal::NATURAL: return AccidentalType::NONE;
|
||||
case AccidentalVal::SHARP: return AccidentalType::SHARP;
|
||||
case AccidentalVal::SHARP2: return AccidentalType::SHARP2;
|
||||
case AccidentalVal::FLAT: return AccidentalType::FLAT;
|
||||
case AccidentalVal::FLAT2: return AccidentalType::FLAT2;
|
||||
default:
|
||||
qFatal("value2subtype: illegal accidental val %hhd", v);
|
||||
}
|
||||
return Type::NONE;
|
||||
return AccidentalType::NONE;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
@ -446,7 +446,7 @@ QVariant Accidental::getProperty(P_ID propertyId) const
|
|||
switch (propertyId) {
|
||||
case P_ID::SMALL: return _small;
|
||||
case P_ID::ACCIDENTAL_BRACKET: return _hasBracket;
|
||||
case P_ID::ROLE: return int(role());
|
||||
case P_ID::ROLE: return QVariant::fromValue(role());
|
||||
default:
|
||||
return Element::getProperty(propertyId);
|
||||
}
|
||||
|
@ -461,7 +461,7 @@ QVariant Accidental::propertyDefault(P_ID propertyId) const
|
|||
switch (propertyId) {
|
||||
case P_ID::SMALL: return false;
|
||||
case P_ID::ACCIDENTAL_BRACKET: return false;
|
||||
case P_ID::ROLE: return int(Role::AUTO);
|
||||
case P_ID::ROLE: return QVariant::fromValue(AccidentalRole::AUTO);
|
||||
default:
|
||||
return Element::propertyDefault(propertyId);
|
||||
}
|
||||
|
@ -481,7 +481,7 @@ bool Accidental::setProperty(P_ID propertyId, const QVariant& v)
|
|||
_hasBracket = v.toBool();
|
||||
break;
|
||||
case P_ID::ROLE:
|
||||
_role = Role(v.toInt());
|
||||
_role = v.value<AccidentalRole>();
|
||||
break;
|
||||
default:
|
||||
return Element::setProperty(propertyId, v);
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
|
||||
#include "element.h"
|
||||
|
||||
class QPainter;
|
||||
|
||||
namespace Ms {
|
||||
|
||||
class Note;
|
||||
|
@ -41,64 +39,22 @@ struct SymElement {
|
|||
// @@ Accidental
|
||||
// @P hasBracket bool
|
||||
// @P small bool
|
||||
// @P acctype Ms::Accidental::Type (NONE, SHARP, FLAT, SHARP2, FLAT2, NATURAL, ...) (read only)
|
||||
// @P role Ms::Accidental::Role (AUTO, USER) (read only)
|
||||
// @P acctype Ms::MScore::AccidentalType (NONE, SHARP, FLAT, SHARP2, FLAT2, NATURAL, ...) (read only)
|
||||
// @P role Ms::MScore::AccidentalRole (AUTO, USER) (read only)
|
||||
//---------------------------------------------------------
|
||||
|
||||
class Accidental : public Element {
|
||||
public:
|
||||
enum class Role : char {
|
||||
AUTO, // layout created accidental
|
||||
USER // user created accidental
|
||||
};
|
||||
enum class Type : char {
|
||||
NONE,
|
||||
SHARP,
|
||||
FLAT,
|
||||
SHARP2,
|
||||
FLAT2,
|
||||
NATURAL,
|
||||
|
||||
FLAT_SLASH,
|
||||
FLAT_SLASH2,
|
||||
MIRRORED_FLAT2,
|
||||
MIRRORED_FLAT,
|
||||
MIRRORED_FLAT_SLASH,
|
||||
FLAT_FLAT_SLASH,
|
||||
|
||||
SHARP_SLASH,
|
||||
SHARP_SLASH2,
|
||||
SHARP_SLASH3,
|
||||
SHARP_SLASH4,
|
||||
|
||||
SHARP_ARROW_UP,
|
||||
SHARP_ARROW_DOWN,
|
||||
SHARP_ARROW_BOTH,
|
||||
FLAT_ARROW_UP,
|
||||
FLAT_ARROW_DOWN,
|
||||
FLAT_ARROW_BOTH,
|
||||
NATURAL_ARROW_UP,
|
||||
NATURAL_ARROW_DOWN,
|
||||
NATURAL_ARROW_BOTH,
|
||||
SORI,
|
||||
KORON,
|
||||
END
|
||||
};
|
||||
|
||||
private:
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool hasBracket READ hasBracket WRITE undoSetHasBracket)
|
||||
Q_PROPERTY(bool small READ small WRITE undoSetSmall)
|
||||
Q_PROPERTY(Ms::Accidental::Type accType READ accidentalType)
|
||||
Q_PROPERTY(Ms::Accidental::Role role READ role)
|
||||
Q_ENUMS(Type)
|
||||
Q_ENUMS(Role)
|
||||
Q_PROPERTY(Ms::AccidentalType accType READ accidentalType)
|
||||
Q_PROPERTY(Ms::AccidentalRole role READ role)
|
||||
|
||||
QList<SymElement> el;
|
||||
Type _accidentalType;
|
||||
AccidentalType _accidentalType;
|
||||
bool _hasBracket;
|
||||
bool _small;
|
||||
Role _role;
|
||||
AccidentalRole _role;
|
||||
|
||||
public:
|
||||
Accidental(Score* s = 0);
|
||||
|
@ -107,8 +63,8 @@ class Accidental : public Element {
|
|||
|
||||
const char* subtypeUserName() const;
|
||||
void setSubtype(const QString& s);
|
||||
void setAccidentalType(Type t) { _accidentalType = t; }
|
||||
Type accidentalType() const { return _accidentalType; }
|
||||
void setAccidentalType(AccidentalType t) { _accidentalType = t; }
|
||||
AccidentalType accidentalType() const { return _accidentalType; }
|
||||
virtual int subtype() const override { return (int)_accidentalType; }
|
||||
virtual QString subtypeName() const override { return QString(subtype2name(_accidentalType)); }
|
||||
|
||||
|
@ -126,8 +82,8 @@ class Accidental : public Element {
|
|||
void setHasBracket(bool val) { _hasBracket = val; }
|
||||
void undoSetHasBracket(bool val);
|
||||
|
||||
Role role() const { return _role; }
|
||||
void setRole(Role r) { _role = r; }
|
||||
AccidentalRole role() const { return _role; }
|
||||
void setRole(AccidentalRole r) { _role = r; }
|
||||
|
||||
bool small() const { return _small; }
|
||||
void setSmall(bool val) { _small = val; }
|
||||
|
@ -140,18 +96,16 @@ class Accidental : public Element {
|
|||
virtual bool setProperty(P_ID propertyId, const QVariant&) override;
|
||||
virtual QVariant propertyDefault(P_ID propertyId) const override;
|
||||
|
||||
static AccidentalVal subtype2value(Type); // return effective pitch offset
|
||||
static const char* subtype2name(Type);
|
||||
static Type value2subtype(AccidentalVal);
|
||||
static Type name2subtype(const QString&);
|
||||
static AccidentalVal subtype2value(AccidentalType); // return effective pitch offset
|
||||
static const char* subtype2name(AccidentalType);
|
||||
static AccidentalType value2subtype(AccidentalVal);
|
||||
static AccidentalType name2subtype(const QString&);
|
||||
|
||||
QString accessibleInfo() override;
|
||||
};
|
||||
|
||||
} // namespace Ms
|
||||
|
||||
Q_DECLARE_METATYPE(Ms::Accidental::Role);
|
||||
Q_DECLARE_METATYPE(Ms::Accidental::Type);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -175,12 +175,12 @@ void Ambitus::write(Xml& xml) const
|
|||
xml.tag("topTpc", _topTpc);
|
||||
xml.tag("bottomPitch",_bottomPitch);
|
||||
xml.tag("bottomTpc", _bottomTpc);
|
||||
if (_topAccid.accidentalType() != Accidental::Type::NONE) {
|
||||
if (_topAccid.accidentalType() != AccidentalType::NONE) {
|
||||
xml.stag("topAccidental");
|
||||
_topAccid.write(xml);
|
||||
xml.etag();
|
||||
}
|
||||
if (_bottomAccid.accidentalType() != Accidental::Type::NONE) {
|
||||
if (_bottomAccid.accidentalType() != AccidentalType::NONE) {
|
||||
xml.stag("bottomAccidental");
|
||||
_bottomAccid.write(xml);
|
||||
xml.etag();
|
||||
|
@ -285,18 +285,18 @@ void Ambitus::layout()
|
|||
topLine = relStep(topLine, clf);
|
||||
_topPos.setY(topLine * lineDist * 0.5);
|
||||
// compute accidental
|
||||
Accidental::Type accidType;
|
||||
AccidentalType accidType;
|
||||
// if (13 <= (tpc - key) <= 19) there is no accidental)
|
||||
if (_topTpc - int(key) >= 13 && _topTpc - int(key) <= 19)
|
||||
accidType = Accidental::Type::NONE;
|
||||
accidType = AccidentalType::NONE;
|
||||
else {
|
||||
AccidentalVal accidVal = AccidentalVal( (_topTpc - Tpc::TPC_MIN) / TPC_DELTA_SEMITONE - 2 );
|
||||
accidType = Accidental::value2subtype(accidVal);
|
||||
if (accidType == Accidental::Type::NONE)
|
||||
accidType = Accidental::Type::NATURAL;
|
||||
if (accidType == AccidentalType::NONE)
|
||||
accidType = AccidentalType::NATURAL;
|
||||
}
|
||||
_topAccid.setAccidentalType(accidType);
|
||||
if (accidType != Accidental::Type::NONE)
|
||||
if (accidType != AccidentalType::NONE)
|
||||
_topAccid.layout();
|
||||
else
|
||||
_topAccid.setbbox(QRect());
|
||||
|
@ -311,17 +311,17 @@ void Ambitus::layout()
|
|||
bottomLine = relStep(bottomLine, clf);
|
||||
_bottomPos.setY(bottomLine * lineDist * 0.5);
|
||||
// compute accidental
|
||||
Accidental::Type accidType;
|
||||
AccidentalType accidType;
|
||||
if (_bottomTpc - int(key) >= 13 && _bottomTpc - int(key) <= 19)
|
||||
accidType = Accidental::Type::NONE;
|
||||
accidType = AccidentalType::NONE;
|
||||
else {
|
||||
AccidentalVal accidVal = AccidentalVal( (_bottomTpc - Tpc::TPC_MIN) / TPC_DELTA_SEMITONE - 2 );
|
||||
accidType = Accidental::value2subtype(accidVal);
|
||||
if (accidType == Accidental::Type::NONE)
|
||||
accidType = Accidental::Type::NATURAL;
|
||||
if (accidType == AccidentalType::NONE)
|
||||
accidType = AccidentalType::NATURAL;
|
||||
}
|
||||
_bottomAccid.setAccidentalType(accidType);
|
||||
if (accidType != Accidental::Type::NONE)
|
||||
if (accidType != AccidentalType::NONE)
|
||||
_bottomAccid.layout();
|
||||
else
|
||||
_bottomAccid.setbbox(QRect());
|
||||
|
@ -346,9 +346,9 @@ void Ambitus::layout()
|
|||
if (collision) {
|
||||
// displace bottom accidental (also attempting to 'undercut' flats)
|
||||
xAccidOffBottom = xAccidOffTop +
|
||||
((_bottomAccid.accidentalType() == Accidental::Type::FLAT
|
||||
|| _bottomAccid.accidentalType() == Accidental::Type::FLAT2
|
||||
|| _bottomAccid.accidentalType() == Accidental::Type::NATURAL)
|
||||
((_bottomAccid.accidentalType() == AccidentalType::FLAT
|
||||
|| _bottomAccid.accidentalType() == AccidentalType::FLAT2
|
||||
|| _bottomAccid.accidentalType() == AccidentalType::NATURAL)
|
||||
? _bottomAccid.width() * 0.5 : _bottomAccid.width());
|
||||
}
|
||||
|
||||
|
@ -447,8 +447,8 @@ Space Ambitus::space() const
|
|||
qreal _spatium = spatium();
|
||||
// reduce left space if there accidentals
|
||||
qreal leftSpace = _spatium *
|
||||
((_topAccid.accidentalType() != Accidental::Type::NONE
|
||||
|| _bottomAccid.accidentalType() != Accidental::Type::NONE)
|
||||
((_topAccid.accidentalType() != AccidentalType::NONE
|
||||
|| _bottomAccid.accidentalType() != AccidentalType::NONE)
|
||||
? 0.5 : 0.75);
|
||||
return Space(leftSpace - bbox().x(), width() + bbox().x() + _spatium * 0.5);
|
||||
}
|
||||
|
@ -460,9 +460,9 @@ Space Ambitus::space() const
|
|||
void Ambitus::scanElements(void* data, void (*func)(void*, Element*), bool /*all*/)
|
||||
{
|
||||
func(data, this);
|
||||
if (_topAccid.accidentalType() != Accidental::Type::NONE)
|
||||
if (_topAccid.accidentalType() != AccidentalType::NONE)
|
||||
func(data, &_topAccid);
|
||||
if (_bottomAccid.accidentalType() != Accidental::Type::NONE)
|
||||
if (_bottomAccid.accidentalType() != AccidentalType::NONE)
|
||||
func(data, &_bottomAccid);
|
||||
}
|
||||
|
||||
|
|
|
@ -1368,7 +1368,7 @@ void Score::addArticulation(ArticulationType attr)
|
|||
/// notes.
|
||||
//---------------------------------------------------------
|
||||
|
||||
void Score::changeAccidental(Accidental::Type idx)
|
||||
void Score::changeAccidental(AccidentalType idx)
|
||||
{
|
||||
foreach(Note* note, selection().noteList())
|
||||
changeAccidental(note, idx);
|
||||
|
@ -1431,7 +1431,7 @@ static void changeAccidental2(Note* n, int pitch, int tpc)
|
|||
/// note \a note.
|
||||
//---------------------------------------------------------
|
||||
|
||||
void Score::changeAccidental(Note* note, Accidental::Type accidental)
|
||||
void Score::changeAccidental(Note* note, AccidentalType accidental)
|
||||
{
|
||||
Chord* chord = note->chord();
|
||||
if (!chord)
|
||||
|
@ -1455,7 +1455,7 @@ void Score::changeAccidental(Note* note, Accidental::Type accidental)
|
|||
// accidental change may result in pitch change
|
||||
//
|
||||
AccidentalVal acc2 = measure->findAccidental(note);
|
||||
AccidentalVal acc = (accidental == Accidental::Type::NONE) ? acc2 : Accidental::subtype2value(accidental);
|
||||
AccidentalVal acc = (accidental == AccidentalType::NONE) ? acc2 : Accidental::subtype2value(accidental);
|
||||
|
||||
int pitch = line2pitch(note->line(), clef, Key::C) + int(acc);
|
||||
if (!note->concertPitch())
|
||||
|
@ -1468,13 +1468,13 @@ void Score::changeAccidental(Note* note, Accidental::Type accidental)
|
|||
|
||||
// delete accidental
|
||||
// both for this note and for any linked notes
|
||||
if (accidental == Accidental::Type::NONE)
|
||||
if (accidental == AccidentalType::NONE)
|
||||
forceRemove = true;
|
||||
|
||||
// precautionary or microtonal accidental
|
||||
// either way, we display it unconditionally
|
||||
// both for this note and for any linked notes
|
||||
else if (acc == acc2 || accidental > Accidental::Type::NATURAL)
|
||||
else if (acc == acc2 || accidental > AccidentalType::NATURAL)
|
||||
forceAdd = true;
|
||||
|
||||
for (ScoreElement* se : note->linkList()) {
|
||||
|
@ -1493,7 +1493,7 @@ void Score::changeAccidental(Note* note, Accidental::Type accidental)
|
|||
Accidental* a = new Accidental(lns);
|
||||
a->setParent(ln);
|
||||
a->setAccidentalType(accidental);
|
||||
a->setRole(Accidental::Role::USER);
|
||||
a->setRole(AccidentalRole::USER);
|
||||
lns->undoAddElement(a);
|
||||
}
|
||||
changeAccidental2(ln, pitch, tpc);
|
||||
|
@ -2284,15 +2284,15 @@ void Score::cmd(const QAction* a)
|
|||
else if (cmd == "beam-32")
|
||||
cmdSetBeamMode(Beam::Mode::BEGIN32);
|
||||
else if (cmd == "sharp2")
|
||||
changeAccidental(Accidental::Type::SHARP2);
|
||||
changeAccidental(AccidentalType::SHARP2);
|
||||
else if (cmd == "sharp")
|
||||
changeAccidental(Accidental::Type::SHARP);
|
||||
changeAccidental(AccidentalType::SHARP);
|
||||
else if (cmd == "nat")
|
||||
changeAccidental(Accidental::Type::NATURAL);
|
||||
changeAccidental(AccidentalType::NATURAL);
|
||||
else if (cmd == "flat")
|
||||
changeAccidental(Accidental::Type::FLAT);
|
||||
changeAccidental(AccidentalType::FLAT);
|
||||
else if (cmd == "flat2")
|
||||
changeAccidental(Accidental::Type::FLAT2);
|
||||
changeAccidental(AccidentalType::FLAT2);
|
||||
else if (cmd == "repitch")
|
||||
_is.setRepitchMode(a->isChecked());
|
||||
else if (cmd == "flip")
|
||||
|
|
|
@ -1740,7 +1740,7 @@ void Score::deleteItem(Element* el)
|
|||
|
||||
case Element::Type::ACCIDENTAL:
|
||||
if (el->parent()->type() == Element::Type::NOTE)
|
||||
changeAccidental(static_cast<Note*>(el->parent()), Accidental::Type::NONE);
|
||||
changeAccidental(static_cast<Note*>(el->parent()), AccidentalType::NONE);
|
||||
else
|
||||
undoRemoveElement(el);
|
||||
break;
|
||||
|
|
|
@ -118,8 +118,8 @@ void MScore::init()
|
|||
qRegisterMetaType<MScore::Direction>("Direction");
|
||||
qRegisterMetaType<MScore::DirectionH>("DirectionH");
|
||||
qRegisterMetaType<Element::Placement>("Placement");
|
||||
qRegisterMetaType<Accidental::Role>("AccidentalRole");
|
||||
qRegisterMetaType<Accidental::Type>("AccidentalType");
|
||||
qRegisterMetaType<AccidentalRole>("AccidentalRole");
|
||||
qRegisterMetaType<AccidentalType>("AccidentalType");
|
||||
qRegisterMetaType<Spanner::Anchor>("Anchor");
|
||||
qRegisterMetaType<NoteHead::Group>("NoteHeadGroup");
|
||||
qRegisterMetaType<NoteHead::Type>("NoteHeadType");
|
||||
|
|
|
@ -331,12 +331,18 @@ enum class IconType : signed char {
|
|||
BRACKETS
|
||||
};
|
||||
|
||||
#include "globalEnums.h"
|
||||
|
||||
//---------------------------------------------------------
|
||||
// MScore
|
||||
// MuseScore application object
|
||||
//---------------------------------------------------------
|
||||
|
||||
class MScore : public QObject {
|
||||
public:
|
||||
#include "globalEnums.h" // export enums for scripting
|
||||
|
||||
private:
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
|
@ -438,6 +444,10 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(Align);
|
|||
Q_DECLARE_METATYPE(Ms::MScore::Direction);
|
||||
Q_DECLARE_METATYPE(Ms::MScore::DirectionH);
|
||||
Q_DECLARE_METATYPE(Ms::TextStyleType);
|
||||
Q_DECLARE_METATYPE(Ms::AccidentalRole);
|
||||
Q_DECLARE_METATYPE(Ms::AccidentalType);
|
||||
Q_DECLARE_METATYPE(Ms::MScore::AccidentalRole);
|
||||
Q_DECLARE_METATYPE(Ms::MScore::AccidentalType);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -944,42 +944,42 @@ void Note::read(XmlReader& e)
|
|||
// TODO: for backward compatibility
|
||||
bool bracket = k & 0x8000;
|
||||
k &= 0xfff;
|
||||
Accidental::Type at = Accidental::Type::NONE;
|
||||
AccidentalType at = AccidentalType::NONE;
|
||||
switch(k) {
|
||||
case 0: at = Accidental::Type::NONE; break;
|
||||
case 1: at = Accidental::Type::SHARP; break;
|
||||
case 2: at = Accidental::Type::FLAT; break;
|
||||
case 3: at = Accidental::Type::SHARP2; break;
|
||||
case 4: at = Accidental::Type::FLAT2; break;
|
||||
case 5: at = Accidental::Type::NATURAL; break;
|
||||
case 0: at = AccidentalType::NONE; break;
|
||||
case 1: at = AccidentalType::SHARP; break;
|
||||
case 2: at = AccidentalType::FLAT; break;
|
||||
case 3: at = AccidentalType::SHARP2; break;
|
||||
case 4: at = AccidentalType::FLAT2; break;
|
||||
case 5: at = AccidentalType::NATURAL; break;
|
||||
|
||||
case 6: at = Accidental::Type::FLAT_SLASH; break;
|
||||
case 7: at = Accidental::Type::FLAT_SLASH2; break;
|
||||
case 8: at = Accidental::Type::MIRRORED_FLAT2; break;
|
||||
case 9: at = Accidental::Type::MIRRORED_FLAT; break;
|
||||
case 10: at = Accidental::Type::MIRRORED_FLAT_SLASH; break;
|
||||
case 11: at = Accidental::Type::FLAT_FLAT_SLASH; break;
|
||||
case 6: at = AccidentalType::FLAT_SLASH; break;
|
||||
case 7: at = AccidentalType::FLAT_SLASH2; break;
|
||||
case 8: at = AccidentalType::MIRRORED_FLAT2; break;
|
||||
case 9: at = AccidentalType::MIRRORED_FLAT; break;
|
||||
case 10: at = AccidentalType::MIRRORED_FLAT_SLASH; break;
|
||||
case 11: at = AccidentalType::FLAT_FLAT_SLASH; break;
|
||||
|
||||
case 12: at = Accidental::Type::SHARP_SLASH; break;
|
||||
case 13: at = Accidental::Type::SHARP_SLASH2; break;
|
||||
case 14: at = Accidental::Type::SHARP_SLASH3; break;
|
||||
case 15: at = Accidental::Type::SHARP_SLASH4; break;
|
||||
case 12: at = AccidentalType::SHARP_SLASH; break;
|
||||
case 13: at = AccidentalType::SHARP_SLASH2; break;
|
||||
case 14: at = AccidentalType::SHARP_SLASH3; break;
|
||||
case 15: at = AccidentalType::SHARP_SLASH4; break;
|
||||
|
||||
case 16: at = Accidental::Type::SHARP_ARROW_UP; break;
|
||||
case 17: at = Accidental::Type::SHARP_ARROW_DOWN; break;
|
||||
case 18: at = Accidental::Type::SHARP_ARROW_BOTH; break;
|
||||
case 19: at = Accidental::Type::FLAT_ARROW_UP; break;
|
||||
case 20: at = Accidental::Type::FLAT_ARROW_DOWN; break;
|
||||
case 21: at = Accidental::Type::FLAT_ARROW_BOTH; break;
|
||||
case 22: at = Accidental::Type::NATURAL_ARROW_UP; break;
|
||||
case 23: at = Accidental::Type::NATURAL_ARROW_DOWN; break;
|
||||
case 24: at = Accidental::Type::NATURAL_ARROW_BOTH; break;
|
||||
case 25: at = Accidental::Type::SORI; break;
|
||||
case 26: at = Accidental::Type::KORON; break;
|
||||
case 16: at = AccidentalType::SHARP_ARROW_UP; break;
|
||||
case 17: at = AccidentalType::SHARP_ARROW_DOWN; break;
|
||||
case 18: at = AccidentalType::SHARP_ARROW_BOTH; break;
|
||||
case 19: at = AccidentalType::FLAT_ARROW_UP; break;
|
||||
case 20: at = AccidentalType::FLAT_ARROW_DOWN; break;
|
||||
case 21: at = AccidentalType::FLAT_ARROW_BOTH; break;
|
||||
case 22: at = AccidentalType::NATURAL_ARROW_UP; break;
|
||||
case 23: at = AccidentalType::NATURAL_ARROW_DOWN; break;
|
||||
case 24: at = AccidentalType::NATURAL_ARROW_BOTH; break;
|
||||
case 25: at = AccidentalType::SORI; break;
|
||||
case 26: at = AccidentalType::KORON; break;
|
||||
}
|
||||
_accidental->setAccidentalType(at);
|
||||
_accidental->setHasBracket(bracket);
|
||||
_accidental->setRole(Accidental::Role::USER);
|
||||
_accidental->setRole(AccidentalRole::USER);
|
||||
hasAccidental = true; // we now have an accidental
|
||||
}
|
||||
}
|
||||
|
@ -1759,22 +1759,22 @@ void Note::updateAccidental(AccidentalState* as)
|
|||
|
||||
// don't touch accidentals that don't concern tpc such as
|
||||
// quarter tones
|
||||
if (!(_accidental && _accidental->accidentalType() > Accidental::Type::NATURAL)) {
|
||||
if (!(_accidental && _accidental->accidentalType() > AccidentalType::NATURAL)) {
|
||||
// calculate accidental
|
||||
Accidental::Type acci = Accidental::Type::NONE;
|
||||
AccidentalType acci = AccidentalType::NONE;
|
||||
|
||||
AccidentalVal accVal = tpc2alter(tpc());
|
||||
if ((accVal != as->accidentalVal(relLine)) || hidden() || as->tieContext(relLine)) {
|
||||
as->setAccidentalVal(relLine, accVal, _tieBack != 0);
|
||||
if (_tieBack)
|
||||
acci = Accidental::Type::NONE;
|
||||
acci = AccidentalType::NONE;
|
||||
else {
|
||||
acci = Accidental::value2subtype(accVal);
|
||||
if (acci == Accidental::Type::NONE)
|
||||
acci = Accidental::Type::NATURAL;
|
||||
if (acci == AccidentalType::NONE)
|
||||
acci = AccidentalType::NATURAL;
|
||||
}
|
||||
}
|
||||
if (acci != Accidental::Type::NONE && !_tieBack && !_hidden) {
|
||||
if (acci != AccidentalType::NONE && !_tieBack && !_hidden) {
|
||||
if (_accidental == 0) {
|
||||
Accidental* a = new Accidental(score());
|
||||
a->setParent(this);
|
||||
|
@ -1791,13 +1791,13 @@ void Note::updateAccidental(AccidentalState* as)
|
|||
else {
|
||||
if (_accidental) {
|
||||
// remove this if it was AUTO:
|
||||
if (_accidental->role() == Accidental::Role::AUTO)
|
||||
if (_accidental->role() == AccidentalRole::AUTO)
|
||||
score()->undoRemoveElement(_accidental);
|
||||
else {
|
||||
// keep it, but update type if needed
|
||||
acci = Accidental::value2subtype(accVal);
|
||||
if (acci == Accidental::Type::NONE)
|
||||
acci = Accidental::Type::NATURAL;
|
||||
if (acci == AccidentalType::NONE)
|
||||
acci = AccidentalType::NATURAL;
|
||||
if (_accidental->accidentalType() != acci) {
|
||||
Accidental* a = _accidental->clone();
|
||||
a->setParent(this);
|
||||
|
@ -1984,7 +1984,7 @@ int Note::line() const
|
|||
// setAccidentalType
|
||||
//---------------------------------------------------------
|
||||
|
||||
void Note::setAccidentalType(Accidental::Type type)
|
||||
void Note::setAccidentalType(AccidentalType type)
|
||||
{
|
||||
if (_score)
|
||||
_score->changeAccidental(this, type);
|
||||
|
|
|
@ -42,6 +42,8 @@ class NoteDot;
|
|||
class Spanner;
|
||||
class StaffType;
|
||||
enum class SymId;
|
||||
// enum class AccidentalRole : char;
|
||||
enum class AccidentalType : char;
|
||||
|
||||
static const int MAX_DOTS = 3;
|
||||
|
||||
|
@ -138,7 +140,7 @@ struct NoteVal {
|
|||
// @P headType Ms::NoteHead::Type (HEAD_AUTO, HEAD_WHOLE, HEAD_HALF, HEAD_QUARTER, HEAD_BREVIS)
|
||||
// @P elements array[Ms::Element] list of elements attached to note head
|
||||
// @P accidental Ms::Accidental note accidental (null if none)
|
||||
// @P accidentalType Ms::Accidental::Type note accidental type
|
||||
// @P accidentalType Ms::MScore::AccidentalType note accidental type
|
||||
// @P dots array[Ms::NoteDot] list of note dots (some can be null, read only)
|
||||
// @P dotsCount int number of note dots (read only)
|
||||
// @P tieFor Ms::Tie note forward tie (null if none, read only)
|
||||
|
@ -170,7 +172,7 @@ class Note : public Element {
|
|||
Q_PROPERTY(Ms::NoteHead::Type headType READ headType WRITE undoSetHeadType)
|
||||
Q_PROPERTY(QQmlListProperty<Ms::Element> elements READ qmlElements)
|
||||
Q_PROPERTY(Ms::Accidental* accidental READ accidental)
|
||||
Q_PROPERTY(Ms::Accidental::Type accidentalType READ accidentalType WRITE setAccidentalType)
|
||||
Q_PROPERTY(Ms::AccidentalType accidentalType READ accidentalType WRITE setAccidentalType)
|
||||
Q_PROPERTY(QQmlListProperty<Ms::NoteDot> dots READ qmlDots)
|
||||
Q_PROPERTY(int dotsCount READ qmlDotsCount)
|
||||
Q_PROPERTY(Ms::Tie* tieFor READ tieFor)
|
||||
|
@ -308,8 +310,8 @@ class Note : public Element {
|
|||
Accidental* accidental() const { return _accidental; }
|
||||
void setAccidental(Accidental* a) { _accidental = a; }
|
||||
|
||||
Accidental::Type accidentalType() const { return _accidental ? _accidental->accidentalType() : Accidental::Type::NONE; }
|
||||
void setAccidentalType(Accidental::Type type);
|
||||
AccidentalType accidentalType() const { return _accidental ? _accidental->accidentalType() : AccidentalType::NONE; }
|
||||
void setAccidentalType(AccidentalType type);
|
||||
|
||||
int line() const;
|
||||
void setLine(int n);
|
||||
|
|
|
@ -598,8 +598,8 @@ class Score : public QObject {
|
|||
|
||||
// undo/redo ops
|
||||
void addArticulation(ArticulationType);
|
||||
void changeAccidental(Accidental::Type);
|
||||
void changeAccidental(Note* oNote, Ms::Accidental::Type);
|
||||
void changeAccidental(AccidentalType);
|
||||
void changeAccidental(Note* oNote, Ms::AccidentalType);
|
||||
|
||||
void addElement(Element*);
|
||||
void removeElement(Element*);
|
||||
|
|
|
@ -2393,8 +2393,8 @@ void AccidentalView::setElement(Element* e)
|
|||
ShowElementBase::setElement(e);
|
||||
|
||||
acc.hasBracket->setChecked(s->hasBracket());
|
||||
acc.accAuto->setChecked(s->role() == Accidental::Role::AUTO);
|
||||
acc.accUser->setChecked(s->role() == Accidental::Role::USER);
|
||||
acc.accAuto->setChecked(s->role() == AccidentalRole::AUTO);
|
||||
acc.accUser->setChecked(s->role() == AccidentalRole::USER);
|
||||
acc.small->setChecked(s->small());
|
||||
}
|
||||
|
||||
|
|
|
@ -2331,10 +2331,10 @@ void ExportMusicXml::chord(Chord* chord, int staff, const QList<Lyrics*>* ll, bo
|
|||
double alter2 = 0.0;
|
||||
if (acc) {
|
||||
switch (acc->accidentalType()) {
|
||||
case Accidental::Type::MIRRORED_FLAT: alter2 = -0.5; break;
|
||||
case Accidental::Type::SHARP_SLASH: alter2 = 0.5; break;
|
||||
case Accidental::Type::MIRRORED_FLAT2: alter2 = -1.5; break;
|
||||
case Accidental::Type::SHARP_SLASH4: alter2 = 1.5; break;
|
||||
case AccidentalType::MIRRORED_FLAT: alter2 = -0.5; break;
|
||||
case AccidentalType::SHARP_SLASH: alter2 = 0.5; break;
|
||||
case AccidentalType::MIRRORED_FLAT2: alter2 = -1.5; break;
|
||||
case AccidentalType::SHARP_SLASH4: alter2 = 1.5; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2494,7 +2494,7 @@ Measure* MusicXml::xmlMeasure(Part* part, QDomElement e, int number, Fraction me
|
|||
Note* note = xmlNote(measure, staff, part->id(), beam, cv, e, graceNotes, alt);
|
||||
if(note) {
|
||||
if(note->accidental()){
|
||||
if(note->accidental()->accidentalType() != Accidental::Type::NONE){
|
||||
if(note->accidental()->accidentalType() != AccidentalType::NONE){
|
||||
courtAccNotes.append(note);
|
||||
alterList.append(alt);
|
||||
}
|
||||
|
@ -2762,14 +2762,14 @@ Measure* MusicXml::xmlMeasure(Part* part, QDomElement e, int number, Fraction me
|
|||
int alter = alterList.value(i);
|
||||
int ln = absStep(nt->tpc(), nt->pitch());
|
||||
AccidentalVal currAccVal = currAcc.accidentalVal(ln);
|
||||
if ((alter == -1 && currAccVal == AccidentalVal::FLAT && nt->accidental()->accidentalType() == Accidental::Type::FLAT && !accTmp.value(ln))
|
||||
|| (alter == 0 && currAccVal == AccidentalVal::NATURAL && nt->accidental()->accidentalType() == Accidental::Type::NATURAL && !accTmp.value(ln))
|
||||
|| (alter == 1 && currAccVal == AccidentalVal::SHARP && nt->accidental()->accidentalType() == Accidental::Type::SHARP && !accTmp.value(ln))) {
|
||||
nt->accidental()->setRole(Accidental::Role::USER);
|
||||
if ((alter == -1 && currAccVal == AccidentalVal::FLAT && nt->accidental()->accidentalType() == AccidentalType::FLAT && !accTmp.value(ln))
|
||||
|| (alter == 0 && currAccVal == AccidentalVal::NATURAL && nt->accidental()->accidentalType() == AccidentalType::NATURAL && !accTmp.value(ln))
|
||||
|| (alter == 1 && currAccVal == AccidentalVal::SHARP && nt->accidental()->accidentalType() == AccidentalType::SHARP && !accTmp.value(ln))) {
|
||||
nt->accidental()->setRole(AccidentalRole::USER);
|
||||
}
|
||||
else if ((nt->accidental()->accidentalType() > Accidental::Type::NATURAL) && (nt->accidental()->accidentalType() < Accidental::Type::END)) { // microtonal accidental
|
||||
else if ((nt->accidental()->accidentalType() > AccidentalType::NATURAL) && (nt->accidental()->accidentalType() < AccidentalType::END)) { // microtonal accidental
|
||||
alter = 0;
|
||||
nt->accidental()->setRole(Accidental::Role::USER);
|
||||
nt->accidental()->setRole(AccidentalRole::USER);
|
||||
accTmp.replace(ln, false);
|
||||
}
|
||||
else {
|
||||
|
@ -3729,36 +3729,36 @@ static bool isAppr(const double v, const double ref, const double epsilon)
|
|||
//---------------------------------------------------------
|
||||
|
||||
/**
|
||||
Convert a MusicXML alter tag into a microtonal accidental in MuseScore enum Accidental::Type.
|
||||
Convert a MusicXML alter tag into a microtonal accidental in MuseScore enum AccidentalType.
|
||||
Works only for quarter tone, half tone, three-quarters tone and whole tone accidentals.
|
||||
*/
|
||||
|
||||
static Accidental::Type microtonalGuess(double val)
|
||||
static AccidentalType microtonalGuess(double val)
|
||||
{
|
||||
const double eps = 0.001;
|
||||
if (isAppr(val, -2, eps))
|
||||
return Accidental::Type::FLAT2;
|
||||
return AccidentalType::FLAT2;
|
||||
else if (isAppr(val, -1.5, eps))
|
||||
return Accidental::Type::MIRRORED_FLAT2;
|
||||
return AccidentalType::MIRRORED_FLAT2;
|
||||
else if (isAppr(val, -1, eps))
|
||||
return Accidental::Type::FLAT;
|
||||
return AccidentalType::FLAT;
|
||||
else if (isAppr(val, -0.5, eps))
|
||||
return Accidental::Type::MIRRORED_FLAT;
|
||||
return AccidentalType::MIRRORED_FLAT;
|
||||
else if (isAppr(val, 0, eps))
|
||||
return Accidental::Type::NATURAL;
|
||||
return AccidentalType::NATURAL;
|
||||
else if (isAppr(val, 0.5, eps))
|
||||
return Accidental::Type::SHARP_SLASH;
|
||||
return AccidentalType::SHARP_SLASH;
|
||||
else if (isAppr(val, 1, eps))
|
||||
return Accidental::Type::SHARP;
|
||||
return AccidentalType::SHARP;
|
||||
else if (isAppr(val, 1.5, eps))
|
||||
return Accidental::Type::SHARP_SLASH4;
|
||||
return AccidentalType::SHARP_SLASH4;
|
||||
else if (isAppr(val, 2, eps))
|
||||
return Accidental::Type::SHARP2;
|
||||
return AccidentalType::SHARP2;
|
||||
else
|
||||
qDebug("Guess for microtonal accidental corresponding to value %f failed.", val);
|
||||
|
||||
// default
|
||||
return Accidental::Type::NONE;
|
||||
return AccidentalType::NONE;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
@ -3779,7 +3779,7 @@ static void addSymToSig(KeySigEvent& sig, const QString& step, const QString& al
|
|||
bool ok;
|
||||
double d;
|
||||
d = alter.toDouble(&ok);
|
||||
Accidental::Type accTpAlter = ok ? microtonalGuess(d) : Accidental::Type::NONE;
|
||||
AccidentalType accTpAlter = ok ? microtonalGuess(d) : AccidentalType::NONE;
|
||||
id = mxmlString2accSymId(accidentalType2MxmlString(accTpAlter));
|
||||
}
|
||||
|
||||
|
@ -5375,7 +5375,7 @@ Note* MusicXml::xmlNote(Measure* measure, int staff, const QString& partId, Beam
|
|||
QString step;
|
||||
int alter = 0;
|
||||
int octave = 4;
|
||||
Accidental::Type accidental = Accidental::Type::NONE;
|
||||
AccidentalType accidental = AccidentalType::NONE;
|
||||
bool parentheses = false;
|
||||
bool editorial = false;
|
||||
bool cautionary = false;
|
||||
|
@ -5513,7 +5513,7 @@ Note* MusicXml::xmlNote(Measure* measure, int staff, const QString& partId, Beam
|
|||
qPrintable(altertext), ee.lineNumber(), ee.columnNumber());
|
||||
bool ok2;
|
||||
double altervalue = altertext.toDouble(&ok2);
|
||||
if (ok2 && (qAbs(altervalue) < 2.0) && (accidental == Accidental::Type::NONE)) {
|
||||
if (ok2 && (qAbs(altervalue) < 2.0) && (accidental == AccidentalType::NONE)) {
|
||||
// try to see if a microtonal accidental is needed
|
||||
accidental = microtonalGuess(altervalue);
|
||||
}
|
||||
|
@ -5825,12 +5825,12 @@ Note* MusicXml::xmlNote(Measure* measure, int staff, const QString& partId, Beam
|
|||
// qDebug("staff for new note: %p (staff=%d, relStaff=%d)",
|
||||
// score->staff(staff + relStaff), staff, relStaff);
|
||||
|
||||
if(accidental != Accidental::Type::NONE){
|
||||
if(accidental != AccidentalType::NONE){
|
||||
Accidental* a = new Accidental(score);
|
||||
a->setAccidentalType(accidental);
|
||||
if (editorial || cautionary || parentheses) {
|
||||
a->setHasBracket(cautionary || parentheses);
|
||||
a->setRole(Accidental::Role::USER);
|
||||
a->setRole(AccidentalRole::USER);
|
||||
}
|
||||
else {
|
||||
alt = alter;
|
||||
|
|
|
@ -273,24 +273,24 @@ Palette* MuseScore::newAccidentalsPalette(bool basic)
|
|||
sp->setDrawGrid(true);
|
||||
|
||||
if (basic) {
|
||||
static Accidental::Type types[] = {
|
||||
Accidental::Type::NONE,
|
||||
Accidental::Type::SHARP,
|
||||
Accidental::Type::FLAT,
|
||||
Accidental::Type::SHARP2,
|
||||
Accidental::Type::FLAT2,
|
||||
Accidental::Type::NATURAL
|
||||
static AccidentalType types[] = {
|
||||
AccidentalType::NONE,
|
||||
AccidentalType::SHARP,
|
||||
AccidentalType::FLAT,
|
||||
AccidentalType::SHARP2,
|
||||
AccidentalType::FLAT2,
|
||||
AccidentalType::NATURAL
|
||||
};
|
||||
for (auto i : types) {
|
||||
Accidental* s = new Accidental(gscore);
|
||||
s->setAccidentalType(Accidental::Type(i));
|
||||
s->setAccidentalType(AccidentalType(i));
|
||||
sp->append(s, qApp->translate("accidental", s->subtypeUserName()));
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (int i = int(Accidental::Type::SHARP); i < int(Accidental::Type::END); ++i) {
|
||||
for (int i = int(AccidentalType::SHARP); i < int(AccidentalType::END); ++i) {
|
||||
Accidental* s = new Accidental(gscore);
|
||||
s->setAccidentalType(Accidental::Type(i));
|
||||
s->setAccidentalType(AccidentalType(i));
|
||||
if (s->symbol() != SymId::noSym)
|
||||
sp->append(s, qApp->translate("accidental", s->subtypeUserName()));
|
||||
else
|
||||
|
|
|
@ -386,24 +386,24 @@ QString accSymId2MxmlString(const SymId id)
|
|||
case SymId::accidentalBakiyeFlat: s = "slash-flat"; break;
|
||||
case SymId::accidentalBuyukMucennebFlat: s = "double-slash-flat"; break;
|
||||
/* TODO
|
||||
case Accidental::Type::FLAT_ARROW_UP: s = "flat-up"; break;
|
||||
case Accidental::Type::NATURAL_ARROW_DOWN: s = "natural-down"; break;
|
||||
case Accidental::Type::SHARP_ARROW_DOWN: s = "sharp-down"; break;
|
||||
case Accidental::Type::NATURAL_ARROW_UP: s = "natural-up"; break;
|
||||
case Accidental::Type::MIRRORED_FLAT2: s = "three-quarters-flat"; break;
|
||||
case Accidental::Type::FLAT_FLAT_SLASH: s = "three-quarters-flat"; break;
|
||||
case Accidental::Type::FLAT_ARROW_DOWN: s = "flat-down"; break;
|
||||
case Accidental::Type::SHARP_SLASH4: s = "three-quarters-sharp"; break;
|
||||
case Accidental::Type::SHARP_ARROW_UP: s = "sharp-up"; break;
|
||||
case Accidental::Type::SORI: s = "sori"; break;
|
||||
case Accidental::Type::KORON: s = "koron"; break;
|
||||
case AccidentalType::FLAT_ARROW_UP: s = "flat-up"; break;
|
||||
case AccidentalType::NATURAL_ARROW_DOWN: s = "natural-down"; break;
|
||||
case AccidentalType::SHARP_ARROW_DOWN: s = "sharp-down"; break;
|
||||
case AccidentalType::NATURAL_ARROW_UP: s = "natural-up"; break;
|
||||
case AccidentalType::MIRRORED_FLAT2: s = "three-quarters-flat"; break;
|
||||
case AccidentalType::FLAT_FLAT_SLASH: s = "three-quarters-flat"; break;
|
||||
case AccidentalType::FLAT_ARROW_DOWN: s = "flat-down"; break;
|
||||
case AccidentalType::SHARP_SLASH4: s = "three-quarters-sharp"; break;
|
||||
case AccidentalType::SHARP_ARROW_UP: s = "sharp-up"; break;
|
||||
case AccidentalType::SORI: s = "sori"; break;
|
||||
case AccidentalType::KORON: s = "koron"; break;
|
||||
*/
|
||||
default:
|
||||
qDebug("accSymId2MxmlString: unknown accidental %d", static_cast<int>(id));
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------
|
||||
// mxmlString2accSymId
|
||||
//---------------------------------------------------------
|
||||
|
@ -419,30 +419,30 @@ SymId mxmlString2accSymId(const QString mxmlName)
|
|||
map["flat-flat"] = SymId::accidentalDoubleFlat;
|
||||
|
||||
//map["double-flat"] = SymId::accidentalDoubleFlat;
|
||||
//map["natural-flat"] = Accidental::Type::FLAT;
|
||||
|
||||
//map["natural-flat"] = AccidentalType::FLAT;
|
||||
|
||||
map["quarter-flat"] = SymId::accidentalQuarterToneFlatStein;
|
||||
map["quarter-sharp"] = SymId::accidentalQuarterToneSharpStein;
|
||||
//map["three-quarters-flat"] = Accidental::Type::MIRRORED_FLAT2;
|
||||
//map["three-quarters-sharp"] = Accidental::Type::SHARP_SLASH4;
|
||||
|
||||
//map["sharp-down"] = Accidental::Type::SHARP_ARROW_DOWN;
|
||||
//map["sharp-up"] = Accidental::Type::SHARP_ARROW_UP;
|
||||
//map["natural-down"] = Accidental::Type::NATURAL_ARROW_DOWN;
|
||||
//map["natural-up"] = Accidental::Type::NATURAL_ARROW_UP;
|
||||
//map["flat-down"] = Accidental::Type::FLAT_ARROW_DOWN;
|
||||
//map["flat-up"] = Accidental::Type::FLAT_ARROW_UP;
|
||||
|
||||
//map["three-quarters-flat"] = AccidentalType::MIRRORED_FLAT2;
|
||||
//map["three-quarters-sharp"] = AccidentalType::SHARP_SLASH4;
|
||||
|
||||
//map["sharp-down"] = AccidentalType::SHARP_ARROW_DOWN;
|
||||
//map["sharp-up"] = AccidentalType::SHARP_ARROW_UP;
|
||||
//map["natural-down"] = AccidentalType::NATURAL_ARROW_DOWN;
|
||||
//map["natural-up"] = AccidentalType::NATURAL_ARROW_UP;
|
||||
//map["flat-down"] = AccidentalType::FLAT_ARROW_DOWN;
|
||||
//map["flat-up"] = AccidentalType::FLAT_ARROW_UP;
|
||||
|
||||
map["slash-quarter-sharp"] = SymId::accidentalKucukMucennebSharp;
|
||||
map["slash-sharp"] = SymId::accidentalBuyukMucennebSharp;
|
||||
map["slash-flat"] = SymId::accidentalBakiyeFlat;
|
||||
map["double-slash-flat"] = SymId::accidentalBuyukMucennebFlat;
|
||||
|
||||
//map["sori"] = Accidental::Type::SORI;
|
||||
//map["koron"] = Accidental::Type::KORON;
|
||||
|
||||
//map["natural-sharp"] = Accidental::Type::SHARP;
|
||||
|
||||
|
||||
//map["sori"] = AccidentalType::SORI;
|
||||
//map["koron"] = AccidentalType::KORON;
|
||||
|
||||
//map["natural-sharp"] = AccidentalType::SHARP;
|
||||
|
||||
if (map.contains(mxmlName))
|
||||
return map.value(mxmlName);
|
||||
else
|
||||
|
@ -455,87 +455,87 @@ SymId mxmlString2accSymId(const QString mxmlName)
|
|||
//---------------------------------------------------------
|
||||
// accidentalType2MxmlString
|
||||
//---------------------------------------------------------
|
||||
|
||||
QString accidentalType2MxmlString(const Accidental::Type type)
|
||||
|
||||
QString accidentalType2MxmlString(const AccidentalType type)
|
||||
{
|
||||
QString s;
|
||||
switch (type) {
|
||||
case Accidental::Type::SHARP: s = "sharp"; break;
|
||||
case Accidental::Type::FLAT: s = "flat"; break;
|
||||
case Accidental::Type::SHARP2: s = "double-sharp"; break;
|
||||
case Accidental::Type::FLAT2: s = "flat-flat"; break;
|
||||
case Accidental::Type::NATURAL: s = "natural"; break;
|
||||
case Accidental::Type::FLAT_SLASH: s = "slash-flat"; break;
|
||||
case Accidental::Type::MIRRORED_FLAT: s = "quarter-flat"; break;
|
||||
case Accidental::Type::FLAT_ARROW_UP: s = "flat-up"; break;
|
||||
case Accidental::Type::NATURAL_ARROW_DOWN: s = "natural-down"; break;
|
||||
case Accidental::Type::SHARP_SLASH: s = "quarter-sharp"; break;
|
||||
case Accidental::Type::SHARP_ARROW_DOWN: s = "sharp-down"; break;
|
||||
case Accidental::Type::NATURAL_ARROW_UP: s = "natural-up"; break;
|
||||
case Accidental::Type::MIRRORED_FLAT2: s = "three-quarters-flat"; break;
|
||||
case Accidental::Type::FLAT_FLAT_SLASH: s = "three-quarters-flat"; break;
|
||||
case Accidental::Type::FLAT_ARROW_DOWN: s = "flat-down"; break;
|
||||
case Accidental::Type::SHARP_SLASH4: s = "three-quarters-sharp"; break;
|
||||
case Accidental::Type::SHARP_ARROW_UP: s = "sharp-up"; break;
|
||||
case Accidental::Type::SHARP_SLASH3: s = "slash-quarter-sharp"; break;
|
||||
case Accidental::Type::FLAT_SLASH2: s = "double-slash-flat"; break;
|
||||
case Accidental::Type::SHARP_SLASH2: s = "slash-sharp"; break;
|
||||
case Accidental::Type::SORI: s = "sori"; break;
|
||||
case Accidental::Type::KORON: s = "koron"; break;
|
||||
case AccidentalType::SHARP: s = "sharp"; break;
|
||||
case AccidentalType::FLAT: s = "flat"; break;
|
||||
case AccidentalType::SHARP2: s = "double-sharp"; break;
|
||||
case AccidentalType::FLAT2: s = "flat-flat"; break;
|
||||
case AccidentalType::NATURAL: s = "natural"; break;
|
||||
case AccidentalType::FLAT_SLASH: s = "slash-flat"; break;
|
||||
case AccidentalType::MIRRORED_FLAT: s = "quarter-flat"; break;
|
||||
case AccidentalType::FLAT_ARROW_UP: s = "flat-up"; break;
|
||||
case AccidentalType::NATURAL_ARROW_DOWN: s = "natural-down"; break;
|
||||
case AccidentalType::SHARP_SLASH: s = "quarter-sharp"; break;
|
||||
case AccidentalType::SHARP_ARROW_DOWN: s = "sharp-down"; break;
|
||||
case AccidentalType::NATURAL_ARROW_UP: s = "natural-up"; break;
|
||||
case AccidentalType::MIRRORED_FLAT2: s = "three-quarters-flat"; break;
|
||||
case AccidentalType::FLAT_FLAT_SLASH: s = "three-quarters-flat"; break;
|
||||
case AccidentalType::FLAT_ARROW_DOWN: s = "flat-down"; break;
|
||||
case AccidentalType::SHARP_SLASH4: s = "three-quarters-sharp"; break;
|
||||
case AccidentalType::SHARP_ARROW_UP: s = "sharp-up"; break;
|
||||
case AccidentalType::SHARP_SLASH3: s = "slash-quarter-sharp"; break;
|
||||
case AccidentalType::FLAT_SLASH2: s = "double-slash-flat"; break;
|
||||
case AccidentalType::SHARP_SLASH2: s = "slash-sharp"; break;
|
||||
case AccidentalType::SORI: s = "sori"; break;
|
||||
case AccidentalType::KORON: s = "koron"; break;
|
||||
default:
|
||||
qDebug("accidentalType2MxmlString: unknown accidental %d", static_cast<int>(type));
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------
|
||||
// mxmlString2accidentalType
|
||||
//---------------------------------------------------------
|
||||
|
||||
/**
|
||||
Convert a MusicXML accidental name to a MuseScore enum Accidental::Type.
|
||||
Convert a MusicXML accidental name to a MuseScore enum AccidentalType.
|
||||
*/
|
||||
|
||||
Accidental::Type mxmlString2accidentalType(const QString mxmlName)
|
||||
AccidentalType mxmlString2accidentalType(const QString mxmlName)
|
||||
{
|
||||
QMap<QString, Accidental::Type> map; // map MusicXML accidental name to MuseScore enum Accidental::Type
|
||||
map["natural"] = Accidental::Type::NATURAL;
|
||||
map["flat"] = Accidental::Type::FLAT;
|
||||
map["sharp"] = Accidental::Type::SHARP;
|
||||
map["double-sharp"] = Accidental::Type::SHARP2;
|
||||
map["sharp-sharp"] = Accidental::Type::SHARP2;
|
||||
map["flat-flat"] = Accidental::Type::FLAT2;
|
||||
map["double-flat"] = Accidental::Type::FLAT2;
|
||||
map["natural-flat"] = Accidental::Type::FLAT;
|
||||
|
||||
map["quarter-flat"] = Accidental::Type::MIRRORED_FLAT;
|
||||
map["quarter-sharp"] = Accidental::Type::SHARP_SLASH;
|
||||
map["three-quarters-flat"] = Accidental::Type::MIRRORED_FLAT2;
|
||||
map["three-quarters-sharp"] = Accidental::Type::SHARP_SLASH4;
|
||||
|
||||
map["sharp-down"] = Accidental::Type::SHARP_ARROW_DOWN;
|
||||
map["sharp-up"] = Accidental::Type::SHARP_ARROW_UP;
|
||||
map["natural-down"] = Accidental::Type::NATURAL_ARROW_DOWN;
|
||||
map["natural-up"] = Accidental::Type::NATURAL_ARROW_UP;
|
||||
map["flat-down"] = Accidental::Type::FLAT_ARROW_DOWN;
|
||||
map["flat-up"] = Accidental::Type::FLAT_ARROW_UP;
|
||||
|
||||
map["slash-quarter-sharp"] = Accidental::Type::SHARP_SLASH3; // MIRRORED_FLAT_SLASH; ?
|
||||
map["slash-sharp"] = Accidental::Type::SHARP_SLASH2; // SHARP_SLASH; ?
|
||||
map["slash-flat"] = Accidental::Type::FLAT_SLASH;
|
||||
map["double-slash-flat"] = Accidental::Type::FLAT_SLASH2;
|
||||
|
||||
map["sori"] = Accidental::Type::SORI;
|
||||
map["koron"] = Accidental::Type::KORON;
|
||||
|
||||
map["natural-sharp"] = Accidental::Type::SHARP;
|
||||
|
||||
QMap<QString, AccidentalType> map; // map MusicXML accidental name to MuseScore enum AccidentalType
|
||||
map["natural"] = AccidentalType::NATURAL;
|
||||
map["flat"] = AccidentalType::FLAT;
|
||||
map["sharp"] = AccidentalType::SHARP;
|
||||
map["double-sharp"] = AccidentalType::SHARP2;
|
||||
map["sharp-sharp"] = AccidentalType::SHARP2;
|
||||
map["flat-flat"] = AccidentalType::FLAT2;
|
||||
map["double-flat"] = AccidentalType::FLAT2;
|
||||
map["natural-flat"] = AccidentalType::FLAT;
|
||||
|
||||
map["quarter-flat"] = AccidentalType::MIRRORED_FLAT;
|
||||
map["quarter-sharp"] = AccidentalType::SHARP_SLASH;
|
||||
map["three-quarters-flat"] = AccidentalType::MIRRORED_FLAT2;
|
||||
map["three-quarters-sharp"] = AccidentalType::SHARP_SLASH4;
|
||||
|
||||
map["sharp-down"] = AccidentalType::SHARP_ARROW_DOWN;
|
||||
map["sharp-up"] = AccidentalType::SHARP_ARROW_UP;
|
||||
map["natural-down"] = AccidentalType::NATURAL_ARROW_DOWN;
|
||||
map["natural-up"] = AccidentalType::NATURAL_ARROW_UP;
|
||||
map["flat-down"] = AccidentalType::FLAT_ARROW_DOWN;
|
||||
map["flat-up"] = AccidentalType::FLAT_ARROW_UP;
|
||||
|
||||
map["slash-quarter-sharp"] = AccidentalType::SHARP_SLASH3; // MIRRORED_FLAT_SLASH; ?
|
||||
map["slash-sharp"] = AccidentalType::SHARP_SLASH2; // SHARP_SLASH; ?
|
||||
map["slash-flat"] = AccidentalType::FLAT_SLASH;
|
||||
map["double-slash-flat"] = AccidentalType::FLAT_SLASH2;
|
||||
|
||||
map["sori"] = AccidentalType::SORI;
|
||||
map["koron"] = AccidentalType::KORON;
|
||||
|
||||
map["natural-sharp"] = AccidentalType::SHARP;
|
||||
|
||||
if (map.contains(mxmlName))
|
||||
return map.value(mxmlName);
|
||||
else
|
||||
qDebug("mxmlString2accidentalType: unknown accidental '%s'", qPrintable(mxmlName));
|
||||
// default: return Accidental::Type::NONE
|
||||
return Accidental::Type::NONE;
|
||||
// default: return AccidentalType::NONE
|
||||
return AccidentalType::NONE;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -193,10 +193,10 @@ private:
|
|||
extern void domError(const QDomElement&);
|
||||
extern void domNotImplemented(const QDomElement&);
|
||||
|
||||
|
||||
|
||||
extern QString accSymId2MxmlString(const SymId id);
|
||||
extern QString accidentalType2MxmlString(const Accidental::Type type);
|
||||
extern Accidental::Type mxmlString2accidentalType(const QString mxmlName);
|
||||
extern QString accidentalType2MxmlString(const AccidentalType type);
|
||||
extern AccidentalType mxmlString2accidentalType(const QString mxmlName);
|
||||
extern SymId mxmlString2accSymId(const QString mxmlName);
|
||||
|
||||
} // namespace Ms
|
||||
|
|
Loading…
Reference in a new issue