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_JUMP_H
24 : #define MU_ENGRAVING_JUMP_H
25 :
26 : #include "textbase.h"
27 :
28 : #include "../types/types.h"
29 :
30 : namespace mu::engraving {
31 : //---------------------------------------------------------
32 : // @@ Jump
33 : /// Jump label
34 : //
35 : // @P continueAt string
36 : // @P jumpTo string
37 : // not used?
38 : // jumpType enum (Jump.DC, .DC_AL_FINE, .DC_AL_CODA, .DS_AL_CODA, .DS_AL_FINE, .DS, USER) (read only)
39 : // @P playUntil string
40 : //---------------------------------------------------------
41 :
42 : class Jump final : public TextBase
43 : {
44 311 : OBJECT_ALLOCATOR(engraving, Jump)
45 1599 : DECLARE_CLASSOF(ElementType::JUMP)
46 :
47 : public:
48 :
49 : Jump(DummyParentOr<Measure> parent);
50 :
51 : void setJumpType(JumpType t);
52 : JumpType jumpType() const;
53 : String jumpTypeUserName() const;
54 :
55 0 : Jump* clone() const override { return new Jump(*this); }
56 : void setOwnershipParent(DummyParentOr<Measure> parent) { EngravingItem::setOwnershipParent(parent); }
57 :
58 0 : int subtype() const override { return int(jumpType()); }
59 : TranslatableString subtypeUserName() const override;
60 :
61 0 : Measure* measure() const { return toMeasure(ownershipParent()); }
62 :
63 239 : String jumpTo() const { return m_jumpTo; }
64 239 : String playUntil() const { return m_playUntil; }
65 233 : String continueAt() const { return m_continueAt; }
66 175 : void setJumpTo(const String& s) { m_jumpTo = s; }
67 175 : void setPlayUntil(const String& s) { m_playUntil = s; }
68 175 : void setContinueAt(const String& s) { m_continueAt = s; }
69 368 : bool playRepeats() const { return m_playRepeats; }
70 20 : void setPlayRepeats(bool val) { m_playRepeats = val; }
71 :
72 : PropertyValue getProperty(Pid propertyId) const override;
73 : bool setProperty(Pid propertyId, const PropertyValue&) override;
74 : PropertyValue propertyDefault(Pid) const override;
75 :
76 : EngravingItem* nextSegmentElement() override;
77 : EngravingItem* prevSegmentElement() override;
78 : String accessibleInfo() const override;
79 :
80 228 : bool positionRelativeToNoteheadRest() const override { return false; }
81 :
82 : private:
83 : String m_jumpTo;
84 : String m_playUntil;
85 : String m_continueAt;
86 : bool m_playRepeats = false;
87 : };
88 :
89 : struct JumpTypeTableItem {
90 : JumpType type;
91 : AsciiStringView text;
92 : AsciiStringView jumpTo;
93 : AsciiStringView playUntil;
94 : AsciiStringView continueAt;
95 : };
96 :
97 : extern const std::vector<JumpTypeTableItem> jumpTypeTable;
98 : } // namespace mu::engraving
99 :
100 : #endif
|