Canorus  0.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
/home/iurt/rpm/BUILD/canorus-0.7.R1002/src/core/clef.h
Go to the documentation of this file.
00001 
00008 #ifndef CLEF_H_
00009 #define CLEF_H_
00010 
00011 #include <QString>
00012 
00013 #include "core/muselement.h"
00014 #include "core/staff.h"
00015 
00016 class CAContext;
00017 
00018 class CAClef : public CAMusElement {
00019 public:
00020         enum CAPredefinedClefType {
00021                 Undefined=-1,
00022                 Treble,
00023                 Bass,
00024                 French,
00025                 Soprano,
00026                 Mezzosoprano,
00027                 Alto,
00028                 Tenor,
00029                 Baritone,
00030                 Varbaritone,
00031                 Subbass,
00032                 Percussion,
00033                 Tablature
00034         };
00035 
00036         enum CAClefType {
00037                 F,
00038                 G,
00039                 C,
00040                 PercussionHigh,
00041                 PercussionLow,
00042                 Tab
00043         };
00044 
00045         CAClef( CAPredefinedClefType type, CAStaff *staff, int time, int offsetInterval=0 );
00046         CAClef( CAClefType type, int c1, CAStaff *staff, int time, int offset=0 );
00047         CAClef *clone(CAContext* context=0);
00048         CAStaff *staff() { return static_cast<CAStaff*>(context()); }
00049 
00050         void setPredefinedType( CAPredefinedClefType type );
00051         CAClefType clefType() { return _clefType; }
00052         const int c1() { return _c1; }
00053         const int centerPitch() { return _centerPitch; }
00054         int compare(CAMusElement *elt);
00055 
00056         void setClefType(CAClefType type);
00057 
00058         inline void setOffset( int offset ) { _c1+=_offset; _c1-=(_offset=offset); }
00059         inline int offset() { return _offset; }
00060 
00061         static const QString clefTypeToString(CAClefType);
00062         static CAClefType clefTypeFromString(const QString);
00063 
00064         static const int offsetFromReadable( const int offsetInterval );
00065         static const int offsetToReadable( const int offset );
00066 
00067 private:
00068         CAClefType _clefType;
00069         int _c1;          // Location of middle C in the staff from the bottom line up
00070         int _centerPitch; // Location of the clefs physical center (where the clef's glyph is going to be rendered)
00071         int _offset;
00072 };
00073 #endif /* CLEF_H_ */