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 : EngravingObject* propertyDelegate(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(EngravingObject* parent);
52 : NoteLine(const NoteLine&);
53 0 : ~NoteLine() {}
54 :
55 0 : NoteLine* clone() const override { return new NoteLine(*this); }
56 :
57 40 : Anchor anchor() const override { return Anchor::NOTE; }
58 :
59 : LineSegment* createLineSegment() override;
60 :
61 : PropertyValue propertyDefault(Pid) const override;
62 : PropertyValue getProperty(Pid) const override;
63 : bool setProperty(Pid propertyId, const PropertyValue&) override;
64 :
65 0 : bool allowTimeAnchor() const override { return false; }
66 :
67 6 : NoteLineEndPlacement lineEndPlacement() { return m_lineEndPlacement; }
68 1 : void setLineEndPlacement(NoteLineEndPlacement v) { m_lineEndPlacement = v; }
69 :
70 : void reset() override;
71 :
72 1 : bool enforceMinLength() { return m_lineEndPlacement != NoteLineEndPlacement::LEFT_EDGE; }
73 :
74 : protected:
75 : Sid defaultPosSid() const override;
76 2 : bool isInSpannerMap() const override { return false; }
77 :
78 : private:
79 : NoteLineEndPlacement m_lineEndPlacement = NoteLineEndPlacement::OFFSET_ENDS;
80 : };
81 : }
|