|
Canorus
0.7
|
00001 00008 #ifndef DRAWABLESTAFF_H_ 00009 #define DRAWABLESTAFF_H_ 00010 00011 #include "drawable/drawablecontext.h" 00012 #include "core/staff.h" 00013 00014 class CANote; 00015 class CAClef; 00016 class CAKeySignature; 00017 class CATimeSignature; 00018 class CADrawableClef; 00019 class CADrawableKeySignature; 00020 class CADrawableTimeSignature; 00021 00022 class CADrawableStaff : public CADrawableContext { 00023 public: 00024 CADrawableStaff(CAStaff* staff, double x, double y); 00025 void draw(QPainter *, const CADrawSettings s); 00026 CADrawableStaff *clone(); 00027 inline CAStaff *staff() { return static_cast<CAStaff*>(_context); } 00028 00029 inline double lineSpace() { return (staff()->numberOfLines()?height()/(staff()->numberOfLines()-1):0); } 00030 00031 double calculateCenterYCoord(int pitch, CAClef *clef); 00032 double calculateCenterYCoord(CANote *note, CAClef *clef); 00033 double calculateCenterYCoord(CANote *note, double x); 00034 double calculateCenterYCoord(int pitch, double x); 00035 double calculateCenterYCoord(double y); 00036 00037 int calculatePitch(double x, double y); 00038 00039 void addClef(CADrawableClef *clef); 00040 void addKeySignature(CADrawableKeySignature *keySig); 00041 void addTimeSignature(CADrawableTimeSignature *keySig); 00042 00043 bool removeClef(CADrawableClef *clef); 00044 bool removeKeySignature(CADrawableKeySignature *keySig); 00045 bool removeTimeSignature(CADrawableTimeSignature *keySig); 00046 00047 CAClef *getClef(double x); 00048 CAKeySignature *getKeySignature(double x); 00049 CATimeSignature *getTimeSignature(double x); 00050 00051 int getAccs(double x, int pitch); 00052 void addMElement(CADrawableMusElement *elt); 00053 int removeMElement(CADrawableMusElement* elt); 00054 00055 private: 00056 QList<CADrawableClef *> _drawableClefList; // List of all the drawable clefs. Used for fast look-up with the given key - X-coordinate usually. 00057 QList<CADrawableKeySignature *> _drawableKeySignatureList; // List of all the drawable key signatures. Used for fast look-up with the given key - X-coordinate usually. 00058 QList<CADrawableTimeSignature *> _drawableTimeSignatureList; // List of all the drawable time signatures. Used for fast look-up with the given key - X-coordinate usually. 00059 static const double STAFFLINE_WIDTH; // Width of the staffs' lines. Defined in drawablestaff.cpp 00060 }; 00061 00062 #endif /* DRAWABLESTAFF_H_ */
1.8.0