1 //============================================================================= 2 // MuseScore 3 // Music Composition & Notation 4 // 5 // Copyright (C) 2010-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 __TREMOLOBAR_H__ 14 #define __TREMOLOBAR_H__ 15 16 #include "element.h" 17 #include "pitchvalue.h" 18 19 namespace Ms { 20 21 //--------------------------------------------------------- 22 // @@ TremoloBar 23 // 24 // @P userMag qreal 25 // @P lineWidth qreal 26 // @P play bool play tremolo bar 27 //--------------------------------------------------------- 28 29 class TremoloBar final : public Element { 30 Spatium _lw; 31 qreal _userMag { 1.0 }; // allowed 0.1 - 10.0 32 bool _play { true }; 33 34 QList<PitchValue> _points; 35 36 QPolygonF polygon; // computed by layout 37 38 public: 39 TremoloBar(Score* s); 40 clone()41 TremoloBar* clone() const override { return new TremoloBar(*this); } type()42 ElementType type() const override { return ElementType::TREMOLOBAR; } 43 44 void layout() override; 45 void draw(QPainter*) const override; 46 47 void write(XmlWriter&) const override; 48 void read(XmlReader& e) override; 49 points()50 QList<PitchValue>& points() { return _points; } points()51 const QList<PitchValue>& points() const { return _points; } setPoints(const QList<PitchValue> & p)52 void setPoints(const QList<PitchValue>& p) { _points = p; } 53 54 QVariant getProperty(Pid propertyId) const override; 55 bool setProperty(Pid propertyId, const QVariant&) override; propertyDefault(Pid)56 QVariant propertyDefault(Pid) const override; 57 58 qreal userMag() const { return _userMag; } setUserMag(qreal m)59 void setUserMag(qreal m) { _userMag = m; } 60 setLineWidth(Spatium v)61 void setLineWidth(Spatium v) { _lw = v; } lineWidth()62 Spatium lineWidth() const { return _lw; } 63 play()64 bool play() const { return _play; } setPlay(bool val)65 void setPlay(bool val) { _play = val; } 66 }; 67 68 69 } // namespace Ms 70 #endif 71 72