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_ */