MuseScore  3.4
Music composition and notation
slur.h
Go to the documentation of this file.
1 //=============================================================================
2 // MuseScore
3 // Music Composition & Notation
4 //
5 // Copyright (C) 2002-2016 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 __SLUR_H__
14 #define __SLUR_H__
15 
16 #include "slurtie.h"
17 
18 namespace Ms {
19 
20 //---------------------------------------------------------
21 // @@ SlurSegment
23 //---------------------------------------------------------
24 
25 class SlurSegment final : public SlurTieSegment {
26 
27  protected:
28  qreal _extraHeight = 0.0;
29  virtual void changeAnchor(EditData&, Element*) override;
30 
31  public:
34 
35  virtual SlurSegment* clone() const override { return new SlurSegment(*this); }
36  virtual ElementType type() const override { return ElementType::SLUR_SEGMENT; }
37  virtual int subtype() const override { return static_cast<int>(spanner()->type()); }
38  virtual QString subtypeName() const override { return name(spanner()->type()); }
39  virtual void draw(QPainter*) const override;
40 
41  void layoutSegment(const QPointF& p1, const QPointF& p2);
42 
43  bool isEdited() const;
44  virtual bool edit(EditData&) override;
45 
46  Slur* slur() const { return toSlur(spanner()); }
47 
48  virtual void computeBezier(QPointF so = QPointF());
49  };
50 
51 //---------------------------------------------------------
52 // @@ Slur
53 //---------------------------------------------------------
54 
55 class Slur final : public SlurTie {
56 
57  void slurPosChord(SlurPos*);
58 
59  public:
60  Slur(Score* = 0);
61  ~Slur() {}
62  virtual Slur* clone() const override { return new Slur(*this); }
63  virtual ElementType type() const override { return ElementType::SLUR; }
64  virtual void write(XmlWriter& xml) const override;
65  virtual void layout() override;
66  virtual SpannerSegment* layoutSystem(System*) override;
67  virtual void setTrack(int val) override;
68  virtual void slurPos(SlurPos*) override;
69 
70  SlurSegment* frontSegment() { return toSlurSegment(Spanner::frontSegment()); }
71  const SlurSegment* frontSegment() const { return toSlurSegment(Spanner::frontSegment()); }
72  SlurSegment* backSegment() { return toSlurSegment(Spanner::backSegment()); }
73  const SlurSegment* backSegment() const { return toSlurSegment(Spanner::backSegment()); }
74  SlurSegment* segmentAt(int n) { return toSlurSegment(Spanner::segmentAt(n)); }
75  const SlurSegment* segmentAt(int n) const { return toSlurSegment(Spanner::segmentAt(n)); }
76  virtual SlurTieSegment* newSlurTieSegment() override { return new SlurSegment(score()); }
77  };
78 
79 } // namespace Ms
80 #endif
81 
SlurSegment * frontSegment()
Definition: slur.h:70
virtual SlurTieSegment * newSlurTieSegment() override
Definition: slur.h:76
virtual int subtype() const override
Definition: slur.h:37
SlurSegment(Score *s)
Definition: slur.h:32
qreal _extraHeight
Definition: slur.h:28
parent: System
Definition: spanner.h:50
Definition: slurtie.h:132
Definition: slur.h:55
SpannerSegment * segmentAt(int n)
Definition: spanner.h:211
virtual void setTrack(int val)
Definition: element.h:317
Base class of score layout elements.
Definition: element.h:158
Spanner * spanner() const
Definition: spanner.h:67
const SlurSegment * segmentAt(int n) const
Definition: slur.h:75
virtual void write(XmlWriter &) const
Definition: element.cpp:732
virtual ElementType type() const =0
virtual ElementType type() const override
Definition: slur.h:36
Definition: score.h:391
const SlurSegment * frontSegment() const
Definition: slur.h:71
virtual void draw(QPainter *) const override
Definition: slur.cpp:31
virtual ElementType type() const override
Definition: slur.h:63
Score * score() const
Definition: scoreElement.h:189
SpannerSegment * backSegment()
Definition: spanner.h:209
SlurSegment(const SlurSegment &ss)
Definition: slur.h:33
a single segment of slur; also used for Tie
Definition: slur.h:25
virtual Slur * clone() const override
Definition: slur.h:62
void layoutSegment(const QPointF &p1, const QPointF &p2)
Definition: slur.cpp:370
Definition: aeolus.cpp:26
Definition: slurtie.h:80
Definition: slurtie.h:25
Definition: xml.h:218
virtual void layout()
Definition: element.h:334
virtual bool edit(EditData &) override
Definition: slur.cpp:94
~Slur()
Definition: slur.h:61
bool isEdited() const
Definition: slur.cpp:445
virtual void computeBezier(QPointF so=QPointF())
Definition: slur.cpp:235
Definition: element.h:111
virtual SlurSegment * clone() const override
Definition: slur.h:35
const SlurSegment * backSegment() const
Definition: slur.h:73
SlurSegment * segmentAt(int n)
Definition: slur.h:74
One row of measures for all instruments; a complete piece of the timeline.
Definition: system.h:79
const char * name() const
Definition: scoreElement.cpp:787
virtual QString subtypeName() const override
Definition: slur.h:38
ElementType
Definition: types.h:34
SlurSegment * backSegment()
Definition: slur.h:72
virtual void changeAnchor(EditData &, Element *) override
Definition: slur.cpp:149
SpannerSegment * frontSegment()
Definition: spanner.h:207
Slur * slur() const
Definition: slur.h:46