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_FERMATA_H
24 : #define MU_ENGRAVING_FERMATA_H
25 :
26 : #include "../types/types.h"
27 :
28 : #include "engravingitem.h"
29 :
30 : namespace mu::engraving {
31 : class ChordRest;
32 : class Factory;
33 : class Measure;
34 : class Page;
35 : class Segment;
36 : class System;
37 :
38 : //---------------------------------------------------------
39 : // Fermata
40 : //---------------------------------------------------------
41 :
42 : class Fermata final : public EngravingItem
43 : {
44 408 : OBJECT_ALLOCATOR(engraving, Fermata)
45 1868 : DECLARE_CLASSOF(ElementType::FERMATA)
46 :
47 : public:
48 :
49 3 : Fermata(const Fermata&) = default;
50 : Fermata& operator=(const Fermata&) = delete;
51 :
52 3 : Fermata* clone() const override { return new Fermata(*this); }
53 0 : void setOwnershipParent(DummyParentOr<Segment> parent) { EngravingItem::setOwnershipParent(parent); }
54 :
55 : double mag() const override;
56 :
57 1775 : SymId symId() const { return m_symId; }
58 68 : void setSymId(SymId id) { m_symId = id; }
59 : void setSymIdAndTimeStretch(SymId id);
60 : FermataType fermataType() const;
61 : int subtype() const override;
62 : TranslatableString subtypeUserName() const override;
63 :
64 : std::vector<LineF> dragAnchorLines() const override;
65 :
66 : PropertyValue getProperty(Pid propertyId) const override;
67 : bool setProperty(Pid propertyId, const PropertyValue&) override;
68 : PropertyValue propertyDefault(Pid) const override;
69 : void resetProperty(Pid id) override;
70 :
71 39168 : Segment* segment() const { return toSegment(ownershipParent()); }
72 : Measure* measure() const;
73 : System* system() const;
74 : Page* page() const;
75 :
76 165 : double timeStretch() const { return m_timeStretch; }
77 12 : void setTimeStretch(double val) { m_timeStretch = val; }
78 :
79 153 : bool play() const { return m_play; }
80 208 : void setPlay(bool val) { m_play = val; }
81 :
82 : String accessibleInfo() const override;
83 :
84 : Sid defaultPosSid() const override;
85 :
86 : private:
87 :
88 : friend class Factory;
89 : Fermata(DummyParentOr<Segment> parent);
90 :
91 : SymId m_symId = SymId::noSym;
92 : double m_timeStretch = -1.0;
93 : bool m_play = true;
94 : };
95 : } // namespace mu::engraving
96 : #endif
|