From 4c0db9b19b4cb25dd9a4286feb0ee3847d13976e Mon Sep 17 00:00:00 2001 From: Matt McClinch Date: Mon, 13 Apr 2020 10:15:06 -0400 Subject: [PATCH] fix #294542: Allow setting notehead scheme on a note-by-note basis in the Inspector MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resolves: https://musescore.org/en/node/294542. Up until now, notehead scheme has only been a StaffType property. If a Note is going to have its own notehead scheme, it seems fitting to do a bit of reorganization. Here is a summary of the changes made: - Moved enum class NoteHeadScheme to NoteHead::Scheme, alongside NoteHead::Group and NoteHead::Type. - Added HEAD_AUTO as a possible value for NoteHead::Scheme. - Moved scheme2userName(), scheme2name(), and name2scheme() from class StaffType to class NoteHead. - Renamed Pid::STAFF_NOTEHEAD_SCHEME to Pid::HEAD_SCHEME. This change is reflected in the Plugin API, with Element property staffNoteheadScheme being renamed to headScheme. This should not break too many existing plugins, because the NoteHeadScheme enum values have never been exposed until now. Speaking of which, - Exposed the NoteHead::Scheme enum values to the Plugin API as NoteHeadScheme.HEAD_AUTO, etc. And finally, (and the main point of all of this): - Added a property of type NoteHead::Scheme to class Note, and exposed it via the Inspector. If set to HEAD_AUTO (the default), the StaffType’s noteHeadScheme will be used. Otherwise, this will override the StaffType’s noteHeadScheme. --- libmscore/mscore.h | 13 --- libmscore/note.cpp | 129 ++++++++++++++++++++++------- libmscore/note.h | 36 ++++++-- libmscore/property.cpp | 7 +- libmscore/property.h | 3 +- libmscore/stafftype.cpp | 44 +--------- libmscore/stafftype.h | 10 +-- libmscore/stafftypechange.cpp | 10 +-- mscore/editstafftype.cpp | 24 +++--- mscore/inspector/inspector.cpp | 22 ++--- mscore/inspector/inspectorNote.cpp | 49 +++++++++-- mscore/inspector/inspectorNote.h | 1 + mscore/inspector/inspector_note.ui | 74 +++++++++++++---- mscore/plugin/api/elements.h | 3 +- mscore/plugin/api/qmlpluginapi.cpp | 2 + mscore/plugin/api/qmlpluginapi.h | 2 + 16 files changed, 282 insertions(+), 147 deletions(-) diff --git a/libmscore/mscore.h b/libmscore/mscore.h index 4084eaca43..f636eef059 100644 --- a/libmscore/mscore.h +++ b/libmscore/mscore.h @@ -179,19 +179,6 @@ enum class StaffGroup : char { }; const int STAFF_GROUP_MAX = int(StaffGroup::TAB) + 1; // out of enum to avoid compiler complains about not handled switch cases -enum class NoteHeadScheme : char { - HEAD_NORMAL = 0, - HEAD_PITCHNAME, - HEAD_PITCHNAME_GERMAN, - HEAD_SOLFEGE, - HEAD_SOLFEGE_FIXED, - HEAD_SHAPE_NOTE_4, - HEAD_SHAPE_NOTE_7_AIKIN, - HEAD_SHAPE_NOTE_7_FUNK, - HEAD_SHAPE_NOTE_7_WALKER, - HEAD_SCHEMES - }; - //--------------------------------------------------------- // BarLineType //--------------------------------------------------------- diff --git a/libmscore/note.cpp b/libmscore/note.cpp index 01f96badb4..f7df311265 100644 --- a/libmscore/note.cpp +++ b/libmscore/note.cpp @@ -215,6 +215,20 @@ struct NoteHeadName { const char* username; }; +// same order as NoteHead::Scheme +static NoteHeadName noteHeadSchemeNames[] = { + {"auto", QT_TRANSLATE_NOOP("noteheadschemes", "Auto") }, + {"normal", QT_TRANSLATE_NOOP("noteheadschemes", "Normal") }, + {"name-pitch", QT_TRANSLATE_NOOP("noteheadschemes", "Pitch Names") }, + {"name-pitch-german", QT_TRANSLATE_NOOP("noteheadschemes", "German Pitch Names") }, + {"solfege-movable", QT_TRANSLATE_NOOP("noteheadschemes", "Solf\u00e8ge Movable Do") }, // è + {"solfege-fixed", QT_TRANSLATE_NOOP("noteheadschemes", "Solf\u00e8ge Fixed Do") }, // è + {"shape-4", QT_TRANSLATE_NOOP("noteheadschemes", "4-shape (Walker)") }, + {"shape-7-aikin", QT_TRANSLATE_NOOP("noteheadschemes", "7-shape (Aikin)") }, + {"shape-7-funk", QT_TRANSLATE_NOOP("noteheadschemes", "7-shape (Funk)") }, + {"shape-7-walker", QT_TRANSLATE_NOOP("noteheadschemes", "7-shape (Walker)") } + }; + // same order as NoteHead::Group static NoteHeadName noteHeadGroupNames[] = { {"normal", QT_TRANSLATE_NOOP("noteheadnames", "Normal") }, @@ -298,6 +312,15 @@ static NoteHeadName noteHeadTypeNames[] = { {"breve", QT_TRANSLATE_NOOP("noteheadnames", "Breve") }, }; +//--------------------------------------------------------- +// scheme2userName +//--------------------------------------------------------- + +QString NoteHead::scheme2userName(NoteHead::Scheme scheme) + { + return qApp->translate("noteheadschemes", noteHeadSchemeNames[int(scheme) + 1].username); + } + //--------------------------------------------------------- // group2userName //--------------------------------------------------------- @@ -316,6 +339,15 @@ QString NoteHead::type2userName(NoteHead::Type type) return qApp->translate("noteheadnames", noteHeadTypeNames[int(type) + 1].username); } +//--------------------------------------------------------- +// scheme2name +//--------------------------------------------------------- + +QString NoteHead::scheme2name(NoteHead::Scheme scheme) + { + return noteHeadSchemeNames[int(scheme) + 1].name; + } + //--------------------------------------------------------- // group2name //--------------------------------------------------------- @@ -334,11 +366,24 @@ QString NoteHead::type2name(NoteHead::Type type) return noteHeadTypeNames[int(type) + 1].name; } +//--------------------------------------------------------- +// name2scheme +//--------------------------------------------------------- + +NoteHead::Scheme NoteHead::name2scheme(const QString& s) + { + for (int i = 0; i <= int(NoteHead::Scheme::HEAD_SCHEMES); ++i) { + if (noteHeadSchemeNames[i].name == s) + return NoteHead::Scheme(i - 1); + } + return NoteHead::Scheme::HEAD_NORMAL; + } + //--------------------------------------------------------- // name2group //--------------------------------------------------------- -NoteHead::Group NoteHead::name2group(QString s) +NoteHead::Group NoteHead::name2group(const QString& s) { for (int i = 0; i < int(NoteHead::Group::HEAD_GROUPS); ++i) { if (noteHeadGroupNames[i].name == s) @@ -351,7 +396,7 @@ NoteHead::Group NoteHead::name2group(QString s) // name2type //--------------------------------------------------------- -NoteHead::Type NoteHead::name2type(QString s) +NoteHead::Type NoteHead::name2type(const QString& s) { for (int i = 0; i <= int(NoteHead::Type::HEAD_TYPES); ++i) { if (noteHeadTypeNames[i].name == s) @@ -369,17 +414,17 @@ SymId Note::noteHead(int direction, NoteHead::Group group, NoteHead::Type t) return noteHeads[direction][int(group)][int(t)]; } -SymId Note::noteHead(int direction, NoteHead::Group group, NoteHead::Type t, int tpc, Key key, NoteHeadScheme scheme) +SymId Note::noteHead(int direction, NoteHead::Group group, NoteHead::Type t, int tpc, Key key, NoteHead::Scheme scheme) { // shortcut - if (scheme == NoteHeadScheme::HEAD_NORMAL) + if (scheme == NoteHead::Scheme::HEAD_NORMAL) return noteHeads[direction][int(group)][int(t)]; // other schemes - if (scheme == NoteHeadScheme::HEAD_PITCHNAME || scheme == NoteHeadScheme::HEAD_PITCHNAME_GERMAN) { + if (scheme == NoteHead::Scheme::HEAD_PITCHNAME || scheme == NoteHead::Scheme::HEAD_PITCHNAME_GERMAN) { if (tpc == Tpc::TPC_A) group = NoteHead::Group::HEAD_A; else if (tpc == Tpc::TPC_B) { - if (scheme == NoteHeadScheme::HEAD_PITCHNAME_GERMAN) + if (scheme == NoteHead::Scheme::HEAD_PITCHNAME_GERMAN) group = NoteHead::Group::HEAD_H; else group = NoteHead::Group::HEAD_B; @@ -397,7 +442,7 @@ SymId Note::noteHead(int direction, NoteHead::Group group, NoteHead::Type t, int else if (tpc == Tpc::TPC_A_S) group = NoteHead::Group::HEAD_A_SHARP; else if (tpc == Tpc::TPC_B_S) - if (scheme == NoteHeadScheme::HEAD_PITCHNAME_GERMAN) + if (scheme == NoteHead::Scheme::HEAD_PITCHNAME_GERMAN) group = NoteHead::Group::HEAD_H_SHARP; else group = NoteHead::Group::HEAD_B_SHARP; @@ -414,7 +459,7 @@ SymId Note::noteHead(int direction, NoteHead::Group group, NoteHead::Type t, int else if (tpc == Tpc::TPC_A_B) group = NoteHead::Group::HEAD_A_FLAT; else if (tpc == Tpc::TPC_B_B) - if (scheme == NoteHeadScheme::HEAD_PITCHNAME_GERMAN) + if (scheme == NoteHead::Scheme::HEAD_PITCHNAME_GERMAN) group = NoteHead::Group::HEAD_B; else group = NoteHead::Group::HEAD_B_FLAT; @@ -429,7 +474,7 @@ SymId Note::noteHead(int direction, NoteHead::Group group, NoteHead::Type t, int else if (tpc == Tpc::TPC_G_B) group = NoteHead::Group::HEAD_G_FLAT; } - else if (scheme == NoteHeadScheme::HEAD_SHAPE_NOTE_4) { + else if (scheme == NoteHead::Scheme::HEAD_SHAPE_NOTE_4) { int degree = tpc2degree(tpc, key); switch (degree) { case 0: @@ -445,25 +490,25 @@ SymId Note::noteHead(int direction, NoteHead::Group group, NoteHead::Type t, int group = NoteHead::Group::HEAD_MI; break; } } - else if (scheme == NoteHeadScheme::HEAD_SHAPE_NOTE_7_AIKIN - || scheme == NoteHeadScheme::HEAD_SHAPE_NOTE_7_FUNK - || scheme == NoteHeadScheme::HEAD_SHAPE_NOTE_7_WALKER) { + else if (scheme == NoteHead::Scheme::HEAD_SHAPE_NOTE_7_AIKIN + || scheme == NoteHead::Scheme::HEAD_SHAPE_NOTE_7_FUNK + || scheme == NoteHead::Scheme::HEAD_SHAPE_NOTE_7_WALKER) { int degree = tpc2degree(tpc, key); switch (degree) { case 0: - if (scheme == NoteHeadScheme::HEAD_SHAPE_NOTE_7_AIKIN) + if (scheme == NoteHead::Scheme::HEAD_SHAPE_NOTE_7_AIKIN) group = NoteHead::Group::HEAD_DO; - else if (scheme == NoteHeadScheme::HEAD_SHAPE_NOTE_7_FUNK) + else if (scheme == NoteHead::Scheme::HEAD_SHAPE_NOTE_7_FUNK) group = NoteHead::Group::HEAD_DO_FUNK; - else if (scheme == NoteHeadScheme::HEAD_SHAPE_NOTE_7_WALKER) + else if (scheme == NoteHead::Scheme::HEAD_SHAPE_NOTE_7_WALKER) group = NoteHead::Group::HEAD_DO_WALKER; break; case 1: - if (scheme == NoteHeadScheme::HEAD_SHAPE_NOTE_7_AIKIN) + if (scheme == NoteHead::Scheme::HEAD_SHAPE_NOTE_7_AIKIN) group = NoteHead::Group::HEAD_RE; - else if (scheme == NoteHeadScheme::HEAD_SHAPE_NOTE_7_FUNK) + else if (scheme == NoteHead::Scheme::HEAD_SHAPE_NOTE_7_FUNK) group = NoteHead::Group::HEAD_RE_FUNK; - else if (scheme == NoteHeadScheme::HEAD_SHAPE_NOTE_7_WALKER) + else if (scheme == NoteHead::Scheme::HEAD_SHAPE_NOTE_7_WALKER) group = NoteHead::Group::HEAD_RE_WALKER; break; case 2: @@ -475,16 +520,16 @@ SymId Note::noteHead(int direction, NoteHead::Group group, NoteHead::Type t, int case 5: group = NoteHead::Group::HEAD_LA; break; case 6: - if (scheme == NoteHeadScheme::HEAD_SHAPE_NOTE_7_AIKIN) + if (scheme == NoteHead::Scheme::HEAD_SHAPE_NOTE_7_AIKIN) group = NoteHead::Group::HEAD_TI; - else if (scheme == NoteHeadScheme::HEAD_SHAPE_NOTE_7_FUNK) + else if (scheme == NoteHead::Scheme::HEAD_SHAPE_NOTE_7_FUNK) group = NoteHead::Group::HEAD_TI_FUNK; - else if (scheme == NoteHeadScheme::HEAD_SHAPE_NOTE_7_WALKER) + else if (scheme == NoteHead::Scheme::HEAD_SHAPE_NOTE_7_WALKER) group = NoteHead::Group::HEAD_TI_WALKER; break; } } - else if (scheme == NoteHeadScheme::HEAD_SOLFEGE) { + else if (scheme == NoteHead::Scheme::HEAD_SOLFEGE) { int degree = tpc2degree(tpc, key); switch (degree) { case 0: @@ -503,7 +548,7 @@ SymId Note::noteHead(int direction, NoteHead::Group group, NoteHead::Type t, int group = NoteHead::Group::HEAD_TI_NAME; break; } } - else if (scheme == NoteHeadScheme::HEAD_SOLFEGE_FIXED) { + else if (scheme == NoteHead::Scheme::HEAD_SOLFEGE_FIXED) { QString stepName = tpc2stepName(tpc); if (stepName == "C") group = NoteHead::Group::HEAD_DO_NAME; @@ -582,6 +627,7 @@ Note::Note(const Note& n, bool link) _tuning = n._tuning; _veloType = n._veloType; _veloOffset = n._veloOffset; + _headScheme = n._headScheme; _headGroup = n._headGroup; _headType = n._headType; _mirror = n._mirror; @@ -822,14 +868,17 @@ SymId Note::noteHead() const } Key key = Key::C; - NoteHeadScheme scheme = NoteHeadScheme::HEAD_NORMAL; + NoteHead::Scheme scheme = _headScheme; if (st) { Fraction tick = chord()->tick(); if (tick >= Fraction(0,1)) { key = st->key(tick); - scheme = st->staffTypeForElement(chord())->noteHeadScheme(); + if (scheme == NoteHead::Scheme::HEAD_AUTO) + scheme = st->staffTypeForElement(chord())->noteHeadScheme(); } } + if (scheme == NoteHead::Scheme::HEAD_AUTO) + scheme = NoteHead::Scheme::HEAD_NORMAL; SymId t = noteHead(up, _headGroup, ht, tpc(), key, scheme); if (t == SymId::noSym) { qDebug("invalid notehead %d/%d", int(_headGroup), int(ht)); @@ -1093,8 +1142,11 @@ bool Note::isNoteName() const { if (chord() && chord()->staff()) { const Staff* st = staff(); - NoteHeadScheme s = st->staffTypeForElement(this)->noteHeadScheme(); - return s == NoteHeadScheme::HEAD_PITCHNAME || s == NoteHeadScheme::HEAD_PITCHNAME_GERMAN || s == NoteHeadScheme::HEAD_SOLFEGE || s == NoteHeadScheme::HEAD_SOLFEGE_FIXED; + NoteHead::Scheme s = _headScheme; + if (s == NoteHead::Scheme::HEAD_AUTO) + s = st->staffTypeForElement(this)->noteHeadScheme(); + return s == NoteHead::Scheme::HEAD_PITCHNAME || s == NoteHead::Scheme::HEAD_PITCHNAME_GERMAN || s == NoteHead::Scheme::HEAD_SOLFEGE || s == NoteHead::Scheme::HEAD_SOLFEGE_FIXED; + } return false; } @@ -1209,7 +1261,7 @@ void Note::write(XmlWriter& xml) const xml.etag(); } for (Pid id : { Pid::PITCH, Pid::TPC1, Pid::TPC2, Pid::SMALL, Pid::MIRROR_HEAD, Pid::DOT_POSITION, - Pid::HEAD_GROUP, Pid::VELO_OFFSET, Pid::PLAY, Pid::TUNING, Pid::FRET, Pid::STRING, + Pid::HEAD_SCHEME, Pid::HEAD_GROUP, Pid::VELO_OFFSET, Pid::PLAY, Pid::TUNING, Pid::FRET, Pid::STRING, Pid::GHOST, Pid::HEAD_TYPE, Pid::VELO_TYPE, Pid::FIXED, Pid::FIXED_LINE }) { writeProperty(xml, id); @@ -1339,6 +1391,8 @@ bool Note::readProperties(XmlReader& e) setFixed(e.readBool()); else if (tag == "fixedLine") setFixedLine(e.readInt()); + else if (tag == "headScheme") + readProperty(e, Pid::HEAD_SCHEME); else if (tag == "head") readProperty(e, Pid::HEAD_GROUP); else if (tag == "velocity") @@ -2252,6 +2306,18 @@ void Note::setString(int val) rypos() = _string * spatium() * 1.5; } +//--------------------------------------------------------- +// setHeadScheme +//--------------------------------------------------------- + +void Note::setHeadScheme(NoteHead::Scheme val) + { + IF_ASSERT_FAILED(int(val) >= -1 && int(val) < int(NoteHead::Scheme::HEAD_SCHEMES)) { + val = NoteHead::Scheme::HEAD_AUTO; + } + _headScheme = val; + } + //--------------------------------------------------------- // setHeadGroup //--------------------------------------------------------- @@ -2654,6 +2720,8 @@ QVariant Note::getProperty(Pid propertyId) const return int(userMirror()); case Pid::DOT_POSITION: return QVariant::fromValue(userDotPosition()); + case Pid::HEAD_SCHEME: + return int(headScheme()); case Pid::HEAD_GROUP: return int(headGroup()); case Pid::VELO_OFFSET: @@ -2715,6 +2783,9 @@ bool Note::setProperty(Pid propertyId, const QVariant& v) setUserDotPosition(v.value()); triggerLayout(); return true; + case Pid::HEAD_SCHEME: + setHeadScheme(NoteHead::Scheme(v.toInt())); + break; case Pid::HEAD_GROUP: setHeadGroup(NoteHead::Group(v.toInt())); break; @@ -2791,6 +2862,8 @@ QVariant Note::propertyDefault(Pid propertyId) const return int(MScore::DirectionH::AUTO); case Pid::DOT_POSITION: return QVariant::fromValue(Direction::AUTO); + case Pid::HEAD_SCHEME: + return int(NoteHead::Scheme::HEAD_AUTO); case Pid::HEAD_GROUP: return int(NoteHead::Group::HEAD_NORMAL); case Pid::VELO_OFFSET: diff --git a/libmscore/note.h b/libmscore/note.h index 8955d5d25e..86e9fb73fe 100644 --- a/libmscore/note.h +++ b/libmscore/note.h @@ -53,6 +53,23 @@ static const int MAX_DOTS = 4; class NoteHead final : public Symbol { Q_GADGET public: + // keep in sync with noteHeadSchemeNames array in note.cpp + enum class Scheme : signed char { + ///.\{ + HEAD_AUTO = -1, + HEAD_NORMAL, + HEAD_PITCHNAME, + HEAD_PITCHNAME_GERMAN, + HEAD_SOLFEGE, + HEAD_SOLFEGE_FIXED, + HEAD_SHAPE_NOTE_4, + HEAD_SHAPE_NOTE_7_AIKIN, + HEAD_SHAPE_NOTE_7_FUNK, + HEAD_SHAPE_NOTE_7_WALKER, + HEAD_SCHEMES + ///\} + }; + // keep in sync with noteHeadGroupNames array in note.cpp enum class Group : signed char { ///.\{ HEAD_NORMAL = 0, @@ -126,6 +143,7 @@ class NoteHead final : public Symbol { HEAD_INVALID = -1 ///\} }; + // keep in sync with noteHeadTypeNames array in note.cpp enum class Type : signed char { ///.\{ HEAD_AUTO = -1, @@ -137,6 +155,7 @@ class NoteHead final : public Symbol { ///\} }; + Q_ENUM(Scheme); Q_ENUM(Group); Q_ENUM(Type); @@ -147,12 +166,15 @@ class NoteHead final : public Symbol { Group headGroup() const; + static QString scheme2userName(Scheme scheme); static QString group2userName(Group group); static QString type2userName(Type type); + static QString scheme2name(Scheme scheme); static QString group2name(Group group); static QString type2name(Type type); - static Group name2group(QString s); - static Type name2type(QString s); + static Scheme name2scheme(const QString& s); + static Group name2group(const QString& s); + static Type name2type(const QString& s); }; //--------------------------------------------------------- @@ -186,8 +208,9 @@ static const int INVALID_LINE = -10000; // @P elements array[Element] list of elements attached to notehead // @P fret int fret number in tablature // @P ghost bool ghost note (guitar: death note) -// @P headGroup enum (NoteHead.HEAD_NORMAL, .HEAD_BREVIS_ALT, .HEAD_CROSS, .HEAD_DIAMOND, .HEAD_DO, .HEAD_FA, .HEAD_LA, .HEAD_MI, .HEAD_RE, .HEAD_SLASH, .HEAD_SOL, .HEAD_TI, .HEAD_XCIRCLE, .HEAD_TRIANGLE) -// @P headType enum (NoteHead.HEAD_AUTO, .HEAD_BREVIS, .HEAD_HALF, .HEAD_QUARTER, .HEAD_WHOLE) +// @P headScheme enum (NoteHeadScheme.HEAD_AUTO, .HEAD_NORMAL, .HEAD_PITCHNAME, .HEAD_PITCHNAME_GERMAN, .HEAD_SHAPE_NOTE_4, .HEAD_SHAPE_NOTE_7_AIKIN, .HEAD_SHAPE_NOTE_7_FUNK, .HEAD_SHAPE_NOTE_7_WALKER, .HEAD_SOLFEGE, .HEAD_SOLFEGE_FIXED) +// @P headGroup enum (NoteHeadGroup.HEAD_NORMAL, .HEAD_BREVIS_ALT, .HEAD_CROSS, .HEAD_DIAMOND, .HEAD_DO, .HEAD_FA, .HEAD_LA, .HEAD_MI, .HEAD_RE, .HEAD_SLASH, .HEAD_SOL, .HEAD_TI, .HEAD_XCIRCLE, .HEAD_TRIANGLE) +// @P headType enum (NoteHeadType.HEAD_AUTO, .HEAD_BREVIS, .HEAD_HALF, .HEAD_QUARTER, .HEAD_WHOLE) // @P hidden bool hidden, not played note (read only) // @P line int notehead position (read only) // @P mirror bool mirror notehead on x axis (read only) @@ -234,6 +257,7 @@ class Note final : public Element { MScore::DirectionH _userMirror { MScore::DirectionH::AUTO }; ///< user override of mirror Direction _userDotPosition { Direction::AUTO }; ///< user override of dot position + NoteHead::Scheme _headScheme { NoteHead::Scheme::HEAD_AUTO }; NoteHead::Group _headGroup { NoteHead::Group::HEAD_NORMAL }; NoteHead::Type _headType { NoteHead::Type::HEAD_AUTO }; @@ -319,8 +343,10 @@ class Note final : public Element { qreal bboxRightPos() const; qreal headBodyWidth() const; + NoteHead::Scheme headScheme() const { return _headScheme; } NoteHead::Group headGroup() const { return _headGroup; } NoteHead::Type headType() const { return _headType; } + void setHeadScheme(NoteHead::Scheme val); void setHeadGroup(NoteHead::Group val); void setHeadType(NoteHead::Type t); @@ -478,7 +504,7 @@ class Note final : public Element { void addParentheses(); - static SymId noteHead(int direction, NoteHead::Group, NoteHead::Type, int tpc, Key key, NoteHeadScheme scheme); + static SymId noteHead(int direction, NoteHead::Group, NoteHead::Type, int tpc, Key key, NoteHead::Scheme scheme); static SymId noteHead(int direction, NoteHead::Group, NoteHead::Type); NoteVal noteVal() const; diff --git a/libmscore/property.cpp b/libmscore/property.cpp index b047e9335f..69b28f7b1d 100644 --- a/libmscore/property.cpp +++ b/libmscore/property.cpp @@ -253,7 +253,7 @@ static constexpr PropertyMetaData propertyList[] = { { Pid::STAFF_SHOW_LEDGERLINES, false, "", P_TYPE::BOOL, DUMMY_QT_TRANSLATE_NOOP("propertyName", "showing ledgerlines") }, { Pid::STAFF_STEMLESS, false, "", P_TYPE::BOOL, DUMMY_QT_TRANSLATE_NOOP("propertyName", "stemless") }, - { Pid::STAFF_NOTEHEAD_SCHEME, false, "", P_TYPE::INT, DUMMY_QT_TRANSLATE_NOOP("propertyName", "notehead scheme") }, + { Pid::HEAD_SCHEME, false, "headScheme", P_TYPE::HEAD_SCHEME, DUMMY_QT_TRANSLATE_NOOP("propertyName", "notehead scheme") }, { Pid::STAFF_GEN_CLEF, false, "", P_TYPE::BOOL, DUMMY_QT_TRANSLATE_NOOP("propertyName", "generating clefs") }, { Pid::STAFF_GEN_TIMESIG, false, "", P_TYPE::BOOL, DUMMY_QT_TRANSLATE_NOOP("propertyName", "generating time signature") }, { Pid::STAFF_GEN_KEYSIG, false, "", P_TYPE::BOOL, DUMMY_QT_TRANSLATE_NOOP("propertyName", "generating key signature") }, @@ -532,6 +532,8 @@ QVariant propertyFromString(Pid id, QString value) return QVariant(); case P_TYPE::SYMID: return QVariant::fromValue(Sym::name2id(value)); + case P_TYPE::HEAD_SCHEME: + return QVariant::fromValue(NoteHead::name2scheme(value)); case P_TYPE::HEAD_GROUP: return QVariant::fromValue(NoteHead::name2group(value)); case P_TYPE::HEAD_TYPE: @@ -621,6 +623,7 @@ QVariant readProperty(Pid id, XmlReader& e) case P_TYPE::TEXT_PLACE: case P_TYPE::BARLINE_TYPE: case P_TYPE::SYMID: + case P_TYPE::HEAD_SCHEME: case P_TYPE::HEAD_GROUP: case P_TYPE::HEAD_TYPE: case P_TYPE::SUB_STYLE: @@ -788,6 +791,8 @@ QString propertyToString(Pid id, QVariant value, bool mscx) return Sym::id2name(SymId(value.toInt())); case P_TYPE::BARLINE_TYPE: return BarLine::barLineTypeName(BarLineType(value.toInt())); + case P_TYPE::HEAD_SCHEME: + return NoteHead::scheme2name(NoteHead::Scheme(value.toInt())); case P_TYPE::HEAD_GROUP: return NoteHead::group2name(NoteHead::Group(value.toInt())); case P_TYPE::HEAD_TYPE: diff --git a/libmscore/property.h b/libmscore/property.h index edaab23db7..10260cc05a 100644 --- a/libmscore/property.h +++ b/libmscore/property.h @@ -263,7 +263,7 @@ enum class Pid { STAFF_SHOW_LEDGERLINES, STAFF_STEMLESS, - STAFF_NOTEHEAD_SCHEME, + HEAD_SCHEME, STAFF_GEN_CLEF, STAFF_GEN_TIMESIG, STAFF_GEN_KEYSIG, @@ -400,6 +400,7 @@ enum class P_TYPE : char { KEYMODE, // enum class KeyMode PATH, // QPainterPath + HEAD_SCHEME, // enum class NoteHead::Scheme }; extern QVariant readProperty(Pid type, XmlReader& e); diff --git a/libmscore/stafftype.cpp b/libmscore/stafftype.cpp index bd8c0f4fd8..aacca5b8b0 100644 --- a/libmscore/stafftype.cpp +++ b/libmscore/stafftype.cpp @@ -221,7 +221,7 @@ void StaffType::write(XmlWriter& xml) const if (!_genTimesig) xml.tag("timesig", _genTimesig); if (_group == StaffGroup::STANDARD) { - xml.tag("noteheadScheme", StaffType::scheme2name(_noteHeadScheme), StaffType::scheme2name(NoteHeadScheme::HEAD_NORMAL)); + xml.tag("noteheadScheme", NoteHead::scheme2name(_noteHeadScheme), NoteHead::scheme2name(NoteHead::Scheme::HEAD_NORMAL)); } if (_group == StaffGroup::STANDARD || _group == StaffGroup::PERCUSSION) { if (!_genKeysig) @@ -305,7 +305,7 @@ void StaffType::read(XmlReader& e) else if (tag == "timesig") setGenTimesig(e.readInt()); else if (tag == "noteheadScheme") - setNoteHeadScheme(StaffType::name2scheme(e.readElementText())); + setNoteHeadScheme(NoteHead::name2scheme(e.readElementText())); else if (tag == "keysig") _genKeysig = e.readInt(); else if (tag == "ledgerlines") @@ -1316,46 +1316,6 @@ const StaffType* StaffType::getDefaultPreset(StaffGroup grp) return &_presets[_idx]; } -//--------------------------------------------------------- -// NoteHeadScheme utils -//--------------------------------------------------------- - -struct NoteHeadSchemeName { - const char* name; - const char* username; - }; - -static NoteHeadSchemeName noteHeadSchemeNames[] = { - {"normal", QT_TRANSLATE_NOOP("noteheadschemes", "Normal") }, - {"name-pitch", QT_TRANSLATE_NOOP("noteheadschemes", "Pitch Names") }, - {"name-pitch-german", QT_TRANSLATE_NOOP("noteheadschemes", "German Pitch Names") }, - {"solfege-movable", QT_TRANSLATE_NOOP("noteheadschemes", "Solf\u00e8ge Movable Do") }, // è - {"solfege-fixed", QT_TRANSLATE_NOOP("noteheadschemes", "Solf\u00e8ge Fixed Do") }, // è - {"shape-4", QT_TRANSLATE_NOOP("noteheadschemes", "4-shape (Walker)") }, - {"shape-7-aikin", QT_TRANSLATE_NOOP("noteheadschemes", "7-shape (Aikin)") }, - {"shape-7-funk", QT_TRANSLATE_NOOP("noteheadschemes", "7-shape (Funk)") }, - {"shape-7-walker", QT_TRANSLATE_NOOP("noteheadschemes", "7-shape (Walker)") } - }; - -QString StaffType::scheme2userName(NoteHeadScheme ns) - { - return qApp->translate("noteheadschemes", noteHeadSchemeNames[int(ns)].username); - } - -QString StaffType::scheme2name(NoteHeadScheme ns) - { - return noteHeadSchemeNames[int(ns)].name; - } - -NoteHeadScheme StaffType::name2scheme(QString name) - { - for (int i = 0; i < int(NoteHeadScheme::HEAD_SCHEMES); ++i) { - if (noteHeadSchemeNames[i].name == name) - return NoteHeadScheme(i); - } - return NoteHeadScheme::HEAD_NORMAL; - } - //--------------------------------------------------------- // initStaffTypes //--------------------------------------------------------- diff --git a/libmscore/stafftype.h b/libmscore/stafftype.h index 7c394a897f..889672f84a 100644 --- a/libmscore/stafftype.h +++ b/libmscore/stafftype.h @@ -17,6 +17,7 @@ #include "spatium.h" #include "mscore.h" #include "durationtype.h" +#include "note.h" namespace Ms { @@ -194,7 +195,7 @@ class StaffType { bool _genKeysig = true; // create key signature at beginning of system // Standard: configurable properties - NoteHeadScheme _noteHeadScheme = NoteHeadScheme::HEAD_NORMAL; + NoteHead::Scheme _noteHeadScheme = NoteHead::Scheme::HEAD_NORMAL; // TAB: configurable properties qreal _durationFontSize = 15.0; // the size (in points) for the duration symbol font @@ -316,8 +317,8 @@ class StaffType { bool genKeysig() const { return _genKeysig; } void setShowLedgerLines(bool val) { _showLedgerLines = val; } bool showLedgerLines() const { return _showLedgerLines; } - void setNoteHeadScheme(NoteHeadScheme s) { _noteHeadScheme = s; } - NoteHeadScheme noteHeadScheme() const { return _noteHeadScheme; } + void setNoteHeadScheme(NoteHead::Scheme s) { _noteHeadScheme = s; } + NoteHead::Scheme noteHeadScheme() const { return _noteHeadScheme; } QString fretString(int fret, int string, bool ghost) const; // returns a string with the text for fret QString durationString(TDuration::DurationType type, int dots) const; @@ -400,9 +401,6 @@ class StaffType { static void initStaffTypes(); static const std::vector& presets() { return _presets; } - static QString scheme2userName(NoteHeadScheme ns); - static QString scheme2name(NoteHeadScheme ns); - static NoteHeadScheme name2scheme(QString name); }; //--------------------------------------------------------- diff --git a/libmscore/stafftypechange.cpp b/libmscore/stafftypechange.cpp index eae29b661c..f476bcc2d3 100644 --- a/libmscore/stafftypechange.cpp +++ b/libmscore/stafftypechange.cpp @@ -132,7 +132,7 @@ QVariant StaffTypeChange::getProperty(Pid propertyId) const return _staffType->showLedgerLines(); case Pid::STAFF_STEMLESS: return _staffType->stemless(); - case Pid::STAFF_NOTEHEAD_SCHEME: + case Pid::HEAD_SCHEME: return int(_staffType->noteHeadScheme()); case Pid::STAFF_GEN_CLEF: return _staffType->genClef(); @@ -176,8 +176,8 @@ bool StaffTypeChange::setProperty(Pid propertyId, const QVariant& v) case Pid::STAFF_STEMLESS: _staffType->setStemless(v.toBool()); break; - case Pid::STAFF_NOTEHEAD_SCHEME: - _staffType->setNoteHeadScheme(NoteHeadScheme(v.toInt())); + case Pid::HEAD_SCHEME: + _staffType->setNoteHeadScheme(NoteHead::Scheme(v.toInt())); break; case Pid::STAFF_GEN_CLEF: _staffType->setGenClef(v.toBool()); @@ -236,8 +236,8 @@ QVariant StaffTypeChange::propertyDefault(Pid id) const return true; case Pid::STAFF_STEMLESS: return false; - case Pid::STAFF_NOTEHEAD_SCHEME: - return int(NoteHeadScheme::HEAD_NORMAL); + case Pid::HEAD_SCHEME: + return int(NoteHead::Scheme::HEAD_NORMAL); case Pid::STAFF_GEN_CLEF: return true; case Pid::STAFF_GEN_TIMESIG: diff --git a/mscore/editstafftype.cpp b/mscore/editstafftype.cpp index 8af1194605..c4a0f6bb32 100644 --- a/mscore/editstafftype.cpp +++ b/mscore/editstafftype.cpp @@ -34,16 +34,16 @@ const char* g_groupNames[STAFF_GROUP_MAX] = { // noteHeadSchemes //--------------------------------------------------------- -NoteHeadScheme noteHeadSchemes[] = { - NoteHeadScheme::HEAD_NORMAL, - NoteHeadScheme::HEAD_PITCHNAME, - NoteHeadScheme::HEAD_PITCHNAME_GERMAN, - NoteHeadScheme::HEAD_SOLFEGE, - NoteHeadScheme::HEAD_SOLFEGE_FIXED, - NoteHeadScheme::HEAD_SHAPE_NOTE_4, - NoteHeadScheme::HEAD_SHAPE_NOTE_7_AIKIN, - NoteHeadScheme::HEAD_SHAPE_NOTE_7_FUNK, - NoteHeadScheme::HEAD_SHAPE_NOTE_7_WALKER +NoteHead::Scheme noteHeadSchemes[] = { + NoteHead::Scheme::HEAD_NORMAL, + NoteHead::Scheme::HEAD_PITCHNAME, + NoteHead::Scheme::HEAD_PITCHNAME_GERMAN, + NoteHead::Scheme::HEAD_SOLFEGE, + NoteHead::Scheme::HEAD_SOLFEGE_FIXED, + NoteHead::Scheme::HEAD_SHAPE_NOTE_4, + NoteHead::Scheme::HEAD_SHAPE_NOTE_7_AIKIN, + NoteHead::Scheme::HEAD_SHAPE_NOTE_7_FUNK, + NoteHead::Scheme::HEAD_SHAPE_NOTE_7_WALKER }; //--------------------------------------------------------- @@ -89,7 +89,7 @@ EditStaffType::EditStaffType(QWidget* parent, Staff* st) durFontName->setCurrentIndex(0); for (auto i : noteHeadSchemes) - noteHeadScheme->addItem(StaffType::scheme2userName(i), StaffType::scheme2name(i)); + noteHeadScheme->addItem(NoteHead::scheme2userName(i), NoteHead::scheme2name(i)); // load a sample standard score in preview MasterScore* sc = new MasterScore(MScore::defaultStyle()); @@ -383,7 +383,7 @@ void EditStaffType::setFromDlg() staffType.setGenKeysig(genKeysigPitched->isChecked()); staffType.setShowLedgerLines(showLedgerLinesPitched->isChecked()); staffType.setStemless(stemlessPitched->isChecked()); - staffType.setNoteHeadScheme(StaffType::name2scheme(noteHeadScheme->currentData().toString())); + staffType.setNoteHeadScheme(NoteHead::name2scheme(noteHeadScheme->currentData().toString())); } if (staffType.group() == StaffGroup::PERCUSSION) { staffType.setGenKeysig(genKeysigPercussion->isChecked()); diff --git a/mscore/inspector/inspector.cpp b/mscore/inspector/inspector.cpp index 2dc1349147..6c9ba482ae 100644 --- a/mscore/inspector/inspector.cpp +++ b/mscore/inspector/inspector.cpp @@ -497,7 +497,7 @@ InspectorStaffTypeChange::InspectorStaffTypeChange(QWidget* parent) { Pid::STAFF_SHOW_BARLINES, 0, sl.showBarlines, sl.resetShowBarlines }, { Pid::STAFF_SHOW_LEDGERLINES, 0, sl.showLedgerlines, sl.resetShowLedgerlines }, { Pid::STAFF_STEMLESS, 0, sl.stemless, sl.resetStemless }, - { Pid::STAFF_NOTEHEAD_SCHEME, 0, sl.noteheadScheme, sl.resetNoteheadScheme }, + { Pid::HEAD_SCHEME, 0, sl.noteheadScheme, sl.resetNoteheadScheme }, { Pid::STAFF_GEN_CLEF, 0, sl.genClefs, sl.resetGenClefs }, { Pid::STAFF_GEN_TIMESIG, 0, sl.genTimesig, sl.resetGenTimesig }, { Pid::STAFF_GEN_KEYSIG, 0, sl.genKeysig, sl.resetGenKeysig }, @@ -505,16 +505,16 @@ InspectorStaffTypeChange::InspectorStaffTypeChange(QWidget* parent) pList = { { sl.title, sl.panel } }; sl.noteheadScheme->clear(); - for (auto i : { NoteHeadScheme::HEAD_NORMAL, - NoteHeadScheme::HEAD_PITCHNAME, - NoteHeadScheme::HEAD_PITCHNAME_GERMAN, - NoteHeadScheme::HEAD_SOLFEGE, - NoteHeadScheme::HEAD_SOLFEGE_FIXED, - NoteHeadScheme::HEAD_SHAPE_NOTE_4, - NoteHeadScheme::HEAD_SHAPE_NOTE_7_AIKIN, - NoteHeadScheme::HEAD_SHAPE_NOTE_7_FUNK, - NoteHeadScheme::HEAD_SHAPE_NOTE_7_WALKER} ) { - sl.noteheadScheme->addItem(StaffType::scheme2userName(i), int(i)); + for (auto i : { NoteHead::Scheme::HEAD_NORMAL, + NoteHead::Scheme::HEAD_PITCHNAME, + NoteHead::Scheme::HEAD_PITCHNAME_GERMAN, + NoteHead::Scheme::HEAD_SOLFEGE, + NoteHead::Scheme::HEAD_SOLFEGE_FIXED, + NoteHead::Scheme::HEAD_SHAPE_NOTE_4, + NoteHead::Scheme::HEAD_SHAPE_NOTE_7_AIKIN, + NoteHead::Scheme::HEAD_SHAPE_NOTE_7_FUNK, + NoteHead::Scheme::HEAD_SHAPE_NOTE_7_WALKER} ) { + sl.noteheadScheme->addItem(NoteHead::scheme2userName(i), int(i)); } mapSignals(); } diff --git a/mscore/inspector/inspectorNote.cpp b/mscore/inspector/inspectorNote.cpp index 17e313c20b..d7ced7840b 100644 --- a/mscore/inspector/inspectorNote.cpp +++ b/mscore/inspector/inspectorNote.cpp @@ -35,6 +35,19 @@ InspectorNote::InspectorNote(QWidget* parent) c.setupUi(addWidget()); n.setupUi(addWidget()); + static const NoteHead::Scheme schemes[] = { + NoteHead::Scheme::HEAD_AUTO, + NoteHead::Scheme::HEAD_NORMAL, + NoteHead::Scheme::HEAD_PITCHNAME, + NoteHead::Scheme::HEAD_PITCHNAME_GERMAN, + NoteHead::Scheme::HEAD_SOLFEGE, + NoteHead::Scheme::HEAD_SOLFEGE_FIXED, + NoteHead::Scheme::HEAD_SHAPE_NOTE_4, + NoteHead::Scheme::HEAD_SHAPE_NOTE_7_AIKIN, + NoteHead::Scheme::HEAD_SHAPE_NOTE_7_FUNK, + NoteHead::Scheme::HEAD_SHAPE_NOTE_7_WALKER + }; + static const NoteHead::Group heads[] = { NoteHead::Group::HEAD_NORMAL, NoteHead::Group::HEAD_CROSS, @@ -69,6 +82,9 @@ InspectorNote::InspectorNote(QWidget* parent) for (auto head : heads) n.noteHeadGroup->addItem(NoteHead::group2userName(head), int(head)); + for (auto scheme : schemes) + n.noteHeadScheme->addItem(NoteHead::scheme2userName(scheme), int(scheme)); + // noteHeadType starts at -1: correct values and count one item more (HEAD_AUTO) for (int i = 0; i <= int(NoteHead::Type::HEAD_TYPES); ++i) { n.noteHeadType->addItem(NoteHead::type2userName(NoteHead::Type(i - 1))); @@ -77,6 +93,7 @@ InspectorNote::InspectorNote(QWidget* parent) const std::vector iiList = { { Pid::SMALL, 0, n.small, n.resetSmall }, + { Pid::HEAD_SCHEME, 0, n.noteHeadScheme, n.resetNoteHeadScheme }, { Pid::HEAD_GROUP, 0, n.noteHeadGroup, n.resetNoteHeadGroup }, { Pid::HEAD_TYPE, 0, n.noteHeadType, n.resetNoteHeadType }, { Pid::MIRROR_HEAD, 0, n.mirrorHead, n.resetMirrorHead }, @@ -101,6 +118,8 @@ InspectorNote::InspectorNote(QWidget* parent) }; mapSignals(iiList, ppList); + connect(n.noteHeadScheme, SIGNAL(currentIndexChanged(int)), SLOT(noteHeadSchemeChanged(int))); + connect(n.dot1, SIGNAL(clicked()), SLOT(dot1Clicked())); connect(n.dot2, SIGNAL(clicked()), SLOT(dot2Clicked())); connect(n.dot3, SIGNAL(clicked()), SLOT(dot3Clicked())); @@ -129,15 +148,17 @@ void InspectorNote::setElement() n.beam->setEnabled(note->chord()->beam()); n.tuplet->setEnabled(note->chord()->tuplet()); - const StaffType* st = const_cast(note->chord()->staff())->staffType(note->tick()); - bool isNHGroupEnabled = (st->group() == StaffGroup::STANDARD) && (st->noteHeadScheme() == NoteHeadScheme::HEAD_NORMAL); - n.noteHeadGroup->setEnabled(isNHGroupEnabled); - InspectorElementBase::setElement(); //must be placed after InspectorBase::setElement() cause the last one sets resetButton enability - if (!isNHGroupEnabled) + if (note->staffType()->group() == StaffGroup::STANDARD) + noteHeadSchemeChanged(n.noteHeadScheme->currentIndex()); + else { + n.noteHeadScheme->setEnabled(false); + n.resetNoteHeadScheme->setEnabled(false); + n.noteHeadGroup->setEnabled(false); n.resetNoteHeadGroup->setEnabled(false); + } bool nograce = !note->chord()->isGrace(); s.leadingSpace->setEnabled(nograce); @@ -149,6 +170,24 @@ void InspectorNote::setElement() n.playWidget->setVisible(false); } +//--------------------------------------------------------- +// noteHeadSchemeChanged +//--------------------------------------------------------- + +void InspectorNote::noteHeadSchemeChanged(int index) + { + Note* note = toNote(inspector->element()); + NoteHead::Scheme scheme = (index == 0 ? note->staffType()->noteHeadScheme() : NoteHead::Scheme(index - 1)); + if (scheme == NoteHead::Scheme::HEAD_NORMAL) { + n.noteHeadGroup->setEnabled(true); + n.resetNoteHeadGroup->setEnabled(note->headGroup() != NoteHead::Group::HEAD_NORMAL); + } + else { + n.noteHeadGroup->setEnabled(false); + n.resetNoteHeadGroup->setEnabled(false); + } + } + //--------------------------------------------------------- // dot1Clicked //--------------------------------------------------------- diff --git a/mscore/inspector/inspectorNote.h b/mscore/inspector/inspectorNote.h index a13c3b3d15..e5700df217 100644 --- a/mscore/inspector/inspectorNote.h +++ b/mscore/inspector/inspectorNote.h @@ -35,6 +35,7 @@ class InspectorNote : public InspectorElementBase { void block(bool); private slots: + void noteHeadSchemeChanged(int val); void dot1Clicked(); void dot2Clicked(); void dot3Clicked(); diff --git a/mscore/inspector/inspector_note.ui b/mscore/inspector/inspector_note.ui index a7e0d37b0f..abde7c299f 100644 --- a/mscore/inspector/inspector_note.ui +++ b/mscore/inspector/inspector_note.ui @@ -76,7 +76,7 @@ 3 - + Qt::Vertical @@ -96,7 +96,7 @@ - + @@ -109,7 +109,7 @@ - + @@ -168,7 +168,7 @@ - + @@ -181,7 +181,7 @@ - + @@ -209,7 +209,7 @@ - + Mirror head: @@ -222,7 +222,7 @@ - + @@ -235,7 +235,7 @@ - + @@ -251,7 +251,7 @@ - + @@ -307,7 +307,7 @@ - + Head type: @@ -333,7 +333,7 @@ - + Qt::TabFocus @@ -343,7 +343,46 @@ + + + + Head scheme: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + noteHeadScheme + + + + + + + 0 + 0 + + + + Head scheme + + + + + + + + 0 + 0 + + + + Reset 'Head scheme' value + + + + @@ -359,7 +398,7 @@ - + @@ -372,7 +411,7 @@ - + @@ -385,7 +424,7 @@ - + Head group: @@ -398,7 +437,7 @@ - + @@ -576,7 +615,7 @@ - + 3 @@ -631,7 +670,7 @@ - + @@ -660,6 +699,7 @@ title small + noteHeadScheme noteHeadGroup noteHeadType mirrorHead diff --git a/mscore/plugin/api/elements.h b/mscore/plugin/api/elements.h index c0b5612f99..4ea2b489d9 100644 --- a/mscore/plugin/api/elements.h +++ b/mscore/plugin/api/elements.h @@ -142,6 +142,8 @@ class Element : public Ms::PluginAPI::ScoreElement { API_PROPERTY( fixedLine, FIXED_LINE ) /** Notehead type, one of PluginAPI::PluginAPI::NoteHeadType values */ API_PROPERTY( headType, HEAD_TYPE ) + /** Notehead scheme, one of PluginAPI::PluginAPI::NoteHeadScheme values */ + API_PROPERTY( headScheme, HEAD_SCHEME ) /** Notehead group, one of PluginAPI::PluginAPI::NoteHeadGroup values */ API_PROPERTY( headGroup, HEAD_GROUP ) API_PROPERTY( articulationAnchor, ARTICULATION_ANCHOR ) @@ -306,7 +308,6 @@ class Element : public Ms::PluginAPI::ScoreElement { API_PROPERTY( staffShowBarlines, STAFF_SHOW_BARLINES ) API_PROPERTY( staffShowLedgerlines, STAFF_SHOW_LEDGERLINES ) API_PROPERTY( staffStemless, STAFF_STEMLESS ) - API_PROPERTY( staffNoteheadScheme, STAFF_NOTEHEAD_SCHEME ) API_PROPERTY( staffGenClef, STAFF_GEN_CLEF ) API_PROPERTY( staffGenTimesig, STAFF_GEN_TIMESIG ) API_PROPERTY( staffGenKeysig, STAFF_GEN_KEYSIG ) diff --git a/mscore/plugin/api/qmlpluginapi.cpp b/mscore/plugin/api/qmlpluginapi.cpp index 11c33ac8c6..f697a33802 100644 --- a/mscore/plugin/api/qmlpluginapi.cpp +++ b/mscore/plugin/api/qmlpluginapi.cpp @@ -46,6 +46,7 @@ Enum* PluginAPI::alignEnum; Enum* PluginAPI::noteTypeEnum; Enum* PluginAPI::playEventTypeEnum; Enum* PluginAPI::noteHeadTypeEnum; +Enum* PluginAPI::noteHeadSchemeEnum; Enum* PluginAPI::noteHeadGroupEnum; Enum* PluginAPI::noteValueTypeEnum; Enum* PluginAPI::segmentTypeEnum; @@ -76,6 +77,7 @@ void PluginAPI::initEnums() { PluginAPI::noteTypeEnum = wrapEnum(); PluginAPI::playEventTypeEnum = wrapEnum(); PluginAPI::noteHeadTypeEnum = wrapEnum(); + PluginAPI::noteHeadSchemeEnum = wrapEnum(); PluginAPI::noteHeadGroupEnum = wrapEnum(); PluginAPI::noteValueTypeEnum = wrapEnum(); PluginAPI::segmentTypeEnum = wrapEnum(); diff --git a/mscore/plugin/api/qmlpluginapi.h b/mscore/plugin/api/qmlpluginapi.h index 58235ea05c..5b2c32cffd 100644 --- a/mscore/plugin/api/qmlpluginapi.h +++ b/mscore/plugin/api/qmlpluginapi.h @@ -138,6 +138,8 @@ class PluginAPI : public Ms::QmlPlugin { /// \note In MuseScore 2.X this enumeration was available in /// NoteHead class (e.g. NoteHead.HEAD_QUARTER). DECLARE_API_ENUM( NoteHeadType, noteHeadTypeEnum ) + /// Contains Ms::NoteHead::Scheme enumeration values + DECLARE_API_ENUM( NoteHeadScheme, noteHeadSchemeEnum ) /// Contains Ms::NoteHead::Group enumeration values /// \note In MuseScore 2.X this enumeration was available in /// NoteHead class (e.g. NoteHead.HEAD_TRIANGLE).