MuseScore  3.4
Music composition and notation
types.h
Go to the documentation of this file.
1 //=============================================================================
2 // MuseScore
3 // Music Composition & Notation
4 //
5 // Copyright (C) 2017 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 __TYPES_H__
14 #define __TYPES_H__
15 
16 #include "config.h"
17 
22 namespace Ms {
23 #ifdef SCRIPT_INTERFACE
24 Q_NAMESPACE
25 #endif
26 
27 //-------------------------------------------------------------------
32 //-------------------------------------------------------------------
33 
34 enum class ElementType {
36  INVALID = 0,
38  PART,
39  STAFF,
40  SCORE,
41  SYMBOL,
42  TEXT,
47  BAR_LINE,
50  STEM_SLASH,
51  ARPEGGIO,
52  ACCIDENTAL,
54  STEM, // list STEM before NOTE: notes in TAB might 'break' stems
55  NOTE, // and this requires stems to be drawn before notes
56  CLEF, // elements from CLEF to TIMESIG need to be in the order
57  KEYSIG, // in which they appear in a measure
58  AMBITUS,
59  TIMESIG,
60  REST,
61  BREATH,
63  TIE,
65  FERMATA,
66  CHORDLINE,
67  DYNAMIC,
68  BEAM,
69  HOOK,
70  LYRICS,
72  MARKER,
73  JUMP,
74  FINGERING,
75  TUPLET,
76  TEMPO_TEXT,
77  STAFF_TEXT,
82  HARMONY,
84  BEND,
85  TREMOLOBAR,
86  VOLTA,
99  SPACER,
100  STAFF_STATE,
101  NOTEHEAD,
102  NOTEDOT,
103  TREMOLO,
104  IMAGE,
105  MEASURE,
106  SELECTION,
107  LASSO,
108  SHADOW_NOTE,
110  FSYMBOL,
111  PAGE,
112  HAIRPIN,
113  OTTAVA,
114  PEDAL,
115  TRILL,
116  LET_RING,
117  VIBRATO,
118  PALM_MUTE,
119  TEXTLINE,
121  NOTELINE,
122  LYRICSLINE,
123  GLISSANDO,
124  BRACKET,
125  SEGMENT,
126  SYSTEM,
127  COMPOUND,
128  CHORD,
129  SLUR,
130  ELEMENT,
131  ELEMENT_LIST,
132  STAFF_LIST,
133  MEASURE_LIST,
134  HBOX,
135  VBOX,
136  TBOX,
137  FBOX,
138  ICON,
139  OSSIA,
141  STICKING,
142 
143  MAXTYPE
145  };
146 
147 //---------------------------------------------------------
148 // AccidentalType
149 //---------------------------------------------------------
150 // NOTE: keep this in sync with with accList array
151 
152 enum class AccidentalType : char {
154  NONE,
155  FLAT,
156  NATURAL,
157  SHARP,
158  SHARP2,
159  FLAT2,
160  //SHARP3,
161  //FLAT3,
162  NATURAL_FLAT,
164  SHARP_SHARP,
165 
166  // Gould arrow quartertone
177 
178  // Stein-Zimmermann
181  SHARP_SLASH,
182  SHARP_SLASH4,
183 
184  // Arel-Ezgi-Uzdilek (AEU)
185  FLAT_SLASH2,
186  FLAT_SLASH,
187  SHARP_SLASH3,
188  SHARP_SLASH2,
189 
190  // Extended Helmholtz-Ellis accidentals (just intonation)
197 
204 
211 
218 
225 
232 
235 
243 
244  // Persian
245  SORI,
246  KORON,
247  END
249  };
250 
251 //---------------------------------------------------------
252 // NoteType
253 //---------------------------------------------------------
254 
255 enum class NoteType {
257  NORMAL = 0,
258  ACCIACCATURA = 0x1,
259  APPOGGIATURA = 0x2, // grace notes
260  GRACE4 = 0x4,
261  GRACE16 = 0x8,
262  GRACE32 = 0x10,
263  GRACE8_AFTER = 0x20,
264  GRACE16_AFTER = 0x40,
265  GRACE32_AFTER = 0x80,
266  INVALID = 0xFF
268  };
269 
271  return static_cast<NoteType>(static_cast<int>(t1) | static_cast<int>(t2));
272  }
273 constexpr bool operator& (NoteType t1, NoteType t2) {
274  return static_cast<int>(t1) & static_cast<int>(t2);
275  }
276 
277 
278 //---------------------------------------------------------
279 // Direction
280 //---------------------------------------------------------
281 
282 enum class Direction {
284  AUTO, UP, DOWN
286  };
287 
288 //---------------------------------------------------------
289 // GlissandoType
290 //---------------------------------------------------------
291 
292 enum class GlissandoType {
294  STRAIGHT, WAVY
296  };
297 
298 //---------------------------------------------------------
299 // GlissandoStyle
300 //---------------------------------------------------------
301 
302 enum class GlissandoStyle {
306  };
307 
308 //---------------------------------------------------------
309 // Placement
310 //---------------------------------------------------------
311 
312 enum class Placement {
314  ABOVE, BELOW
316  };
317 
318 //---------------------------------------------------------
319 // OffsetType
320 //---------------------------------------------------------
321 
322 enum class OffsetType : char {
323  ABS,
324  SPATIUM
325  };
326 
327 //-------------------------------------------------------------------
328 // SegmentType
329 //
330 // Type values determine the order of segments for a given tick
331 //-------------------------------------------------------------------
332 
333 enum class SegmentType {
335  Invalid = 0x0,
336  BeginBarLine = 0x1,
337  HeaderClef = 0x2,
338  KeySig = 0x4,
339  Ambitus = 0x8,
340  TimeSig = 0x10,
341  StartRepeatBarLine = 0x20,
342  Clef = 0x40,
343  BarLine = 0x80,
344  Breath = 0x100,
345  //--
346  ChordRest = 0x200,
347  //--
348  EndBarLine = 0x400,
349  KeySigAnnounce = 0x800,
350  TimeSigAnnounce = 0x1000,
351  All = -1,
355  };
356 
357 constexpr SegmentType operator| (const SegmentType t1, const SegmentType t2) {
358  return static_cast<SegmentType>(static_cast<int>(t1) | static_cast<int>(t2));
359  }
360 constexpr bool operator& (const SegmentType t1, const SegmentType t2) {
361  return static_cast<int>(t1) & static_cast<int>(t2);
362  }
363 
364 //-------------------------------------------------------------------
365 // Tid
369 //-------------------------------------------------------------------
370 
371 enum class Tid {
373  DEFAULT,
374  TITLE,
375  SUBTITLE,
376  COMPOSER,
377  POET,
378  LYRICS_ODD,
379  LYRICS_EVEN,
380  FINGERING,
387  DYNAMICS,
388  EXPRESSION,
389  TEMPO,
390  METRONOME,
392  TRANSLATOR,
393  TUPLET,
394  SYSTEM,
395  STAFF,
396  HARMONY_A,
397  HARMONY_B,
401  REPEAT_LEFT, // align to start of measure
402  REPEAT_RIGHT, // align to end of measure
403  FRAME,
404  TEXTLINE,
405  GLISSANDO,
406  OTTAVA,
407  VOLTA,
408  PEDAL,
409  LET_RING,
410  PALM_MUTE,
411  HAIRPIN,
412  BEND,
413  HEADER,
414  FOOTER,
416  STICKING,
417  USER1,
418  USER2,
419  USER3,
420  USER4,
421  USER5,
422  USER6,
423  USER7,
424  USER8,
425  USER9,
426  USER10,
427  USER11,
428  USER12,
429  // special, no-contents, styles used while importing older scores
430  TEXT_STYLES, // used for user-defined styles
431  IGNORED_STYLES // used for styles no longer relevant (mainly Figured bass text style)
433  };
434 
435 //---------------------------------------------------------
436 // Align
437 //---------------------------------------------------------
438 
439 enum class Align : char {
441  LEFT = 0,
442  RIGHT = 1,
443  HCENTER = 2,
444  TOP = 0,
445  BOTTOM = 4,
446  VCENTER = 8,
447  BASELINE = 16,
452  };
453 
454 constexpr Align operator| (Align a1, Align a2) {
455  return static_cast<Align>(static_cast<char>(a1) | static_cast<char>(a2));
456  }
457 constexpr bool operator& (Align a1, Align a2) {
458  return static_cast<char>(a1) & static_cast<char>(a2);
459  }
460 constexpr Align operator~ (Align a) {
461  return static_cast<Align>(~static_cast<char>(a));
462  }
463 
464 //---------------------------------------------------------
465 // FontStyle
466 //---------------------------------------------------------
467 
468 enum class FontStyle : char {
469  Normal = 0, Bold = 1, Italic = 2, Underline = 4
470  };
471 
473  return static_cast<FontStyle>(static_cast<char>(a1) | static_cast<char>(a2));
474  }
476  return static_cast<FontStyle>(static_cast<char>(a1) & ~static_cast<char>(a2));
477  }
478 constexpr bool operator& (FontStyle a1, FontStyle a2) {
479  return static_cast<bool>(static_cast<char>(a1) & static_cast<char>(a2));
480  }
481 
482 //---------------------------------------------------------
483 // PlayEventType
487 //---------------------------------------------------------
488 
489 enum class PlayEventType : char {
491  Auto,
492  User,
493  };
495 
496 //---------------------------------------------------------
497 // Tuplets
498 //---------------------------------------------------------
499 
502 
503 #ifdef SCRIPT_INTERFACE
504 Q_ENUM_NS(ElementType);
505 Q_ENUM_NS(Direction);
506 Q_ENUM_NS(GlissandoType);
507 Q_ENUM_NS(GlissandoStyle);
508 Q_ENUM_NS(Placement);
509 Q_ENUM_NS(SegmentType);
510 Q_ENUM_NS(Tid);
511 Q_ENUM_NS(Align);
512 Q_ENUM_NS(NoteType);
513 Q_ENUM_NS(PlayEventType);
514 Q_ENUM_NS(AccidentalType);
515 #endif
516 
517 //hack: to force the build system to run moc on this file
519 class Mops : public QObject {
520  Q_GADGET
521  };
522 
523 extern Direction toDirection(const QString&);
524 extern const char* toString(Direction);
525 extern QString toUserString(Direction);
526 extern void fillComboBoxDirection(QComboBox*);
527 
528 
529 } // namespace Ms
530 
531 Q_DECLARE_METATYPE(Ms::Align);
532 
533 Q_DECLARE_METATYPE(Ms::Direction);
534 
535 Q_DECLARE_METATYPE(Ms::NoteType);
536 
537 Q_DECLARE_METATYPE(Ms::PlayEventType);
538 
539 Q_DECLARE_METATYPE(Ms::AccidentalType);
540 
541 #endif
QString toUserString(Direction val)
Definition: mscore.cpp:195
This class represents a time signature.
Definition: timesig.h:41
constexpr ArticulationShowIn operator|(ArticulationShowIn a1, ArticulationShowIn a2)
Definition: articulation.h:45
TupletNumberType
Definition: types.h:500
AccidentalType
Definition: types.h:152
Includes all barline types.
FontStyle
Definition: types.h:468
Definition: types.h:519
Graphic representation of a clef.
Definition: clef.h:132
const char * toString(Direction val)
Definition: mscore.cpp:176
TupletBracketType
Definition: types.h:501
constexpr bool operator &(ArticulationShowIn a1, ArticulationShowIn a2)
Definition: articulation.h:48
PlayEventType
Determines whether oranaments are automatically generated when playing a score and whether the PlayEv...
Definition: types.h:489
Placement
Definition: types.h:312
OffsetType
Definition: types.h:322
constexpr Align operator~(Align a)
Definition: types.h:460
Direction toDirection(const QString &s)
Definition: mscore.cpp:158
The KeySig class represents a Key Signature on a staff.
Definition: keysig.h:31
SegmentType
Definition: types.h:333
Tid
Enumerates the list of built-in text substyles.
Definition: types.h:371
void fillComboBoxDirection(QComboBox *cb)
Definition: mscore.cpp:214
Definition: aeolus.cpp:26
GlissandoType
Definition: types.h:292
Pos operator+(const Pos &a, int b)
Definition: pos.cpp:184
NoteType
Definition: types.h:255
Pos operator-(const Pos &a, int b)
Definition: pos.cpp:190
Definition: chordrest.h:48
Direction
Definition: types.h:282
GlissandoStyle
Definition: types.h:302
ElementType
Definition: types.h:34
Some play events are modified by user.
Definition: ambitus.h:26
Definition: barline.h:57
Align
Definition: types.h:439
breathType() is index in symList
Definition: breath.h:37
offset in point units
BarLineType
Definition: mscore.h:199