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_BREATH_H
24 : #define MU_ENGRAVING_BREATH_H
25 :
26 : #include "engravingitem.h"
27 :
28 : namespace mu::engraving {
29 : class Factory;
30 :
31 : //---------------------------------------------------------
32 : // BreathType
33 : //---------------------------------------------------------
34 :
35 : struct BreathType {
36 : SymId id = SymId::noSym;
37 : bool isCaesura = false;
38 : double pause = false;
39 : };
40 :
41 : //---------------------------------------------------------
42 : // @@ Breath
43 : //! breathType() is index in symList
44 : //---------------------------------------------------------
45 :
46 : class Breath final : public EngravingItem
47 : {
48 249 : OBJECT_ALLOCATOR(engraving, Breath)
49 1866 : DECLARE_CLASSOF(ElementType::BREATH)
50 :
51 : public:
52 :
53 9 : Breath* clone() const override { return new Breath(*this); }
54 :
55 : double mag() const override;
56 :
57 120 : void setSymId(SymId id) { m_symId = id; }
58 350 : SymId symId() const { return m_symId; }
59 3 : double pause() const { return m_pause; }
60 8 : void setPause(double v) { m_pause = v; }
61 :
62 25 : Segment* segment() const { return (Segment*)ownershipParent(); }
63 :
64 : PropertyValue getProperty(Pid propertyId) const override;
65 : bool setProperty(Pid propertyId, const PropertyValue&) override;
66 : PropertyValue propertyDefault(Pid) const override;
67 :
68 : EngravingItem* nextSegmentElement() override;
69 : EngravingItem* prevSegmentElement() override;
70 : String accessibleInfo() const override;
71 :
72 0 : int subtype() const override { return int(m_symId); }
73 : TranslatableString subtypeUserName() const override;
74 :
75 : bool isCaesura() const;
76 :
77 : static const std::vector<BreathType> BREATH_LIST;
78 :
79 : private:
80 :
81 : friend class Factory;
82 : Breath(DummyParentOr<Segment> parent);
83 :
84 : double m_pause = 0.0;
85 : SymId m_symId = SymId::breathMarkComma;
86 : };
87 : } // namespace mu::engraving
88 : #endif
|