MuseScore  3.4
Music composition and notation
property.h
Go to the documentation of this file.
1 //=============================================================================
2 // MuseScore
3 // Music Composition & Notation
4 //
5 // Copyright (C) 2011 Werner Schweer
6 //
7 // This program is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License version 2
9 // as published by the Free Software Foundation and appearing in
10 // the file LICENCE.GPL
11 //=============================================================================
12 
13 #ifndef __PROPERTY_H__
14 #define __PROPERTY_H__
15 
16 namespace Ms {
17 
18 class XmlReader;
19 enum class Sid : int;
20 
21 //------------------------------------------------------------------------
22 // M_PROPERTY (type, getter_name, setter_name)
23 // helper macro to define a styled ScoreElement property
24 //
25 // usage example:
26 // class Text : public Element {
27 // M_PROPERTY(QColor, color, setColor)
28 // ...
29 // };
30 // this defines:
31 // QColor _color;
32 // const QColor& color() const { return _color; }
33 // void setColor(const QColor& val) { _color = val; }
34 //---------------------------------------------------------
35 
36 #define M_PROPERTY(a,b,c) \
37  a _ ## b; \
38  public: \
39  const a& b() const { return _ ## b; } \
40  void c(const a& val) { _ ## b = val; } \
41  private:
42 
43 #define M_PROPERTY2(a,b,c,d) \
44  a _ ## b { d }; \
45  public: \
46  const a& b() const { return _ ## b; } \
47  void c(const a& val) { _ ## b = val; } \
48  private:
49 
50 //---------------------------------------------------------
51 // PropertyFlags
52 //---------------------------------------------------------
53 
54 enum class PropertyFlags : char {
56  };
57 
58 //------------------------------------------------------------------------
59 // Element Properties
60 //------------------------------------------------------------------------
61 
62 enum class Pid {
63  SUBTYPE,
64  SELECTED,
65  GENERATED,
66  COLOR,
67  VISIBLE,
68  Z,
69  SMALL,
72  LINE_TYPE,
73  PITCH,
74 
75  TPC1,
76  TPC2,
77  LINE,
78  FIXED,
79  FIXED_LINE,
80  HEAD_TYPE,
81  HEAD_GROUP,
82  VELO_TYPE,
85 
86  DIRECTION,
88  NO_STEM,
91  DISTRIBUTE,
94  TUNING,
95  PAUSE,
96 
101  OFFSET,
102  FRET,
103  STRING,
104  GHOST,
105  PLAY,
107 
109  NUMBER_TYPE,
110  BRACKET_TYPE,
111  NORMAL_NOTES,
112  ACTUAL_NOTES,
113  P1,
114  P2,
115  GROW_LEFT,
116  GROW_RIGHT,
117  BOX_HEIGHT,
118 
119  BOX_WIDTH,
120  TOP_GAP,
121  BOTTOM_GAP,
122  LEFT_MARGIN,
123  RIGHT_MARGIN,
124  TOP_MARGIN,
126  LAYOUT_BREAK,
127  AUTOSCALE,
128  SIZE,
129 
130  SCALE,
133  TEXT,
134  HTML_TEXT,
136  BEAM_POS,
137  BEAM_MODE,
139  USER_LEN, // used for stems
140 
141  SPACE, // used for spacer
142  TEMPO,
148  FBPREFIX, // used for FiguredBassItem
149  FBDIGIT, // " "
150  FBSUFFIX, // " "
151  FBCONTINUATIONLINE, // " "
152 
153  FBPARENTHESIS1, // " "
154  FBPARENTHESIS2, // " "
155  FBPARENTHESIS3, // " "
156  FBPARENTHESIS4, // " "
157  FBPARENTHESIS5, // " "
158  OTTAVA_TYPE,
159  NUMBERS_ONLY,
160  TRILL_TYPE,
161  VIBRATO_TYPE,
163 
164  HAIRPIN_TYPE,
167  VELO_CHANGE,
170  DYNAMIC_TYPE,
173 //100
174  PLACEMENT,
175  VELOCITY,
176  JUMP_TO,
177  PLAY_UNTIL,
178  CONTINUE_AT,
179  LABEL,
180  MARKER_TYPE,
183  REPEAT_END,
184  REPEAT_START,
185  REPEAT_JUMP,
187  GLISS_TYPE,
188  GLISS_TEXT,
189 
191  DIAGONAL,
192  GROUPS,
193  LINE_STYLE,
194  LINE_WIDTH,
195  LASSO_POS,
196  LASSO_SIZE,
197  TIME_STRETCH,
199 
200  TIMESIG,
203  TIMESIG_TYPE,
204  SPANNER_TICK,
207  OFFSET2,
208  BREAK_MMR,
209  REPEAT_COUNT,
210 
211  USER_STRETCH,
212  NO_OFFSET,
213  IRREGULAR,
214  ANCHOR,
215  SLUR_UOFF1,
216  SLUR_UOFF2,
217  SLUR_UOFF3,
218  SLUR_UOFF4,
219  STAFF_MOVE,
220  VERSE,
221 
222  SYLLABIC,
223  LYRIC_TICKS,
224  VOLTA_ENDING,
225  LINE_VISIBLE,
226  MAG,
227  USE_DRUMSET,
228  DURATION,
230  ROLE,
231  TRACK,
232 
234  FRET_STRINGS,
235  FRET_FRETS,
236  FRET_NUT,
237  FRET_OFFSET,
238  FRET_NUM_POS,
239 
241  GAP,
242  AUTOPLACE,
244  DASH_GAP_LEN,
245  TICK,
249 
251  SYMBOL,
252  PLAY_REPEATS,
254  STAFF_LINES,
256  STEP_OFFSET,
260 
270  BRACKET_SPAN,
271 
274  SUB_STYLE,
275 
276  FONT_FACE,
277  FONT_SIZE,
278  FONT_STYLE,
279 
280  FRAME_TYPE,
281  FRAME_WIDTH,
283  FRAME_ROUND,
285 //200
288  ALIGN,
289  SYSTEM_FLAG,
290  BEGIN_TEXT,
291 
300 
308  END_TEXT,
309 
318 
319  POS_ABOVE,
320 
327 
328  VOICE,
329  POSITION,
330 
333  KEY,
334  ACTION, // for Icon
335  MIN_DISTANCE,
336 
340  TREMOLO_TYPE,
342  HARMONY_TYPE,
343 
346 
347  PATH, // for ChordLine to make its shape changes undoable
348 
349  END
350  };
351 
352 enum class P_TYPE : char {
353  BOOL,
354  INT,
355  REAL,
356  SPATIUM,
357  SP_REAL, // real (point) value saved in (score) spatium units
358  FRACTION,
359  POINT,
360  POINT_SP, // point units, value saved in (score) spatium units
361  POINT_MM,
362  POINT_SP_MM, // point units, value saved as mm or spatium depending on Element->sizeIsSpatiumDependent()
363  SIZE,
364  SIZE_MM,
365  STRING,
366  SCALE,
367  COLOR,
368  DIRECTION, // enum class Direction
369  DIRECTION_H, // enum class MScore::DirectionH
370  ORNAMENT_STYLE, // enum class MScore::OrnamentStyle
371  TDURATION,
372  LAYOUT_BREAK,
373  VALUE_TYPE,
374  BEAM_MODE,
375  PLACEMENT,
376  TEXT_PLACE,
377  TEMPO,
378  GROUPS,
379  SYMID,
380  INT_LIST,
382  BARLINE_TYPE,
383  HEAD_TYPE, // enum class Notehead::Type
384  HEAD_GROUP, // enum class Notehead::Group
385  ZERO_INT, // displayed with offset +1
386  FONT,
387  SUB_STYLE,
388  ALIGN,
389  CHANGE_METHOD, // enum class VeloChangeMethod (for single notedynamics)
390  CHANGE_SPEED, // enum class Dynamic::Speed
391  CLEF_TYPE, // enum class ClefType
392  DYNAMIC_TYPE, // enum class Dynamic::Type
393  KEYMODE, // enum class KeyMode
394 
395  PATH, // QPainterPath
396  };
397 
398 extern QVariant readProperty(Pid type, XmlReader& e);
399 extern QVariant propertyFromString(Pid type, QString value);
400 extern QString propertyToString(Pid, QVariant value, bool mscx);
401 extern P_TYPE propertyType(Pid);
402 extern const char* propertyName(Pid);
403 extern bool propertyLink(Pid id);
404 extern Pid propertyId(const QString& name);
405 extern Pid propertyId(const QStringRef& name);
406 extern QString propertyUserName(Pid);
407 
408 } // namespace Ms
409 
410 Q_DECLARE_METATYPE(QPainterPath); // for properties with P_TYPE::PATH
411 
412 #endif
413 
Pid
Definition: property.h:62
P_TYPE
Definition: property.h:352
Definition: xml.h:67
QString propertyUserName(Pid id)
Definition: property.cpp:399
bool propertyLink(Pid id)
Definition: property.cpp:379
QString propertyToString(Pid id, QVariant value, bool mscx)
Definition: property.cpp:650
Definition: inspectorAmbitus.cpp:21
PropertyFlags
Definition: property.h:54
P_TYPE propertyType(Pid id)
Definition: property.cpp:369
QVariant readProperty(Pid id, XmlReader &e)
Definition: property.cpp:581
Definition: aeolus.cpp:26
Sid
Definition: style.h:33
QVariant propertyFromString(Pid id, QString value)
Definition: property.cpp:409
Definition: inspectorAmbitus.cpp:21
Definition: xmlreader.h:28
Definition: editdrumset.cpp:32
const char * propertyName(Pid id)
Definition: property.cpp:389
Definition: inspectorAmbitus.cpp:22
Pid propertyId(const QStringRef &s)
Definition: property.cpp:347