MuseScore  3.4
Music composition and notation
marker.h
Go to the documentation of this file.
1 //=============================================================================
2 // MuseScore
3 // Music Composition & Notation
4 //
5 // Copyright (C) 2002-2013 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 __MARKER_H__
14 #define __MARKER_H__
15 
16 #include "text.h"
17 
18 namespace Ms {
19 
20 //---------------------------------------------------------
21 // @@ Marker
22 //
23 // @P label string
24 // @P markerType enum (Marker.CODA, .CODETTA, .FINE, .SEGNO, .TOCODA, .USER, .VARCODA, .VARSEGNO)
25 //---------------------------------------------------------
26 
27 class Marker final : public TextBase {
28  public:
29  enum class Type : char {
30  SEGNO,
31  VARSEGNO,
32  CODA,
33  VARCODA,
34  CODETTA,
35  FINE,
36  TOCODA,
37  USER
38  };
39 
40  private:
42  QString _label;
43 
44  public:
45  Marker(Score*);
46  Marker(Score*, Tid);
47 
48  void setMarkerType(Type t);
49  Type markerType() const { return _markerType; }
50  QString markerTypeUserName() const;
51  Type markerType(const QString&) const;
52 
53  virtual Marker* clone() const override { return new Marker(*this); }
54  virtual ElementType type() const override { return ElementType::MARKER; }
55  virtual int subtype() const override { return int(_markerType); }
56 
57  Measure* measure() const { return (Measure*)parent(); }
58 
59  virtual void layout() override;
60  virtual void read(XmlReader&) override;
61  virtual void write(XmlWriter& xml) const override;
62 
63  QString label() const { return _label; }
64  void setLabel(const QString& s) { _label = s; }
65  void undoSetLabel(const QString& s);
66  void undoSetMarkerType(Type t);
67 
68  virtual void styleChanged() override;
69 
70  virtual QVariant getProperty(Pid propertyId) const override;
71  virtual bool setProperty(Pid propertyId, const QVariant&) override;
72  virtual QVariant propertyDefault(Pid) const override;
73 
74  virtual Element* nextSegmentElement() override;
75  virtual Element* prevSegmentElement() override;
76  virtual QString accessibleInfo() const override;
77  };
78 
79 //---------------------------------------------------------
80 // MarkerTypeItem
81 //---------------------------------------------------------
82 
85  QString name;
86  };
87 
88 extern const MarkerTypeItem markerTypeTable[];
90 
91 } // namespace Ms
92 
93 Q_DECLARE_METATYPE(Ms::Marker::Type);
94 
95 #endif
96 
Definition: marker.h:83
Pid
Definition: property.h:62
Definition: xml.h:67
Type markerType() const
Definition: marker.h:49
one measure in a system
Definition: measure.h:65
virtual QVariant getProperty(Pid propertyId) const override
Definition: marker.cpp:236
virtual QString accessibleInfo() const override
Definition: marker.cpp:324
QString name
Definition: marker.h:85
void undoSetLabel(const QString &s)
Definition: marker.cpp:218
Base class of score layout elements.
Definition: element.h:158
Element * parent() const
Definition: element.h:192
virtual Element * prevSegmentElement() override
Definition: marker.cpp:314
Definition: score.h:391
virtual int subtype() const override
Definition: marker.h:55
Measure * measure() const
Definition: marker.h:57
virtual void layout() override
Definition: marker.cpp:168
virtual void write(XmlWriter &xml) const override
Definition: marker.cpp:206
Definition: marker.h:27
Type _markerType
Definition: marker.h:41
virtual Element * nextSegmentElement() override
Definition: marker.cpp:295
Tid
Enumerates the list of built-in text substyles.
Definition: types.h:371
virtual bool setProperty(Pid propertyId, const QVariant &) override
Definition: marker.cpp:253
Definition: textbase.h:217
Definition: aeolus.cpp:26
Type
Definition: marker.h:29
virtual QVariant propertyDefault(Pid) const override
Definition: marker.cpp:275
const MarkerTypeItem markerTypeTable[]
Definition: marker.cpp:31
Definition: xml.h:218
QString _label
referenced from Jump() element
Definition: marker.h:42
void setLabel(const QString &s)
Definition: marker.h:64
Marker(Score *)
Definition: marker.cpp:51
virtual ElementType type() const override
Definition: marker.h:54
virtual Pid propertyId(const QStringRef &xmlName) const override
Definition: textbase.cpp:1808
void setMarkerType(Type t)
Definition: marker.cpp:68
int markerTypeTableSize()
Definition: marker.cpp:42
virtual Marker * clone() const override
Definition: marker.h:53
void undoSetMarkerType(Type t)
Definition: marker.cpp:227
ElementType
Definition: types.h:34
virtual void read(XmlReader &) override
Definition: marker.cpp:185
QString markerTypeUserName() const
Definition: marker.cpp:125
QString label() const
Definition: marker.h:63
virtual void styleChanged() override
Definition: marker.cpp:134
Marker::Type type
Definition: marker.h:84