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 307 : 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 :
57 0 : int subtype() const override { return int(jumpType()); }
58 : TranslatableString subtypeUserName() const override;
59 :
60 0 : Measure* measure() const { return toMeasure(ownershipParent()); }
61 :
62 237 : String jumpTo() const { return m_jumpTo; }
63 237 : String playUntil() const { return m_playUntil; }
64 231 : String continueAt() const { return m_continueAt; }
65 173 : void setJumpTo(const String& s) { m_jumpTo = s; }
66 173 : void setPlayUntil(const String& s) { m_playUntil = s; }
67 173 : void setContinueAt(const String& s) { m_continueAt = s; }
68 365 : bool playRepeats() const { return m_playRepeats; }
69 20 : void setPlayRepeats(bool val) { m_playRepeats = val; }
70 :
71 : PropertyValue getProperty(Pid propertyId) const override;
72 : bool setProperty(Pid propertyId, const PropertyValue&) override;
73 : PropertyValue propertyDefault(Pid) const override;
74 :
75 : EngravingItem* nextSegmentElement() override;
76 : EngravingItem* prevSegmentElement() override;
77 : String accessibleInfo() const override;
78 :
79 224 : bool positionRelativeToNoteheadRest() const override { return false; }
80 :
81 : private:
82 : String m_jumpTo;
83 : String m_playUntil;
84 : String m_continueAt;
85 : bool m_playRepeats = false;
86 : };
87 :
88 : struct JumpTypeTableItem {
89 : JumpType type;
90 : AsciiStringView text;
91 : AsciiStringView jumpTo;
92 : AsciiStringView playUntil;
93 : AsciiStringView continueAt;
94 : };
95 :
96 : extern const std::vector<JumpTypeTableItem> jumpTypeTable;
97 : } // namespace mu::engraving
98 :
99 : #endif
|