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 29 : void setOwnershipParent(DummyParentOr<Segment> parent) { EngravingItem::setOwnershipParent(parent); }
48 :
49 : void clear();
50 :
51 : Segment* segment() const;
52 3706 : String channelName(voice_idx_t voice) const { return m_channelNames[voice]; }
53 0 : void setChannelName(voice_idx_t v, const String& s) { m_channelNames[v] = s; }
54 822 : void setSwingParameters(int unit, int ratio)
55 : {
56 822 : m_swingParameters.swingUnit = unit;
57 822 : m_swingParameters.swingRatio = ratio;
58 822 : }
59 :
60 356 : const std::vector<ChannelActions>& channelActions() const { return m_channelActions; }
61 0 : std::vector<ChannelActions>& channelActions() { return m_channelActions; }
62 40 : const SwingParameters& swingParameters() const { return m_swingParameters; }
63 : void clearAeolusStops();
64 : void setAeolusStop(int group, int idx, bool val);
65 : void setAeolusStop(int group, int val);
66 : bool getAeolusStop(int group, int idx) const;
67 : int aeolusStop(int group) const;
68 0 : void setSetAeolusStops(bool val) { m_setAeolusStops = val; }
69 6 : void setSwing(bool checked) { m_swing = checked; }
70 0 : void setCapo(int fretId) { m_capo = fretId; }
71 356 : bool setAeolusStops() const { return m_setAeolusStops; }
72 1268 : bool swing() const { return m_swing; }
73 178 : int capo() const { return m_capo; }
74 :
75 1475 : bool positionRelativeToNoteheadRest() const override { return true; }
76 :
77 : void added() override;
78 : void removed() override;
79 :
80 : private:
81 : String m_channelNames[4];
82 : std::vector<ChannelActions> m_channelActions;
83 : SwingParameters m_swingParameters;
84 : bool m_setAeolusStops = false;
85 : int m_aeolusStops[4] { 0, 0, 0, 0 };
86 : bool m_swing = false;
87 : int m_capo = 0;
88 : };
89 : }
|