MuseScore  3.4
Music composition and notation
volta.h
Go to the documentation of this file.
1 //=============================================================================
2 // MuseScore
3 // Music Composition & Notation
4 //
5 // Copyright (C) 2002-2011 Werner Schweer
6 //
7 // This program is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License version 2
9 // as published by the Free Software Foundation and appearing in
10 // the file LICENCE.GPL
11 //=============================================================================
12 
13 #ifndef __VOLTA_H__
14 #define __VOLTA_H__
15 
16 #include "textlinebase.h"
17 
18 namespace Ms {
19 
20 class Score;
21 class XmlWriter;
22 class Volta;
23 class Measure;
24 
25 extern void vdebug(int n);
26 extern LineSegment* voltaDebug;
27 
28 //---------------------------------------------------------
29 // @@ VoltaSegment
30 //---------------------------------------------------------
31 
32 class VoltaSegment final : public TextLineBaseSegment {
33  public:
35  virtual ElementType type() const override { return ElementType::VOLTA_SEGMENT; }
36  virtual VoltaSegment* clone() const override { return new VoltaSegment(*this); }
37  Volta* volta() const { return (Volta*)spanner(); }
38  virtual void layout() override;
39 
40  virtual Element* propertyDelegate(Pid) override;
41  };
42 
43 //---------------------------------------------------------
44 // @@ Volta
45 // @P voltaType enum (Volta.CLOSE, Volta.OPEN)
46 //---------------------------------------------------------
47 
48 class Volta final : public TextLineBase {
49  QList<int> _endings;
50 
51  public:
52  enum class Type : char {
53  OPEN, CLOSED
54  };
55 
56  Volta(Score* s);
57  virtual Volta* clone() const override { return new Volta(*this); }
58  virtual ElementType type() const override { return ElementType::VOLTA; }
59  virtual LineSegment* createLineSegment() override;
60 
61  virtual void write(XmlWriter&) const override;
62  virtual void read(XmlReader& e) override;
63  virtual SpannerSegment* layoutSystem(System* system) override;
64 
65  void setVelocity() const;
66  void setChannel() const;
67  void setTempo() const;
68 
69  QList<int> endings() const { return _endings; }
70  QList<int>& endings() { return _endings; }
71  void setEndings(const QList<int>& l) { _endings = l; }
72  void setText(const QString& s);
73  QString text() const;
74 
75  bool hasEnding(int repeat) const;
76  int lastEnding() const;
77  void setVoltaType(Volta::Type); // deprecated
78  Type voltaType() const; // deprecated
79 
80  virtual QVariant getProperty(Pid propertyId) const override;
81  virtual bool setProperty(Pid propertyId, const QVariant&) override;
82  virtual QVariant propertyDefault(Pid) const override;
83 
84  virtual QString accessibleInfo() const override;
85  };
86 
87 } // namespace Ms
88 
89 Q_DECLARE_METATYPE(Ms::Volta::Type);
90 
91 #endif
92 
Pid
Definition: property.h:62
virtual ElementType type() const override
Definition: volta.h:58
Definition: xml.h:67
virtual ElementType type() const override
Definition: volta.h:35
parent: System
Definition: spanner.h:50
VoltaSegment(Spanner *, Score *)
Definition: volta.cpp:54
Virtual base class for slurs, ties, lines etc.
Definition: spanner.h:136
virtual QString accessibleInfo() const override
Definition: spanner.cpp:305
Definition: volta.h:48
System * system() const
Definition: spanner.h:80
Base class of score layout elements.
Definition: element.h:158
LineSegment * voltaDebug
virtual QVariant propertyDefault(Pid id) const override
Definition: spanner.cpp:162
Spanner * spanner() const
Definition: spanner.h:67
Virtual base class for segmented lines segments (OttavaSegment, HairpinSegment, TrillSegment...)
Definition: line.h:34
Definition: volta.h:32
virtual void write(XmlWriter &) const
Definition: element.cpp:732
Definition: score.h:391
virtual Volta * clone() const override
Definition: volta.h:57
virtual Pid propertyId(const QStringRef &xmlName) const override
Definition: element.cpp:1326
Definition: textlinebase.h:31
virtual QVariant getProperty(Pid id) const override
Definition: spanner.cpp:127
virtual void layout() override
Definition: volta.cpp:62
Type
Definition: volta.h:52
Definition: aeolus.cpp:26
QList< int > & endings()
Definition: volta.h:70
Definition: xml.h:218
virtual Element * propertyDelegate(Pid) override
Definition: volta.cpp:72
Definition: xmlwriter.h:26
QList< int > _endings
Definition: volta.h:49
virtual void read(XmlReader &) override
Definition: line.cpp:69
Definition: textlinebase.h:70
virtual VoltaSegment * clone() const override
Definition: volta.h:36
virtual bool setProperty(Pid id, const QVariant &v) override
Definition: spanner.cpp:143
One row of measures for all instruments; a complete piece of the timeline.
Definition: system.h:79
Volta * volta() const
Definition: volta.h:37
ElementType
Definition: types.h:34
QList< int > endings() const
Definition: volta.h:69
void setEndings(const QList< int > &l)
Definition: volta.h:71
void vdebug(int n)