MuseScore Plugins  3.2.3
Plugins API for MuseScore
types.h
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 enum class AccidentalType : char {
153  NONE,
154  FLAT,
155  NATURAL,
156  SHARP,
157  SHARP2,
158  FLAT2,
159  //SHARP3,
160  //FLAT3,
161  NATURAL_FLAT,
163  SHARP_SHARP,
164 
165  // Gould arrow quartertone
176 
177  // Stein-Zimmermann
180  SHARP_SLASH,
181  SHARP_SLASH4,
182 
183  // Arel-Ezgi-Uzdilek (AEU)
184  FLAT_SLASH2,
185  FLAT_SLASH,
186  SHARP_SLASH3,
187  SHARP_SLASH2,
188 
189  // Extended Helmholtz-Ellis accidentals (just intonation)
196 
203 
210 
217 
224 
231 
234 
242 
243  // Persian
244  SORI,
245  KORON,
246  END
248  };
249 
250 //---------------------------------------------------------
251 // NoteType
252 //---------------------------------------------------------
253 
254 enum class NoteType {
256  NORMAL = 0,
257  ACCIACCATURA = 0x1,
258  APPOGGIATURA = 0x2, // grace notes
259  GRACE4 = 0x4,
260  GRACE16 = 0x8,
261  GRACE32 = 0x10,
262  GRACE8_AFTER = 0x20,
263  GRACE16_AFTER = 0x40,
264  GRACE32_AFTER = 0x80,
265  INVALID = 0xFF
267  };
268 
269 constexpr NoteType operator| (NoteType t1, NoteType t2) {
270  return static_cast<NoteType>(static_cast<int>(t1) | static_cast<int>(t2));
271  }
272 constexpr bool operator& (NoteType t1, NoteType t2) {
273  return static_cast<int>(t1) & static_cast<int>(t2);
274  }
275 
276 
277 //---------------------------------------------------------
278 // Direction
279 //---------------------------------------------------------
280 
281 enum class Direction {
283  AUTO, UP, DOWN
285  };
286 
287 //---------------------------------------------------------
288 // GlissandoType
289 //---------------------------------------------------------
290 
291 enum class GlissandoType {
293  STRAIGHT, WAVY
295  };
296 
297 //---------------------------------------------------------
298 // GlissandoStyle
299 //---------------------------------------------------------
300 
301 enum class GlissandoStyle {
305  };
306 
307 //---------------------------------------------------------
308 // Placement
309 //---------------------------------------------------------
310 
311 enum class Placement {
313  ABOVE, BELOW
315  };
316 
317 //---------------------------------------------------------
318 // OffsetType
319 //---------------------------------------------------------
320 
321 enum class OffsetType : char {
322  ABS,
323  SPATIUM
324  };
325 
326 //-------------------------------------------------------------------
327 // SegmentType
328 //
329 // Type values determine the order of segments for a given tick
330 //-------------------------------------------------------------------
331 
332 enum class SegmentType {
334  Invalid = 0x0,
335  BeginBarLine = 0x1,
336  HeaderClef = 0x2,
337  KeySig = 0x4,
338  Ambitus = 0x8,
339  TimeSig = 0x10,
340  StartRepeatBarLine = 0x20,
341  Clef = 0x40,
342  BarLine = 0x80,
343  Breath = 0x100,
344  //--
345  ChordRest = 0x200,
346  //--
347  EndBarLine = 0x400,
348  KeySigAnnounce = 0x800,
349  TimeSigAnnounce = 0x1000,
350  All = -1,
354  };
355 
356 constexpr SegmentType operator| (const SegmentType t1, const SegmentType t2) {
357  return static_cast<SegmentType>(static_cast<int>(t1) | static_cast<int>(t2));
358  }
359 constexpr bool operator& (const SegmentType t1, const SegmentType t2) {
360  return static_cast<int>(t1) & static_cast<int>(t2);
361  }
362 
363 //-------------------------------------------------------------------
364 // Tid
368 //-------------------------------------------------------------------
369 
370 enum class Tid {
372  DEFAULT,
373  TITLE,
374  SUBTITLE,
375  COMPOSER,
376  POET,
377  LYRICS_ODD,
378  LYRICS_EVEN,
379  FINGERING,
386  DYNAMICS,
387  EXPRESSION,
388  TEMPO,
389  METRONOME,
391  TRANSLATOR,
392  TUPLET,
393  SYSTEM,
394  STAFF,
395  HARMONY_A,
396  HARMONY_B,
398  REPEAT_LEFT, // align to start of measure
399  REPEAT_RIGHT, // align to end of measure
400  FRAME,
401  TEXTLINE,
402  GLISSANDO,
403  OTTAVA,
404  VOLTA,
405  PEDAL,
406  LET_RING,
407  PALM_MUTE,
408  HAIRPIN,
409  BEND,
410  HEADER,
411  FOOTER,
413  STICKING,
414  USER1,
415  USER2,
416  USER3,
417  USER4,
418  USER5,
419  USER6,
422  };
423 
424 //---------------------------------------------------------
425 // Align
426 //---------------------------------------------------------
427 
428 enum class Align : char {
429  LEFT = 0,
430  RIGHT = 1,
431  HCENTER = 2,
432  TOP = 0,
433  BOTTOM = 4,
434  VCENTER = 8,
435  BASELINE = 16,
436  CENTER = Align::HCENTER | Align::VCENTER,
437  HMASK = Align::LEFT | Align::RIGHT | Align::HCENTER,
438  VMASK = Align::TOP | Align::BOTTOM | Align::VCENTER | Align::BASELINE
439  };
440 
441 constexpr Align operator| (Align a1, Align a2) {
442  return static_cast<Align>(static_cast<char>(a1) | static_cast<char>(a2));
443  }
444 constexpr bool operator& (Align a1, Align a2) {
445  return static_cast<char>(a1) & static_cast<char>(a2);
446  }
447 constexpr Align operator~ (Align a) {
448  return static_cast<Align>(~static_cast<char>(a));
449  }
450 
451 //---------------------------------------------------------
452 // FontStyle
453 //---------------------------------------------------------
454 
455 enum class FontStyle : char {
456  Normal = 0, Bold = 1, Italic = 2, Underline = 4
457  };
458 
459 constexpr FontStyle operator+ (FontStyle a1, FontStyle a2) {
460  return static_cast<FontStyle>(static_cast<char>(a1) | static_cast<char>(a2));
461  }
462 constexpr FontStyle operator- (FontStyle a1, FontStyle a2) {
463  return static_cast<FontStyle>(static_cast<char>(a1) & ~static_cast<char>(a2));
464  }
465 constexpr bool operator& (FontStyle a1, FontStyle a2) {
466  return static_cast<bool>(static_cast<char>(a1) & static_cast<char>(a2));
467  }
468 
469 //---------------------------------------------------------
470 // Tuplets
471 //---------------------------------------------------------
472 
473 enum class TupletNumberType : char { SHOW_NUMBER, SHOW_RELATION, NO_TEXT };
474 enum class TupletBracketType : char { AUTO_BRACKET, SHOW_BRACKET, SHOW_NO_BRACKET };
475 
476 #ifdef SCRIPT_INTERFACE
477 Q_ENUM_NS(ElementType)
478 Q_ENUM_NS(AccidentalType)
479 Q_ENUM_NS(Direction)
480 Q_ENUM_NS(GlissandoType)
481 Q_ENUM_NS(GlissandoStyle)
482 Q_ENUM_NS(Placement)
483 Q_ENUM_NS(SegmentType)
484 Q_ENUM_NS(Tid)
485 Q_ENUM_NS(NoteType)
486 #endif
487 
488 //hack: to force the build system to run moc on this file
490 class Mops : public QObject {
491  Q_GADGET
492  };
493 
494 extern Direction toDirection(const QString&);
495 extern const char* toString(Direction);
496 extern QString toUserString(Direction);
497 extern void fillComboBoxDirection(QComboBox*);
498 
499 
500 } // namespace Ms
501 
502 Q_DECLARE_METATYPE(Ms::Align)
503 
504 Q_DECLARE_METATYPE(Ms::Direction);
505 
506 Q_DECLARE_METATYPE(Ms::NoteType);
507 
508 #endif
Placement
Definition: types.h:311
Tid
Enumerates the list of built-in text substyles.
Definition: types.h:370
OffsetType
Definition: types.h:321
ElementType
Definition: types.h:34
Direction
Definition: types.h:281
Includes all barline types.
NoteType
Definition: types.h:254
GlissandoStyle
Definition: types.h:301
offset in staff space units
Definition: cursor.cpp:29
SegmentType
Definition: types.h:332
offset in point units
GlissandoType
Definition: types.h:291
AccidentalType
Definition: types.h:151