File: textlinebase.h

package info (click to toggle)
musescore3 3.2.3%2Bdfsg2-11
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 210,672 kB
  • sloc: cpp: 291,093; xml: 200,238; sh: 3,779; ansic: 1,447; python: 393; makefile: 240; perl: 82; pascal: 79
file content (125 lines) | stat: -rw-r--r-- 4,668 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
//=============================================================================
//  MuseScore
//  Music Composition & Notation
//
//  Copyright (C) 2002-2011 Werner Schweer
//
//  This program is free software; you can redistribute it and/or modify
//  it under the terms of the GNU General Public License version 2
//  as published by the Free Software Foundation and appearing in
//  the file LICENCE.GPL
//=============================================================================

#ifndef __TEXTLINEBASE_H__
#define __TEXTLINEBASE_H__

#include "line.h"
#include "style.h"
#include "property.h"

namespace Ms {

enum class Align : char;
class TextLineBase;
class Element;
class Text;

//---------------------------------------------------------
//   @@ TextLineBaseSegment
//---------------------------------------------------------

class TextLineBaseSegment : public LineSegment {
   protected:
      Text* _text;
      Text* _endText;
      QPointF points[4];
      int npoints;
      bool twoLines { false };

   public:
      TextLineBaseSegment(Spanner*, Score* s, ElementFlags f = ElementFlag::NOTHING);
      TextLineBaseSegment(const TextLineBaseSegment&);
      ~TextLineBaseSegment();

      TextLineBase* textLineBase() const            { return (TextLineBase*)spanner(); }
      virtual void draw(QPainter*) const override;

      virtual void layout() override;
      virtual void setSelected(bool f);

      virtual void spatiumChanged(qreal /*oldValue*/, qreal /*newValue*/) override;

      virtual Element* propertyDelegate(Pid) override;

      virtual Shape shape() const override;
      };

//---------------------------------------------------------
//   HookType
//---------------------------------------------------------

enum class HookType : char {
      NONE, HOOK_90, HOOK_45, HOOK_90T
      };

//---------------------------------------------------------
//   @@ TextLineBase
//---------------------------------------------------------

class TextLineBase : public SLine {
      enum class LineType : char { CRESCENDO, DECRESCENDO };

      M_PROPERTY(bool,      lineVisible,           setLineVisible)
      M_PROPERTY2(HookType, beginHookType,         setBeginHookType,          HookType::NONE)
      M_PROPERTY2(HookType, endHookType,           setEndHookType,            HookType::NONE)
      M_PROPERTY(Spatium,   beginHookHeight,       setBeginHookHeight)
      M_PROPERTY(Spatium,   endHookHeight,         setEndHookHeight)

      M_PROPERTY(PlaceText, beginTextPlace,        setBeginTextPlace)
      M_PROPERTY(QString,   beginText,             setBeginText)
      M_PROPERTY(Align,     beginTextAlign,        setBeginTextAlign)
      M_PROPERTY(QString,   beginFontFamily,       setBeginFontFamily)
      M_PROPERTY(qreal,     beginFontSize,         setBeginFontSize)
      M_PROPERTY(FontStyle, beginFontStyle,        setBeginFontStyle)
      M_PROPERTY(QPointF,   beginTextOffset,       setBeginTextOffset)

      M_PROPERTY(PlaceText, continueTextPlace,     setContinueTextPlace)
      M_PROPERTY(QString,   continueText,          setContinueText)
      M_PROPERTY(Align,     continueTextAlign,     setContinueTextAlign)
      M_PROPERTY(QString,   continueFontFamily,    setContinueFontFamily)
      M_PROPERTY(qreal,     continueFontSize,      setContinueFontSize)
      M_PROPERTY(FontStyle, continueFontStyle,     setContinueFontStyle)
      M_PROPERTY(QPointF,   continueTextOffset,    setContinueTextOffset)

      M_PROPERTY(PlaceText, endTextPlace,          setEndTextPlace)
      M_PROPERTY(QString,   endText,               setEndText)
      M_PROPERTY(Align,     endTextAlign,          setEndTextAlign)
      M_PROPERTY(QString,   endFontFamily,         setEndFontFamily)
      M_PROPERTY(qreal,     endFontSize,           setEndFontSize)
      M_PROPERTY(FontStyle, endFontStyle,          setEndFontStyle)
      M_PROPERTY(QPointF,   endTextOffset,         setEndTextOffset)

   protected:
      friend class TextLineBaseSegment;

   public:
      TextLineBase(Score* s, ElementFlags = ElementFlag::NOTHING);

      virtual void write(XmlWriter& xml) const override;
      virtual void read(XmlReader&) override;

      virtual void writeProperties(XmlWriter& xml) const override;
      virtual bool readProperties(XmlReader& node) override;

      virtual void spatiumChanged(qreal /*oldValue*/, qreal /*newValue*/) override;

      virtual QVariant getProperty(Pid id) const override;
      virtual bool setProperty(Pid propertyId, const QVariant&) override;
      virtual Pid propertyId(const QStringRef& xmlName) const override;
      };

}     // namespace Ms
Q_DECLARE_METATYPE(Ms::HookType);

#endif