1 //=============================================================================
2 //  MusE Score
3 //  Linux Music Score Editor
4 //
5 //  Copyright (C) 2002-2011 Werner Schweer and others
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 //
10 //  This program is distributed in the hope that it will be useful,
11 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 //  GNU General Public License for more details.
14 //
15 //  You should have received a copy of the GNU General Public License
16 //  along with this program; if not, write to the Free Software
17 //  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 //=============================================================================
19 
20 #ifndef __GLOBALS_H__
21 #define __GLOBALS_H__
22 
23 namespace Ms {
24 
25 extern bool enableExperimental;
26 extern bool noSeq;            ///< Don’t use sequencer; cmd line option.
27 extern bool noMidi;           ///< Don’t use midi; cmd line option.
28 extern bool midiInputTrace;   ///< debug option: dump midi input
29 extern bool midiOutputTrace;  ///< debug option: dump midi output
30 extern bool converterMode;
31 extern bool pluginMode;
32 extern double guiScaling;
33 extern int trimMargin;
34 extern bool noWebView;
35 extern bool ignoreWarnings;
36 
37 enum TelemetryDataCollectionType : unsigned char {
38       COLLECT_NO_DATA = 0,
39       COLLECT_CRASH_FREE_DATA = 1,
40       COLLECT_INSPECTOR_DATA = 1 << 1,
41       COLLECT_SHORTCUT_AND_MENU_DATA = 1 << 2,
42       COLLECT_ALL_DATA = COLLECT_CRASH_FREE_DATA & COLLECT_INSPECTOR_DATA & COLLECT_SHORTCUT_AND_MENU_DATA
43 };
44 
45 constexpr TelemetryDataCollectionType enabledTelemetryDataTypes = TelemetryDataCollectionType::COLLECT_CRASH_FREE_DATA;
46 
47 //---------------------------------------------------------
48 // MsWidget
49 // used to assign actions (shortcuts) to the appropriate
50 // widget (actions.cpp, shortcuts.cpp)
51 //---------------------------------------------------------
52 
53 enum MsWidget {
54       MAIN_WINDOW       = 0,
55       SCORE_TAB         = 1,
56       PIANO_ROLL_EDITOR = 2,
57       };
58 
59 //---------------------------------------------------------
60 //    ScoreState
61 //    used also to mask out shortcuts (actions.cpp)
62 //---------------------------------------------------------
63 
64 enum ScoreState {
65       STATE_INIT                                = 0,
66       STATE_DISABLED                            = 1 <<  0,
67       STATE_NORMAL                              = 1 <<  1,
68    // STATE_NOTE_ENTRY_STAFF_PITCHED
69       STATE_NOTE_ENTRY_STAFF_DRUM               = 1 <<  2,
70       STATE_NOTE_ENTRY_STAFF_TAB                = 1 <<  3,
71       STATE_NOTE_ENTRY_METHOD_STEPTIME          = 1 <<  4,
72       STATE_NOTE_ENTRY_METHOD_REPITCH           = 1 <<  5,
73       STATE_NOTE_ENTRY_METHOD_RHYTHM            = 1 <<  6,
74       STATE_NOTE_ENTRY_METHOD_REALTIME_AUTO     = 1 <<  7,
75       STATE_NOTE_ENTRY_METHOD_REALTIME_MANUAL   = 1 <<  8,
76       STATE_EDIT                                = 1 <<  9,
77       STATE_TEXT_EDIT                           = 1 << 10,
78       STATE_LYRICS_EDIT                         = 1 << 11,
79       STATE_HARMONY_FIGBASS_EDIT                = 1 << 12,
80       STATE_PLAY                                = 1 << 13,
81       STATE_FOTO                                = 1 << 14,
82       STATE_LOCK                                = 1 << 15,
83       STATE_NOTE_ENTRY_METHOD_TIMEWISE          = 1 << 16,
84 
85       STATE_NEVER                               = 1 << 31,
86 
87       STATE_NOTE_ENTRY_STAFF_PITCHED = STATE_NOTE_ENTRY_METHOD_STEPTIME
88                                         | STATE_NOTE_ENTRY_METHOD_REPITCH
89                                         | STATE_NOTE_ENTRY_METHOD_RHYTHM
90                                         | STATE_NOTE_ENTRY_METHOD_REALTIME_AUTO
91                                         | STATE_NOTE_ENTRY_METHOD_REALTIME_MANUAL
92                                         | STATE_NOTE_ENTRY_METHOD_TIMEWISE,
93       STATE_NOTE_ENTRY 		= STATE_NOTE_ENTRY_STAFF_PITCHED | STATE_NOTE_ENTRY_STAFF_DRUM | STATE_NOTE_ENTRY_STAFF_TAB,
94       STATE_ALLTEXTUAL_EDIT	= STATE_TEXT_EDIT | STATE_LYRICS_EDIT | STATE_HARMONY_FIGBASS_EDIT,
95       STATE_ALL        		= -1
96       };
97 
98 //---------------------------------------------------------
99 //   MidiRemoteType
100 //---------------------------------------------------------
101 
102 enum MidiRemoteType {
103       MIDI_REMOTE_TYPE_INACTIVE = -1,
104       MIDI_REMOTE_TYPE_NOTEON = 0, MIDI_REMOTE_TYPE_CTRL
105       };
106 
107 //---------------------------------------------------------
108 //   MidiRemote
109 //---------------------------------------------------------
110 
111 struct MidiRemote {
112       int channel;
113       MidiRemoteType type;
114       int data;         // pitch or controller number
115       };
116 
117 extern const char* stateName(ScoreState);
118 
119 static constexpr qreal DPI_DISPLAY     = 96.0;  // 96 DPI nominal resolution
120 static constexpr qreal DPMM_DISPLAY    = DPI_DISPLAY / 25.4;
121 static constexpr qreal PALETTE_SPATIUM = 1.764 * DPMM_DISPLAY;
122 
123 static constexpr qreal ZOOM_LEVEL_MIN     = 1.0 / 16.0; // 6.25%
124 static constexpr qreal ZOOM_LEVEL_MAX     = 400;
125 static constexpr int   ZOOM_PRECISION_MIN = 1;
126 static constexpr int   ZOOM_PRECISION_MAX = 16;
127 
128 } // namespace Ms
129 #endif
130