@@ -44,6 +44,23 @@ static const ElementStyle markerStyle {
4444 { Sid::repeatMinDistance, Pid::MIN_DISTANCE },
4545};
4646
47+ // ---------------------------------------------------------
48+ // MarkerTypeTable
49+ // ---------------------------------------------------------
50+
51+ const std::vector<MarkerTypeTableItem> markerTypeTable {
52+ { MarkerType::SEGNO, " <sym>segno</sym>" , " segno" , false },
53+ { MarkerType::VARSEGNO, " <sym>segnoSerpent1</sym>" , " varsegno" , false },
54+ { MarkerType::CODA, " <sym>coda</sym>" , " codab" , false },
55+ { MarkerType::VARCODA, " <sym>codaSquare</sym>" , " varcoda" , false },
56+ { MarkerType::CODETTA, " <sym>coda</sym><sym>coda</sym>" , " codetta" , false },
57+ { MarkerType::FINE, " Fine" , " fine" , true },
58+ { MarkerType::TOCODA, " To Coda" , " coda" , true },
59+ { MarkerType::TOCODASYM, " To <sym>coda</sym>" , " coda" , true },
60+ { MarkerType::DA_CODA, " Da Coda" , " coda" , true },
61+ { MarkerType::DA_DBLCODA, " Da Doppia Coda" , " coda" , true },
62+ };
63+
4764// ---------------------------------------------------------
4865// Marker
4966// ---------------------------------------------------------
@@ -68,73 +85,17 @@ Marker::Marker(EngravingItem* parent, TextStyleType tid)
6885
6986void Marker::setMarkerType (MarkerType t)
7087{
88+ bool changeLabel = getProperty (Pid::LABEL) == propertyDefault (Pid::LABEL);
7189 m_markerType = t;
72- const char * txt = 0 ;
73- switch (t) {
74- case MarkerType::SEGNO:
75- txt = " <sym>segno</sym>" ;
76- setLabel (u" segno" );
77- break ;
78-
79- case MarkerType::VARSEGNO:
80- txt = " <sym>segnoSerpent1</sym>" ;
81- setLabel (u" varsegno" );
82- break ;
83-
84- case MarkerType::CODA:
85- txt = " <sym>coda</sym>" ;
86- setLabel (u" codab" );
87- break ;
88-
89- case MarkerType::VARCODA:
90- txt = " <sym>codaSquare</sym>" ;
91- setLabel (u" varcoda" );
92- break ;
93-
94- case MarkerType::CODETTA:
95- txt = " <sym>coda</sym><sym>coda</sym>" ;
96- setLabel (u" codetta" );
97- break ;
98-
99- case MarkerType::FINE:
100- txt = " Fine" ;
101- initTextStyleType (TextStyleType::REPEAT_RIGHT, true );
102- setLabel (u" fine" );
103- break ;
104-
105- case MarkerType::TOCODA:
106- txt = " To Coda" ;
107- initTextStyleType (TextStyleType::REPEAT_RIGHT, true );
108- setLabel (u" coda" );
109- break ;
110-
111- case MarkerType::TOCODASYM:
112- txt = " To <font size=\" 20\" /><sym>coda</sym>" ;
113- initTextStyleType (TextStyleType::REPEAT_RIGHT, true );
114- setLabel (u" coda" );
115- break ;
116-
117- case MarkerType::DA_CODA:
118- txt = " Da Coda" ;
119- initTextStyleType (TextStyleType::REPEAT_RIGHT, true );
120- setLabel (u" coda" );
121- break ;
122-
123- case MarkerType::DA_DBLCODA:
124- txt = " Da Doppia Coda" ;
125- initTextStyleType (TextStyleType::REPEAT_RIGHT, true );
126- setLabel (u" coda" );
127- break ;
128-
129- case MarkerType::USER:
130- break ;
131-
132- default :
133- LOGD (" unknown marker type %d" , int (t));
134- break ;
135- }
136- if (empty () && txt) {
137- setXmlText (String::fromAscii (txt));
90+ for (const MarkerTypeTableItem& p : markerTypeTable) {
91+ if (p.type == t) {
92+ setXmlText (String::fromAscii (p.text .ascii ()));
93+ if (changeLabel) {
94+ setLabel (String::fromAscii (p.label .ascii ()));
95+ }
96+ initTextStyleType (p.rightAligned ? TextStyleType::REPEAT_RIGHT : TextStyleType::REPEAT_LEFT);
97+ break ;
98+ }
13899 }
139100}
140101
@@ -200,6 +161,11 @@ PropertyValue Marker::propertyDefault(Pid propertyId) const
200161{
201162 switch (propertyId) {
202163 case Pid::LABEL:
164+ for (const MarkerTypeTableItem& p : markerTypeTable) {
165+ if (m_markerType == p.type ) {
166+ return String::fromAscii (p.label .ascii ());
167+ }
168+ }
203169 return String ();
204170 case Pid::MARKER_TYPE:
205171 return MarkerType::FINE;
0 commit comments