Canorus  0.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 "core/muselement.h"
14 #include "core/staff.h"
15 
16 class CAContext;
17 
18 class CAClef : public CAMusElement {
19 public:
34  };
35 
36  enum CAClefType {
37  F,
38  G,
39  C,
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_ */
static const int offsetFromReadable(const int offsetInterval)
Definition: clef.cpp:190
Definition: clef.h:33
Definition: clef.h:22
Definition: clef.h:30
void setClefType(CAClefType type)
Definition: clef.cpp:99
Definition: clef.h:23
Definition: clef.h:40
const int centerPitch()
Definition: clef.h:53
int _centerPitch
Definition: clef.h:70
Definition: clef.h:18
int compare(CAMusElement *elt)
Definition: clef.cpp:122
Definition: clef.h:28
Definition: clef.h:42
static const QString clefTypeToString(CAClefType)
Definition: clef.cpp:139
const int c1()
Definition: clef.h:52
CAClef * clone(CAContext *context=0)
Definition: clef.cpp:111
CAClef(CAPredefinedClefType type, CAStaff *staff, int time, int offsetInterval=0)
Definition: clef.cpp:28
Definition: clef.h:24
Definition: clef.h:37
CAPredefinedClefType
Definition: clef.h:20
CAStaff * staff()
Definition: clef.h:48
Definition: clef.h:41
static const int offsetToReadable(const int offset)
Definition: clef.cpp:177
Definition: clef.h:29
Definition: clef.h:25
Definition: clef.h:39
CAClefType
Definition: clef.h:36
An abstract class which represents every music element in the score.
Definition: muselement.h:20
Definition: clef.h:38
CAClefType _clefType
Definition: clef.h:68
Definition: clef.h:31
Definition: clef.h:27
void setPredefinedType(CAPredefinedClefType type)
Definition: clef.cpp:49
Represents a staff in the sheet.
Definition: staff.h:24
static CAClefType clefTypeFromString(const QString)
Definition: clef.cpp:156
int _c1
Definition: clef.h:69
CAContext * context()
Definition: muselement.h:45
Definition: clef.h:21
void setOffset(int offset)
Definition: clef.h:58
Definition: clef.h:32
int offset()
Definition: clef.h:59
int _offset
Definition: clef.h:71
Line of music elements in the sheet.
Definition: context.h:16
Definition: clef.h:26
CAClefType clefType()
Definition: clef.h:51