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_BRACKET_ITEM_H
24 : #define MU_ENGRAVING_BRACKET_ITEM_H
25 :
26 : #include "engravingitem.h"
27 : #include "stafflabel.h"
28 :
29 : #include "../types/types.h"
30 :
31 : namespace mu::engraving {
32 : class Factory;
33 :
34 : //---------------------------------------------------------
35 : // BracketItem
36 : //---------------------------------------------------------
37 :
38 : class BracketItem final : public EngravingItem
39 : {
40 1766 : OBJECT_ALLOCATOR(engraving, BracketItem)
41 :
42 : public:
43 : EngravingItem* clone() const override;
44 :
45 : PropertyValue getProperty(Pid) const override;
46 : bool setProperty(Pid, const PropertyValue&) override;
47 : PropertyValue propertyDefault(Pid id) const override;
48 :
49 6986 : size_t bracketSpan() const { return m_bracketSpan; }
50 45463 : BracketType bracketType() const { return m_bracketType; }
51 580 : void setBracketSpan(size_t v) { m_bracketSpan = v; }
52 700 : void setBracketType(BracketType v) { m_bracketType = v; }
53 1 : staff_idx_t startStaffIdx() const { return m_startStaffIdx; }
54 1058 : void setStartStaffIdx(staff_idx_t staffIdx) { m_startStaffIdx = staffIdx; }
55 : Staff* startStaff() const;
56 31388 : size_t column() const { return m_column; }
57 885 : void setColumn(size_t v) { m_column = v; }
58 :
59 0 : StaffLabel& label() { return m_name; }
60 0 : const StaffLabel& label() const { return m_name; }
61 0 : const String& longName() const { return m_name.longName(); }
62 0 : const String& shortName() const { return m_name.shortName(); }
63 :
64 0 : bool showText() const { return m_showText; }
65 0 : bool showBracket() const { return m_showBracket; }
66 :
67 : bool intersects(const BracketItem* other) const;
68 : bool intersects(staff_idx_t first, staff_idx_t last) const;
69 :
70 : private:
71 :
72 : friend class Factory;
73 :
74 : BracketItem(DummyParentOr<EngravingItem> parent);
75 : BracketItem(DummyParentOr<EngravingItem> parent, BracketType bracketType, size_t span);
76 :
77 : BracketType m_bracketType = BracketType::NO_BRACKET;
78 : size_t m_column = 0;
79 : size_t m_bracketSpan = 0;
80 : staff_idx_t m_startStaffIdx = muse::nidx;
81 :
82 : StaffLabel m_name = StaffLabel(muse::mtrc("systemBrackets", "GROUP"), muse::mtrc("systemBrackets", "GR.", "Short for GROUP"));
83 : bool m_showText = true;
84 : bool m_showBracket = true;
85 : };
86 : }
87 : #endif
|