MuseScore Plugins 3.3
Plugins API for MuseScore
Loading...
Searching...
No Matches
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
22namespace Ms {
23#ifdef SCRIPT_INTERFACE
24Q_NAMESPACE
25#endif
26
27//-------------------------------------------------------------------
32//-------------------------------------------------------------------
33
34enum class ElementType {
36 INVALID = 0,
38 PART,
39 STAFF,
40 SCORE,
41 SYMBOL,
42 TEXT,
55 STEM, // list STEM before NOTE: notes in TAB might 'break' stems
56 NOTE, // and this requires stems to be drawn before notes
57 CLEF, // elements from CLEF to TIMESIG need to be in the order
58 KEYSIG, // in which they appear in a measure
59 AMBITUS,
60 TIMESIG,
61 REST,
62 BREATH,
64 TIE,
66 FERMATA,
68 DYNAMIC,
69 BEAM,
70 HOOK,
71 LYRICS,
73 MARKER,
74 JUMP,
76 TUPLET,
83 HARMONY,
85 BEND,
87 VOLTA,
100 SPACER,
102 NOTEHEAD,
103 NOTEDOT,
104 TREMOLO,
105 IMAGE,
106 MEASURE,
107 SELECTION,
108 LASSO,
111 FSYMBOL,
112 PAGE,
113 HAIRPIN,
114 OTTAVA,
115 PEDAL,
116 TRILL,
117 LET_RING,
118 VIBRATO,
119 PALM_MUTE,
120 TEXTLINE,
122 NOTELINE,
124 GLISSANDO,
125 BRACKET,
126 SEGMENT,
127 SYSTEM,
128 COMPOUND,
129 CHORD,
130 SLUR,
131 ELEMENT,
135 HBOX,
136 VBOX,
137 TBOX,
138 FBOX,
139 ICON,
140 OSSIA,
142 STICKING,
143
144 MAXTYPE
146 };
147
148//---------------------------------------------------------
149// AccidentalType
150//---------------------------------------------------------
151// NOTE: keep this in sync with with accList array in accidentals.cpp
152
153enum class AccidentalType : unsigned char {
155 NONE,
156 FLAT,
157 NATURAL,
158 SHARP,
159 SHARP2,
160 FLAT2,
161 SHARP3,
162 FLAT3,
166
167 // Gould arrow quartertone
179 ARROW_UP,
180
181 // Stein-Zimmermann
186
187 // Arel-Ezgi-Uzdilek (AEU)
192
193 // Extended Helmholtz-Ellis accidentals (just intonation)
200
207
214
221
228
235
238
246
247 FLAT_17,
248 SHARP_17,
249 FLAT_19,
250 SHARP_19,
251 FLAT_23,
252 SHARP_23,
253 FLAT_31,
254 SHARP_31,
255 FLAT_53,
256 SHARP_53,
257 //EQUALS_ALMOST,
258 //EQUALS,
259 //TILDE,
260
261 // Persian
262 SORI,
263 KORON,
264
265 // Wyschnegradsky
288
289 // (Spartan) Sagittal
316
317 END
319 };
320
321//---------------------------------------------------------
322// NoteType
323//---------------------------------------------------------
324
325enum class NoteType {
327 NORMAL = 0,
328 ACCIACCATURA = 0x1,
329 APPOGGIATURA = 0x2, // grace notes
330 GRACE4 = 0x4,
331 GRACE16 = 0x8,
332 GRACE32 = 0x10,
333 GRACE8_AFTER = 0x20,
334 GRACE16_AFTER = 0x40,
335 GRACE32_AFTER = 0x80,
336 INVALID = 0xFF
338 };
339
340constexpr NoteType operator| (NoteType t1, NoteType t2) {
341 return static_cast<NoteType>(static_cast<int>(t1) | static_cast<int>(t2));
342 }
343constexpr bool operator& (NoteType t1, NoteType t2) {
344 return static_cast<int>(t1) & static_cast<int>(t2);
345 }
346
347
348//---------------------------------------------------------
349// Direction
350//---------------------------------------------------------
351
352enum class Direction {
354 AUTO, UP, DOWN
356 };
357
358//---------------------------------------------------------
359// GlissandoType
360//---------------------------------------------------------
361
362enum class GlissandoType {
366 };
367
368//---------------------------------------------------------
369// GlissandoStyle
370//---------------------------------------------------------
371
377
378//---------------------------------------------------------
379// HarmonyType
380//---------------------------------------------------------
381
382enum class HarmonyType {
384 STANDARD,
385 ROMAN,
388 };
389
390//---------------------------------------------------------
391// Placement
392//---------------------------------------------------------
393
394enum class Placement {
396 ABOVE, BELOW
398 };
399
400//---------------------------------------------------------
401// HPlacement
402//---------------------------------------------------------
403
404enum class HPlacement {
408 };
409
410//---------------------------------------------------------
411// MMRestRangeBracketType
412//---------------------------------------------------------
413
419
420
421//---------------------------------------------------------
422// OffsetType
423//---------------------------------------------------------
424
425enum class OffsetType : char {
426 ABS,
427 SPATIUM
428 };
429
430//-------------------------------------------------------------------
431// SegmentType
432//
433// Type values determine the order of segments for a given tick
434//-------------------------------------------------------------------
435
436enum class SegmentType {
438 Invalid = 0x0,
439 BeginBarLine = 0x1,
440 HeaderClef = 0x2,
441 KeySig = 0x4,
442 Ambitus = 0x8,
443 TimeSig = 0x10,
444 StartRepeatBarLine = 0x20,
445 Clef = 0x40,
446 BarLine = 0x80,
447 Breath = 0x100,
448 //--
449 ChordRest = 0x200,
450 //--
451 EndBarLine = 0x400,
452 KeySigAnnounce = 0x800,
453 TimeSigAnnounce = 0x1000,
454 All = -1,
458 };
459
460constexpr SegmentType operator| (const SegmentType t1, const SegmentType t2) {
461 return static_cast<SegmentType>(static_cast<int>(t1) | static_cast<int>(t2));
462 }
463constexpr bool operator& (const SegmentType t1, const SegmentType t2) {
464 return static_cast<int>(t1) & static_cast<int>(t2);
465 }
466
467//-------------------------------------------------------------------
468// Tid
472//-------------------------------------------------------------------
473
474enum class Tid {
476 DEFAULT,
477 TITLE,
478 SUBTITLE,
479 COMPOSER,
480 POET,
482 FRAME,
487 HEADER,
488 FOOTER,
491 TEMPO,
492 METRONOME,
493 REPEAT_LEFT, // align to start of measure
494 REPEAT_RIGHT, // align to end of measure
496 SYSTEM,
497 STAFF,
499 DYNAMICS,
500 HAIRPIN,
503 HARMONY_A,
504 HARMONY_B,
507 TUPLET,
508 STICKING,
509 FINGERING,
513 TEXTLINE,
514 VOLTA,
515 OTTAVA,
516 GLISSANDO,
517 PEDAL,
518 BEND,
519 LET_RING,
520 PALM_MUTE,
521 USER1,
522 USER2,
523 USER3,
524 USER4,
525 USER5,
526 USER6,
527 USER7,
528 USER8,
529 USER9,
530 USER10,
531 USER11,
532 USER12,
533 // special, no-contents, styles used while importing older scores
534 TEXT_STYLES, // used for user-defined styles
535 IGNORED_STYLES // used for styles no longer relevant (mainly Figured bass text style)
537 };
538
539//---------------------------------------------------------
548//---------------------------------------------------------
549
550enum class Align : char {
552 LEFT = 0,
553 RIGHT = 1,
554 HCENTER = 2,
555 TOP = 0,
556 BOTTOM = 4,
557 VCENTER = 8,
558 BASELINE = 16,
563 };
564
565constexpr Align operator| (Align a1, Align a2) {
566 return static_cast<Align>(static_cast<char>(a1) | static_cast<char>(a2));
567 }
568constexpr bool operator& (Align a1, Align a2) {
569 return static_cast<char>(a1) & static_cast<char>(a2);
570 }
571constexpr Align operator~ (Align a) {
572 return static_cast<Align>(~static_cast<char>(a));
573 }
574
575//---------------------------------------------------------
576// FontStyle
577//---------------------------------------------------------
578
579enum class FontStyle : char {
580 Normal = 0, Bold = 1, Italic = 2, Underline = 4
581 };
582
583constexpr FontStyle operator+ (FontStyle a1, FontStyle a2) {
584 return static_cast<FontStyle>(static_cast<char>(a1) | static_cast<char>(a2));
585 }
586constexpr FontStyle operator- (FontStyle a1, FontStyle a2) {
587 return static_cast<FontStyle>(static_cast<char>(a1) & ~static_cast<char>(a2));
588 }
589constexpr bool operator& (FontStyle a1, FontStyle a2) {
590 return static_cast<bool>(static_cast<char>(a1) & static_cast<char>(a2));
591 }
592
593//---------------------------------------------------------
594// PlayEventType
598//---------------------------------------------------------
599
600enum class PlayEventType : char {
602 Auto,
603 User,
605 };
606
607//---------------------------------------------------------
608// Tuplets
609//---------------------------------------------------------
610
611enum class TupletNumberType : char { SHOW_NUMBER, SHOW_RELATION, NO_TEXT };
612enum class TupletBracketType : char { AUTO_BRACKET, SHOW_BRACKET, SHOW_NO_BRACKET };
613
614#ifdef SCRIPT_INTERFACE
615Q_ENUM_NS(ElementType);
616Q_ENUM_NS(Direction);
617Q_ENUM_NS(GlissandoType);
618Q_ENUM_NS(GlissandoStyle);
619Q_ENUM_NS(Placement);
620Q_ENUM_NS(HPlacement);
621Q_ENUM_NS(SegmentType);
622Q_ENUM_NS(Tid);
623Q_ENUM_NS(Align);
624Q_ENUM_NS(NoteType);
625Q_ENUM_NS(PlayEventType);
626Q_ENUM_NS(AccidentalType);
627Q_ENUM_NS(HarmonyType);
628#endif
629
630//hack: to force the build system to run moc on this file
632class Mops : public QObject {
633 Q_GADGET
634 };
635
636extern Direction toDirection(const QString&);
637extern const char* toString(Direction);
638extern QString toUserString(Direction);
639extern void fillComboBoxDirection(QComboBox*);
640
641
642} // namespace Ms
643
644Q_DECLARE_METATYPE(Ms::Align);
645
646Q_DECLARE_METATYPE(Ms::Direction);
647
648Q_DECLARE_METATYPE(Ms::NoteType);
649
650Q_DECLARE_METATYPE(Ms::PlayEventType);
651
652Q_DECLARE_METATYPE(Ms::AccidentalType);
653
654Q_DECLARE_METATYPE(Ms::HPlacement);
655
656#endif
Definition cursor.cpp:30
NoteType
Definition types.h:325
ElementType
Definition types.h:34
Direction
Definition types.h:352
HarmonyType
Definition types.h:382
OffsetType
Definition types.h:425
@ SPATIUM
offset in staff space units
@ ABS
offset in point units
SegmentType
Definition types.h:436
@ All
Includes all barline types.
PlayEventType
Determines whether oranaments are automatically generated when playing a score and whether the PlayEv...
Definition types.h:600
@ User
Some play events are modified by user.
AccidentalType
Definition types.h:153
Align
Align Because the Align enum has Top = 0 and Left = 0, align() & Align::Top will always return false.
Definition types.h:550
Placement
Definition types.h:394
GlissandoType
Definition types.h:362
HPlacement
Definition types.h:404
Tid
Enumerates the list of built-in text substyles.
Definition types.h:474
@ HARMONY_NASHVILLE
@ INSTRUMENT_EXCERPT
@ INSTRUMENT_LONG
@ LH_GUITAR_FINGERING
@ REPEAT_RIGHT
@ HARMONY_ROMAN
@ RH_GUITAR_FINGERING
@ INSTRUMENT_SHORT
@ STRING_NUMBER
GlissandoStyle
Definition types.h:372
MMRestRangeBracketType
Definition types.h:414