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 "textbase.h"
26 :
27 : namespace mu::engraving {
28 : //---------------------------------------------------------
29 : // ChannelActions
30 : //---------------------------------------------------------
31 :
32 : struct ChannelActions {
33 : int channel = 0;
34 : StringList midiActionNames;
35 : };
36 :
37 : //---------------------------------------------------------
38 : // StaffTextBase
39 : //---------------------------------------------------------
40 :
41 : class StaffTextBase : public TextBase
42 : {
43 0 : OBJECT_ALLOCATOR(engraving, StaffTextBase)
44 :
45 : public:
46 : StaffTextBase(const ElementType& type, DummyParentOr<Segment> parent, TextStyleType tid, ElementFlags = ElementFlag::ON_STAFF);
47 :
48 : void clear();
49 :
50 : Segment* segment() const;
51 3706 : String channelName(voice_idx_t voice) const { return m_channelNames[voice]; }
52 0 : void setChannelName(voice_idx_t v, const String& s) { m_channelNames[v] = s; }
53 784 : void setSwingParameters(int unit, int ratio)
54 : {
55 784 : m_swingParameters.swingUnit = unit;
56 784 : m_swingParameters.swingRatio = ratio;
57 784 : }
58 :
59 356 : const std::vector<ChannelActions>& channelActions() const { return m_channelActions; }
60 0 : std::vector<ChannelActions>& channelActions() { return m_channelActions; }
61 40 : const SwingParameters& swingParameters() const { return m_swingParameters; }
62 : void clearAeolusStops();
63 : void setAeolusStop(int group, int idx, bool val);
64 : void setAeolusStop(int group, int val);
65 : bool getAeolusStop(int group, int idx) const;
66 : int aeolusStop(int group) const;
67 0 : void setSetAeolusStops(bool val) { m_setAeolusStops = val; }
68 6 : void setSwing(bool checked) { m_swing = checked; }
69 0 : void setCapo(int fretId) { m_capo = fretId; }
70 356 : bool setAeolusStops() const { return m_setAeolusStops; }
71 1212 : bool swing() const { return m_swing; }
72 178 : int capo() const { return m_capo; }
73 :
74 1514 : bool positionRelativeToNoteheadRest() const override { return true; }
75 :
76 : void added() override;
77 : void removed() override;
78 :
79 : private:
80 : String m_channelNames[4];
81 : std::vector<ChannelActions> m_channelActions;
82 : SwingParameters m_swingParameters;
83 : bool m_setAeolusStops = false;
84 : int m_aeolusStops[4] { 0, 0, 0, 0 };
85 : bool m_swing = false;
86 : int m_capo = 0;
87 : };
88 : }
|