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 LaissezVibSegment : public TieSegment
29 : {
30 40 : OBJECT_ALLOCATOR(engraving, LaissezVibSegment)
31 : DECLARE_CLASSOF(ElementType::LAISSEZ_VIB_SEGMENT)
32 :
33 : public:
34 : LaissezVibSegment(LaissezVib* sp);
35 : LaissezVibSegment(const LaissezVibSegment& s);
36 :
37 0 : LaissezVibSegment* clone() const override { return new LaissezVibSegment(*this); }
38 :
39 222 : LaissezVib* laissezVib() const { return (LaissezVib*)spanner(); }
40 :
41 0 : int gripsCount() const override { return 0; }
42 :
43 : struct LayoutData : public TieSegment::LayoutData {
44 : SymId symbol = SymId::noSym;
45 : ld_field<PointF> posRelativeToNote = { "[LaissezVibSegment] posRelativeToNote", PointF() };
46 : };
47 203 : DECLARE_LAYOUTDATA_METHODS(LaissezVibSegment)
48 : private:
49 : String formatBarsAndBeats() const override;
50 : };
51 :
52 : class LaissezVib : public Tie
53 : {
54 40 : OBJECT_ALLOCATOR(engraving, LaissezVib)
55 : DECLARE_CLASSOF(ElementType::LAISSEZ_VIB);
56 :
57 : public:
58 : LaissezVib(DummyParentOr<Note> parent);
59 :
60 0 : LaissezVib* clone() const override { return new LaissezVib(*this); }
61 :
62 : PropertyValue getProperty(Pid propertyId) const override;
63 : PropertyValue propertyDefault(Pid propertyId) const override;
64 : bool setProperty(Pid propertyId, const PropertyValue& v) override;
65 :
66 74 : Spatium minLength() const { return m_minLength; }
67 21 : void setMinLength(Spatium val) { m_minLength = val; }
68 :
69 : SymId symId() const;
70 :
71 : SlurTieSegment* newSlurTieSegment() override;
72 :
73 : void setEndNote(Note* note) override;
74 : void setEndElement(EngravingItem*) override;
75 :
76 : LaissezVibSegment* frontSegment() { return toLaissezVibSegment(Spanner::frontSegment()); }
77 108 : const LaissezVibSegment* frontSegment() const { return toLaissezVibSegment(Spanner::frontSegment()); }
78 : LaissezVibSegment* backSegment() { return toLaissezVibSegment(Spanner::backSegment()); }
79 : const LaissezVibSegment* backSegment() const { return toLaissezVibSegment(Spanner::backSegment()); }
80 74 : LaissezVibSegment* segmentAt(int n) { return toLaissezVibSegment(Spanner::segmentAt(n)); }
81 : const LaissezVibSegment* segmentAt(int n) const { return toLaissezVibSegment(Spanner::segmentAt(n)); }
82 : private:
83 : Spatium m_minLength = 2.0_sp;
84 : };
85 : }
|