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_ */
static const double STAFFLINE_WIDTH
Definition: drawablestaff.h:59
CATimeSignature * getTimeSignature(double x)
Definition: drawablestaff.cpp:233
int removeMElement(CADrawableMusElement *elt)
Definition: drawablestaff.cpp:256
void addKeySignature(CADrawableKeySignature *keySig)
Definition: drawablestaff.cpp:189
Definition: drawablecontext.h:18
Definition: drawabletimesignature.h:17
QList< CADrawableKeySignature * > _drawableKeySignatureList
Definition: drawablestaff.h:57
Definition: clef.h:18
Represents a key signature sign in the staff.
Definition: keysignature.h:19
void draw(QPainter *, const CADrawSettings s)
Definition: drawablestaff.cpp:28
double calculateCenterYCoord(int pitch, CAClef *clef)
Definition: drawablestaff.cpp:54
Represents a time signature in the staff.
Definition: timesignature.h:18
Definition: drawable.h:16
bool removeKeySignature(CADrawableKeySignature *keySig)
Definition: drawablestaff.cpp:199
Represents a note in the score.
Definition: note.h:18
Definition: drawablestaff.h:22
CADrawableStaff * clone()
Definition: drawablestaff.cpp:41
QList< CADrawableTimeSignature * > _drawableTimeSignatureList
Definition: drawablestaff.h:58
CAKeySignature * getKeySignature(double x)
Definition: drawablestaff.cpp:206
void addClef(CADrawableClef *clef)
Definition: drawablestaff.cpp:132
Definition: drawablemuselement.h:16
void addMElement(CADrawableMusElement *elt)
Definition: drawablestaff.cpp:240
Drawable instance of CAClef This class draws the clef to the canvas.
Definition: drawableclef.h:16
bool removeTimeSignature(CADrawableTimeSignature *keySig)
Definition: drawablestaff.cpp:226
int getAccs(double x, int pitch)
Definition: drawablestaff.cpp:161
CADrawableStaff(CAStaff *staff, double x, double y)
Definition: drawablestaff.cpp:22
bool removeClef(CADrawableClef *clef)
Definition: drawablestaff.cpp:142
Represents a staff in the sheet.
Definition: staff.h:24
Definition: drawablekeysignature.h:20
double height()
Definition: drawable.h:58
CAClef * getClef(double x)
Definition: drawablestaff.cpp:149
double lineSpace()
Definition: drawablestaff.h:29
int calculatePitch(double x, double y)
Definition: drawablestaff.cpp:121
void addTimeSignature(CADrawableTimeSignature *keySig)
Definition: drawablestaff.cpp:216
CAStaff * staff()
Definition: drawablestaff.h:27
CAContext * _context
Definition: drawablecontext.h:52
QList< CADrawableClef * > _drawableClefList
Definition: drawablestaff.h:56