1 //=========================================================
2 //  MusE
3 //  Linux Music Editor
4 //  $Id: gconfig.h,v 1.12.2.10 2009/12/01 03:52:40 terminator356 Exp $
5 //
6 //  (C) Copyright 1999-2003 Werner Schweer (ws@seh.de)
7 //
8 //  This program is free software; you can redistribute it and/or
9 //  modify it under the terms of the GNU General Public License
10 //  as published by the Free Software Foundation; version 2 of
11 //  the License, or (at your option) any later version.
12 //
13 //  This program is distributed in the hope that it will be useful,
14 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
15 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 //  GNU General Public License for more details.
17 //
18 //  You should have received a copy of the GNU General Public License
19 //  along with this program; if not, write to the Free Software
20 //  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 //
22 //=========================================================
23 
24 #ifndef __CONFIG_H__
25 #define __CONFIG_H__
26 
27 #define NUM_PARTCOLORS 18
28 #define NUM_FONTS 7
29 
30 #include <QColor>
31 #include <QFont>
32 #include <QRect>
33 #include <QString>
34 #include <QList>
35 #include <QStringList>
36 
37 namespace MusECore {
38 class Xml;
39 
40 enum newDrumRecordCondition_t
41 {
42   REC_ALL = 0,
43   DONT_REC_HIDDEN = 1,
44   DONT_REC_MUTED = 2,
45   DONT_REC_MUTED_OR_HIDDEN = 3
46 };
47 
48 }
49 
50 namespace MusEGlobal {
51 
52 // font scaling factors
53 struct FntFac {
54     static constexpr double F1 = 0.7;
55     static constexpr double F2 = 0.8;
56     static constexpr double F3 = 0.9;
57     static constexpr double F4 = 0.8;
58     static constexpr double F5 = 0.8;
59     static constexpr double F6 = 0.8;
60 };
61 
62 // Or'd together
63 enum ExportPortsDevices_t
64 {
65   PORT_NUM_META = 0x01,
66   DEVICE_NAME_META = 0x02,
67 };
68 
69 // Or'd together
70 enum ExportModeInstr_t
71 {
72   MODE_SYSEX = 0x01,
73   INSTRUMENT_NAME_META = 0x02,
74 };
75 
76 enum RouteNameAliasPreference { RoutePreferCanonicalName = 0, RoutePreferFirstAlias = 1, RoutePreferSecondAlias = 2 };
77 
78 enum WaveDrawing { WaveRmsPeak=1, WaveOutLine=2 };
79 
80 struct StripConfig {
81   // The corresponding track's serial number. Can be -1.
82   int _serial;
83   // The corresponding track's index in the song file. Can be -1.
84   // Temporary during loading to avoid using globally or locally
85   //  'unique' identifiers in the song file, such as the serial,
86   //  to resolve references.
87   int _tmpFileIdx;
88 
89   bool _visible;
90   int _width;
91   bool _deleted;
92 
93   StripConfig();
94   StripConfig(int trackSerial, bool visible, int width);
95 
96   bool isNull() const;
97 
98   void write(int level, MusECore::Xml& xml) const;
99   void read(MusECore::Xml& xml);
100 };
101 
102 typedef QList<StripConfig> StripConfigList_t;
103 typedef StripConfigList_t::iterator iStripConfigList;
104 typedef StripConfigList_t::const_iterator ciStripConfigList;
105 
106 //---------------------------------------------------------
107 //   MixerConfig
108 //---------------------------------------------------------
109 
110 struct MixerConfig {
111   enum DisplayOrder {
112         STRIPS_TRADITIONAL_VIEW = -1004,
113         STRIPS_EDITED_VIEW = -1003,
114         STRIPS_ARRANGER_VIEW = -1002,
115       };
116       QString name;
117       // Obsolete. Keep for old song support.
118       QStringList stripOrder;
119       QRect geometry;
120       bool showMidiTracks;
121       bool showDrumTracks;
122       bool showNewDrumTracks;
123       bool showInputTracks;
124       bool showOutputTracks;
125       bool showWaveTracks;
126       bool showGroupTracks;
127       bool showAuxTracks;
128       bool showSyntiTracks;
129       DisplayOrder displayOrder;
130       // Obsolete. Keep for old song support.
131       QList<bool> stripVisibility;
132       // This replaces stripOrder and stripVisibility.
133       // NOTE: To avoid having to put this information within a track,
134       //  we keep it conveniently here. But this means it does not
135       //  participate in the UNDO/REDO system. If a track is 'deleted'
136       //  the information here MUST be allowed to exist so that undoing
137       //  the track 'delete' finds the info.
138       // Thus it acts sort of 'in parallel' to the undo system and is similar
139       //  to the undo list (it never dies). The redo list can die, and we
140       //  could safely remove these corresponding items. FIXME TODO: DO THAT!
141       // Therefore the list must generally be protected from haphazard item
142       //  removal for the duration of the song file session.
143       // When writing to file BE SURE to ignore items with no corresponding track,
144       //  to filter out all the undesired 'deleted' ones.
145       StripConfigList_t stripConfigList;
146 
147       void write(int level, MusECore::Xml& xml, bool global) const;
148       void read(MusECore::Xml& xml);
149       };
150 
151 //---------------------------------------------------------
152 //   GlobalConfigValues
153 //---------------------------------------------------------
154 enum CONF_LV2_UI_BEHAVIOR {
155    CONF_LV2_UI_USE_FIRST = 0,
156    CONF_LV2_UI_ASK_ONCE,
157    CONF_LV2_UI_ASK_ALWAYS
158 };
159 
160 struct GlobalConfigValues {
161       QStringList pluginLadspaPathList;
162       QStringList pluginDssiPathList;
163       QStringList pluginVstPathList;
164       QStringList pluginLinuxVstPathList;
165       QStringList pluginLv2PathList;
166       bool pluginCacheTriggerRescan; // Whether to trigger a plugin cache rescan.
167 
168       int globalAlphaBlend;
169       QColor palette[16];
170       QColor partColors[NUM_PARTCOLORS];
171       QString partColorNames[NUM_PARTCOLORS];
172       QColor transportHandleColor;
173       QColor bigTimeForegroundColor;
174       QColor bigTimeBackgroundColor;
175       QColor waveEditBackgroundColor;
176       QFont fonts[NUM_FONTS];
177       bool autoAdjustFontSize;
178       QColor trackBg;
179       QColor selectTrackBg;
180       QColor selectTrackFg;
181       QColor selectTrackCurBg;
182       QColor trackSectionDividerColor;
183 
184       QColor midiTrackLabelBg;
185       QColor drumTrackLabelBg;
186       QColor newDrumTrackLabelBg;
187       QColor waveTrackLabelBg;
188       QColor outputTrackLabelBg;
189       QColor inputTrackLabelBg;
190       QColor groupTrackLabelBg;
191       QColor auxTrackLabelBg;
192       QColor synthTrackLabelBg;
193 
194       QColor midiTrackBg;
195       QColor drumTrackBg;
196       QColor newDrumTrackBg;
197       QColor waveTrackBg;
198       QColor outputTrackBg;
199       QColor inputTrackBg;
200       QColor groupTrackBg;
201       QColor auxTrackBg;
202       QColor synthTrackBg;
203 
204       QColor partCanvasBg;
205       QColor partCanvasCoarseRasterColor;
206       QColor partCanvasBeatRasterColor;
207       QColor partCanvasFineRasterColor;
208       QColor ctrlGraphFg;
209       QColor ctrlGraphSel;
210 //      QColor mixerBg;
211 
212       QColor rulerBg;
213       QColor rulerFg;
214       QColor midiCanvasBg;
215       QColor midiControllerViewBg;
216       QColor drumListBg;
217       QColor drumListFont;
218       QColor drumListSel;
219       QColor drumListSelFont;
220       QColor rulerCurrent;
221       QColor midiCanvasFineColor;
222       QColor midiCanvasBeatColor;
223       QColor midiCanvasBarColor;
224       QColor midiItemColor;
225       QColor midiItemSelectedColor;
226       QColor dummyPartColor;
227       QColor midiDividerColor;
228       QColor pianoCurrentKey;
229       QColor pianoPressedKey;
230       QColor pianoSelectedKey;
231 
232       QColor waveNonselectedPart;
233       QColor wavePeakColor;
234       QColor waveRmsColor;
235       QColor wavePeakColorSelected;
236       QColor waveRmsColorSelected;
237 
238       QColor partWaveColorPeak;
239       QColor partWaveColorRms;
240       QColor partMidiDarkEventColor;
241       QColor partMidiLightEventColor;
242 
243       QColor sliderBarColor;
244       QColor sliderBackgroundColor;
245       QColor panSliderColor;
246       QColor gainSliderColor;
247       QColor auxSliderColor;
248       QColor audioVolumeSliderColor;
249       QColor midiVolumeSliderColor;
250       QColor audioVolumeHandleColor;
251       QColor midiVolumeHandleColor;
252       QColor audioControllerSliderColor;
253       QColor audioPropertySliderColor;
254       QColor midiControllerSliderColor;
255       QColor midiPropertySliderColor;
256       QColor midiPatchReadoutColor;
257       QColor knobFontColor;
258 
259       QColor audioMeterPrimaryColor;
260       QColor midiMeterPrimaryColor;
261       QColor meterBackgroundColor;
262 
263       QColor rackItemBackgroundColor;
264       QColor rackItemBgActiveColor;
265       QColor rackItemFontColor;
266       QColor rackItemFontActiveColor;
267       QColor rackItemBorderColor;
268       QColor rackItemFontColorHover;
269 
270       QColor midiInstrumentBackgroundColor;
271       QColor midiInstrumentBgActiveColor;
272       QColor midiInstrumentFontColor;
273       QColor midiInstrumentFontActiveColor;
274       QColor midiInstrumentBorderColor;
275 
276       QColor markerColor;
277       QColor rangeMarkerColor;
278       QColor positionMarkerColor;
279       QColor currentPositionColor;
280 
281       WaveDrawing waveDrawing;
282 
283       // At what point size to switch from aliased text to non-aliased text. Zero means always use anti-aliasing.
284       // For certain widgets that use it. May be more later.
285       int maxAliasedPointSize;
286 
287       int iconSize;
288       int cursorSize;
289       bool cascadeStylesheets;
290       bool showIconsInMenus;
291       bool useNativeStandardDialogs;
292       int trackGradientStrength;
293       int partGradientStrength;
294 
295       bool enableAlsaMidiDriver; // Whether to enable the ALSA midi driver
296       int division;
297       int rtcTicks;
298       int curMidiSyncInPort;     // The currently selected midi sync input port.
299       bool midiSendInit;         // Send instrument initialization sequences
300       bool warnInitPending;      // Warn instrument initialization sequences pending
301       bool midiSendCtlDefaults;  // Send instrument controller defaults at position 0 if none in song
302       bool midiSendNullParameters; // Send null parameters after each (N)RPN event
303       bool midiOptimizeControllers; // Don't send redundant H/L parameters or H/L values
304       bool warnIfBadTiming;      // Warn if timer res not good
305       bool velocityPerNote;      // Whether to show per-note or all velocities
306       int minMeter;
307       double minSlider;
308       bool freewheelMode;
309       int guiRefresh;
310       QString userInstrumentsDir;  // Obsolete. Must keep for compatibility.
311 
312       bool extendedMidi;      // extended smf format
313       int midiDivision;       // division for smf export
314       QString copyright;      // copyright string for smf export
315       int smfFormat;          // smf export file type
316       bool exp2ByteTimeSigs;  // Export 2 byte time sigs instead of 4 bytes
317       bool expOptimNoteOffs;  // Save space by replacing note offs with note on velocity 0
318       bool expRunningStatus;  // Save space by using running status
319       bool importMidiSplitParts; // Split imported tracks into multiple parts.
320       bool useLastEditedEvent; // option to set event properties from last edited when adding events in pianoroll
321 // Obsolete. There is only 'New' drum tracks now.
322 //       bool importMidiNewStyleDrum; // Use new style drum tracks
323       bool importDevNameMetas;    // Import Prefer Device Name metas over port number metas if both exist.
324       bool importInstrNameMetas;  // Import Prefer Instrument Name metas over Mode sysexes if both exist.
325       int exportPortsDevices;     // Or'd ExportPortsDevices_t flags. Export port number metas and/or device name metas.
326       bool exportPortDeviceSMF0;  // Export a port and/or device meta even for SMF0.
327       int exportModeInstr;        // Or'd ExportModeInstr_t flags. Export mode sysexes and/or instrument name metas.
328       QString importMidiDefaultInstr;  // Default to this instrument not Generic, if no match found
329       bool exportDrumMapOverrides; // Apply Port, Channel, and ANote drum map overrides to export
330       bool exportChannelOverridesToNewTrack; // Drum map Channel overrides go to a separate track
331 
332       int startMode;          // 0 - start with last song
333                               // 1 - start with default template
334                               // 2 - start with song
335       QString startSong;      // path for start song
336       bool startSongLoadConfig;  // Whether to load configuration with the start template or song
337 
338 
339       QRect geometryMain;
340       QRect geometryTransport;
341       QRect geometryBigTime;
342       MixerConfig mixer1;
343       MixerConfig mixer2;
344       bool transportVisible;
345       bool bigTimeVisible;
346       bool mixer1Visible;
347       bool mixer2Visible;
348       bool markerVisible;
349 //      bool arrangerVisible;
350 
351       bool showSplashScreen;
352       int canvasShowPartType;       // 1 - names, 2 events
353       int canvasShowPartEvent;      //
354       bool canvasShowGrid;
355       bool canvasShowGridHorizontalAlways;
356       bool canvasShowGridBeatsAlways;
357       bool useTrackColorForParts;
358       QString canvasBgPixmap;
359       QStringList canvasCustomBgList;
360 //      QString styleSheetFile;
361 //      QString style;
362       QString theme;
363 
364       QString externalWavEditor;
365       bool useOldStyleStopShortCut;
366       bool useRewindOnStop;
367       bool moveArmedCheckBox;
368       bool useDenormalBias;
369       bool useOutputLimiter;
370       bool showDidYouKnow;
371       bool vstInPlace; // Enable VST in-place processing
372       int deviceAudioSampleRate;
373       int deviceAudioBufSize;
374       int deviceAudioBackend;
375       bool useJackTransport;
376       bool timebaseMaster;
377 
378       QString projectBaseFolder;
379       bool projectStoreInFolder;
380       bool useProjectSaveDialog;
381       unsigned long minControlProcessPeriod;
382       bool popupsDefaultStayOpen;
383       bool leftMouseButtonCanDecrease;
384 //      bool rangeMarkerWithoutMMB;
385       MusECore::newDrumRecordCondition_t newDrumRecordCondition;
386       bool addHiddenTracks;
387       bool unhideTracks;
388 // Obsolete. There is only 'New' drum tracks now.
389 //       drumTrackPreference_t drumTrackPreference;
390       bool smartFocus;
391       int trackHeight;
392       bool borderlessMouse;
393       bool autoSave;
394       bool scrollableSubMenus;
395       bool liveWaveUpdate;   //live update wave tracks while recording
396       bool warnOnFileVersions; // Warn if file version different than current
397       CONF_LV2_UI_BEHAVIOR lv2UiBehavior;
398       int audioEffectsRackVisibleItems; // Number of rack slots visible at one time in the rack.
399       bool preferKnobsVsSliders; // Whether to prefer the use of knobs over sliders, esp in mixer.
400       bool showControlValues; // Whether to show the value along with label in small controls, esp in mixer.
401       bool monitorOnRecord;  // Whether to automatically monitor on record arm.
402       bool lineEditStyleHack; // Force line edit widgets to draw a frame at small sizes. Some styles refuse to draw the frame.
403       bool preferMidiVolumeDb; // Prefer midi volume as decibels instead of 0-127.
404       // NOTE: The following are similar to the paste dialog function options, stored separately.
405       bool midiCtrlGraphMergeErase; // Whether to erase underlying erase target items when dragging/dropping source items.
406       bool midiCtrlGraphMergeEraseInclusive; // Whether to erase target items in-between source item groups.
407       bool midiCtrlGraphMergeEraseWysiwyg; // Whether to erase past the last item in a group to include its original source width.
408       RouteNameAliasPreference preferredRouteNameOrAlias;
409       bool routerExpandVertically; // Whether to expand the router items vertically. (Good use of space but slow!)
410       // How to group the router channels together for easier multi-channel manipulation.
411       int routerGroupingChannels;
412       // Whether to enable latency correction/compensation.
413       bool enableLatencyCorrection;
414       // Whether to include unterminated output branches in latency correction calculations.
415       bool correctUnterminatedOutBranchLatency;
416       // Whether to include unterminated input branches in latency correction calculations.
417       bool correctUnterminatedInBranchLatency;
418       // Whether a track's monitoring feature affects latency.
419       bool monitoringAffectsLatency;
420       // Whether completely independent branches share a common latency.
421       bool commonProjectLatency;
422       QString mixdownPath;
423       bool showNoteNamesInPianoRoll;
424       bool showNoteTooltips;
425       bool showTimeScaleBeatNumbers;
426       // Whether selecting parts or events is undoable.
427       // If set, it can be somewhat tedious for the user to step through all the undo/redo items.
428       bool selectionsUndoable;
429       // Revert native GUI scaling on HiDPI
430       bool noPluginScaling;
431       bool keepTransportWindowOnTop;
432       bool showStatusBar;
433       int recentListLength;
434       };
435 
436 
437 
438 
439 extern GlobalConfigValues config;
440 } // namespace MusEGlobal
441 
442 #endif
443 
444