MuseScore  3.4
Music composition and notation
textlinebase.h
Go to the documentation of this file.
1 //=============================================================================
2 // MuseScore
3 // Music Composition & Notation
4 //
5 // Copyright (C) 2002-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 __TEXTLINEBASE_H__
14 #define __TEXTLINEBASE_H__
15 
16 #include "line.h"
17 #include "style.h"
18 #include "property.h"
19 
20 namespace Ms {
21 
22 enum class Align : char;
23 class TextLineBase;
24 class Element;
25 class Text;
26 
27 //---------------------------------------------------------
28 // @@ TextLineBaseSegment
29 //---------------------------------------------------------
30 
32  protected:
35  QPointF points[6];
36  int npoints;
37  qreal lineLength;
38  bool twoLines { false };
39 
40  public:
44 
45  TextLineBase* textLineBase() const { return (TextLineBase*)spanner(); }
46  virtual void draw(QPainter*) const override;
47 
48  virtual void layout() override;
49  virtual void setSelected(bool f);
50 
51  virtual void spatiumChanged(qreal /*oldValue*/, qreal /*newValue*/) override;
52 
53  virtual Element* propertyDelegate(Pid) override;
54 
55  virtual Shape shape() const override;
56  };
57 
58 //---------------------------------------------------------
59 // HookType
60 //---------------------------------------------------------
61 
62 enum class HookType : char {
64  };
65 
66 //---------------------------------------------------------
67 // @@ TextLineBase
68 //---------------------------------------------------------
69 
70 class TextLineBase : public SLine {
71  enum class LineType : char { CRESCENDO, DECRESCENDO };
72 
73  M_PROPERTY(bool, lineVisible, setLineVisible)
74  M_PROPERTY2(HookType, beginHookType, setBeginHookType, HookType::NONE)
75  M_PROPERTY2(HookType, endHookType, setEndHookType, HookType::NONE)
76  M_PROPERTY(Spatium, beginHookHeight, setBeginHookHeight)
77  M_PROPERTY(Spatium, endHookHeight, setEndHookHeight)
78 
79  M_PROPERTY(PlaceText, beginTextPlace, setBeginTextPlace)
80  M_PROPERTY(QString, beginText, setBeginText)
81  M_PROPERTY(Align, beginTextAlign, setBeginTextAlign)
82  M_PROPERTY(QString, beginFontFamily, setBeginFontFamily)
83  M_PROPERTY(qreal, beginFontSize, setBeginFontSize)
84  M_PROPERTY(FontStyle, beginFontStyle, setBeginFontStyle)
85  M_PROPERTY(QPointF, beginTextOffset, setBeginTextOffset)
86 
87  M_PROPERTY(PlaceText, continueTextPlace, setContinueTextPlace)
88  M_PROPERTY(QString, continueText, setContinueText)
89  M_PROPERTY(Align, continueTextAlign, setContinueTextAlign)
90  M_PROPERTY(QString, continueFontFamily, setContinueFontFamily)
91  M_PROPERTY(qreal, continueFontSize, setContinueFontSize)
92  M_PROPERTY(FontStyle, continueFontStyle, setContinueFontStyle)
93  M_PROPERTY(QPointF, continueTextOffset, setContinueTextOffset)
94 
95  M_PROPERTY(PlaceText, endTextPlace, setEndTextPlace)
96  M_PROPERTY(QString, endText, setEndText)
97  M_PROPERTY(Align, endTextAlign, setEndTextAlign)
98  M_PROPERTY(QString, endFontFamily, setEndFontFamily)
99  M_PROPERTY(qreal, endFontSize, setEndFontSize)
100  M_PROPERTY(FontStyle, endFontStyle, setEndFontStyle)
101  M_PROPERTY(QPointF, endTextOffset, setEndTextOffset)
102 
103  protected:
104  friend class TextLineBaseSegment;
105 
106  public:
108 
109  virtual void write(XmlWriter& xml) const override;
110  virtual void read(XmlReader&) override;
111 
112  virtual void writeProperties(XmlWriter& xml) const override;
113  virtual bool readProperties(XmlReader& node) override;
114 
115  virtual void spatiumChanged(qreal /*oldValue*/, qreal /*newValue*/) override;
116 
117  virtual QVariant getProperty(Pid id) const override;
118  virtual bool setProperty(Pid propertyId, const QVariant&) override;
119  virtual Pid propertyId(const QStringRef& xmlName) const override;
120  };
121 
122 } // namespace Ms
123 Q_DECLARE_METATYPE(Ms::HookType);
124 
125 #endif
126 
Pid
Definition: property.h:62
Definition: xml.h:67
QFlags< ElementFlag > ElementFlags
Definition: element.h:101
Virtual base class for slurs, ties, lines etc.
Definition: spanner.h:136
Base class of score layout elements.
Definition: element.h:158
FontStyle
Definition: types.h:468
qreal lineLength
Definition: textlinebase.h:37
Virtual base class for segmented lines segments (OttavaSegment, HairpinSegment, TrillSegment...)
Definition: line.h:34
LineType
Definition: textlinebase.h:71
TextLineBase * textLineBase() const
Definition: textlinebase.h:45
Definition: score.h:391
#define M_PROPERTY2(a, b, c, d)
Definition: property.h:43
virtual base class for Hairpin, Trill and TextLine
Definition: line.h:70
Definition: textlinebase.h:31
#define M_PROPERTY(a, b, c)
Definition: property.h:36
ElementFlag
Definition: element.h:66
Definition: aeolus.cpp:26
Definition: spatium.h:25
Definition: xml.h:218
HookType
Definition: textlinebase.h:62
Definition: textlinebase.h:70
Definition: shape.h:42
PlaceText
Definition: mscore.h:115
Align
Definition: types.h:439
Definition: text.h:24
Pid propertyId(const QStringRef &s)
Definition: property.cpp:347
int npoints
Definition: textlinebase.h:36
Text * _text
Definition: textlinebase.h:33
Text * _endText
Definition: textlinebase.h:34