Canorus 0.0
muselement.h
Go to the documentation of this file.
1
8#ifndef MUSELEMENT_H_
9#define MUSELEMENT_H_
10
11#include <QString>
12#include <QList>
13#include <QColor>
14
15class CAContext;
16class CAMusElement;
17class CAPlayable;
18class CAMark;
20
22public:
37 Mark
38 };
39
41 virtual ~CAMusElement();
42
44 virtual int compare(CAMusElement *elt) = 0;
45
47
48 inline CAContext *context() { return _context; }
50
51 inline virtual int timeStart() const { return _timeStart; }
52 inline void setTimeStart(int time) { _timeStart = time; }
53 inline virtual int timeLength() const { return _timeLength; }
54 inline void setTimeLength(int length) { _timeLength = length; }
55 inline int timeEnd() { return timeStart() + timeLength(); }
56
57 inline virtual int realTimeStart() { return _timeStart; } // TODO: calculates and returns time in miliseconds
58 inline virtual int realTimeLength() { return _timeLength; } // TODO: calculates and returns time in miliseconds
59 inline int realTimeEnd() { return realTimeStart() + realTimeLength(); } // TODO: calculates and returns time in miliseconds
60
61 inline const QString name() { return _name; }
62 inline void setName(const QString name) { _name = name; }
63
64 inline const bool isVisible() { return _visible; }
65 inline void setVisible( const bool v ) { _visible = v; }
66
67 inline const QColor color() { return _color; }
68 inline void setColor( const QColor c ) { _color = c; }
69
70 inline const QList<CAMark*> markList() { return _markList; }
71 void addMark( CAMark *mark );
72 void addMarks( QList<CAMark*> marks );
73 inline void removeMark( CAMark* mark ) { _markList.removeAll(mark); }
74
75 inline const QList<CANoteCheckerError*>& noteCheckerErrorList() { return _noteCheckerErrorList; };
77 inline void removeNoteCheckerError( CANoteCheckerError* nce ) { _noteCheckerErrorList.removeAll(nce); }
78
79 bool isPlayable();
80
81 static const QString musElementTypeToString(CAMusElementType);
82 static CAMusElementType musElementTypeFromString(const QString);
83
84protected:
85 inline void setMusElementType( CAMusElementType type ) { _musElementType = type; }
86
88 QList< CAMark* > _markList;
89 QList< CANoteCheckerError* > _noteCheckerErrorList;
94 QColor _color;
95 QString _name;
96};
97#endif /* MUSELEMENT_H_ */
Line of music elements in the sheet.
Definition: context.h:16
Marks that depend on other music elements.
Definition: mark.h:15
An abstract class which represents every music element in the score.
Definition: muselement.h:21
void setTimeStart(int time)
Definition: muselement.h:52
virtual int realTimeStart()
Definition: muselement.h:57
QString _name
Definition: muselement.h:95
const QList< CANoteCheckerError * > & noteCheckerErrorList()
Definition: muselement.h:75
virtual int timeStart() const
Definition: muselement.h:51
bool _visible
Definition: muselement.h:93
QColor _color
Definition: muselement.h:94
CAMusElementType _musElementType
Definition: muselement.h:87
QList< CAMark * > _markList
Definition: muselement.h:88
void removeMark(CAMark *mark)
Definition: muselement.h:73
void setTimeLength(int length)
Definition: muselement.h:54
const bool isVisible()
Definition: muselement.h:64
int realTimeEnd()
Definition: muselement.h:59
int _timeLength
Definition: muselement.h:92
const QList< CAMark * > markList()
Definition: muselement.h:70
CAContext * context()
Definition: muselement.h:48
CAMusElement(CAContext *context, int timeStart, int timeLength=0)
Definition: muselement.cpp:39
virtual ~CAMusElement()
Definition: muselement.cpp:52
const QString name()
Definition: muselement.h:61
bool isPlayable()
Definition: muselement.cpp:78
virtual CAMusElement * clone(CAContext *context=0)=0
void setName(const QString name)
Definition: muselement.h:62
int _timeStart
Definition: muselement.h:91
int timeEnd()
Definition: muselement.h:55
void addMarks(QList< CAMark * > marks)
Definition: muselement.cpp:153
CAContext * _context
Definition: muselement.h:90
void removeNoteCheckerError(CANoteCheckerError *nce)
Definition: muselement.h:77
void setVisible(const bool v)
Definition: muselement.h:65
static CAMusElementType musElementTypeFromString(const QString)
Definition: muselement.cpp:114
void setContext(CAContext *context)
Definition: muselement.h:49
void setMusElementType(CAMusElementType type)
Definition: muselement.h:85
virtual int timeLength() const
Definition: muselement.h:53
void setColor(const QColor c)
Definition: muselement.h:68
CAMusElementType
Definition: muselement.h:23
@ Undefined
Definition: muselement.h:24
@ MidiNote
Definition: muselement.h:27
@ Rest
Definition: muselement.h:26
@ Syllable
Definition: muselement.h:34
@ Mark
Definition: muselement.h:37
@ Tuplet
Definition: muselement.h:33
@ Slur
Definition: muselement.h:32
@ Note
Definition: muselement.h:25
@ KeySignature
Definition: muselement.h:31
@ Barline
Definition: muselement.h:28
@ FunctionMark
Definition: muselement.h:35
@ TimeSignature
Definition: muselement.h:30
@ Clef
Definition: muselement.h:29
@ FiguredBassMark
Definition: muselement.h:36
QList< CANoteCheckerError * > _noteCheckerErrorList
Definition: muselement.h:89
virtual int realTimeLength()
Definition: muselement.h:58
void addMark(CAMark *mark)
Definition: muselement.cpp:135
const QColor color()
Definition: muselement.h:67
CAMusElementType musElementType()
Definition: muselement.h:46
static const QString musElementTypeToString(CAMusElementType)
Definition: muselement.cpp:88
virtual int compare(CAMusElement *elt)=0
void addNoteCheckerError(CANoteCheckerError *nce)
Definition: muselement.h:76
Class representing the error produced by the note checker.
Definition: notecheckererror.h:13
Playable instances of music elements.
Definition: playable.h:18