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) 2024 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 : #include "engravingitem.h"
25 :
26 : namespace mu::engraving {
27 : class Parenthesis : public EngravingItem
28 : {
29 934 : OBJECT_ALLOCATOR(engraving, Parenthesis)
30 1768 : M_PROPERTY2(DirectionH, direction, setDirection, DirectionH::LEFT)
31 :
32 : public:
33 : static constexpr double PARENTHESIS_END_WIDTH = 0.1;
34 :
35 : Parenthesis(DummyParentOr<EngravingItem> parent);
36 : Parenthesis(const Parenthesis& p);
37 :
38 22 : Parenthesis* clone() const override { return new Parenthesis(*this); }
39 0 : Segment* segment() const { return ownershipParent() && ownershipParent()->isSegment() ? toSegment(ownershipParent()) : nullptr; }
40 :
41 : PropertyValue getProperty(Pid) const override;
42 : bool setProperty(Pid, const PropertyValue&) override;
43 : PropertyValue propertyDefault(Pid) const override;
44 :
45 : String accessibleInfo() const override;
46 :
47 : bool followParentCurColor() const;
48 : void setFollowParentColor(bool val);
49 :
50 : Color curColor(const rendering::PaintOptions& opt) const override;
51 :
52 : struct LayoutData : public EngravingItem::LayoutData
53 : {
54 : ld_field<muse::draw::PainterPath> path = "[Parenthesis] path";
55 : ld_field<double> startY = { "[Parenthesis] startY", 0.0 };
56 : ld_field<double> height = { "[Parenthesis] height", 0.0 };
57 : ld_field<double> midPointThickness = { "[Parenthesis] midPointThickness", 0.0 };
58 : ld_field<double> endPointThickness = { "[Parenthesis] endPointThickness", PARENTHESIS_END_WIDTH };
59 : ld_field<double> shoulderWidth = { "[Parenthesis] endPointThickness", 0.0 };
60 : ld_field<double> intrinsicMag = { "[Parenthesis] intrinsicMag", 1.0 }; // Mag separate from staff scale
61 : ld_field<SymId> symId = { "[Parenthesis] symId", SymId::noSym };
62 : ld_field<double> symScale = { "[Parenthesis] symScale", 1.0 };
63 : };
64 2808 : DECLARE_LAYOUTDATA_METHODS(Parenthesis);
65 :
66 : private:
67 : bool m_followParentColor = false;
68 : };
69 : } // namespace engraving
|