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) 2026 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 : #pragma once
24 :
25 : #include "engravingitem.h"
26 :
27 : namespace mu::engraving {
28 : //---------------------------------------------------------
29 : // TabDurationSymbol
30 : // EngravingItem used to draw duration symbols above tablature staves
31 : //---------------------------------------------------------
32 :
33 : enum class TabBeamGrid : char {
34 : NONE = 0,
35 : INITIAL,
36 : MEDIALFINAL,
37 : NUM_OF
38 : };
39 :
40 : class TabDurationSymbol final : public EngravingItem
41 : {
42 10 : OBJECT_ALLOCATOR(engraving, TabDurationSymbol)
43 : DECLARE_CLASSOF(ElementType::TAB_DURATION_SYMBOL)
44 :
45 : public:
46 : TabDurationSymbol(DummyParentOr<ChordRest> parent);
47 : TabDurationSymbol(DummyParentOr<ChordRest> parent, const StaffType* tab, DurationType type, int dots);
48 : TabDurationSymbol(const TabDurationSymbol&);
49 0 : TabDurationSymbol* clone() const override { return new TabDurationSymbol(*this); }
50 : void setOwnershipParent(DummyParentOr<ChordRest> parent) { EngravingItem::setOwnershipParent(parent); }
51 :
52 0 : bool isEditable() const override { return false; }
53 :
54 128 : const StaffType* tab() const { return m_tab; }
55 16 : const String& text() const { return m_text; }
56 : void setDuration(DurationType type, int dots, const StaffType* tab);
57 :
58 0 : bool isRepeat() const { return m_repeat; }
59 24 : void setRepeat(bool val) { m_repeat = val; }
60 :
61 : struct LayoutData : public EngravingItem::LayoutData {
62 : TabBeamGrid beamGrid = TabBeamGrid::NONE; // value for special 'English' grid display
63 : double beamLength = 0.0; // if beamGrid==MEDIALFINAL, length of the beam toward previous grid element
64 : int beamLevel = 0.0; // if beamGrid==MEDIALFINAL, the number of beams
65 : };
66 53 : DECLARE_LAYOUTDATA_METHODS(TabDurationSymbol)
67 :
68 : private:
69 : const StaffType* m_tab = nullptr;
70 : String m_text;
71 : bool m_repeat = false;
72 : };
73 : }
|