17 #include "durationtype.h" 28 enum class IconType : signed char;
29 enum class SpannerSegmentType;
37 class
Beam final :
public Element {
39 QVector<ChordRest*> _elements;
40 QVector<QLineF*> beamSegments;
47 bool _userModified[2];
55 QVector<BeamFragment*> fragments;
61 TDuration maxDuration;
64 void layout2(std::vector<ChordRest*>, SpannerSegmentType,
int frag);
65 bool twoBeamedNotes();
66 void computeStemLen(
const std::vector<ChordRest*>& crl, qreal& py1,
int beamLevels);
67 bool slopeZero(
const std::vector<ChordRest*>& crl);
73 enum class Mode : signed char {
83 Beam* clone()
const override {
return new Beam(*
this); }
85 QPointF pagePos()
const override;
86 QPointF canvasPos()
const override;
88 bool isEditable()
const override {
return true; }
89 void startEdit(EditData&)
override;
90 void endEdit(EditData&)
override;
91 void editDrag(EditData&)
override;
93 Fraction tick()
const override;
94 Fraction rtick()
const override;
95 Fraction ticks()
const;
97 void write(XmlWriter& xml)
const override;
98 void read(XmlReader&)
override;
99 void spatiumChanged(qreal , qreal )
override;
101 void reset()
override;
103 System* system()
const {
return toSystem(parent()); }
106 void layoutGraceNotes();
109 const QVector<ChordRest*>& elements() {
return _elements; }
110 void clear() { _elements.clear(); }
111 bool empty()
const {
return _elements.empty(); }
112 bool contains(
const ChordRest* cr)
const {
return std::find(_elements.begin(), _elements.end(), cr) != _elements.end(); }
114 void add(Element*)
override;
115 void remove(Element*)
override;
117 void move(
const QPointF&)
override;
118 void draw(QPainter*)
const override;
120 bool up()
const {
return _up; }
121 void setUp(
bool v) { _up = v; }
122 void setId(
int i)
const { _id = i; }
123 int id()
const {
return _id; }
124 bool noSlope()
const {
return _noSlope; }
125 void setNoSlope(
bool val) { _noSlope = val; }
128 Direction beamDirection()
const {
return _direction; }
130 bool acceptDrop(EditData&)
const override;
131 Element* drop(EditData&)
override;
133 qreal growLeft()
const {
return _grow1; }
134 qreal growRight()
const {
return _grow2; }
135 void setGrowLeft(qreal val) { _grow1 = val; }
136 void setGrowRight(qreal val) { _grow2 = val; }
138 bool distribute()
const {
return _distribute; }
139 void setDistribute(
bool val) { _distribute = val; }
141 bool userModified()
const;
142 void setUserModified(
bool val);
144 QPointF beamPos()
const;
145 void setBeamPos(
const QPointF& bp);
147 qreal beamDist()
const {
return _beamDist; }
149 QVariant getProperty(Pid propertyId)
const override;
150 bool setProperty(Pid propertyId,
const QVariant&)
override;
151 QVariant propertyDefault(Pid
id)
const override;
153 bool isGrace()
const {
return _isGrace; }
154 bool cross()
const {
return _cross; }
156 void addSkyline(Skyline&);
158 void triggerLayout()
const override;
160 EditBehavior normalModeEditBehavior()
const override {
return EditBehavior::Edit; }
161 int gripsCount()
const override {
return 3; }
162 Grip initialEditModeGrip()
const override {
return Grip::END; }
163 Grip defaultGrip()
const override {
return Grip::MIDDLE; }
164 std::vector<QPointF> gripsPositions(
const EditData&)
const override;
166 static IconType iconType(
Mode);
168 QRectF drag(EditData &)
override;
169 bool isMovable()
const override;
170 void startDrag(EditData &)
override;
173 void initBeamEditData(EditData &ed);
ElementType
Definition: types.h:34
Mode
Definition: beam.h:73
Direction
Definition: types.h:351
Definition: cursor.cpp:30