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 404 : OBJECT_ALLOCATOR(engraving, Fermata)
45 1866 : 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 :
54 : double mag() const override;
55 :
56 1775 : SymId symId() const { return m_symId; }
57 66 : void setSymId(SymId id) { m_symId = id; }
58 : void setSymIdAndTimeStretch(SymId id);
59 : FermataType fermataType() const;
60 : int subtype() const override;
61 : TranslatableString subtypeUserName() const override;
62 :
63 : std::vector<LineF> dragAnchorLines() const override;
64 :
65 : PropertyValue getProperty(Pid propertyId) const override;
66 : bool setProperty(Pid propertyId, const PropertyValue&) override;
67 : PropertyValue propertyDefault(Pid) const override;
68 : void resetProperty(Pid id) override;
69 :
70 39168 : Segment* segment() const { return toSegment(ownershipParent()); }
71 : Measure* measure() const;
72 : System* system() const;
73 : Page* page() const;
74 :
75 165 : double timeStretch() const { return m_timeStretch; }
76 12 : void setTimeStretch(double val) { m_timeStretch = val; }
77 :
78 153 : bool play() const { return m_play; }
79 206 : void setPlay(bool val) { m_play = val; }
80 :
81 : String accessibleInfo() const override;
82 :
83 : Sid defaultPosSid() const override;
84 :
85 : private:
86 :
87 : friend class Factory;
88 : Fermata(EngravingObject* parent);
89 :
90 : SymId m_symId = SymId::noSym;
91 : double m_timeStretch = -1.0;
92 : bool m_play = true;
93 : };
94 : } // namespace mu::engraving
95 : #endif
|