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 "async/notification.h"
26 : #include "types/ret.h"
27 :
28 : #include "types/noteinputtypes.h"
29 :
30 : namespace mu::notation {
31 : class INotationNoteInput
32 : {
33 : public:
34 0 : virtual ~INotationNoteInput() = default;
35 :
36 : virtual bool isNoteInputMode() const = 0;
37 :
38 : virtual const NoteInputState& state() const = 0;
39 :
40 : virtual void startNoteInput(NoteInputMethod method = NoteInputMethod::BY_NOTE_NAME, bool focusNotation = true) = 0;
41 : virtual void endNoteInput(bool resetState = false) = 0;
42 :
43 : virtual muse::async::Channel</*focusNotation*/ bool> noteInputStarted() const = 0;
44 : virtual muse::async::Notification noteInputEnded() const = 0;
45 :
46 : virtual bool usingNoteInputMethod(NoteInputMethod method) const = 0;
47 : virtual void setNoteInputMethod(NoteInputMethod method) = 0;
48 :
49 : virtual void addNote(const NoteInputParams& params, NoteAddingMode addingMode) = 0;
50 : virtual void setDuration(engraving::DurationType duration) = 0;
51 : virtual void toggleRest() = 0;
52 : virtual void toggleDots(int dots) = 0;
53 : virtual muse::Ret putNote(const muse::PointF& pos, bool replace, bool insert) = 0;
54 : virtual void removeNote(const muse::PointF& pos) = 0;
55 :
56 : virtual void addTuplet(const TupletOptions& options) = 0;
57 :
58 : virtual void doubleNoteInputDuration() = 0;
59 : virtual void halveNoteInputDuration() = 0;
60 :
61 : virtual void addSlur(mu::engraving::Slur* slur) = 0;
62 : virtual void resetSlur() = 0;
63 :
64 : virtual void addTie() = 0;
65 :
66 : virtual void addLaissezVib() = 0;
67 :
68 : // Used in the input-by-duration mode
69 : virtual void setInputNote(const NoteInputParams& params) = 0;
70 : virtual void setInputNotes(const engraving::NoteValList& notes) = 0;
71 : virtual void moveInputNotes(bool up, engraving::UpDownMode mode) = 0;
72 :
73 : virtual void setRestMode(bool rest) = 0;
74 : virtual void setAccidental(engraving::AccidentalType accidentalType) = 0;
75 : virtual void setArticulation(engraving::SymId articulationSymbolId) = 0;
76 : virtual void setDrumNote(int note) = 0;
77 : virtual void setCurrentVoice(engraving::voice_idx_t voiceIndex) = 0;
78 : virtual void setCurrentTrack(engraving::track_idx_t trackIndex) = 0;
79 :
80 : virtual muse::RectF cursorRect() const = 0;
81 :
82 : virtual muse::async::Notification noteAdded() const = 0;
83 : virtual muse::async::Notification stateChanged() const = 0;
84 : };
85 :
86 : using INotationNoteInputPtr = std::shared_ptr<INotationNoteInput>;
87 : }
|