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 "tie.h"
26 :
27 : namespace mu::engraving {
28 : class PartialTieSegment : public TieSegment
29 : {
30 96 : OBJECT_ALLOCATOR(engraving, PartialTieSegment)
31 : DECLARE_CLASSOF(ElementType::PARTIAL_TIE_SEGMENT)
32 :
33 : public:
34 : PartialTieSegment(PartialTie* sp);
35 : PartialTieSegment(const PartialTieSegment& s);
36 :
37 0 : PartialTieSegment* clone() const override { return new PartialTieSegment(*this); }
38 :
39 340 : PartialTie* partialTie() const { return (PartialTie*)spanner(); }
40 : private:
41 : String formatBarsAndBeats() const override;
42 : };
43 :
44 : class PartialTie : public Tie
45 : {
46 101 : OBJECT_ALLOCATOR(engraving, PartialTie)
47 : DECLARE_CLASSOF(ElementType::PARTIAL_TIE);
48 :
49 206 : M_PROPERTY2(PartialSpannerDirection, partialSpannerDirection, setPartialSpannerDirection, PartialSpannerDirection::OUTGOING)
50 :
51 : public:
52 : PartialTie(DummyParentOr<Note> parent);
53 :
54 340 : Note* parentNote() const { return parent() ? toNote(parent()) : nullptr; }
55 :
56 0 : PartialTie* clone() const override { return new PartialTie(*this); }
57 :
58 12942 : inline bool isOutgoing() const { return _partialSpannerDirection == PartialSpannerDirection::OUTGOING; }
59 :
60 : PropertyValue getProperty(Pid propertyId) const override;
61 : PropertyValue propertyDefault(Pid propertyId) const override;
62 : bool setProperty(Pid propertyId, const PropertyValue& v) override;
63 :
64 : SlurTieSegment* newSlurTieSegment() override;
65 :
66 344 : Note* note() const { return isOutgoing() ? startNote() : endNote(); }
67 : void setStartNote(Note* note) override;
68 : void setEndNote(Note* note) override;
69 :
70 : TieJumpPointList* tieJumpPoints() override;
71 : const TieJumpPointList* tieJumpPoints() const override;
72 : bool allJumpPointsInactive() const override;
73 :
74 : Note* startNote() const override;
75 :
76 : PartialTieSegment* frontSegment() { return toPartialTieSegment(Spanner::frontSegment()); }
77 : const PartialTieSegment* frontSegment() const { return toPartialTieSegment(Spanner::frontSegment()); }
78 : PartialTieSegment* backSegment() { return toPartialTieSegment(Spanner::backSegment()); }
79 : const PartialTieSegment* backSegment() const { return toPartialTieSegment(Spanner::backSegment()); }
80 340 : PartialTieSegment* segmentAt(int n) { return toPartialTieSegment(Spanner::segmentAt(n)); }
81 : const PartialTieSegment* segmentAt(int n) const { return toPartialTieSegment(Spanner::segmentAt(n)); }
82 : };
83 : }
|