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 :
51 0 : bool isEditable() const override { return false; }
52 :
53 128 : const StaffType* tab() const { return m_tab; }
54 16 : const String& text() const { return m_text; }
55 : void setDuration(DurationType type, int dots, const StaffType* tab);
56 :
57 0 : bool isRepeat() const { return m_repeat; }
58 24 : void setRepeat(bool val) { m_repeat = val; }
59 :
60 : struct LayoutData : public EngravingItem::LayoutData {
61 : TabBeamGrid beamGrid = TabBeamGrid::NONE; // value for special 'English' grid display
62 : double beamLength = 0.0; // if beamGrid==MEDIALFINAL, length of the beam toward previous grid element
63 : int beamLevel = 0.0; // if beamGrid==MEDIALFINAL, the number of beams
64 : };
65 53 : DECLARE_LAYOUTDATA_METHODS(TabDurationSymbol)
66 :
67 : private:
68 : const StaffType* m_tab = nullptr;
69 : String m_text;
70 : bool m_repeat = false;
71 : };
72 : }
|