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 
16 class CAContext;
17 
18 class CAClef : public CAMusElement {
19 public:
33  Tablature
34  };
35 
36  enum CAClefType {
37  F,
38  G,
39  C,
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 
67 private:
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)
71  int _offset;
72 };
73 #endif /* CLEF_H_ */
CAClef::PercussionHigh
@ PercussionHigh
Definition: clef.h:40
CAMusElement::context
CAContext * context()
Definition: muselement.h:48
CAClef::Treble
@ Treble
Definition: clef.h:22
CAClef
Definition: clef.h:18
CAMusElement::Clef
@ Clef
Definition: muselement.h:29
CAClef::offsetFromReadable
static const int offsetFromReadable(const int offsetInterval)
Definition: clef.cpp:198
CAClef::Alto
@ Alto
Definition: clef.h:27
CAClef::offsetToReadable
static const int offsetToReadable(const int offset)
Definition: clef.cpp:185
CAMusElement::markList
const QList< CAMark * > markList()
Definition: muselement.h:70
CAClef::Tenor
@ Tenor
Definition: clef.h:28
CAClef::F
@ F
Definition: clef.h:37
CAClef::_c1
int _c1
Definition: clef.h:69
CAClef::Tablature
@ Tablature
Definition: clef.h:33
CAClef::offset
int offset()
Definition: clef.h:59
CAClef::CAClefType
CAClefType
Definition: clef.h:36
CAClef::clefTypeToString
static const QString clefTypeToString(CAClefType)
Definition: clef.cpp:147
CAClef::Percussion
@ Percussion
Definition: clef.h:32
CAMusElement::addMark
void addMark(CAMark *mark)
Definition: muselement.cpp:135
CAClef::clefType
CAClefType clefType()
Definition: clef.h:51
CAClef::clefTypeFromString
static CAClefType clefTypeFromString(const QString)
Definition: clef.cpp:164
CAClef::Bass
@ Bass
Definition: clef.h:23
CAClef::Subbass
@ Subbass
Definition: clef.h:31
CAClef::C
@ C
Definition: clef.h:39
CAClef::setClefType
void setClefType(CAClefType type)
Definition: clef.cpp:103
CAClef::Baritone
@ Baritone
Definition: clef.h:29
CAClef::Soprano
@ Soprano
Definition: clef.h:25
CAStaff
Represents a staff in the sheet.
Definition: staff.h:25
CAMusElement
An abstract class which represents every music element in the score.
Definition: muselement.h:21
CAClef::centerPitch
const int centerPitch()
Definition: clef.h:53
CAClef::staff
CAStaff * staff()
Definition: clef.h:48
CAClef::_centerPitch
int _centerPitch
Definition: clef.h:70
CAClef::c1
const int c1()
Definition: clef.h:52
CAClef::Mezzosoprano
@ Mezzosoprano
Definition: clef.h:26
CAClef::setOffset
void setOffset(int offset)
Definition: clef.h:58
CAClef::French
@ French
Definition: clef.h:24
CAClef::G
@ G
Definition: clef.h:38
CAClef::compare
int compare(CAMusElement *elt)
Definition: clef.cpp:130
CAClef::PercussionLow
@ PercussionLow
Definition: clef.h:41
CAClef::clone
CAClef * clone(CAContext *context=0)
Definition: clef.cpp:119
CAClef::_offset
int _offset
Definition: clef.h:71
CAClef::_clefType
CAClefType _clefType
Definition: clef.h:68
muselement.h
CAContext
Line of music elements in the sheet.
Definition: context.h:16
CAMusElement::_musElementType
CAMusElementType _musElementType
Definition: muselement.h:87
CAMark
Marks that depend on other music elements.
Definition: mark.h:15
CAClef::setPredefinedType
void setPredefinedType(CAPredefinedClefType type)
Definition: clef.cpp:49
clef.h
CAClef::Tab
@ Tab
Definition: clef.h:42
CAClef::CAPredefinedClefType
CAPredefinedClefType
Definition: clef.h:20
CAClef::CAClef
CAClef(CAPredefinedClefType type, CAStaff *staff, int time, int offsetInterval=0)
Definition: clef.cpp:28
CAClef::Varbaritone
@ Varbaritone
Definition: clef.h:30
staff.h
CAMusElement::musElementType
CAMusElementType musElementType()
Definition: muselement.h:46
mark.h
CAClef::Undefined
@ Undefined
Definition: clef.h:21
CAMusElement::_timeStart
int _timeStart
Definition: muselement.h:91