MuseScore
3.4
Music composition and notation
libmscore
ottava.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 __OTTAVA_H__
14
#define __OTTAVA_H__
15
16
#include "
textlinebase.h
"
17
#include "
property.h
"
18
19
namespace
Ms
{
20
21
//---------------------------------------------------------
22
// OttavaE
23
//---------------------------------------------------------
24
25
struct
OttavaE
{
26
int
offset
;
27
unsigned
start
;
28
unsigned
end
;
29
};
30
31
//---------------------------------------------------------
32
// OttavaType
33
//---------------------------------------------------------
34
35
enum class
OttavaType
: char {
36
OTTAVA_8VA
,
37
OTTAVA_8VB
,
38
OTTAVA_15MA
,
39
OTTAVA_15MB
,
40
OTTAVA_22MA
,
41
OTTAVA_22MB
42
};
43
44
//---------------------------------------------------------
45
// OttavaDefault
46
//---------------------------------------------------------
47
48
struct
OttavaDefault
{
49
OttavaType
type
;
50
int
shift
;
51
const
char
*
name
;
52
};
53
54
// order is important, should be the same as OttavaType
55
static
const
OttavaDefault
ottavaDefault[] = {
56
{
OttavaType::OTTAVA_8VA
, 12,
"8va"
},
57
{
OttavaType::OTTAVA_8VB
, -12,
"8vb"
},
58
{
OttavaType::OTTAVA_15MA
, 24,
"15ma"
},
59
{
OttavaType::OTTAVA_15MB
, -24,
"15mb"
},
60
{
OttavaType::OTTAVA_22MA
, 36,
"22ma"
},
61
{
OttavaType::OTTAVA_22MB
, -36,
"22mb"
}
62
};
63
64
65
class
Ottava
;
66
67
//---------------------------------------------------------
68
// @@ OttavaSegment
69
//---------------------------------------------------------
70
71
class
OttavaSegment
final :
public
TextLineBaseSegment
{
72
virtual
void
undoChangeProperty(
Pid
id
,
const
QVariant&,
PropertyFlags
ps)
override
;
73
virtual
Sid
getPropertyStyle(
Pid
)
const override
;
74
75
public
:
76
OttavaSegment
(
Spanner
* sp,
Score
* s) :
TextLineBaseSegment
(sp, s,
ElementFlag
::
MOVABLE
|
ElementFlag
::
ON_STAFF
) { }
77
virtual
ElementType
type
()
const override
{
return
ElementType::OTTAVA_SEGMENT
; }
78
virtual
OttavaSegment
*
clone
()
const override
{
return
new
OttavaSegment
(*
this
); }
79
Ottava
*
ottava
()
const
{
return
(
Ottava
*)spanner(); }
80
virtual
void
layout()
override
;
81
virtual
Element
* propertyDelegate(
Pid
)
override
;
82
};
83
84
//---------------------------------------------------------
85
// @@ Ottava
86
// @P ottavaType enum (Ottava.OTTAVA_8VA, .OTTAVA_8VB, .OTTAVA_15MA, .OTTAVA_15MB, .OTTAVA_22MA, .OTTAVA_22MB)
87
//---------------------------------------------------------
88
89
class
Ottava
final :
public
TextLineBase
{
90
OttavaType
_ottavaType
;
91
bool
_numbersOnly
;
92
93
void
updateStyledProperties();
94
virtual
Sid
getPropertyStyle(
Pid
)
const override
;
95
virtual
void
undoChangeProperty(
Pid
id
,
const
QVariant&,
PropertyFlags
ps)
override
;
96
97
protected
:
98
friend
class
OttavaSegment
;
99
100
public
:
101
Ottava
(
Score
* s);
102
Ottava
(
const
Ottava
&);
103
virtual
Ottava
*
clone
()
const override
{
return
new
Ottava
(*
this
); }
104
virtual
ElementType
type
()
const override
{
return
ElementType::OTTAVA
; }
105
106
void
setOttavaType(
OttavaType
val);
107
OttavaType
ottavaType
()
const
{
return
_ottavaType; }
108
109
bool
numbersOnly
()
const
{
return
_numbersOnly; }
110
void
setNumbersOnly(
bool
val);
111
112
void
setPlacement(
Placement
);
113
114
virtual
LineSegment
* createLineSegment()
override
;
115
int
pitchShift()
const
;
116
117
virtual
void
write(
XmlWriter
& xml)
const override
;
118
virtual
void
read(
XmlReader
& de)
override
;
119
bool
readProperties(
XmlReader
& e);
120
121
virtual
QVariant getProperty(
Pid
propertyId
)
const override
;
122
virtual
bool
setProperty(
Pid
propertyId,
const
QVariant&)
override
;
123
virtual
QVariant propertyDefault(
Pid
)
const override
;
124
virtual
Pid
propertyId
(
const
QStringRef& xmlName)
const override
;
125
126
virtual
QString accessibleInfo()
const override
;
127
static
const
char
* ottavaTypeName(
OttavaType
type);
128
};
129
130
}
// namespace Ms
131
132
#endif
133
Ms::OttavaE::end
unsigned end
Definition:
ottava.h:28
Ms::Pid
Pid
Definition:
property.h:62
Ms::OttavaDefault::type
OttavaType type
Definition:
ottava.h:49
Ms::XmlReader
Definition:
xml.h:67
Ms::OttavaDefault
Definition:
ottava.h:48
Ms::Ottava::ottavaType
OttavaType ottavaType() const
Definition:
ottava.h:107
Ms::Spanner
Virtual base class for slurs, ties, lines etc.
Definition:
spanner.h:136
Ms::OttavaDefault::name
const char * name
Definition:
ottava.h:51
Ms::OttavaDefault::shift
int shift
Definition:
ottava.h:50
Ms::OttavaType
OttavaType
Definition:
ottava.h:35
Ms::OttavaSegment::clone
virtual OttavaSegment * clone() const override
Definition:
ottava.h:78
Ms::Ottava::clone
virtual Ottava * clone() const override
Definition:
ottava.h:103
Ms::Element
Base class of score layout elements.
Definition:
element.h:158
Ms::Ottava::numbersOnly
bool numbersOnly() const
Definition:
ottava.h:109
Ms::OttavaE
Definition:
ottava.h:25
Ms::LineSegment
Virtual base class for segmented lines segments (OttavaSegment, HairpinSegment, TrillSegment...)
Definition:
line.h:34
property.h
Ms::Ottava
Definition:
ottava.h:89
Ms::OttavaE::start
unsigned start
Definition:
ottava.h:27
Ms::Score
Definition:
score.h:391
Ms::OttavaSegment
Definition:
ottava.h:71
Ms::PropertyFlags
PropertyFlags
Definition:
property.h:54
Ms::SelectionFilterType::OTTAVA
Ms::Placement
Placement
Definition:
types.h:312
Ms::Ottava::_ottavaType
OttavaType _ottavaType
Definition:
ottava.h:90
Ms::OttavaType::OTTAVA_8VA
Ms::OttavaType::OTTAVA_8VB
Ms::TextLineBaseSegment
Definition:
textlinebase.h:31
Ms::OttavaType::OTTAVA_15MB
Ms::ElementFlag
ElementFlag
Definition:
element.h:66
Ms
Definition:
aeolus.cpp:26
Ms::ElementFlag::ON_STAFF
Ms::Sid
Sid
Definition:
style.h:33
Ms::OttavaSegment::type
virtual ElementType type() const override
Definition:
ottava.h:77
Ms::XmlWriter
Definition:
xml.h:218
Ms::ElementType::OTTAVA_SEGMENT
Ms::ElementFlag::MOVABLE
Ms::OttavaType::OTTAVA_22MB
Ms::Ottava::type
virtual ElementType type() const override
Definition:
ottava.h:104
Ms::OttavaE::offset
int offset
Definition:
ottava.h:26
Ms::TextLineBase
Definition:
textlinebase.h:70
Ms::OttavaType::OTTAVA_15MA
Ms::OttavaSegment::ottava
Ottava * ottava() const
Definition:
ottava.h:79
Ms::Ottava::_numbersOnly
bool _numbersOnly
Definition:
ottava.h:91
Ms::ElementType
ElementType
Definition:
types.h:34
Ms::OttavaType::OTTAVA_22MA
textlinebase.h
Ms::OttavaSegment::OttavaSegment
OttavaSegment(Spanner *sp, Score *s)
Definition:
ottava.h:76
Ms::propertyId
Pid propertyId(const QStringRef &s)
Definition:
property.cpp:347
Generated by
1.8.13