Canorus 0.0
staff.h
Go to the documentation of this file.
1
8#ifndef STAFF_H_
9#define STAFF_H_
10
11#include <QList>
12#include <QString>
13
14class QPainter;
15
16#include "score/context.h"
17#include "score/muselement.h"
18
19class CASheet;
20class CAContext;
21class CAVoice;
22class CANote;
23class CATempo;
24
25class CAStaff : public CAContext {
26public:
27 CAStaff( const QString name, CASheet *s, int numberOfLines = 5);
28 ~CAStaff();
29
30 inline int numberOfLines() { return _numberOfLines; }
31 inline void setNumberOfLines(int val) { _numberOfLines = val; }
32 void clear();
33 CAStaff *clone( CASheet *s );
34
35 inline const QList<CAVoice*>& voiceList() { return _voiceList; }
36 inline void addVoice(CAVoice *voice) { _voiceList << voice; }
37 inline void insertVoice(int idx, CAVoice *voice) { _voiceList.insert(idx, voice); }
39 inline void removeVoice(CAVoice *voice) { _voiceList.removeAll(voice); }
40 CAVoice *findVoice(const QString name);
41
44 bool remove( CAMusElement *elt, bool updateSignTimes );
45 bool remove( CAMusElement *elt ) { return remove(elt, true); }
46
47 int lastTimeEnd();
48 QList<CAMusElement*> getEltByType( CAMusElement::CAMusElementType type, int startTime );
50
51 QList<CAPlayable*> getChord( int time );
52 CATempo *getTempo( int time );
53
54 bool synchronizeVoices();
55
56 static bool placeAutoBar( CAPlayable* elt );
57
58 // Functions to keep list of references of signature events for a faster look up.
59 inline QList<CAMusElement *>& clefRefs() { return _clefList; }
60 inline QList<CAMusElement *>& keySignatureRefs() { return _keySignatureList; }
61 inline QList<CAMusElement *>& timeSignatureRefs() { return _timeSignatureList; }
62 inline QList<CAMusElement *>& barlineRefs() { return _barlineList; }
63
64private:
65 QList<CAVoice *> _voiceList;
66
68
69 QList<CAMusElement *> _clefList;
70 QList<CAMusElement *> _keySignatureList;
71 QList<CAMusElement *> _timeSignatureList;
72 QList<CAMusElement *> _barlineList;
73};
74#endif /* STAFF_H_ */
Line of music elements in the sheet.
Definition: context.h:16
const QString name()
Definition: context.h:29
An abstract class which represents every music element in the score.
Definition: muselement.h:21
CAMusElementType
Definition: muselement.h:23
Represents a note in the score.
Definition: note.h:18
Playable instances of music elements.
Definition: playable.h:18
Represents a single sheet of paper in the document.
Definition: sheet.h:22
Represents a staff in the sheet.
Definition: staff.h:25
QList< CAMusElement * > & barlineRefs()
Definition: staff.h:62
const QList< CAVoice * > & voiceList()
Definition: staff.h:35
QList< CAMusElement * > & keySignatureRefs()
Definition: staff.h:60
CAStaff(const QString name, CASheet *s, int numberOfLines=5)
Definition: staff.cpp:41
CAMusElement * next(CAMusElement *elt)
Definition: staff.cpp:215
QList< CAMusElement * > _timeSignatureList
Definition: staff.h:71
QList< CAPlayable * > getChord(int time)
Definition: staff.cpp:307
bool synchronizeVoices()
Definition: staff.cpp:346
bool remove(CAMusElement *elt, bool updateSignTimes)
Definition: staff.cpp:247
CAStaff * clone(CASheet *s)
Definition: staff.cpp:51
QList< CAMusElement * > _clefList
Definition: staff.h:69
void addVoice(CAVoice *voice)
Definition: staff.h:36
int numberOfLines()
Definition: staff.h:30
QList< CAMusElement * > _keySignatureList
Definition: staff.h:70
int _numberOfLines
Definition: staff.h:67
QList< CAVoice * > _voiceList
Definition: staff.h:65
QList< CAMusElement * > & timeSignatureRefs()
Definition: staff.h:61
~CAStaff()
Definition: staff.cpp:47
CAVoice * findVoice(const QString name)
Definition: staff.cpp:257
CAMusElement * getOneEltByType(CAMusElement::CAMusElementType type, int startTime)
Definition: staff.cpp:289
void removeVoice(CAVoice *voice)
Definition: staff.h:39
QList< CAMusElement * > & clefRefs()
Definition: staff.h:59
CAMusElement * previous(CAMusElement *elt)
Definition: staff.cpp:230
void clear()
Definition: staff.cpp:193
CATempo * getTempo(int time)
Definition: staff.cpp:318
void insertVoice(int idx, CAVoice *voice)
Definition: staff.h:37
void setNumberOfLines(int val)
Definition: staff.h:31
QList< CAMusElement * > _barlineList
Definition: staff.h:72
static bool placeAutoBar(CAPlayable *elt)
Definition: staff.cpp:501
QList< CAMusElement * > getEltByType(CAMusElement::CAMusElementType type, int startTime)
Definition: staff.cpp:272
CAVoice * addVoice()
Definition: staff.cpp:203
bool remove(CAMusElement *elt)
Definition: staff.h:45
int lastTimeEnd()
Definition: staff.cpp:184
Tempo mark.
Definition: tempo.h:14
Class which represents a voice in the staff.
Definition: voice.h:23