Line data Source code
1 : /*
2 : * SPDX-License-Identifier: GPL-3.0-only
3 : * MuseScore-Studio-CLA-applies
4 : *
5 : * MuseScore Studio
6 : * Music Composition & Notation
7 : *
8 : * Copyright (C) 2021 MuseScore Limited and others
9 : *
10 : * This program is free software: you can redistribute it and/or modify
11 : * it under the terms of the GNU General Public License version 3 as
12 : * published by the Free Software Foundation.
13 : *
14 : * This program is distributed in the hope that it will be useful,
15 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 : * GNU General Public License for more details.
18 : *
19 : * You should have received a copy of the GNU General Public License
20 : * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 : */
22 :
23 : #pragma once
24 :
25 : #include <QColor>
26 : #include <optional>
27 :
28 : #include "modularity/imoduleinterface.h"
29 : #include "async/channel.h"
30 : #include "types/retval.h"
31 : #include "io/path.h"
32 : #include "global/globaltypes.h"
33 :
34 : #include "types/noteinputtypes.h"
35 : #include "types/zoomtype.h"
36 :
37 : #include "engraving/automation/automationtypes.h"
38 :
39 : namespace mu::notation {
40 : class INotationConfiguration : MODULE_GLOBAL_INTERFACE
41 : {
42 8 : INTERFACE_ID(INotationConfiguration)
43 :
44 : public:
45 73 : virtual ~INotationConfiguration() = default;
46 :
47 : virtual QColor notationColor() const = 0;
48 : virtual void setNotationColor(const QColor& color) = 0;
49 : virtual muse::async::Notification notationColorChanged() const = 0;
50 : virtual void resetNotationColor() = 0;
51 :
52 : virtual QColor backgroundColor() const = 0;
53 : virtual void setBackgroundColor(const QColor& color) = 0;
54 :
55 : virtual muse::io::path_t backgroundWallpaperPath() const = 0;
56 : virtual const QPixmap& backgroundWallpaper() const = 0;
57 : virtual void setBackgroundWallpaperPath(const muse::io::path_t& path) = 0;
58 :
59 : virtual bool backgroundUseColor() const = 0;
60 : virtual void setBackgroundUseColor(bool value) = 0;
61 :
62 : virtual void resetBackground() = 0;
63 :
64 : virtual muse::async::Notification backgroundChanged() const = 0;
65 :
66 : virtual QColor foregroundColor() const = 0;
67 : virtual void setForegroundColor(const QColor& color) = 0;
68 :
69 : virtual muse::io::path_t foregroundWallpaperPath() const = 0;
70 : virtual const QPixmap& foregroundWallpaper() const = 0;
71 : virtual void setForegroundWallpaperPath(const muse::io::path_t& path) = 0;
72 :
73 : virtual bool foregroundUseColor() const = 0;
74 : virtual void setForegroundUseColor(bool value) = 0;
75 :
76 : virtual void resetForeground() = 0;
77 :
78 : virtual muse::async::Notification foregroundChanged() const = 0;
79 :
80 : virtual muse::io::path_t wallpapersDefaultDirPath() const = 0;
81 :
82 : virtual bool shouldInvertScore() const = 0; // Whether score should be inverted now, based on theme.
83 :
84 : virtual bool scoreInversionEnabled() const = 0;
85 : virtual void setScoreInversionEnabled(bool value) = 0;
86 : virtual muse::async::Notification scoreInversionChanged() const = 0;
87 :
88 : virtual bool isOnlyInvertInDarkTheme() const = 0;
89 : virtual void setOnlyInvertInDarkTheme(bool value) = 0;
90 : virtual muse::async::Notification isOnlyInvertInDarkThemeChanged() const = 0;
91 :
92 : virtual QColor borderColor() const = 0;
93 : virtual int borderWidth() const = 0;
94 :
95 : virtual QColor playbackCursorColor() const = 0;
96 : virtual QColor loopMarkerColor() const = 0;
97 : virtual int cursorOpacity() const = 0;
98 :
99 : virtual bool thinNoteInputCursor() const = 0;
100 :
101 : virtual QColor selectionColor(engraving::voice_idx_t voiceIndex = 0) const = 0;
102 : virtual QColor highlightSelectionColor(engraving::voice_idx_t voiceIndex = 0) const = 0;
103 :
104 : virtual QColor dropRectColor() const = 0;
105 :
106 : virtual muse::draw::Color noteInputPreviewColor() const = 0;
107 :
108 : virtual bool useNoteInputCursorInInputByDuration() const = 0;
109 : virtual void setUseNoteInputCursorInInputByDuration(bool use) = 0;
110 : virtual muse::async::Notification useNoteInputCursorInInputByDurationChanged() const = 0;
111 :
112 : virtual int selectionProximity() const = 0;
113 : virtual void setSelectionProximity(int proximity) = 0;
114 : virtual muse::async::Channel<int> selectionProximityChanged() const = 0;
115 :
116 : virtual ZoomType defaultZoomType() const = 0;
117 : virtual void setDefaultZoomType(ZoomType zoomType) = 0;
118 :
119 : virtual int defaultZoom() const = 0;
120 : virtual void setDefaultZoom(int zoomPercentage) = 0;
121 : virtual muse::async::Notification defaultZoomChanged() const = 0;
122 :
123 : virtual QList<int> possibleZoomPercentageList() const = 0;
124 :
125 : virtual mu::engraving::AutomationType currentAutomationType() const = 0;
126 : virtual void setCurrentAutomationType(mu::engraving::AutomationType type) = 0;
127 : virtual muse::async::Notification currentAutomationTypeChanged() const = 0;
128 :
129 : virtual int mouseZoomPrecision() const = 0;
130 : virtual void setMouseZoomPrecision(int precision) = 0;
131 : virtual muse::async::Notification mouseZoomPrecisionChanged() const = 0;
132 :
133 : virtual std::string fontFamily() const = 0;
134 : virtual int fontSize() const = 0;
135 :
136 : virtual muse::io::path_t userStylesPath() const = 0;
137 : virtual void setUserStylesPath(const muse::io::path_t& path) = 0;
138 : virtual muse::async::Channel<muse::io::path_t> userStylesPathChanged() const = 0;
139 :
140 : virtual muse::io::path_t defaultStyleFilePath() const = 0;
141 : virtual void setDefaultStyleFilePath(const muse::io::path_t& path) = 0;
142 : virtual muse::async::Channel<muse::io::path_t> defaultStyleFilePathChanged() const = 0;
143 :
144 : virtual muse::io::path_t partStyleFilePath() const = 0;
145 : virtual void setPartStyleFilePath(const muse::io::path_t& path) = 0;
146 : virtual muse::async::Channel<muse::io::path_t> partStyleFilePathChanged() const = 0;
147 :
148 : virtual NoteInputMethod defaultNoteInputMethod() const = 0;
149 : virtual void setDefaultNoteInputMethod(NoteInputMethod method) = 0;
150 : virtual muse::async::Notification defaultNoteInputMethodChanged() const = 0;
151 :
152 : virtual bool addAccidentalDotsArticulationsToNextNoteEntered() const = 0;
153 : virtual void setAddAccidentalDotsArticulationsToNextNoteEntered(bool value) = 0;
154 : virtual muse::async::Notification addAccidentalDotsArticulationsToNextNoteEnteredChanged() const = 0;
155 :
156 : virtual muse::io::path_t userMusicFontsPath() const = 0;
157 : virtual void setUserMusicFontsPath(const muse::io::path_t& path) = 0;
158 : virtual muse::async::Channel<muse::io::path_t> userMusicFontsPathChanged() const = 0;
159 :
160 : virtual bool isMidiInputEnabled() const = 0;
161 : virtual void setIsMidiInputEnabled(bool enabled) = 0;
162 : virtual muse::async::Notification isMidiInputEnabledChanged() const = 0;
163 :
164 : virtual bool startNoteInputAtSelectedNoteRestWhenPressingMidiKey() const = 0;
165 : virtual void setStartNoteInputAtSelectedNoteRestWhenPressingMidiKey(bool value) = 0;
166 : virtual muse::async::Notification startNoteInputAtSelectedNoteRestWhenPressingMidiKeyChanged() const = 0;
167 :
168 : virtual bool isAutomaticallyPanEnabled() const = 0;
169 : virtual void setIsAutomaticallyPanEnabled(bool enabled) = 0;
170 : virtual muse::async::Notification isAutomaticallyPanEnabledChanged() const = 0;
171 :
172 : virtual bool isPlayRepeatsEnabled() const = 0;
173 : virtual void setIsPlayRepeatsEnabled(bool enabled) = 0;
174 : virtual muse::async::Notification isPlayRepeatsChanged() const = 0;
175 :
176 : virtual bool isPlayChordSymbolsEnabled() const = 0;
177 : virtual void setIsPlayChordSymbolsEnabled(bool enabled) = 0;
178 : virtual muse::async::Notification isPlayChordSymbolsChanged() const = 0;
179 :
180 : virtual bool isPlayPreviewNotesInInputByDuration() const = 0;
181 : virtual void setIsPlayPreviewNotesInInputByDuration(bool play) = 0;
182 : virtual muse::async::Notification isPlayPreviewNotesInInputByDurationChanged() const = 0;
183 :
184 : virtual bool playPreviewNotesWithScoreDynamics() const = 0;
185 : virtual void setPlayPreviewNotesWithScoreDynamics(bool use) = 0;
186 : virtual muse::async::Notification playPreviewNotesWithScoreDynamicsChanged() const = 0;
187 :
188 : virtual bool isMetronomeEnabled() const = 0;
189 : virtual void setIsMetronomeEnabled(bool enabled) = 0;
190 : virtual muse::async::Notification isMetronomeEnabledChanged() const = 0;
191 :
192 : virtual bool isCountInEnabled() const = 0;
193 : virtual void setIsCountInEnabled(bool enabled) = 0;
194 : virtual muse::async::Notification isCountInEnabledChanged() const = 0;
195 :
196 : virtual muse::ValCh<muse::Orientation> canvasOrientation() const = 0;
197 : virtual void setCanvasOrientation(muse::Orientation orientation) = 0;
198 :
199 : virtual bool colorNotesOutsideOfUsablePitchRange() const = 0;
200 : virtual void setColorNotesOutsideOfUsablePitchRange(bool value) = 0;
201 : virtual muse::async::Channel<bool> colorNotesOutsideOfUsablePitchRangeChanged() const = 0;
202 :
203 : virtual bool warnGuitarBends() const = 0;
204 : virtual void setWarnGuitarBends(bool value) = 0;
205 : virtual muse::async::Channel<bool> warnGuitarBendsChanged() const = 0;
206 :
207 : virtual int delayBetweenNotesInRealTimeModeMilliseconds() const = 0;
208 : virtual void setDelayBetweenNotesInRealTimeModeMilliseconds(int delayMs) = 0;
209 : virtual muse::async::Channel<int> delayBetweenNotesInRealTimeModeMillisecondsChanged() const = 0;
210 :
211 : virtual bool useMidiVelocityAndDurationDuringNoteInput() const = 0;
212 : virtual void setUseMidiVelocityAndDurationDuringNoteInput(bool use) = 0;
213 : virtual muse::async::Channel<bool> useMidiVelocityAndDurationDuringNoteInputChanged() const = 0;
214 :
215 : virtual int notePlayDurationMilliseconds() const = 0;
216 : virtual void setNotePlayDurationMilliseconds(int durationMs) = 0;
217 : virtual muse::async::Channel<int> notePlayDurationMillisecondsChanged() const = 0;
218 :
219 : virtual void setTemplateModeEnabled(std::optional<bool> enabled) = 0;
220 : virtual void setTestModeEnabled(std::optional<bool> enabled) = 0;
221 :
222 : virtual muse::io::path_t instrumentsXmlPath() const = 0;
223 : virtual muse::io::path_t scoreOrdersXmlPath() const = 0;
224 :
225 : virtual muse::io::path_t userInstrumentsFolder() const = 0;
226 : virtual muse::io::paths_t userInstrumentsAndScoreOrdersPaths() const = 0;
227 : virtual void setUserInstrumentsFolder(const muse::io::path_t& path) = 0;
228 : virtual muse::async::Channel<muse::io::path_t> userInstrumentsFolderChanged() const = 0;
229 :
230 : virtual muse::io::path_t stringTuningsPresetsPath() const = 0;
231 :
232 : virtual bool isSnappedToGrid(muse::Orientation gridOrientation) const = 0;
233 : virtual void setIsSnappedToGrid(muse::Orientation gridOrientation, bool isSnapped) = 0;
234 :
235 : virtual int gridSizeSpatium(muse::Orientation gridOrientation) const = 0;
236 : virtual void setGridSize(muse::Orientation gridOrientation, int sizeSpatium) = 0;
237 :
238 : virtual bool needToShowMScoreError(const std::string& errorKey) const = 0;
239 : virtual void setNeedToShowMScoreError(const std::string& errorKey, bool show) = 0;
240 :
241 : virtual muse::ValCh<bool> midiUseWrittenPitch() const = 0;
242 : virtual void setMidiUseWrittenPitch(bool useWrittenPitch) = 0;
243 :
244 : virtual muse::io::path_t styleFileImportPath() const = 0;
245 : virtual void setStyleFileImportPath(const muse::io::path_t& path) = 0;
246 : virtual muse::async::Channel<std::string> styleFileImportPathChanged() const = 0;
247 : };
248 : }
|