MuseScore  3.4
Music composition and notation
glissando.h
Go to the documentation of this file.
1 //=============================================================================
2 // MuseScore
3 // Music Composition & Notation
4 //
5 // Copyright (C) 2008-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 __GLISSANDO_H__
14 #define __GLISSANDO_H__
15 
16 #include "element.h"
17 #include "line.h"
18 #include "property.h"
19 
20 namespace Ms {
21 
22 // the amount of white space to leave before a system-initial chord with glissando
23 static const qreal GLISS_STARTOFSYSTEM_WIDTH = 4; // in sp
24 
25 class Glissando;
26 class Note;
27 enum class GlissandoType;
28 
29 //---------------------------------------------------------
30 // @@ GlissandoSegment
31 //---------------------------------------------------------
32 
33 class GlissandoSegment final : public LineSegment {
34  public:
36  Glissando* glissando() const { return toGlissando(spanner()); }
37  virtual ElementType type() const override { return ElementType::GLISSANDO_SEGMENT; }
38  virtual GlissandoSegment* clone() const override { return new GlissandoSegment(*this); }
39  virtual void draw(QPainter*) const override;
40  virtual void layout() override;
41 
42  virtual Element* propertyDelegate(Pid) override;
43  };
44 
45 //---------------------------------------------------------
46 // Glissando
47 //---------------------------------------------------------
48 
49 class Glissando final : public SLine {
50  M_PROPERTY(QString, text, setText)
51  M_PROPERTY(GlissandoType, glissandoType, setGlissandoType)
52  M_PROPERTY(GlissandoStyle, glissandoStyle, setGlissandoStyle)
53  M_PROPERTY(QString, fontFace, setFontFace)
54  M_PROPERTY(qreal, fontSize, setFontSize)
55  M_PROPERTY(bool, showText, setShowText)
56  M_PROPERTY(bool, playGlissando, setPlayGlissando)
57  M_PROPERTY(FontStyle, fontStyle, setFontStyle)
58 
59  public:
60  Glissando(Score* s);
61  Glissando(const Glissando&);
62 
63  static Note* guessInitialNote(Chord* chord);
64  static Note* guessFinalNote(Chord* chord);
65 
66  // overridden inherited methods
67  virtual Glissando* clone() const override { return new Glissando(*this); }
68  virtual ElementType type() const override { return ElementType::GLISSANDO; }
69  virtual LineSegment* createLineSegment() override;
70  virtual void scanElements(void* data, void (*func)(void*, Element*), bool all=true) override;
71  virtual void layout() override;
72  virtual void write(XmlWriter&) const override;
73  virtual void read(XmlReader&) override;
74 
75  // property/style methods
76  virtual QVariant getProperty(Pid propertyId) const override;
77  virtual bool setProperty(Pid propertyId, const QVariant&) override;
78  virtual QVariant propertyDefault(Pid) const override;
79  virtual Pid propertyId(const QStringRef& xmlName) const override;
80  };
81 
82 
83 } // namespace Ms
84 
85 #endif
86 
Pid
Definition: property.h:62
Definition: xml.h:67
GlissandoSegment(Spanner *sp, Score *s)
Definition: glissando.h:35
Virtual base class for slurs, ties, lines etc.
Definition: spanner.h:136
virtual void layout() override
Definition: glissando.cpp:58
Base class of score layout elements.
Definition: element.h:158
virtual void scanElements(void *data, void(*func)(void *, Element *), bool all=true)
Definition: element.cpp:220
virtual ElementType type() const override
Definition: glissando.h:68
FontStyle
Definition: types.h:468
virtual QVariant propertyDefault(Pid id) const override
Definition: spanner.cpp:162
Spanner * spanner() const
Definition: spanner.h:67
virtual GlissandoSegment * clone() const override
Definition: glissando.h:38
Virtual base class for segmented lines segments (OttavaSegment, HairpinSegment, TrillSegment...)
Definition: line.h:34
virtual void write(XmlWriter &) const
Definition: element.cpp:732
Definition: score.h:391
Glissando * glissando() const
Definition: glissando.h:36
virtual void draw(QPainter *) const override
Definition: glissando.cpp:71
Definition: glissando.h:49
virtual Pid propertyId(const QStringRef &xmlName) const override
Definition: element.cpp:1326
virtual base class for Hairpin, Trill and TextLine
Definition: line.h:70
#define M_PROPERTY(a, b, c)
Definition: property.h:36
virtual QVariant getProperty(Pid id) const override
Definition: spanner.cpp:127
Definition: aeolus.cpp:26
GlissandoType
Definition: types.h:292
Definition: xml.h:218
Graphic representation of a chord.
Definition: chord.h:55
virtual void read(XmlReader &) override
Definition: line.cpp:69
Definition: glissando.h:33
GlissandoStyle
Definition: types.h:302
virtual bool setProperty(Pid id, const QVariant &v) override
Definition: spanner.cpp:143
virtual Element * propertyDelegate(Pid) override
Definition: glissando.cpp:133
Graphic representation of a note.
Definition: note.h:212
ElementType
Definition: types.h:34
virtual ElementType type() const override
Definition: glissando.h:37