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) 2026 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 : #pragma once
23 :
24 : #include "modularity/imoduleinterface.h"
25 :
26 : #include "global/async/channel.h"
27 : #include "global/async/notification.h"
28 :
29 : #include "rcommand/commandtypes.h"
30 :
31 : #include "notation/types/noteinputtypes.h"
32 : #include "notation/notationtypes.h"
33 : #include "notation/inotationstyle.h"
34 :
35 : namespace mu::notation {
36 : class INotationViewController;
37 : class INotationCommandsController : MODULE_CONTEXT_INTERFACE
38 : {
39 0 : INTERFACE_ID(INotationCommandsController)
40 : public:
41 0 : virtual ~INotationCommandsController() = default;
42 :
43 : //! NOTE We need to set a "current" view controller that will "receive" commands, such as zoom.
44 : //! Don't forget to reset the current view controller when deleting, but only if it is the current one.
45 : virtual void setViewController(INotationViewController* controller) = 0;
46 : virtual INotationViewController* viewController() const = 0;
47 :
48 : virtual bool hasSelection() const = 0;
49 : virtual bool isSingleSelection() const = 0;
50 : virtual bool isRangeSelection() const = 0;
51 : virtual muse::async::Notification selectionChanged() const = 0;
52 : virtual bool selectionHasTie() const = 0;
53 : virtual bool selectionHasLaissezVib() const = 0;
54 : virtual bool selectionHasSlur() const = 0;
55 :
56 : virtual bool canUndo() const = 0;
57 : virtual bool canRedo() const = 0;
58 : virtual muse::async::Notification stackChanged() const = 0;
59 :
60 : virtual bool isTextEditing() const = 0;
61 : virtual bool isLyricsEditing() const = 0;
62 : virtual muse::async::Channel<bool> textEditingChanged() const = 0;
63 :
64 : virtual bool isNoteInputAllowed() const = 0;
65 : virtual muse::async::Channel<bool> isNoteInputAllowedChanged() const = 0;
66 :
67 : virtual muse::async::Notification noteInputStateChanged() const = 0;
68 : virtual bool isNoteInputMode() const = 0;
69 : virtual NoteInputMethod noteInputMethod() const = 0;
70 : virtual engraving::DurationType currentDurationType() const = 0;
71 : virtual int currentDotCount() const = 0;
72 : virtual bool currentIsRest() const = 0;
73 : virtual engraving::AccidentalType currentAccidentalType() const = 0;
74 : virtual std::set<engraving::SymId> currentArticulations() const = 0;
75 : virtual engraving::voice_idx_t currentVoice() const = 0;
76 :
77 : virtual bool isNoteInputActionAllowed() const = 0;
78 : virtual bool isNoteOrRestSelected() const = 0;
79 : virtual bool isHairpinSelected() const = 0;
80 : virtual bool isMoveSelectionAvailable(MoveSelectionType type) const = 0;
81 :
82 : virtual bool isToggleLayoutBreakAvailable() const = 0;
83 :
84 : virtual ScoreConfig scoreConfig() const = 0;
85 : virtual muse::async::Channel<ScoreConfigType> scoreConfigChanged() const = 0;
86 :
87 : virtual INotationStylePtr notationStyle() const = 0;
88 : virtual muse::async::Notification notationStyleChanged() const = 0;
89 :
90 : virtual bool isTablatureStaff() const = 0;
91 :
92 : virtual bool isAutomationModeEnabled() const = 0;
93 : virtual muse::async::Notification automationModeEnabledChanged() const = 0;
94 :
95 : virtual bool isDebuggingCommandEnabled(const muse::rcommand::Command& command) const = 0;
96 : virtual muse::async::Notification debuggingOptionsChanged() const = 0;
97 : };
98 : }
|