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 : #pragma once
24 :
25 : #include "engravingitem.h"
26 : #include "draw/types/font.h"
27 :
28 : namespace mu::engraving {
29 : class Factory;
30 : class Transaction;
31 :
32 : //---------------------------------------------------------
33 : // @@ LayoutBreak
34 : /// symbols for line break, page break etc.
35 : //---------------------------------------------------------
36 : class LayoutBreak final : public EngravingItem
37 : {
38 1812 : OBJECT_ALLOCATOR(engraving, LayoutBreak)
39 1525 : DECLARE_CLASSOF(ElementType::LAYOUT_BREAK)
40 :
41 : public:
42 :
43 : void setOwnershipParent(DummyParentOr<MeasureBase> parent);
44 :
45 0 : LayoutBreak* clone() const override { return new LayoutBreak(*this); }
46 0 : int subtype() const override { return static_cast<int>(m_layoutBreakType); }
47 : TranslatableString subtypeUserName() const override;
48 :
49 : void setLayoutBreakType(LayoutBreakType);
50 2467 : LayoutBreakType layoutBreakType() const { return m_layoutBreakType; }
51 :
52 : bool acceptDrop(EditData&) const override;
53 : EngravingItem* drop(Transaction& tx, EditData&) override;
54 :
55 6258 : MeasureBase* measure() const { return (MeasureBase*)ownershipParent(); }
56 37 : double pause() const { return m_pause; }
57 1945 : void setPause(double v) { m_pause = v; }
58 58 : bool startWithLongNames() const { return m_startWithLongNames; }
59 942 : void setStartWithLongNames(bool v) { m_startWithLongNames = v; }
60 113 : bool startWithMeasureOne() const { return m_startWithMeasureOne; }
61 942 : void setStartWithMeasureOne(bool v) { m_startWithMeasureOne = v; }
62 3 : bool firstSystemIndentation() const { return m_firstSystemIndentation; }
63 942 : void setFirstSystemIndentation(bool v) { m_firstSystemIndentation = v; }
64 322 : bool showCourtesy() const { return m_showCourtesy; }
65 942 : void setShowCourtesy(bool v) { m_showCourtesy = v; }
66 :
67 : bool isPageBreak() const { return m_layoutBreakType == LayoutBreakType::PAGE; }
68 : bool isLineBreak() const { return m_layoutBreakType == LayoutBreakType::LINE; }
69 497 : bool isSectionBreak() const { return m_layoutBreakType == LayoutBreakType::SECTION; }
70 2162 : bool isNoBreak() const { return m_layoutBreakType == LayoutBreakType::NOBREAK; }
71 :
72 : PropertyValue getProperty(Pid propertyId) const override;
73 : bool setProperty(Pid propertyId, const PropertyValue&) override;
74 : PropertyValue propertyDefault(Pid) const override;
75 :
76 : String accessibleInfo() const override;
77 :
78 : char16_t iconCode() const;
79 :
80 : muse::draw::Font font() const;
81 :
82 : private:
83 :
84 : friend class Factory;
85 : LayoutBreak(DummyParentOr<MeasureBase> parent);
86 : LayoutBreak(const LayoutBreak&);
87 :
88 : double m_pause = 0.0;
89 : bool m_startWithLongNames = false;
90 : bool m_startWithMeasureOne = false;
91 : bool m_firstSystemIndentation = false;
92 : bool m_showCourtesy = false;
93 : LayoutBreakType m_layoutBreakType = LayoutBreakType::NOBREAK;
94 : };
95 : }
|