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 "textlinebase.h"
26 :
27 : namespace mu::engraving {
28 : class NoteLine;
29 :
30 : class NoteLineSegment final : public TextLineBaseSegment
31 : {
32 1 : OBJECT_ALLOCATOR(engraving, NoteLineSegment)
33 : DECLARE_CLASSOF(ElementType::NOTELINE_SEGMENT)
34 :
35 : public:
36 : NoteLineSegment(NoteLine* sp);
37 :
38 0 : NoteLine* noteLine() const { return toNoteLine(spanner()); }
39 :
40 0 : NoteLineSegment* clone() const override { return new NoteLineSegment(*this); }
41 :
42 : PropertyDelegate resolvePropertyDelegate(Pid) const override;
43 : };
44 :
45 : class NoteLine final : public TextLineBase
46 : {
47 1 : OBJECT_ALLOCATOR(engraving, NoteLine)
48 1429 : DECLARE_CLASSOF(ElementType::NOTELINE)
49 :
50 : public:
51 : NoteLine(DummyParentOr<Note> parent);
52 : NoteLine(const NoteLine&);
53 0 : ~NoteLine() {}
54 :
55 0 : NoteLine* clone() const override { return new NoteLine(*this); }
56 : void setOwnershipParent(DummyParentOr<Note> parent) { EngravingItem::setOwnershipParent(parent); }
57 :
58 40 : Anchor anchor() const override { return Anchor::NOTE; }
59 :
60 : LineSegment* createLineSegment() override;
61 :
62 : PropertyValue propertyDefault(Pid) const override;
63 : PropertyValue getProperty(Pid) const override;
64 : bool setProperty(Pid propertyId, const PropertyValue&) override;
65 :
66 0 : bool allowTimeAnchor() const override { return false; }
67 :
68 6 : NoteLineEndPlacement lineEndPlacement() { return m_lineEndPlacement; }
69 1 : void setLineEndPlacement(NoteLineEndPlacement v) { m_lineEndPlacement = v; }
70 :
71 : void reset() override;
72 :
73 3 : bool enforceMinLength() const { return m_lineEndPlacement != NoteLineEndPlacement::LEFT_EDGE; }
74 :
75 : protected:
76 : Sid defaultPosSid() const override;
77 2 : bool isInSpannerMap() const override { return false; }
78 :
79 : private:
80 : NoteLineEndPlacement m_lineEndPlacement = NoteLineEndPlacement::OFFSET_ENDS;
81 : };
82 : }
|