Canorus 0.0
clef.h
Go to the documentation of this file.
1
8#ifndef CLEF_H_
9#define CLEF_H_
10
11#include <QString>
12
13#include "score/muselement.h"
14#include "score/staff.h"
15
16class CAContext;
17
18class CAClef : public CAMusElement {
19public:
34 };
35
42 Tab
43 };
44
45 CAClef( CAPredefinedClefType type, CAStaff *staff, int time, int offsetInterval=0 );
46 CAClef( CAClefType type, int c1, CAStaff *staff, int time, int offset=0 );
48 CAStaff *staff() { return static_cast<CAStaff*>(context()); }
49
52 const int c1() { return _c1; }
53 const int centerPitch() { return _centerPitch; }
54 int compare(CAMusElement *elt);
55
56 void setClefType(CAClefType type);
57
58 inline void setOffset( int offset ) { _c1+=_offset; _c1-=(_offset=offset); }
59 inline int offset() { return _offset; }
60
61 static const QString clefTypeToString(CAClefType);
62 static CAClefType clefTypeFromString(const QString);
63
64 static const int offsetFromReadable( const int offsetInterval );
65 static const int offsetToReadable( const int offset );
66
67private:
69 int _c1; // Location of middle C in the staff from the bottom line up
70 int _centerPitch; // Location of the clefs physical center (where the clef's glyph is going to be rendered)
72};
73#endif /* CLEF_H_ */
Definition: clef.h:18
CAClefType _clefType
Definition: clef.h:68
void setPredefinedType(CAPredefinedClefType type)
Definition: clef.cpp:49
static const int offsetFromReadable(const int offsetInterval)
Definition: clef.cpp:198
void setOffset(int offset)
Definition: clef.h:58
static const int offsetToReadable(const int offset)
Definition: clef.cpp:185
CAClef * clone(CAContext *context=0)
Definition: clef.cpp:119
void setClefType(CAClefType type)
Definition: clef.cpp:103
const int c1()
Definition: clef.h:52
CAPredefinedClefType
Definition: clef.h:20
@ Baritone
Definition: clef.h:29
@ Bass
Definition: clef.h:23
@ Percussion
Definition: clef.h:32
@ Alto
Definition: clef.h:27
@ Undefined
Definition: clef.h:21
@ French
Definition: clef.h:24
@ Tablature
Definition: clef.h:33
@ Soprano
Definition: clef.h:25
@ Mezzosoprano
Definition: clef.h:26
@ Tenor
Definition: clef.h:28
@ Subbass
Definition: clef.h:31
@ Treble
Definition: clef.h:22
@ Varbaritone
Definition: clef.h:30
int _c1
Definition: clef.h:69
int _offset
Definition: clef.h:71
int _centerPitch
Definition: clef.h:70
static CAClefType clefTypeFromString(const QString)
Definition: clef.cpp:164
const int centerPitch()
Definition: clef.h:53
CAClefType
Definition: clef.h:36
@ Tab
Definition: clef.h:42
@ C
Definition: clef.h:39
@ PercussionHigh
Definition: clef.h:40
@ G
Definition: clef.h:38
@ F
Definition: clef.h:37
@ PercussionLow
Definition: clef.h:41
int compare(CAMusElement *elt)
Definition: clef.cpp:130
CAStaff * staff()
Definition: clef.h:48
CAClef(CAPredefinedClefType type, CAStaff *staff, int time, int offsetInterval=0)
Definition: clef.cpp:28
int offset()
Definition: clef.h:59
CAClefType clefType()
Definition: clef.h:51
static const QString clefTypeToString(CAClefType)
Definition: clef.cpp:147
Line of music elements in the sheet.
Definition: context.h:16
An abstract class which represents every music element in the score.
Definition: muselement.h:21
CAContext * context()
Definition: muselement.h:48
Represents a staff in the sheet.
Definition: staff.h:25