MuseScore  3.4
Music composition and notation
articulation.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 __ARTICULATION_H__
14 #define __ARTICULATION_H__
15 
16 #include "element.h"
17 #include "mscore.h"
18 
19 namespace Ms {
20 
21 class ChordRest;
22 class Segment;
23 class Measure;
24 class System;
25 class Page;
26 
27 enum class SymId;
28 
29 //---------------------------------------------------------
30 // ArticulationInfo
31 // gives infos about note attributes
32 //---------------------------------------------------------
33 
34 enum class ArticulationAnchor : char {
35  TOP_STAFF, // anchor is always placed at top of staff
36  BOTTOM_STAFF, // anchor is always placed at bottom of staff
37  CHORD, // anchor depends on chord direction, away from stem
38  TOP_CHORD, // attribute is always placed at top of chord
39  BOTTOM_CHORD, // attribute is placed at bottom of chord
40  };
41 
42 // flags:
43 enum class ArticulationShowIn : char { PITCHED_STAFF = 1, TABLATURE = 2 };
44 
46  return static_cast<ArticulationShowIn>(static_cast<unsigned char>(a1) | static_cast<unsigned char>(a2));
47  }
49  return static_cast<unsigned char>(a1) & static_cast<unsigned char>(a2);
50  }
51 
52 //---------------------------------------------------------
53 // @@ Articulation
55 //---------------------------------------------------------
56 
57 class Articulation final : public Element {
60  QString _channelName;
61 
63 
64  bool _up;
65  MScore::OrnamentStyle _ornamentStyle; // for use in ornaments such as trill
67 
68  virtual void draw(QPainter*) const;
69 
70  enum class AnchorGroup {
72  LUTE_FINGERING,
73  OTHER
74  };
75  static AnchorGroup anchorGroup(SymId);
76 
77  public:
80  Articulation &operator=(const Articulation&) = delete;
81 
82  virtual Articulation* clone() const override { return new Articulation(*this); }
83  virtual ElementType type() const override { return ElementType::ARTICULATION; }
84 
85  virtual qreal mag() const override;
86 
87  SymId symId() const { return _symId; }
88  void setSymId(SymId id);
89  virtual int subtype() const override;
90  QString userName() const;
91  const char* articulationName() const; // type-name of articulation; used for midi rendering
92  static const char* symId2ArticulationName(SymId symId);
93 
94  virtual void layout() override;
95  bool layoutCloseToNote() const;
96 
97  virtual void read(XmlReader&) override;
98  virtual void write(XmlWriter& xml) const override;
99  virtual bool readProperties(XmlReader&) override;
100 
101  virtual QLineF dragAnchor() const override;
102 
103  virtual QVariant getProperty(Pid propertyId) const override;
104  virtual bool setProperty(Pid propertyId, const QVariant&) override;
105  virtual QVariant propertyDefault(Pid) const override;
106  virtual void resetProperty(Pid id) override;
107  Sid getPropertyStyle(Pid id) const override;
108 
109  virtual Pid propertyId(const QStringRef& xmlName) const override;
110 
111  bool up() const { return _up; }
112  void setUp(bool val);
113  void setDirection(Direction d) { _direction = d; }
114  Direction direction() const { return _direction; }
115 
116  ChordRest* chordRest() const;
117  Segment* segment() const;
118  Measure* measure() const;
119  System* system() const;
120  Page* page() const;
121 
122  ArticulationAnchor anchor() const { return _anchor; }
123  void setAnchor(ArticulationAnchor v) { _anchor = v; }
124 
125  MScore::OrnamentStyle ornamentStyle() const { return _ornamentStyle; }
126  void setOrnamentStyle(MScore::OrnamentStyle val) { _ornamentStyle = val; }
127 
128  bool playArticulation() const { return _playArticulation;}
129  void setPlayArticulation(bool val) { _playArticulation = val; }
130 
131  QString channelName() const { return _channelName; }
132  void setChannelName(const QString& s) { _channelName = s; }
133 
134  QString accessibleInfo() const override;
135 
136  bool isDouble() const;
137  bool isTenuto() const;
138  bool isStaccato() const;
139  bool isAccent() const;
140  bool isMarcato() const;
141  bool isLuteFingering() const;
142  bool isOrnament() const;
143 
144  void doAutoplace();
145  };
146 
147 } // namespace Ms
148 #endif
149 
OrnamentStyle
Definition: mscore.h:298
Pid
Definition: property.h:62
Definition: xml.h:67
void setAnchor(ArticulationAnchor v)
Definition: articulation.h:123
one measure in a system
Definition: measure.h:65
constexpr ArticulationShowIn operator|(ArticulationShowIn a1, ArticulationShowIn a2)
Definition: articulation.h:45
bool playArticulation() const
Definition: articulation.h:128
bool _up
Definition: articulation.h:64
SymId symId() const
Definition: articulation.h:87
SymId
Definition: sym.h:30
Base class of score layout elements.
Definition: element.h:158
Direction direction() const
Definition: articulation.h:114
void setPlayArticulation(bool val)
Definition: articulation.h:129
bool _playArticulation
Definition: articulation.h:66
virtual Articulation * clone() const override
Definition: articulation.h:82
QString channelName() const
Definition: articulation.h:131
Definition: score.h:391
constexpr bool operator &(ArticulationShowIn a1, ArticulationShowIn a2)
Definition: articulation.h:48
AnchorGroup
Definition: articulation.h:70
virtual ElementType type() const override
Definition: articulation.h:83
QString _channelName
Definition: articulation.h:60
void setDirection(Direction d)
Definition: articulation.h:113
MScore::OrnamentStyle _ornamentStyle
Definition: articulation.h:65
articulation marks
Definition: articulation.h:57
Definition: segment.h:50
Definition: aeolus.cpp:26
MScore::OrnamentStyle ornamentStyle() const
Definition: articulation.h:125
Direction _direction
Definition: articulation.h:59
Sid
Definition: style.h:33
Definition: xml.h:218
ArticulationAnchor
Definition: articulation.h:34
ArticulationShowIn
Definition: articulation.h:43
Definition: chordrest.h:48
Direction
Definition: types.h:282
void setOrnamentStyle(MScore::OrnamentStyle val)
Definition: articulation.h:126
SymId _symId
Definition: articulation.h:58
One row of measures for all instruments; a complete piece of the timeline.
Definition: system.h:79
bool up() const
Definition: articulation.h:111
ElementType
Definition: types.h:34
Pid propertyId(const QStringRef &s)
Definition: property.cpp:347
Definition: page.h:34
void setChannelName(const QString &s)
Definition: articulation.h:132
ArticulationAnchor _anchor
Definition: articulation.h:62
ArticulationAnchor anchor() const
Definition: articulation.h:122