MuseScore  3.4
Music composition and notation
element.h
Go to the documentation of this file.
1 //=============================================================================
2 // MuseScore
3 // Music Composition & Notation
4 //
5 // Copyright (C) 2002-2017 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 __ELEMENT_H__
14 #define __ELEMENT_H__
15 
16 #include "spatium.h"
17 #include "fraction.h"
18 #include "scoreElement.h"
19 #include "shape.h"
20 
21 namespace Ms {
22 
23 #ifdef Q_OS_MAC
24 #define CONTROL_MODIFIER Qt::AltModifier
25 #else
26 #define CONTROL_MODIFIER Qt::ControlModifier
27 #endif
28 
29 #ifndef VOICES
30 #define VOICES 4
31 #endif
32 
33 class XmlReader;
34 class XmlWriter;
35 enum class SymId;
36 enum class Pid;
37 class StaffType;
38 
39 //---------------------------------------------------------
40 // Grip
41 //---------------------------------------------------------
42 
43 enum class Grip {
44  NO_GRIP = -1,
45  START = 0, END = 1, // arpeggio etc.
46  MIDDLE = 2, APERTURE = 3, // Line
47  /*START, END , */
48  BEZIER1 = 2, SHOULDER = 3, BEZIER2 = 4, DRAG = 5, // Slur
49  GRIPS = 6 // number of grips for slur
50  };
51 
52 //---------------------------------------------------------
53 // OffsetChange
54 //---------------------------------------------------------
55 
56 enum class OffsetChange {
57  RELATIVE_OFFSET = -1,
58  NONE = 0,
59  ABSOLUTE_OFFSET = 1
60  };
61 
62 //---------------------------------------------------------
63 // ElementFlag
64 //---------------------------------------------------------
65 
66 enum class ElementFlag {
67  NOTHING = 0x00000000,
68  DROP_TARGET = 0x00000001,
69  NOT_SELECTABLE = 0x00000002,
70  MOVABLE = 0x00000004,
71  COMPOSITION = 0x00000008, // true if element is part of another element
72  HAS_TAG = 0x00000010, // true if this is a layered element
73  ON_STAFF = 0x00000020,
74  SELECTED = 0x00000040,
75  GENERATED = 0x00000080,
76  INVISIBLE = 0x00000100,
77  NO_AUTOPLACE = 0x00000200,
78  SYSTEM = 0x00000400,
79  PLACE_ABOVE = 0x00000800,
80  SIZE_SPATIUM_DEPENDENT = 0x00001000,
81 
82  // measure flags
83  REPEAT_END = 0x00002000,
84  REPEAT_START = 0x00004000,
85  REPEAT_JUMP = 0x00008000,
86  IRREGULAR = 0x00010000,
87  LINE_BREAK = 0x00020000,
88  PAGE_BREAK = 0x00040000,
89  SECTION_BREAK = 0x00080000,
90  NO_BREAK = 0x00100000,
91  HEADER = 0x00200000,
92  TRAILER = 0x00400000, // also used in segment
93  KEYSIG = 0x00800000,
94 
95  // segment flags
96  ENABLED = 0x01000000, // used for segments
97  EMPTY = 0x02000000,
98  WRITTEN = 0x04000000,
99  };
100 
101 typedef QFlags<ElementFlag> ElementFlags;
102 Q_DECLARE_OPERATORS_FOR_FLAGS(ElementFlags);
103 
104 class ElementEditData;
105 
106 //---------------------------------------------------------
107 // EditData
108 // used in editDrag
109 //---------------------------------------------------------
110 
111 class EditData {
112  QList<ElementEditData*> data;
113 
114  public:
115  MuseScoreView* view { 0 };
116 
117  QVector<QRectF> grip;
118  int grips { 0 }; // number of grips
119  Grip curGrip { Grip(0) };
120 
121  QPointF pos;
122  QPointF startMove;
124  QPointF lastPos;
125  QPointF delta;
126  bool hRaster { false };
127  bool vRaster { false };
128 
129  int key { 0 };
130  Qt::KeyboardModifiers modifiers { 0 };
131  QString s;
132 
133  Qt::MouseButtons buttons { Qt::NoButton };
134 
135  // drop data:
136  QPointF dragOffset;
137  Element* element { 0 };
138  Element* dropElement { 0 };
139 
140  EditData(MuseScoreView* v) : view(v) {}
141  void clearData();
142 
143  ElementEditData* getData(const Element*) const;
144  void addData(ElementEditData*);
145  bool control(bool textEditing = false) const;
146  bool shift() const { return modifiers & Qt::ShiftModifier; }
147  bool isStartEndGrip() { return curGrip == Grip::START || curGrip == Grip::END; }
148  };
149 
150 //-------------------------------------------------------------------
151 // @@ Element
156 //-------------------------------------------------------------------
157 
158 class Element : public ScoreElement {
159  Element* _parent { 0 };
160  mutable QRectF _bbox;
161  qreal _mag;
162  QPointF _pos;
163  QPointF _offset;
165  QPointF _changedPos;
167  int _track;
168  mutable ElementFlags _flags;
170  uint _tag;
171 
172  public:
173  enum class EditBehavior {
174  SelectOnly,
175  Edit,
176  };
177 
178  protected:
179  mutable int _z;
180  QColor _color;
181 
182  public:
183  Element(Score* = 0, ElementFlags = ElementFlag::NOTHING);
184  Element(const Element&);
185  virtual ~Element();
186 
187  Element &operator=(const Element&) = delete;
188  //@ create a copy of the element
189  Q_INVOKABLE virtual Ms::Element* clone() const = 0;
190  virtual Element* linkedClone();
191 
192  Element* parent() const { return _parent; }
193  void setParent(Element* e) { _parent = e; }
194  Measure* findMeasure();
195  const Measure* findMeasure() const;
196  MeasureBase* findMeasureBase();
197  const MeasureBase* findMeasureBase() const;
198 
199  virtual bool isElement() const override { return true; }
200 
201  qreal spatium() const;
202 
203  inline void setFlag(ElementFlag f, bool v) { if (v) _flags |= f; else _flags &= ~ElementFlags(f); }
204  inline void setFlag(ElementFlag f, bool v) const { if (v) _flags |= f; else _flags &= ~ElementFlags(f); }
205  inline bool flag(ElementFlag f) const { return _flags & f; }
206 
207  bool selected() const { return flag(ElementFlag::SELECTED); }
208  virtual void setSelected(bool f) { setFlag(ElementFlag::SELECTED, f); }
209 
210  bool visible() const { return !flag(ElementFlag::INVISIBLE); }
211  virtual void setVisible(bool f) { setFlag(ElementFlag::INVISIBLE, !f); }
212 
213  virtual bool sizeIsSpatiumDependent() const override { return !flag(ElementFlag::SIZE_SPATIUM_DEPENDENT); }
215 
217  void setPlacement(Placement val) { setFlag(ElementFlag::PLACE_ABOVE, !bool(val)); }
218  bool placeAbove() const { return placement() == Placement::ABOVE; }
219  bool placeBelow() const { return placement() == Placement::BELOW; }
220 
221  bool generated() const { return flag(ElementFlag::GENERATED); }
222  void setGenerated(bool val) { setFlag(ElementFlag::GENERATED, val); }
223 
224  Spatium minDistance() const { return _minDistance; }
225  void setMinDistance(Spatium v) { _minDistance = v; }
226  OffsetChange offsetChanged() const { return _offsetChanged; }
227  void setOffsetChanged(bool v, bool absolute = true, const QPointF& diff = QPointF());
228 
229  const QPointF& ipos() const { return _pos; }
230  virtual const QPointF pos() const { return _pos + _offset; }
231  virtual qreal x() const { return _pos.x() + _offset.x(); }
232  virtual qreal y() const { return _pos.y() + _offset.y(); }
233  void setPos(qreal x, qreal y) { _pos.rx() = x, _pos.ry() = y; }
234  void setPos(const QPointF& p) { _pos = p; }
235  QPointF& rpos() { return _pos; }
236  qreal& rxpos() { return _pos.rx(); }
237  qreal& rypos() { return _pos.ry(); }
238  virtual void move(const QPointF& s) { _pos += s; }
239 
240  virtual QPointF pagePos() const;
241  virtual QPointF canvasPos() const;
242  qreal pageX() const;
243  qreal canvasX() const;
244 
245  const QPointF& offset() const { return _offset; }
246  virtual void setOffset(const QPointF& o) { _offset = o; }
247  void setOffset(qreal x, qreal y) { _offset.rx() = x, _offset.ry() = y; }
248  QPointF& roffset() { return _offset; }
249  qreal& rxoffset() { return _offset.rx(); }
250  qreal& ryoffset() { return _offset.ry(); }
251 
252  virtual Fraction tick() const;
253  virtual Fraction rtick() const;
254 
255  bool isNudged() const { return !_offset.isNull(); }
256 
257  virtual const QRectF& bbox() const { return _bbox; }
258  virtual QRectF& bbox() { return _bbox; }
259  virtual qreal height() const { return bbox().height(); }
260  virtual void setHeight(qreal v) { _bbox.setHeight(v); }
261  virtual qreal width() const { return bbox().width(); }
262  virtual void setWidth(qreal v) { _bbox.setWidth(v); }
263  QRectF abbox() const { return bbox().translated(pagePos()); }
264  QRectF pageBoundingRect() const { return bbox().translated(pagePos()); }
265  QRectF canvasBoundingRect() const { return bbox().translated(canvasPos()); }
266  virtual void setbbox(const QRectF& r) const { _bbox = r; }
267  virtual void addbbox(const QRectF& r) const { _bbox |= r; }
268  bool contains(const QPointF& p) const;
269  bool intersects(const QRectF& r) const;
270 #ifndef NDEBUG
271  virtual Shape shape() const { return Shape(bbox(), name()); }
272 #else
273  virtual Shape shape() const { return Shape(bbox()); }
274 #endif
275  virtual qreal baseLine() const { return -height(); }
276 
277  virtual int subtype() const { return -1; } // for select gui
278 
279  virtual void draw(QPainter*) const {}
280  void drawAt(QPainter*p, const QPointF& pt) const { p->translate(pt); draw(p); p->translate(-pt);}
281 
282  virtual void writeProperties(XmlWriter& xml) const;
283  virtual bool readProperties(XmlReader&);
284 
285  virtual void write(XmlWriter&) const;
286  virtual void read(XmlReader&);
287 
288  virtual void startDrag(EditData&);
289  virtual QRectF drag(EditData&);
290  virtual void endDrag(EditData&);
291  virtual QLineF dragAnchor() const { return QLineF(); }
292 
293  virtual bool isEditable() const { return !flag(ElementFlag::GENERATED); }
294 
295  virtual void startEdit(EditData&);
296  virtual bool edit(EditData&);
297  virtual void startEditDrag(EditData&);
298  virtual void editDrag(EditData&);
299  virtual void endEditDrag(EditData&);
300  virtual void endEdit(EditData&);
301 
302  virtual void editCut(EditData&) {}
303  virtual void editCopy(EditData&) {}
304 
305  void updateGrips(EditData&) const;
306  virtual bool nextGrip(EditData&) const;
307  virtual bool prevGrip(EditData&) const;
308  virtual QPointF gripAnchor(Grip) const { return QPointF(); }
309 
310  virtual EditBehavior normalModeEditBehavior() const { return EditBehavior::SelectOnly; }
311  virtual int gripsCount() const { return 0; }
312  virtual Grip initialEditModeGrip() const { return Grip::NO_GRIP; }
313  virtual Grip defaultGrip() const { return Grip::NO_GRIP; }
314  virtual std::vector<QPointF> gripsPositions(const EditData&) const { return std::vector<QPointF>(); }
315 
316  int track() const { return _track; }
317  virtual void setTrack(int val) { _track = val; }
318 
319  int z() const;
320  void setZ(int val) { _z = val; }
321 
322  int staffIdx() const { return _track >> 2; }
323  virtual int vStaffIdx() const { return staffIdx(); }
324  int voice() const { return _track & 3; }
325  void setVoice(int v) { _track = (_track / VOICES) * VOICES + v; }
326  Staff* staff() const;
327  StaffType* staffType() const;
328  Part* part() const;
329 
330  virtual void add(Element*);
331  virtual void remove(Element*);
332  virtual void change(Element* o, Element* n);
333 
334  virtual void layout() {}
335  virtual void spatiumChanged(qreal /*oldValue*/, qreal /*newValue*/);
336  virtual void localSpatiumChanged(qreal /*oldValue*/, qreal /*newValue*/);
337 
338  // debug functions
339  virtual void dump() const;
340  virtual Q_INVOKABLE QString subtypeName() const;
341  //@ Returns the human-readable name of the element type
342  //@ Returns the name of the element type
343  virtual Q_INVOKABLE QString _name() const { return QString(name()); }
344 
345  virtual QColor color() const { return _color; }
346  QColor curColor() const;
347  QColor curColor(bool isVisible) const;
348  QColor curColor(bool isVisible, QColor normalColor) const;
349  virtual void setColor(const QColor& c) { _color = c; }
350  void undoSetColor(const QColor& c);
351  void undoSetVisible(bool v);
352 
353  static ElementType readType(XmlReader& node, QPointF*, Fraction*);
354  static Element* readMimeData(Score* score, const QByteArray& data, QPointF*, Fraction*);
355 
356  virtual QByteArray mimeData(const QPointF&) const;
364  virtual bool acceptDrop(EditData&) const { return false; }
365 
375  virtual Element* drop(EditData&) { return 0;}
376 
381  virtual bool mousePress(EditData&) { return false; }
382 
383  mutable bool itemDiscovered { false };
384 
385  virtual void scanElements(void* data, void (*func)(void*, Element*), bool all=true);
386 
387  virtual void reset() override; // reset all properties & position to default
388 
389  virtual qreal mag() const { return _mag; }
390  void setMag(qreal val) { _mag = val; }
391  qreal magS() const;
392 
393  bool isPrintable() const;
394  qreal point(const Spatium sp) const { return sp.val() * spatium(); }
395 
396  static Ms::Element* create(Ms::ElementType type, Score*);
397  static Element* name2Element(const QStringRef&, Score*);
398 
399  bool systemFlag() const { return flag(ElementFlag::SYSTEM); }
400  void setSystemFlag(bool v) const { setFlag(ElementFlag::SYSTEM, v); }
401 
402  bool header() const { return flag(ElementFlag::HEADER); }
403  void setHeader(bool v) { setFlag(ElementFlag::HEADER, v); }
404 
405  bool trailer() const { return flag(ElementFlag::TRAILER); }
406  void setTrailer(bool val) { setFlag(ElementFlag::TRAILER, val); }
407 
408  bool selectable() const { return !flag(ElementFlag::NOT_SELECTABLE); }
409  void setSelectable(bool val) { setFlag(ElementFlag::NOT_SELECTABLE, !val); }
410 
411  bool dropTarget() const { return flag(ElementFlag::DROP_TARGET); }
412  void setDropTarget(bool v) const { setFlag(ElementFlag::DROP_TARGET, v); }
413 
414  bool composition() const { return flag(ElementFlag::COMPOSITION); }
415  void setComposition(bool v) const { setFlag(ElementFlag::COMPOSITION, v); }
416 
417  virtual bool isMovable() const { return flag(ElementFlag::MOVABLE); }
418 
419  bool enabled() const { return flag(ElementFlag::ENABLED); }
420  void setEnabled(bool val) { setFlag(ElementFlag::ENABLED, val); }
421 
422  uint tag() const { return _tag; }
423  void setTag(uint val) { _tag = val; }
424 
425  bool autoplace() const;
426  virtual void setAutoplace(bool v) { setFlag(ElementFlag::NO_AUTOPLACE, !v); }
427  bool addToSkyline() const { return !(_flags & (ElementFlag::INVISIBLE|ElementFlag::NO_AUTOPLACE)); }
428 
429  virtual QVariant getProperty(Pid) const override;
430  virtual bool setProperty(Pid, const QVariant&) override;
431  virtual void undoChangeProperty(Pid id, const QVariant&, PropertyFlags ps) override;
433  virtual QVariant propertyDefault(Pid) const override;
434  virtual Pid propertyId(const QStringRef& xmlName) const override;
435  virtual QString propertyUserValue(Pid) const override;
436  virtual Element* propertyDelegate(Pid) { return 0; } // return Spanner for SpannerSegment for some properties
437 
438  bool custom(Pid) const;
439  virtual bool isUserModified() const;
440 
441  void drawSymbol(SymId id, QPainter* p, const QPointF& o = QPointF(), qreal scale = 1.0) const;
442  void drawSymbol(SymId id, QPainter* p, const QPointF& o, int n) const;
443  void drawSymbols(const std::vector<SymId>&, QPainter* p, const QPointF& o = QPointF(), qreal scale = 1.0) const;
444  void drawSymbols(const std::vector<SymId>&, QPainter* p, const QPointF& o, const QSizeF& scale) const;
445  qreal symHeight(SymId id) const;
446  qreal symWidth(SymId id) const;
447  qreal symWidth(const std::vector<SymId>&) const;
448  QRectF symBbox(SymId id) const;
449  QRectF symBbox(const std::vector<SymId>&) const;
450  QPointF symStemDownNW(SymId id) const;
451  QPointF symStemUpSE(SymId id) const;
452  QPointF symCutOutNE(SymId id) const;
453  QPointF symCutOutNW(SymId id) const;
454  QPointF symCutOutSE(SymId id) const;
455  QPointF symCutOutSW(SymId id) const;
456  qreal symAdvance(SymId id) const;
457  bool symIsValid(SymId id) const;
458 
459  bool concertPitch() const;
460  virtual Element* nextElement(); // selects the next score element, (notes, rests etc. as well as articulation etc.)
461  virtual Element* prevElement(); // selects the next score element, (notes, rests etc. as well as articulation etc.)
462  virtual Element* nextSegmentElement(); //< Used for navigation
463  virtual Element* prevSegmentElement(); //< next-element and prev-element command
464 
465  virtual QString accessibleInfo() const; //< used to populate the status bar
466  virtual QString screenReaderInfo() const { //< by default returns accessibleInfo, but can be overridden
467  return accessibleInfo();
468  }
469  // if the screen-reader needs a special string (see note for example)
470  virtual QString accessibleExtraInfo() const { // used to return info that will be appended to accessibleInfo
471  return QString(); // and passed only to the screen-reader
472  }
473 
474  virtual void triggerLayout() const;
475  virtual void triggerLayoutAll() const;
476  virtual void drawEditMode(QPainter*, EditData&);
477 
478  void autoplaceSegmentElement(bool above, bool add); // helper functions
479  void autoplaceMeasureElement(bool above, bool add);
480  void autoplaceSegmentElement(bool add = true) { autoplaceSegmentElement(placeAbove(), add); }
481  void autoplaceMeasureElement(bool add = true) { autoplaceMeasureElement(placeAbove(), add); }
482  void autoplaceCalculateOffset(QRectF& r, qreal minDistance);
483  qreal rebaseOffset(bool nox = true);
484  bool rebaseMinDistance(qreal& md, qreal& yd, qreal sp, qreal rebase, bool above, bool fix);
485 
486  qreal styleP(Sid idx) const;
487  };
488 
489 //-----------------------------------------------------------------------------
490 // ElementEditData
491 // holds element specific data during element editing:
492 //
493 // startEditDrag(EditData&) creates data and attaches it to EditData
494 // editDrag(EditData&)
495 // endEditDrag(EditData&) use data to create undo records
496 //-----------------------------------------------------------------------------
497 
498 struct PropertyData {
500  QVariant data;
502  };
503 
505  public:
507  QList<PropertyData> propertyData;
508 
509  virtual ~ElementEditData() = default;
510  void pushProperty(Pid pid) { propertyData.push_back(PropertyData({ pid, e->getProperty(pid), e->propertyFlags(pid) })); }
511  };
512 
513 //---------------------------------------------------------
514 // ElementList
515 //---------------------------------------------------------
516 
517 class ElementList : public std::vector<Element*> {
518  public:
520  bool remove(Element*);
521  void replace(Element* old, Element* n);
522  void write(XmlWriter&) const;
523  void write(XmlWriter&, const char* name) const;
524  };
525 
526 //---------------------------------------------------------
527 // @@ Compound
528 //---------------------------------------------------------
529 
530 class Compound : public Element {
531  QList<Element*> elements;
532 
533  protected:
534  const QList<Element*>& getElements() const { return elements; }
535 
536  public:
537  Compound(Score*);
538  Compound(const Compound&);
539  virtual ElementType type() const = 0;
540 
541  virtual void draw(QPainter*) const;
542  virtual void addElement(Element*, qreal x, qreal y);
543  void clear();
544  virtual void setSelected(bool f);
545  virtual void setVisible(bool);
546  virtual void layout();
547  };
548 
549 extern bool elementLessThan(const Element* const, const Element* const);
550 extern void collectElements(void* data, Element* e);
551 
552 
553 } // namespace Ms
554 
555 Q_DECLARE_METATYPE(Ms::ElementType);
556 
557 #endif
558 
ElementList()
Definition: element.h:519
virtual void setWidth(qreal v)
Definition: element.h:262
virtual bool acceptDrop(EditData &) const
Return true if this element accepts a drop at canvas relative pos of given element type and subtype...
Definition: element.h:364
int voice() const
Definition: element.h:324
void setDropTarget(bool v) const
Definition: element.h:412
QPoint startMovePixel
Definition: element.h:123
void drawAt(QPainter *p, const QPointF &pt) const
Definition: element.h:280
virtual void editCopy(EditData &)
Definition: element.h:303
virtual qreal mag() const
Definition: element.h:389
virtual int gripsCount() const
Definition: element.h:311
int _track
staffIdx * VOICES + voice
Definition: element.h:167
Global staff data not directly related to drawing.
Definition: staff.h:62
Pid
Definition: property.h:62
Virtual base class for Measure, HBox and VBox.
Definition: measurebase.h:61
bool trailer() const
Definition: element.h:405
QList< PropertyData > propertyData
Definition: element.h:507
Definition: xml.h:67
QPointF lastPos
Definition: element.h:124
uint _tag
tag bitmask
Definition: element.h:170
virtual void undoChangeProperty(Pid id, const QVariant &, PropertyFlags ps)
Definition: scoreElement.cpp:291
int staffIdx() const
Definition: element.h:322
Pid id
Definition: element.h:499
OffsetChange
Definition: element.h:56
void setSizeIsSpatiumDependent(bool v)
Definition: element.h:214
OffsetChange offsetChanged() const
Definition: element.h:226
QFlags< ElementFlag > ElementFlags
Definition: element.h:101
virtual int vStaffIdx() const
Definition: element.h:323
QColor _color
element color attribute
Definition: element.h:180
Placement placement() const
Definition: element.h:216
virtual void editCut(EditData &)
Definition: element.h:302
QRectF _bbox
Bounding box relative to _pos + _offset.
Definition: element.h:160
one measure in a system
Definition: measure.h:65
virtual EditBehavior normalModeEditBehavior() const
Definition: element.h:310
void setComposition(bool v) const
Definition: element.h:415
virtual bool isElement() const override
Definition: element.h:199
void setZ(int val)
Definition: element.h:320
void setGenerated(bool val)
Definition: element.h:222
virtual bool isMovable() const
Definition: element.h:417
Definition: scoreElement.h:173
virtual Element * propertyDelegate(Pid)
Definition: element.h:436
Definition: element.h:504
void setMinDistance(Spatium v)
Definition: element.h:225
virtual void setTrack(int val)
Definition: element.h:317
SymId
Definition: sym.h:30
Base class of score layout elements.
Definition: element.h:158
virtual QPointF gripAnchor(Grip) const
Definition: element.h:308
Definition: element.h:530
void setTag(uint val)
Definition: element.h:423
Definition: element.h:517
int track() const
Definition: element.h:316
void setHeader(bool v)
Definition: element.h:403
qreal & rxpos()
Definition: element.h:236
virtual QString accessibleExtraInfo() const
Definition: element.h:470
Element * parent() const
Definition: element.h:192
virtual const QPointF pos() const
Definition: element.h:230
QPointF pos
Definition: element.h:121
virtual void setSelected(bool f)
Definition: element.h:208
bool composition() const
Definition: element.h:414
virtual qreal height() const
Definition: element.h:259
virtual Grip defaultGrip() const
Definition: element.h:313
Definition: score.h:391
virtual std::vector< QPointF > gripsPositions(const EditData &) const
Definition: element.h:314
virtual QLineF dragAnchor() const
Definition: element.h:291
bool placeAbove() const
Definition: element.h:218
PropertyFlags
Definition: property.h:54
constexpr qreal val() const
Definition: spatium.h:32
qreal & rypos()
Definition: element.h:237
void setParent(Element *e)
Definition: element.h:193
QPointF & rpos()
Definition: element.h:235
QRectF abbox() const
Definition: element.h:263
Spatium minDistance() const
Definition: element.h:224
bool placeBelow() const
Definition: element.h:219
QPointF _changedPos
position set when changing offset
Definition: element.h:165
#define VOICES
Definition: mscore.h:72
Placement
Definition: types.h:312
virtual void setHeight(qreal v)
Definition: element.h:260
void setMag(qreal val)
Definition: element.h:390
virtual qreal width() const
Definition: element.h:261
bool selectable() const
Definition: element.h:408
void setFlag(ElementFlag f, bool v)
Definition: element.h:203
Grip
Definition: element.h:43
virtual void addbbox(const QRectF &r) const
Definition: element.h:267
virtual bool mousePress(EditData &)
delivers mouseEvent to element in edit mode returns true if mouse event is accepted by element ...
Definition: element.h:381
qreal & ryoffset()
Definition: element.h:250
void setOffset(qreal x, qreal y)
Definition: element.h:247
QPointF delta
Definition: element.h:125
ElementFlag
Definition: element.h:66
bool visible() const
Definition: element.h:210
bool systemFlag() const
Definition: element.h:399
void autoplaceMeasureElement(bool add=true)
Definition: element.h:481
Definition: aeolus.cpp:26
void collectElements(void *data, Element *e)
Definition: element.cpp:1152
Definition: spatium.h:25
Element * e
Definition: element.h:506
virtual const QRectF & bbox() const
Definition: element.h:257
Sid
Definition: style.h:33
bool elementLessThan(const Element *const e1, const Element *const e2)
Definition: element.cpp:1131
Definition: stafftype.h:173
virtual void setOffset(const QPointF &o)
Definition: element.h:246
virtual QVariant getProperty(Pid) const override
Definition: element.cpp:1173
virtual bool isEditable() const
Definition: element.h:293
Definition: xml.h:218
bool generated() const
Definition: element.h:221
virtual bool sizeIsSpatiumDependent() const override
Definition: element.h:213
bool isNudged() const
Definition: element.h:255
virtual Grip initialEditModeGrip() const
Definition: element.h:312
virtual Element * drop(EditData &)
Handle a dropped element at canvas relative pos of given element type and subtype.
Definition: element.h:375
OffsetChange _offsetChanged
set by user actions that change offset, used by autoplace
Definition: element.h:164
virtual void layout()
Definition: element.h:334
qreal & rxoffset()
Definition: element.h:249
virtual qreal baseLine() const
Definition: element.h:275
void setPos(const QPointF &p)
Definition: element.h:234
bool enabled() const
Definition: element.h:419
QList< Element * > elements
Definition: element.h:531
virtual qreal y() const
Definition: element.h:232
Definition: xmlwriter.h:26
bool shift() const
Definition: element.h:146
QVariant data
Definition: element.h:500
void autoplaceSegmentElement(bool add=true)
Definition: element.h:480
virtual PropertyFlags propertyFlags(Pid) const
Definition: scoreElement.cpp:735
ElementFlags _flags
valid after call to layout()
Definition: element.h:168
QPointF _pos
Reference position, relative to _parent, set by autoplace.
Definition: element.h:162
virtual qreal x() const
Definition: element.h:231
const QPointF & offset() const
Definition: element.h:245
QList< ElementEditData * > data
Definition: element.h:112
Definition: element.h:111
bool selected() const
Definition: element.h:207
void setVoice(int v)
Definition: element.h:325
QPointF _offset
offset from reference position, set by autoplace or user
Definition: element.h:163
virtual Q_INVOKABLE QString _name() const
Definition: element.h:343
QPointF dragOffset
Definition: element.h:136
Definition: xmlreader.h:28
virtual void setColor(const QColor &c)
Definition: element.h:349
qreal _mag
standard magnification (derived value)
Definition: element.h:161
virtual void setAutoplace(bool v)
Definition: element.h:426
void setSystemFlag(bool v) const
Definition: element.h:400
bool isStartEndGrip()
Definition: element.h:147
virtual void setVisible(bool f)
Definition: element.h:211
QVector< QRectF > grip
Definition: element.h:117
bool addToSkyline() const
Definition: element.h:427
Definition: shape.h:42
virtual void move(const QPointF &s)
Definition: element.h:238
virtual int subtype() const
Definition: element.h:277
Definition: fraction.h:46
virtual Shape shape() const
Definition: element.h:271
void setPos(qreal x, qreal y)
Definition: element.h:233
ElementType
Definition: types.h:34
QPointF startMove
Definition: element.h:122
bool dropTarget() const
Definition: element.h:411
Spatium _minDistance
autoplace min distance
Definition: element.h:166
virtual void draw(QPainter *) const
Definition: element.h:279
QRectF canvasBoundingRect() const
Definition: element.h:265
EditData(MuseScoreView *v)
Definition: element.h:140
Definition: element.h:498
PropertyFlags f
Definition: element.h:501
virtual QRectF & bbox()
Definition: element.h:258
virtual QColor color() const
Definition: element.h:345
QRectF pageBoundingRect() const
Definition: element.h:264
QString s
Definition: element.h:131
bool flag(ElementFlag f) const
Definition: element.h:205
void setFlag(ElementFlag f, bool v) const
Definition: element.h:204
Definition: part.h:47
qreal point(const Spatium sp) const
Definition: element.h:394
const QList< Element * > & getElements() const
Definition: element.h:534
void setPlacement(Placement val)
Definition: element.h:217
virtual void setbbox(const QRectF &r) const
Definition: element.h:266
Q_DECLARE_OPERATORS_FOR_FLAGS(ElementFlags)
void setTrailer(bool val)
Definition: element.h:406
virtual QString screenReaderInfo() const
Definition: element.h:466
QPointF & roffset()
Definition: element.h:248
Pid propertyId(const QStringRef &s)
Definition: property.cpp:347
EditBehavior
Definition: element.h:173
void setSelectable(bool val)
Definition: element.h:409
int _z
Definition: element.h:179
uint tag() const
Definition: element.h:422
bool header() const
Definition: element.h:402
void setEnabled(bool val)
Definition: element.h:420
void pushProperty(Pid pid)
Definition: element.h:510
const QPointF & ipos() const
Definition: element.h:229
Definition: mscoreview.h:32