Canorus  0.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
drawablestaff.h
Go to the documentation of this file.
1 
8 #ifndef DRAWABLESTAFF_H_
9 #define DRAWABLESTAFF_H_
10 
12 #include "core/staff.h"
13 
14 class CANote;
15 class CAClef;
16 class CAKeySignature;
17 class CATimeSignature;
18 class CADrawableClef;
21 
23 public:
24  CADrawableStaff(CAStaff* staff, double x, double y);
25  void draw(QPainter *, const CADrawSettings s);
27  inline CAStaff *staff() { return static_cast<CAStaff*>(_context); }
28 
29  inline double lineSpace() { return (staff()->numberOfLines()?height()/(staff()->numberOfLines()-1):0); }
30 
31  double calculateCenterYCoord(int pitch, CAClef *clef);
32  double calculateCenterYCoord(CANote *note, CAClef *clef);
33  double calculateCenterYCoord(CANote *note, double x);
34  double calculateCenterYCoord(int pitch, double x);
35  double calculateCenterYCoord(double y);
36 
37  int calculatePitch(double x, double y);
38 
39  void addClef(CADrawableClef *clef);
42 
43  bool removeClef(CADrawableClef *clef);
46 
47  CAClef *getClef(double x);
50 
51  int getAccs(double x, int pitch);
54 
55 private:
56  QList<CADrawableClef *> _drawableClefList; // List of all the drawable clefs. Used for fast look-up with the given key - X-coordinate usually.
57  QList<CADrawableKeySignature *> _drawableKeySignatureList; // List of all the drawable key signatures. Used for fast look-up with the given key - X-coordinate usually.
58  QList<CADrawableTimeSignature *> _drawableTimeSignatureList; // List of all the drawable time signatures. Used for fast look-up with the given key - X-coordinate usually.
59  static const double STAFFLINE_WIDTH; // Width of the staffs' lines. Defined in drawablestaff.cpp
60 };
61 
62 #endif /* DRAWABLESTAFF_H_ */