Merge pull request #10091 from igorkorsukov/engraving/property_val_15

Clearing property value types [Step 15]
This commit is contained in:
Elnur Ismailzada 2021-12-14 18:33:59 +02:00 committed by GitHub
commit c5d3ca13f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
43 changed files with 295 additions and 265 deletions

View file

@ -476,7 +476,7 @@ PropertyValue Dynamic::getProperty(Pid propertyId) const
case Pid::DYNAMIC_TYPE:
return _dynamicType;
case Pid::DYNAMIC_RANGE:
return int(_dynRange);
return _dynRange;
case Pid::VELOCITY:
return velocity();
case Pid::SUBTYPE:
@ -538,8 +538,8 @@ bool Dynamic::setProperty(Pid propertyId, const PropertyValue& v)
PropertyValue Dynamic::propertyDefault(Pid id) const
{
switch (id) {
case Pid::SUB_STYLE:
return int(Tid::DYNAMICS);
case Pid::TEXT_TYPE:
return Tid::DYNAMICS;
case Pid::DYNAMIC_RANGE:
return DynamicRange::PART;
case Pid::VELOCITY:

View file

@ -441,11 +441,11 @@ void EngravingObject::undoChangeProperty(Pid id, const PropertyValue& v, Propert
EngravingItem* e = toEngravingItem(this);
e->setOffsetChanged(false);
}
} else if (id == Pid::SUB_STYLE) {
} else if (id == Pid::TEXT_TYPE) {
//
// change a list of properties
//
auto l = textStyle(Tid(v.toInt()));
auto l = textStyle(v.value<Tid>());
// Change to ElementStyle defaults
for (const StyledProperty& p : *l) {
if (p.sid == Sid::NOSTYLE) {

View file

@ -271,9 +271,9 @@ engraving::PropertyValue Fingering::propertyDefault(Pid id) const
{
switch (id) {
case Pid::PLACEMENT:
return int(calculatePlacement());
case Pid::SUB_STYLE:
return int(Tid::FINGERING);
return calculatePlacement();
case Pid::TEXT_TYPE:
return Tid::FINGERING;
default:
return TextBase::propertyDefault(id);
}

View file

@ -1365,7 +1365,7 @@ PropertyValue FretDiagram::getProperty(Pid propertyId) const
case Pid::FRET_NUM_POS:
return _numPos;
case Pid::ORIENTATION:
return int(_orientation);
return _orientation;
break;
default:
return EngravingItem::getProperty(propertyId);
@ -1398,7 +1398,7 @@ bool FretDiagram::setProperty(Pid propertyId, const PropertyValue& v)
_numPos = v.toInt();
break;
case Pid::ORIENTATION:
_orientation = Orientation(v.toInt());
_orientation = v.value<Orientation>();
break;
default:
return EngravingItem::setProperty(propertyId, v);

View file

@ -36,11 +36,6 @@ namespace Ms {
class StringData;
class Chord;
enum class Orientation : signed char {
VERTICAL,
HORIZONTAL
};
// Keep this in order - not used directly for comparisons, but the dots will appear in
// this order in fret multidot mode. See fretproperties.cpp.
enum class FretDotType : signed char {

View file

@ -2276,16 +2276,16 @@ PropertyValue Harmony::propertyDefault(Pid id) const
case Pid::HARMONY_TYPE:
v = int(HarmonyType::STANDARD);
break;
case Pid::SUB_STYLE: {
case Pid::TEXT_TYPE: {
switch (_harmonyType) {
case HarmonyType::STANDARD:
v = int(Tid::HARMONY_A);
v = Tid::HARMONY_A;
break;
case HarmonyType::ROMAN:
v = int(Tid::HARMONY_ROMAN);
v = Tid::HARMONY_ROMAN;
break;
case HarmonyType::NASHVILLE:
v = int(Tid::HARMONY_NASHVILLE);
v = Tid::HARMONY_NASHVILLE;
break;
}
}

View file

@ -241,8 +241,8 @@ void InstrumentChange::read(XmlReader& e)
engraving::PropertyValue InstrumentChange::propertyDefault(Pid propertyId) const
{
switch (propertyId) {
case Pid::SUB_STYLE:
return int(Tid::INSTRUMENT_CHANGE);
case Pid::TEXT_TYPE:
return Tid::INSTRUMENT_CHANGE;
default:
return TextBase::propertyDefault(propertyId);
}

View file

@ -25,6 +25,7 @@
#include "translation.h"
#include "rw/xml.h"
#include "types/symnames.h"
#include "types/typesconv.h"
#include "staff.h"
#include "clef.h"
@ -390,31 +391,11 @@ void KeySig::write(XmlWriter& xml) const
} else {
xml.tag("accidental", int(_sig.key()));
}
switch (_sig.mode()) {
case KeyMode::NONE: xml.tag("mode", "none");
break;
case KeyMode::MAJOR: xml.tag("mode", "major");
break;
case KeyMode::MINOR: xml.tag("mode", "minor");
break;
case KeyMode::DORIAN: xml.tag("mode", "dorian");
break;
case KeyMode::PHRYGIAN: xml.tag("mode", "phrygian");
break;
case KeyMode::LYDIAN: xml.tag("mode", "lydian");
break;
case KeyMode::MIXOLYDIAN: xml.tag("mode", "mixolydian");
break;
case KeyMode::AEOLIAN: xml.tag("mode", "aeolian");
break;
case KeyMode::IONIAN: xml.tag("mode", "ionian");
break;
case KeyMode::LOCRIAN: xml.tag("mode", "locrian");
break;
case KeyMode::UNKNOWN:
default:
;
if (_sig.mode() != KeyMode::UNKNOWN) {
xml.tag("mode", TConv::toXml(_sig.mode()));
}
if (!_showCourtesy) {
xml.tag("showCourtesySig", _showCourtesy);
}

View file

@ -612,8 +612,8 @@ bool Lyrics::setProperty(Pid propertyId, const PropertyValue& v)
PropertyValue Lyrics::propertyDefault(Pid id) const
{
switch (id) {
case Pid::SUB_STYLE:
return int(isEven() ? Tid::LYRICS_EVEN : Tid::LYRICS_ODD);
case Pid::TEXT_TYPE:
return isEven() ? Tid::LYRICS_EVEN : Tid::LYRICS_ODD;
case Pid::PLACEMENT:
return score()->styleV(Sid::lyricsPlacement);
case Pid::SYLLABIC:

View file

@ -66,8 +66,8 @@ MeasureNumber::MeasureNumber(const MeasureNumber& other)
engraving::PropertyValue MeasureNumber::propertyDefault(Pid id) const
{
switch (id) {
case Pid::SUB_STYLE:
return int(Tid::MEASURE_NUMBER);
case Pid::TEXT_TYPE:
return Tid::MEASURE_NUMBER;
case Pid::PLACEMENT:
return score()->styleV(Sid::measureNumberVPlacement);
case Pid::HPLACEMENT:

View file

@ -90,8 +90,8 @@ bool MeasureNumberBase::setProperty(Pid id, const PropertyValue& val)
PropertyValue MeasureNumberBase::propertyDefault(Pid id) const
{
switch (id) {
case Pid::SUB_STYLE:
return int(Tid::DEFAULT);
case Pid::TEXT_TYPE:
return Tid::DEFAULT;
default:
return TextBase::propertyDefault(id);
}

View file

@ -82,8 +82,8 @@ bool MMRestRange::setProperty(Pid id, const PropertyValue& val)
PropertyValue MMRestRange::propertyDefault(Pid id) const
{
switch (id) {
case Pid::SUB_STYLE:
return int(Tid::MMREST_RANGE);
case Pid::TEXT_TYPE:
return Tid::MMREST_RANGE;
case Pid::PLACEMENT:
return score()->styleV(Sid::mmRestRangeVPlacement);
case Pid::HPLACEMENT:

View file

@ -78,7 +78,7 @@ static constexpr PropertyMetaData propertyList[] = {
{ Pid::Z, false, "z", P_TYPE::INT, DUMMY_QT_TR_NOOP("propertyName", "z") },
{ Pid::SMALL, false, "small", P_TYPE::BOOL, DUMMY_QT_TR_NOOP("propertyName", "small") },
{ Pid::SHOW_COURTESY, false, "showCourtesySig", P_TYPE::INT, DUMMY_QT_TR_NOOP("propertyName", "show courtesy") },
{ Pid::KEYSIG_MODE, false, "keysig_mode", P_TYPE::KEYMODE, DUMMY_QT_TR_NOOP("propertyName", "show courtesy") },
{ Pid::KEYSIG_MODE, false, "keysig_mode", P_TYPE::KEY_MODE, DUMMY_QT_TR_NOOP("propertyName", "show courtesy") },
{ Pid::LINE_TYPE, false, "lineType", P_TYPE::INT, DUMMY_QT_TR_NOOP("propertyName", "line type") },
{ Pid::PITCH, true, "pitch", P_TYPE::INT, DUMMY_QT_TR_NOOP("propertyName", "pitch") },
@ -303,7 +303,7 @@ static constexpr PropertyMetaData propertyList[] = {
{ Pid::BRACKET_COLUMN, false, "level", P_TYPE::INT, DUMMY_QT_TR_NOOP("propertyName", "level") },
{ Pid::INAME_LAYOUT_POSITION, false, "layoutPosition", P_TYPE::INT, DUMMY_QT_TR_NOOP("propertyName", "layout position") },
{ Pid::SUB_STYLE, false, "style", P_TYPE::SUB_STYLE, DUMMY_QT_TR_NOOP("propertyName", "style") },
{ Pid::TEXT_TYPE, false, "style", P_TYPE::TEXT_TYPE, DUMMY_QT_TR_NOOP("propertyName", "style") },
{ Pid::FONT_FACE, false, "family", P_TYPE::STRING, DUMMY_QT_TR_NOOP("propertyName", "family") },
{ Pid::FONT_SIZE, false, "size", P_TYPE::REAL, DUMMY_QT_TR_NOOP("propertyName", "size") },
{ Pid::FONT_STYLE, false, "fontStyle", P_TYPE::INT, DUMMY_QT_TR_NOOP("propertyName", "font style") },
@ -467,25 +467,13 @@ PropertyValue propertyFromString(mu::engraving::P_TYPE type, QString value)
case P_TYPE::GROUPS:
// unsupported
return PropertyValue();
case P_TYPE::SYMID:
return PropertyValue::fromValue(SymNames::symIdByName(value));
case P_TYPE::TDURATION:
case P_TYPE::INT_LIST:
return PropertyValue();
case P_TYPE::SUB_STYLE:
case P_TYPE::TEXT_TYPE:
return int(textStyleFromName(value));
case P_TYPE::ALIGN: {
return PropertyValue(XmlValue::fromXml(value, Align::LEFT));
}
case P_TYPE::CHANGE_METHOD:
return PropertyValue(int(ChangeMap::nameToChangeMethod(value)));
case P_TYPE::ORIENTATION:
if (value == "vertical") {
return PropertyValue(int(Orientation::VERTICAL));
} else if (value == "horizontal") {
return PropertyValue(int(Orientation::HORIZONTAL));
}
break;
default:
break;
}
@ -527,6 +515,7 @@ PropertyValue readProperty(Pid id, XmlReader& e)
return PropertyValue::fromValue(e.readSize());
case P_TYPE::STRING:
return PropertyValue(e.readElementText());
case P_TYPE::ALIGN:
return PropertyValue(XmlValue::fromXml(e.readElementText(), Align::LEFT));
case P_TYPE::PLACEMENT_V:
@ -539,6 +528,9 @@ PropertyValue readProperty(Pid id, XmlReader& e)
return PropertyValue(XmlValue::fromXml(e.readElementText(), DirectionV::AUTO));
case P_TYPE::DIRECTION_H:
return PropertyValue(XmlValue::fromXml(e.readElementText(), DirectionH::AUTO));
case P_TYPE::ORIENTATION:
return PropertyValue(TConv::fromXml(e.readElementText(), Orientation::VERTICAL));
case P_TYPE::LAYOUTBREAK_TYPE:
return PropertyValue(XmlValue::fromXml(e.readElementText(), LayoutBreakType::NOBREAK));
case P_TYPE::VELO_TYPE:
@ -564,8 +556,10 @@ PropertyValue readProperty(Pid id, XmlReader& e)
case P_TYPE::HOOK_TYPE:
return PropertyValue(TConv::fromXml(e.readElementText(), HookType::NONE));
case P_TYPE::SUB_STYLE:
case P_TYPE::ORIENTATION:
case P_TYPE::KEY_MODE:
return PropertyValue(TConv::fromXml(e.readElementText(), KeyMode::NONE));
case P_TYPE::TEXT_TYPE:
return propertyFromString(propertyType(id), e.readElementText());
case P_TYPE::BEAM_MODE:
return PropertyValue(int(0));
@ -615,48 +609,12 @@ QString propertyToString(Pid id, const PropertyValue& value, bool mscx)
switch (propertyType(id)) {
case P_TYPE::ZERO_INT:
return QString::number(value.toInt());
case P_TYPE::KEYMODE:
switch (KeyMode(value.toInt())) {
case KeyMode::NONE:
return "none";
case KeyMode::MAJOR:
return "major";
case KeyMode::MINOR:
return "minor";
case KeyMode::DORIAN:
return "dorian";
case KeyMode::PHRYGIAN:
return "phrygian";
case KeyMode::LYDIAN:
return "lydian";
case KeyMode::MIXOLYDIAN:
return "mixolydian";
case KeyMode::AEOLIAN:
return "aeolian";
case KeyMode::IONIAN:
return "ionian";
case KeyMode::LOCRIAN:
return "locrian";
default:
return "unknown";
}
case P_TYPE::SUB_STYLE:
return textStyleName(Tid(value.toInt()));
case P_TYPE::TEXT_TYPE:
return textStyleName(value.value<Tid>());
case P_TYPE::CHANGE_METHOD:
return ChangeMap::changeMethodToName(ChangeMethod(value.toInt()));
case P_TYPE::ORIENTATION: {
const Orientation o = Orientation(value.toInt());
if (o == Orientation::VERTICAL) {
return "vertical";
} else if (o == Orientation::HORIZONTAL) {
return "horizontal";
}
break;
}
case P_TYPE::TDURATION:
qFatal("unknown: TDURATION");
case P_TYPE::BEAM_MODE:
qFatal("unknown: BEAM_MODE");
case P_TYPE::TEMPO:
qFatal("unknown: TEMPO");
case P_TYPE::GROUPS:

View file

@ -303,7 +303,7 @@ enum class Pid {
BRACKET_COLUMN,
INAME_LAYOUT_POSITION,
//200
SUB_STYLE,
TEXT_TYPE,
FONT_FACE,
FONT_SIZE,

View file

@ -98,8 +98,8 @@ void RehearsalMark::layout()
engraving::PropertyValue RehearsalMark::propertyDefault(Pid id) const
{
switch (id) {
case Pid::SUB_STYLE:
return int(Tid::REHEARSAL_MARK);
case Pid::TEXT_TYPE:
return Tid::REHEARSAL_MARK;
case Pid::PLACEMENT:
return score()->styleV(Sid::rehearsalMarkPlacement);
default:

View file

@ -121,7 +121,6 @@ class XmlReader;
class XmlWriter;
struct Interval;
enum class Tid;
enum class BeatType : char;
enum class Key;
enum class HairpinType : signed char;

View file

@ -66,8 +66,8 @@ void StaffText::layout()
engraving::PropertyValue StaffText::propertyDefault(Pid id) const
{
switch (id) {
case Pid::SUB_STYLE:
return int(Tid::STAFF);
case Pid::TEXT_TYPE:
return Tid::STAFF;
default:
return StaffTextBase::propertyDefault(id);
}

View file

@ -88,8 +88,8 @@ void Sticking::layout()
engraving::PropertyValue Sticking::propertyDefault(Pid id) const
{
switch (id) {
case Pid::SUB_STYLE:
return int(Tid::STICKING);
case Pid::TEXT_TYPE:
return Tid::STICKING;
default:
return TextBase::propertyDefault(id);
}

View file

@ -51,8 +51,8 @@ SystemText::SystemText(Segment* parent, Tid tid)
engraving::PropertyValue SystemText::propertyDefault(Pid id) const
{
switch (id) {
case Pid::SUB_STYLE:
return int(Tid::SYSTEM);
case Pid::TEXT_TYPE:
return Tid::SYSTEM;
default:
return TextBase::propertyDefault(id);
}

View file

@ -437,8 +437,8 @@ bool TempoText::setProperty(Pid propertyId, const PropertyValue& v)
PropertyValue TempoText::propertyDefault(Pid id) const
{
switch (id) {
case Pid::SUB_STYLE:
return int(Tid::TEMPO);
case Pid::TEXT_TYPE:
return Tid::TEMPO;
case Pid::TEMPO:
return 2.0;
case Pid::TEMPO_FOLLOW_TEXT:

View file

@ -73,8 +73,8 @@ void Text::read(XmlReader& e)
engraving::PropertyValue Text::propertyDefault(Pid id) const
{
switch (id) {
case Pid::SUB_STYLE:
return int(Tid::DEFAULT);
case Pid::TEXT_TYPE:
return Tid::DEFAULT;
default:
return TextBase::propertyDefault(id);
}

View file

@ -2443,7 +2443,7 @@ void TextBase::read(XmlReader& e)
void TextBase::writeProperties(XmlWriter& xml, bool writeText, bool /*writeStyle*/) const
{
EngravingItem::writeProperties(xml);
writeProperty(xml, Pid::SUB_STYLE);
writeProperty(xml, Pid::TEXT_TYPE);
for (const StyledProperty& spp : *_elementStyle) {
if (!isStyled(spp.pid)) {
@ -2462,7 +2462,7 @@ void TextBase::writeProperties(XmlWriter& xml, bool writeText, bool /*writeStyle
}
static constexpr std::array<Pid, 18> TextBasePropertyId { {
Pid::SUB_STYLE,
Pid::TEXT_TYPE,
Pid::FONT_FACE,
Pid::FONT_SIZE,
Pid::TEXT_LINE_SPACING,
@ -2972,7 +2972,7 @@ mu::draw::FontMetrics TextBase::fontMetrics() const
PropertyValue TextBase::getProperty(Pid propertyId) const
{
switch (propertyId) {
case Pid::SUB_STYLE:
case Pid::TEXT_TYPE:
return int(tid());
case Pid::FONT_FACE:
return _cursor->selectedFragmentsFormat().fontFamily();
@ -3017,7 +3017,7 @@ bool TextBase::setProperty(Pid pid, const mu::engraving::PropertyValue& v)
bool rv = true;
switch (pid) {
case Pid::SUB_STYLE:
case Pid::TEXT_TYPE:
initTid(Tid(v.toInt()));
break;
case Pid::FONT_FACE:
@ -3090,8 +3090,8 @@ mu::engraving::PropertyValue TextBase::propertyDefault(Pid id) const
}
PropertyValue v;
switch (id) {
case Pid::SUB_STYLE:
v = int(Tid::DEFAULT);
case Pid::TEXT_TYPE:
v = Tid::DEFAULT;
break;
case Pid::TEXT:
v = QString();
@ -3138,7 +3138,7 @@ int TextBase::getPropertyFlagsIdx(Pid id) const
Sid TextBase::offsetSid() const
{
Tid defaultTid = Tid(propertyDefault(Pid::SUB_STYLE).toInt());
Tid defaultTid = Tid(propertyDefault(Pid::TEXT_TYPE).toInt());
if (tid() != defaultTid) {
return Sid::NOSTYLE;
}

View file

@ -797,7 +797,7 @@ void Tuplet::write(XmlWriter& xml) const
if (_number) {
xml.startObject("Number", _number);
_number->writeProperty(xml, Pid::SUB_STYLE);
_number->writeProperty(xml, Pid::TEXT_TYPE);
_number->writeProperty(xml, Pid::TEXT);
xml.endObject();
}
@ -1200,8 +1200,8 @@ bool Tuplet::setProperty(Pid propertyId, const PropertyValue& v)
PropertyValue Tuplet::propertyDefault(Pid id) const
{
switch (id) {
case Pid::SUB_STYLE:
return int(Tid::TUPLET);
case Pid::TEXT_TYPE:
return Tid::TUPLET;
case Pid::SYSTEM_FLAG:
return false;
case Pid::TEXT:

View file

@ -461,78 +461,6 @@ constexpr bool operator&(const SegmentType t1, const SegmentType t2)
return static_cast<int>(t1) & static_cast<int>(t2);
}
//-------------------------------------------------------------------
// Tid
/// Enumerates the list of built-in text substyles
/// \internal
/// Must be in sync with textStyles array (in textstyle.cpp)
//-------------------------------------------------------------------
enum class Tid {
///.\{
DEFAULT,
TITLE,
SUBTITLE,
COMPOSER,
POET,
TRANSLATOR,
FRAME,
INSTRUMENT_EXCERPT,
INSTRUMENT_LONG,
INSTRUMENT_SHORT,
INSTRUMENT_CHANGE,
HEADER,
FOOTER,
MEASURE_NUMBER,
MMREST_RANGE,
TEMPO,
METRONOME,
REPEAT_LEFT, // align to start of measure
REPEAT_RIGHT, // align to end of measure
REHEARSAL_MARK,
SYSTEM,
STAFF,
EXPRESSION,
DYNAMICS,
HAIRPIN,
LYRICS_ODD,
LYRICS_EVEN,
HARMONY_A,
HARMONY_B,
HARMONY_ROMAN,
HARMONY_NASHVILLE,
TUPLET,
STICKING,
FINGERING,
LH_GUITAR_FINGERING,
RH_GUITAR_FINGERING,
STRING_NUMBER,
TEXTLINE,
VOLTA,
OTTAVA,
GLISSANDO,
PEDAL,
BEND,
LET_RING,
PALM_MUTE,
USER1,
USER2,
USER3,
USER4,
USER5,
USER6,
USER7,
USER8,
USER9,
USER10,
USER11,
USER12,
// special, no-contents, styles used while importing older scores
TEXT_STYLES, // used for user-defined styles
IGNORED_STYLES // used for styles no longer relevant (mainly Figured bass text style)
///.\}
};
//---------------------------------------------------------
// FontStyle
//---------------------------------------------------------
@ -599,7 +527,6 @@ enum class AccidentalRole : char {
Q_ENUM_NS(ElementType);
Q_ENUM_NS(GlissandoType);
Q_ENUM_NS(SegmentType);
Q_ENUM_NS(Tid);
Q_ENUM_NS(NoteType);
Q_ENUM_NS(PlayEventType);
Q_ENUM_NS(AccidentalType);

View file

@ -152,6 +152,7 @@ QVariant PropertyValue::toQVariant() const
case P_TYPE::PLACEMENT_H: return static_cast<int>(value<PlacementH>());
case P_TYPE::DIRECTION_V: return static_cast<int>(value<DirectionV>());
case P_TYPE::DIRECTION_H: return static_cast<int>(value<DirectionH>());
case P_TYPE::ORIENTATION: return static_cast<int>(value<Orientation>());
case P_TYPE::BEAM_MODE: return static_cast<int>(value<BeamMode>());
// Duration
@ -170,7 +171,8 @@ QVariant PropertyValue::toQVariant() const
case P_TYPE::DYNAMIC_RANGE: return static_cast<int>(value<DynamicRange>());
case P_TYPE::DYNAMIC_SPEED: return static_cast<int>(value<DynamicSpeed>());
case P_TYPE::HOOK_TYPE: return static_cast<int>(value<HookType>());
case P_TYPE::KEYMODE: return static_cast<int>(value<KeyMode>());
case P_TYPE::KEY_MODE: return static_cast<int>(value<KeyMode>());
case P_TYPE::TEXT_TYPE: return static_cast<int>(value<Tid>());
// other
case P_TYPE::ACCIDENTAL_ROLE: return static_cast<int>(value<Ms::AccidentalRole>());
@ -217,6 +219,7 @@ PropertyValue PropertyValue::fromQVariant(const QVariant& v, P_TYPE type)
case P_TYPE::PLACEMENT_H: return PropertyValue(PlacementH(v.toInt()));
case P_TYPE::DIRECTION_V: return PropertyValue(DirectionV(v.toInt()));
case P_TYPE::DIRECTION_H: return PropertyValue(DirectionH(v.toInt()));
case P_TYPE::ORIENTATION: return PropertyValue(Orientation(v.toInt()));
case P_TYPE::BEAM_MODE: return PropertyValue(BeamMode(v.toInt()));
// Duration
@ -238,7 +241,8 @@ PropertyValue PropertyValue::fromQVariant(const QVariant& v, P_TYPE type)
case P_TYPE::DYNAMIC_RANGE: return PropertyValue(DynamicRange(v.toInt()));
case P_TYPE::DYNAMIC_SPEED: return PropertyValue(DynamicSpeed(v.toInt()));
case P_TYPE::HOOK_TYPE: return PropertyValue(HookType(v.toInt()));
case P_TYPE::KEYMODE: return PropertyValue(KeyMode(v.toInt()));
case P_TYPE::KEY_MODE: return PropertyValue(KeyMode(v.toInt()));
case P_TYPE::TEXT_TYPE: return PropertyValue(Tid(v.toInt()));
// other
case P_TYPE::ACCIDENTAL_ROLE: return PropertyValue(Ms::AccidentalRole(v.toInt()));

View file

@ -62,6 +62,7 @@ enum class P_TYPE {
PAIR_REAL,
// Draw
SYMID,
COLOR,
ORNAMENT_STYLE,
GLISS_STYLE,
@ -73,6 +74,7 @@ enum class P_TYPE {
TEXT_PLACE,
DIRECTION_V,
DIRECTION_H,
ORIENTATION,
BEAM_MODE,
// Duration
@ -90,21 +92,20 @@ enum class P_TYPE {
DYNAMIC_RANGE,
DYNAMIC_SPEED,
HOOK_TYPE,
KEY_MODE,
TEXT_TYPE,
// not sorted
TEMPO,
GROUPS,
SYMID,
INT_LIST,
ZERO_INT, // displayed with offset +1
SUB_STYLE,
CHANGE_METHOD, // enum class VeloChangeMethod (for single note dynamics)
KEYMODE, // enum class KeyMode
ORIENTATION, // enum class Orientation
PITCH_VALUES,
ACCIDENTAL_ROLE,
@ -182,6 +183,9 @@ public:
PropertyValue(DirectionH v)
: m_type(P_TYPE::DIRECTION_H), m_data(make_data<DirectionH>(v)) {}
PropertyValue(Orientation v)
: m_type(P_TYPE::ORIENTATION), m_data(make_data<Orientation>(v)) {}
PropertyValue(BeamMode v)
: m_type(P_TYPE::BEAM_MODE), m_data(make_data<BeamMode>(v)) {}
@ -216,12 +220,15 @@ public:
PropertyValue(DynamicSpeed v)
: m_type(P_TYPE::DYNAMIC_SPEED), m_data(make_data<DynamicSpeed>(v)) {}
PropertyValue(KeyMode v)
: m_type(P_TYPE::KEYMODE), m_data(make_data<KeyMode>(v)) {}
PropertyValue(HookType v)
: m_type(P_TYPE::HOOK_TYPE), m_data(make_data<HookType>(v)) {}
PropertyValue(KeyMode v)
: m_type(P_TYPE::KEY_MODE), m_data(make_data<KeyMode>(v)) {}
PropertyValue(Tid v)
: m_type(P_TYPE::TEXT_TYPE), m_data(make_data<Tid>(v)) {}
// not sorted
PropertyValue(const Ms::PitchValues& v)

View file

@ -624,8 +624,8 @@ static void readFingering114(XmlReader& e, Fingering* fing)
auto subtype = e.readElementText();
if (subtype == "StringNumber") {
isStringNumber = true;
fing->setProperty(Pid::SUB_STYLE, int(Tid::STRING_NUMBER));
fing->setPropertyFlags(Pid::SUB_STYLE, PropertyFlags::UNSTYLED);
fing->setProperty(Pid::TEXT_TYPE, int(Tid::STRING_NUMBER));
fing->setPropertyFlags(Pid::TEXT_TYPE, PropertyFlags::UNSTYLED);
}
} else if (tag == "frame") {
auto frame = e.readInt();

View file

@ -303,11 +303,11 @@ void Read206::readTextStyle206(MStyle* style, XmlReader& e, std::map<QString, st
{ "Header", Tid::HEADER },
{ "Footer", Tid::FOOTER },
{ "Instrument Change", Tid::INSTRUMENT_CHANGE },
{ "Repeat Text", Tid::IGNORED_STYLES, }, // Repeat Text style no longer exists
{ "Figured Bass", Tid::IGNORED_STYLES, }, // F.B. data are in style properties
{ "Repeat Text", Tid::IGNORED_TYPES, }, // Repeat Text style no longer exists
{ "Figured Bass", Tid::IGNORED_TYPES, }, // F.B. data are in style properties
{ "Volta", Tid::VOLTA },
};
Tid ss = Tid::TEXT_STYLES;
Tid ss = Tid::TEXT_TYPES;
for (const auto& i : styleTable) {
if (name == i.name) {
ss = i.ss;
@ -315,14 +315,14 @@ void Read206::readTextStyle206(MStyle* style, XmlReader& e, std::map<QString, st
}
}
if (ss == Tid::IGNORED_STYLES) {
if (ss == Tid::IGNORED_TYPES) {
return;
}
bool isExcessStyle = false;
if (ss == Tid::TEXT_STYLES) {
if (ss == Tid::TEXT_TYPES) {
ss = e.addUserTextStyle(name);
if (ss == Tid::TEXT_STYLES) {
if (ss == Tid::TEXT_TYPES) {
qDebug("unhandled substyle <%s>", qPrintable(name));
isExcessStyle = true;
} else {
@ -350,7 +350,7 @@ void Read206::readTextStyle206(MStyle* style, XmlReader& e, std::map<QString, st
break;
}
switch (i.pid) {
case Pid::SUB_STYLE:
case Pid::TEXT_TYPE:
value = int(ss);
break;
case Pid::BEGIN_FONT_FACE:
@ -1191,10 +1191,10 @@ static bool readTextPropertyStyle206(QString xmlTag, const XmlReader& e, TextBas
} else {
Tid ss;
ss = e.lookupUserTextStyle(s);
if (ss == Tid::TEXT_STYLES) {
if (ss == Tid::TEXT_TYPES) {
ss = textStyleFromName(s);
}
if (ss != Tid::TEXT_STYLES) {
if (ss != Tid::TEXT_TYPES) {
t->initTid(ss);
}
}

View file

@ -513,7 +513,7 @@ int XmlReader::spannerId(const Spanner* s)
Tid XmlReader::addUserTextStyle(const QString& name)
{
qDebug("%s", qPrintable(name));
Tid id = Tid::TEXT_STYLES;
Tid id = Tid::TEXT_TYPES;
if (userTextStyles.size() == 0) {
id = Tid::USER1;
} else if (userTextStyles.size() == 1) {
@ -541,7 +541,7 @@ Tid XmlReader::addUserTextStyle(const QString& name)
} else {
qDebug("too many user defined textstyles");
}
if (id != Tid::TEXT_STYLES) {
if (id != Tid::TEXT_TYPES) {
userTextStyles.push_back({ name, id });
}
return id;
@ -558,7 +558,7 @@ Tid XmlReader::lookupUserTextStyle(const QString& name) const
return i.ss;
}
}
return Tid::TEXT_STYLES; // not found
return Tid::TEXT_TYPES; // not found
}
//---------------------------------------------------------

View file

@ -342,6 +342,13 @@ void XmlWriter::tagProperty(const char* name, P_TYPE type, const PropertyValue&
*this << "</" << ename << ">\n";
}
break;
case P_TYPE::ORIENTATION: {
putLevel();
*this << "<" << name << ">";
*this << TConv::toXml(data.value<Orientation>());
*this << "</" << ename << ">\n";
}
break;
// time
case P_TYPE::FRACTION: {
const Fraction& f = data.value<Fraction>();

View file

@ -1010,7 +1010,7 @@ struct TextStyleName {
// Must be in sync with Tid enum (in types.h)
static constexpr std::array<TextStyleName, size_t(Tid::TEXT_STYLES)> textStyles { {
static constexpr std::array<TextStyleName, size_t(Tid::TEXT_TYPES)> textStyles { {
{ QT_TRANSLATE_NOOP("TextStyle", "Default"), &defaultTextStyle, Tid::DEFAULT },
// Page-orientde styles
{ QT_TRANSLATE_NOOP("TextStyle", "Title"), &titleTextStyle, Tid::TITLE },
@ -1189,7 +1189,7 @@ static const std::vector<Tid> _primaryTextStyles = {
const std::vector<Tid>& allTextStyles()
{
if (_allTextStyles.empty()) {
_allTextStyles.reserve(int(Tid::TEXT_STYLES));
_allTextStyles.reserve(int(Tid::TEXT_TYPES));
for (const auto& s : textStyles) {
if (s.tid == Tid::DEFAULT) {
continue;

View file

@ -125,6 +125,12 @@ enum class DirectionH : char {
AUTO, LEFT, RIGHT
};
// P_TYPE::ORIENTATION
enum class Orientation : signed char {
VERTICAL,
HORIZONTAL
};
// P_TYPE::BEAM_MODE
enum class BeamMode : signed char {
AUTO, BEGIN, MID, END, NONE, BEGIN32, BEGIN64, INVALID = -1
@ -364,7 +370,7 @@ enum class HookType : char {
NONE, HOOK_90, HOOK_45, HOOK_90T
};
// P_TYPE::KEYMODE
// P_TYPE::KEY_MODE
enum class KeyMode : char {
UNKNOWN = -1,
NONE,
@ -378,6 +384,76 @@ enum class KeyMode : char {
IONIAN,
LOCRIAN
};
//-------------------------------------------------------------------
// Tid
/// Enumerates the list of built-in text substyles
/// \internal
/// Must be in sync with textStyles array (in textstyle.cpp)
//-------------------------------------------------------------------
// P_TYPE::TEXT_TYPE
enum class Tid {
DEFAULT,
TITLE,
SUBTITLE,
COMPOSER,
POET,
TRANSLATOR,
FRAME,
INSTRUMENT_EXCERPT,
INSTRUMENT_LONG,
INSTRUMENT_SHORT,
INSTRUMENT_CHANGE,
HEADER,
FOOTER,
MEASURE_NUMBER,
MMREST_RANGE,
TEMPO,
METRONOME,
REPEAT_LEFT, // align to start of measure
REPEAT_RIGHT, // align to end of measure
REHEARSAL_MARK,
SYSTEM,
STAFF,
EXPRESSION,
DYNAMICS,
HAIRPIN,
LYRICS_ODD,
LYRICS_EVEN,
HARMONY_A,
HARMONY_B,
HARMONY_ROMAN,
HARMONY_NASHVILLE,
TUPLET,
STICKING,
FINGERING,
LH_GUITAR_FINGERING,
RH_GUITAR_FINGERING,
STRING_NUMBER,
TEXTLINE,
VOLTA,
OTTAVA,
GLISSANDO,
PEDAL,
BEND,
LET_RING,
PALM_MUTE,
USER1,
USER2,
USER3,
USER4,
USER5,
USER6,
USER7,
USER8,
USER9,
USER10,
USER11,
USER12,
// special, no-contents, styles used while importing older scores
TEXT_TYPES, // used for user-defined types
IGNORED_TYPES // used for types no longer relevant (mainly Figured bass text type)
};
} // mu::engraving
//! NOTE compat
@ -388,6 +464,7 @@ using PlacementV = mu::engraving::PlacementV;
using PlacementH = mu::engraving::PlacementH;
using DirectionV = mu::engraving::DirectionV;
using DirectionH = mu::engraving::DirectionH;
using Orientation = mu::engraving::Orientation;
using LayoutBreakType = mu::engraving::LayoutBreakType;
using VeloType = mu::engraving::VeloType;
using BeamMode = mu::engraving::BeamMode;
@ -403,6 +480,7 @@ using DynamicRange = mu::engraving::DynamicRange;
using DynamicSpeed = mu::engraving::DynamicSpeed;
using HookType = mu::engraving::HookType;
using KeyMode = mu::engraving::KeyMode;
using Tid = mu::engraving::Tid;
}
#endif // MU_ENGRAVING_TYPES_H

View file

@ -114,6 +114,26 @@ SymId TConv::fromXml(const QString& tag, SymId def)
return SymNames::symIdByName(tag, def);
}
static const std::vector<Item<Orientation> > ORIENTATION = {
{ Orientation::VERTICAL, "vertical", QT_TRANSLATE_NOOP("engraving", "Vertical") },
{ Orientation::HORIZONTAL, "horizontal", QT_TRANSLATE_NOOP("engraving", "Horizontal") },
};
QString TConv::toUserName(Orientation v)
{
return findUserNameByType<Orientation>(ORIENTATION, v);
}
QString TConv::toXml(Orientation v)
{
return findXmlTagByType<Orientation>(ORIENTATION, v);
}
Orientation TConv::fromXml(const QString& tag, Orientation def)
{
return findTypeByXmlTag<Orientation>(ORIENTATION, tag, def);
}
static const std::vector<Item<NoteHeadType> > NOTEHEAD_TYPES = {
{ NoteHeadType::HEAD_AUTO, "auto", QT_TRANSLATE_NOOP("engraving", "Auto") },
{ NoteHeadType::HEAD_WHOLE, "whole", QT_TRANSLATE_NOOP("engraving", "Whole") },
@ -434,3 +454,32 @@ HookType TConv::fromXml(const QString& tag, HookType def)
int v = tag.toInt(&ok);
return ok ? HookType(v) : def;
}
static const std::vector<Item<KeyMode> > KEY_MODES = {
{ KeyMode::UNKNOWN, "unknown" },
{ KeyMode::NONE, "none" },
{ KeyMode::MAJOR, "major" },
{ KeyMode::MINOR, "minor" },
{ KeyMode::DORIAN, "dorian" },
{ KeyMode::PHRYGIAN, "phrygian" },
{ KeyMode::LYDIAN, "lydian" },
{ KeyMode::MIXOLYDIAN, "mixolydian" },
{ KeyMode::AEOLIAN, "aeolian" },
{ KeyMode::IONIAN, "ionian" },
{ KeyMode::LOCRIAN, "locrian" },
};
QString TConv::toUserName(KeyMode v)
{
return findUserNameByType<KeyMode>(KEY_MODES, v);
}
QString TConv::toXml(KeyMode v)
{
return findXmlTagByType<KeyMode>(KEY_MODES, v);
}
KeyMode TConv::fromXml(const QString& tag, KeyMode def)
{
return findTypeByXmlTag<KeyMode>(KEY_MODES, tag, def);
}

View file

@ -36,6 +36,10 @@ public:
static QString toXml(SymId v);
static SymId fromXml(const QString& tag, SymId def);
static QString toUserName(Orientation v);
static QString toXml(Orientation v);
static Orientation fromXml(const QString& tag, Orientation def);
static QString toUserName(NoteHeadType v);
static QString toXml(NoteHeadType v);
static NoteHeadType fromXml(const QString& tag, NoteHeadType def);
@ -64,6 +68,10 @@ public:
static QString toUserName(HookType v);
static QString toXml(HookType v);
static HookType fromXml(const QString& tag, HookType def);
static QString toUserName(KeyMode v);
static QString toXml(KeyMode v);
static KeyMode fromXml(const QString& tag, KeyMode def);
};
}

View file

@ -148,8 +148,8 @@ PropertyItem* AppearanceSettingsModel::verticalOffset() const
bool AppearanceSettingsModel::isSnappedToGrid() const
{
bool isSnapped = notationConfiguration()->isSnappedToGrid(Orientation::Horizontal);
isSnapped &= notationConfiguration()->isSnappedToGrid(Orientation::Vertical);
bool isSnapped = notationConfiguration()->isSnappedToGrid(framework::Orientation::Horizontal);
isSnapped &= notationConfiguration()->isSnappedToGrid(framework::Orientation::Vertical);
return isSnapped;
}
@ -160,8 +160,8 @@ void AppearanceSettingsModel::setIsSnappedToGrid(bool isSnapped)
return;
}
notationConfiguration()->setIsSnappedToGrid(Orientation::Horizontal, isSnapped);
notationConfiguration()->setIsSnappedToGrid(Orientation::Vertical, isSnapped);
notationConfiguration()->setIsSnappedToGrid(framework::Orientation::Horizontal, isSnapped);
notationConfiguration()->setIsSnappedToGrid(framework::Orientation::Vertical, isSnapped);
emit isSnappedToGridChanged(isSnappedToGrid());
}

View file

@ -70,7 +70,7 @@ void TextSettingsModel::createProperties()
m_frameMargin = buildPropertyItem(Ms::Pid::FRAME_PADDING);
m_frameCornerRadius = buildPropertyItem(Ms::Pid::FRAME_ROUND);
m_textType = buildPropertyItem(Ms::Pid::SUB_STYLE);
m_textType = buildPropertyItem(Ms::Pid::TEXT_TYPE);
m_textPlacement = buildPropertyItem(Ms::Pid::PLACEMENT);
m_textScriptAlignment = buildPropertyItem(Ms::Pid::TEXT_SCRIPT_ALIGN);
}

View file

@ -539,19 +539,19 @@ int NotationConfiguration::notationDivision() const
return Ms::Constant::division;
}
ValCh<Orientation> NotationConfiguration::canvasOrientation() const
ValCh<framework::Orientation> NotationConfiguration::canvasOrientation() const
{
ValCh<Orientation> orientation;
ValCh<framework::Orientation> orientation;
orientation.ch = m_canvasOrientationChanged;
bool isVertical = settings()->value(IS_CANVAS_ORIENTATION_VERTICAL_KEY).toBool();
orientation.val = isVertical ? Orientation::Vertical : Orientation::Horizontal;
orientation.val = isVertical ? framework::Orientation::Vertical : framework::Orientation::Horizontal;
return orientation;
}
void NotationConfiguration::setCanvasOrientation(Orientation orientation)
void NotationConfiguration::setCanvasOrientation(framework::Orientation orientation)
{
bool isVertical = orientation == Orientation::Vertical;
bool isVertical = orientation == framework::Orientation::Vertical;
Ms::MScore::setVerticalOrientation(isVertical);
settings()->setSharedValue(IS_CANVAS_ORIENTATION_VERTICAL_KEY, Val(isVertical));
@ -726,46 +726,46 @@ void NotationConfiguration::setUserScoreOrderListPaths(const io::paths& paths)
}
}
bool NotationConfiguration::isSnappedToGrid(Orientation gridOrientation) const
bool NotationConfiguration::isSnappedToGrid(framework::Orientation gridOrientation) const
{
switch (gridOrientation) {
case Orientation::Horizontal: return settings()->value(IS_SNAPPED_TO_HORIZONTAL_GRID_KEY).toBool();
case Orientation::Vertical: return settings()->value(IS_SNAPPED_TO_VERTICAL_GRID_KEY).toBool();
case framework::Orientation::Horizontal: return settings()->value(IS_SNAPPED_TO_HORIZONTAL_GRID_KEY).toBool();
case framework::Orientation::Vertical: return settings()->value(IS_SNAPPED_TO_VERTICAL_GRID_KEY).toBool();
}
return false;
}
void NotationConfiguration::setIsSnappedToGrid(Orientation gridOrientation, bool isSnapped)
void NotationConfiguration::setIsSnappedToGrid(framework::Orientation gridOrientation, bool isSnapped)
{
switch (gridOrientation) {
case Orientation::Horizontal:
case framework::Orientation::Horizontal:
settings()->setSharedValue(IS_SNAPPED_TO_HORIZONTAL_GRID_KEY, Val(isSnapped));
break;
case Orientation::Vertical:
case framework::Orientation::Vertical:
settings()->setSharedValue(IS_SNAPPED_TO_VERTICAL_GRID_KEY, Val(isSnapped));
break;
}
}
int NotationConfiguration::gridSizeSpatium(Orientation gridOrientation) const
int NotationConfiguration::gridSizeSpatium(framework::Orientation gridOrientation) const
{
switch (gridOrientation) {
case Orientation::Horizontal: return settings()->value(HORIZONTAL_GRID_SIZE_KEY).toInt();
case Orientation::Vertical: return settings()->value(VERTICAL_GRID_SIZE_KEY).toInt();
case framework::Orientation::Horizontal: return settings()->value(HORIZONTAL_GRID_SIZE_KEY).toInt();
case framework::Orientation::Vertical: return settings()->value(VERTICAL_GRID_SIZE_KEY).toInt();
}
return DEFAULT_GRID_SIZE_SPATIUM;
}
void NotationConfiguration::setGridSize(Orientation gridOrientation, int sizeSpatium)
void NotationConfiguration::setGridSize(framework::Orientation gridOrientation, int sizeSpatium)
{
switch (gridOrientation) {
case Orientation::Horizontal:
case framework::Orientation::Horizontal:
Ms::MScore::setHRaster(sizeSpatium);
settings()->setSharedValue(HORIZONTAL_GRID_SIZE_KEY, Val(sizeSpatium));
break;
case Orientation::Vertical:
case framework::Orientation::Vertical:
Ms::MScore::setVRaster(sizeSpatium);
settings()->setSharedValue(VERTICAL_GRID_SIZE_KEY, Val(sizeSpatium));
break;

View file

@ -771,8 +771,8 @@ void NotationInteraction::drag(const PointF& fromPos, const PointF& toPos, DragM
m_dragData.ed.lastPos = m_dragData.ed.pos;
m_dragData.ed.hRaster = configuration()->isSnappedToGrid(Orientation::Horizontal);
m_dragData.ed.vRaster = configuration()->isSnappedToGrid(Orientation::Vertical);
m_dragData.ed.hRaster = configuration()->isSnappedToGrid(framework::Orientation::Horizontal);
m_dragData.ed.vRaster = configuration()->isSnappedToGrid(framework::Orientation::Vertical);
m_dragData.ed.delta = delta;
m_dragData.ed.moveDelta = delta - m_dragData.elementOffset;
m_dragData.ed.evtDelta = evtDelta;

View file

@ -1275,7 +1275,7 @@ PalettePtr PaletteCreator::newTextPalette(bool defaultPalette)
// Instead, they simply set the corresponding measure's MeasureNumberMode to SHOW
// Because of that, the element shown in the palettes does not have to have any particular formatting.
auto meaNum = makeElement<MeasureNumber>(gpaletteScore);
meaNum->setProperty(Pid::SUB_STYLE, int(Tid::STAFF)); // Make the element bigger in the palettes (using the default measure number style makes it too small)
meaNum->setProperty(Pid::TEXT_TYPE, int(Tid::STAFF)); // Make the element bigger in the palettes (using the default measure number style makes it too small)
meaNum->setXmlText(QT_TRANSLATE_NOOP("palette", "Measure number"));
sp->appendElement(meaNum, QT_TRANSLATE_NOOP("palette", "Measure number"))->setElementTranslated(true);

View file

@ -153,6 +153,23 @@ enum class NoteHeadGroup {
};
Q_ENUM_NS(NoteHeadGroup);
enum class Tid {
DEFAULT = int(mu::engraving::Tid::DEFAULT),
TITLE = int(mu::engraving::Tid::TITLE),
SUBTITLE = int(mu::engraving::Tid::SUBTITLE),
COMPOSER = int(mu::engraving::Tid::COMPOSER),
POET = int(mu::engraving::Tid::POET),
TRANSLATOR = int(mu::engraving::Tid::TRANSLATOR),
FRAME = int(mu::engraving::Tid::FRAME),
INSTRUMENT_EXCERPT = int(mu::engraving::Tid::INSTRUMENT_EXCERPT),
INSTRUMENT_LONG = int(mu::engraving::Tid::INSTRUMENT_LONG),
INSTRUMENT_SHORT = int(mu::engraving::Tid::INSTRUMENT_SHORT),
INSTRUMENT_CHANGE = int(mu::engraving::Tid::INSTRUMENT_CHANGE),
HEADER = int(mu::engraving::Tid::HEADER),
FOOTER = int(mu::engraving::Tid::FOOTER),
};
Q_ENUM_NS(Tid);
//! HACK to force the build system to run moc on this file
class Mops : public QObject
{

View file

@ -346,7 +346,7 @@ class EngravingItem : public Ms::PluginAPI::ScoreElement
API_PROPERTY(bracketSpan, BRACKET_SPAN)
API_PROPERTY(bracketColumn, BRACKET_COLUMN)
API_PROPERTY(inameLayoutPosition, INAME_LAYOUT_POSITION)
API_PROPERTY(subStyle, SUB_STYLE)
API_PROPERTY(subStyle, TEXT_TYPE)
API_PROPERTY(fontFace, FONT_FACE)
API_PROPERTY(fontSize, FONT_SIZE)
API_PROPERTY(fontStyle, FONT_STYLE)

View file

@ -151,7 +151,7 @@ class PluginAPI : public Ms::QmlPlugin
/// Contains Ms::Tid enumeration values
/// \note In MuseScore 2.X this enumeration was available as
/// TextStyleType (TextStyleType.TITLE etc.)
DECLARE_API_ENUM(Tid, tidEnum, Ms::Tid)
DECLARE_API_ENUM(Tid, tidEnum, Ms::PluginAPI::Tid)
/// Contains Ms::Align enumeration values
/// \since MuseScore 3.3
DECLARE_API_ENUM(Align, alignEnum, Ms::PluginAPI::Align)

View file

@ -61,15 +61,15 @@ void Score::addText(const QString& type, const QString& txt)
score()->insertMeasure(ElementType::VBOX, measure);
measure = score()->first();
}
Tid tid = Tid::DEFAULT;
Ms::Tid tid = Ms::Tid::DEFAULT;
if (type == "title") {
tid = Tid::TITLE;
tid = Ms::Tid::TITLE;
} else if (type == "subtitle") {
tid = Tid::SUBTITLE;
tid = Ms::Tid::SUBTITLE;
} else if (type == "composer") {
tid = Tid::COMPOSER;
tid = Ms::Tid::COMPOSER;
} else if (type == "lyricist") {
tid = Tid::POET;
tid = Ms::Tid::POET;
}
Ms::Text* text = mu::engraving::Factory::createText(measure, tid);