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 : #ifndef MU_ENGRAVING_VIBRATO_H
24 : #define MU_ENGRAVING_VIBRATO_H
25 :
26 : #include "line.h"
27 :
28 : namespace mu::engraving {
29 : class Vibrato;
30 :
31 : //---------------------------------------------------------
32 : // @@ VibratoSegment
33 : //---------------------------------------------------------
34 :
35 : class VibratoSegment final : public LineSegment
36 : {
37 52 : OBJECT_ALLOCATOR(engraving, VibratoSegment)
38 : DECLARE_CLASSOF(ElementType::VIBRATO_SEGMENT)
39 :
40 : public:
41 : VibratoSegment(Vibrato* sp);
42 :
43 0 : VibratoSegment* clone() const override { return new VibratoSegment(*this); }
44 :
45 28 : Vibrato* vibrato() const { return toVibrato(spanner()); }
46 :
47 : EngravingObject* propertyDelegate(Pid) const override;
48 :
49 0 : const SymIdList& symbols() const { return m_symbols; }
50 : void setSymbols(const SymIdList& s) { m_symbols = s; }
51 :
52 : void symbolLine(SymId start, SymId fill);
53 : void symbolLine(SymId start, SymId fill, SymId end);
54 :
55 : private:
56 : SymIdList m_symbols;
57 : };
58 :
59 : //---------------------------------------------------------
60 : // Vibrato
61 : //---------------------------------------------------------
62 :
63 : class Vibrato final : public SLine
64 : {
65 60 : OBJECT_ALLOCATOR(engraving, Vibrato)
66 100 : DECLARE_CLASSOF(ElementType::VIBRATO)
67 :
68 : public:
69 : Vibrato(DummyParentOr<EngravingItem> parent);
70 : ~Vibrato();
71 :
72 0 : Vibrato* clone() const override { return new Vibrato(*this); }
73 :
74 286 : Anchor anchor() const override { return Anchor::SEGMENT; }
75 :
76 : LineSegment* createLineSegment() override;
77 : PointF linePos(Grip grip, System** system) const override;
78 :
79 35 : void setVibratoType(VibratoType tt) { m_vibratoType = tt; }
80 58 : VibratoType vibratoType() const { return m_vibratoType; }
81 : String vibratoTypeUserName() const;
82 :
83 : Segment* segment() const { return (Segment*)ownershipParent(); }
84 :
85 : PropertyValue getProperty(Pid propertyId) const override;
86 : bool setProperty(Pid propertyId, const PropertyValue&) override;
87 : PropertyValue propertyDefault(Pid) const override;
88 : String accessibleInfo() const override;
89 :
90 0 : int subtype() const override { return int(m_vibratoType); }
91 : TranslatableString subtypeUserName() const override;
92 :
93 : protected:
94 : Sid defaultPosSid() const override;
95 :
96 : private:
97 : VibratoType m_vibratoType = VibratoType::GUITAR_VIBRATO;
98 : };
99 : } // namespace mu::engraving
100 :
101 : #endif
|