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 
15 class CAContext;
16 class CAMusElement;
17 class CAPlayable;
18 class CAMark;
19 class CANoteCheckerError;
20 
21 class CAMusElement {
22 public:
24  Undefined = 0,
37  Mark
38  };
39 
41  virtual ~CAMusElement();
42 
43  virtual CAMusElement* clone(CAContext* context=0) = 0;
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 
84 protected:
85  inline void setMusElementType( CAMusElementType type ) { _musElementType = type; }
86 
88  QList< CAMark* > _markList;
89  QList< CANoteCheckerError* > _noteCheckerErrorList;
93  bool _visible;
94  QColor _color;
95  QString _name;
96 };
97 #endif /* MUSELEMENT_H_ */
CAMusElement::_name
QString _name
Definition: muselement.h:95
CAMusElement::CAMusElementType
CAMusElementType
Definition: muselement.h:23
CAMusElement::context
CAContext * context()
Definition: muselement.h:48
CAMusElement::setMusElementType
void setMusElementType(CAMusElementType type)
Definition: muselement.h:85
CAMusElement::removeNoteCheckerError
void removeNoteCheckerError(CANoteCheckerError *nce)
Definition: muselement.h:77
CAMusElement::Mark
@ Mark
Definition: muselement.h:37
CAMusElement::MidiNote
@ MidiNote
Definition: muselement.h:27
CAMusElement::realTimeLength
virtual int realTimeLength()
Definition: muselement.h:58
CAArticulation
Note articulation marks.
Definition: articulation.h:14
CAMusElement::noteCheckerErrorList
const QList< CANoteCheckerError * > & noteCheckerErrorList()
Definition: muselement.h:75
CAMusElement::Tuplet
@ Tuplet
Definition: muselement.h:33
playable.h
CAMusElement::Clef
@ Clef
Definition: muselement.h:29
CAMusElement::_noteCheckerErrorList
QList< CANoteCheckerError * > _noteCheckerErrorList
Definition: muselement.h:89
CAMusElement::Barline
@ Barline
Definition: muselement.h:28
CAMusElement::_context
CAContext * _context
Definition: muselement.h:90
CAMusElement::realTimeEnd
int realTimeEnd()
Definition: muselement.h:59
CAMusElement::markList
const QList< CAMark * > markList()
Definition: muselement.h:70
CAPlayable
Playable instances of music elements.
Definition: playable.h:18
CAMusElement::setTimeLength
void setTimeLength(int length)
Definition: muselement.h:54
CAMusElement::_timeLength
int _timeLength
Definition: muselement.h:92
CAMusElement::setColor
void setColor(const QColor c)
Definition: muselement.h:68
notecheckererror.h
CAMusElement::removeMark
void removeMark(CAMark *mark)
Definition: muselement.h:73
CAMusElement::setContext
void setContext(CAContext *context)
Definition: muselement.h:49
CAMusElement::TimeSignature
@ TimeSignature
Definition: muselement.h:30
CAMark::markType
CAMarkType markType()
Definition: mark.h:45
CAMusElement::Undefined
@ Undefined
Definition: muselement.h:24
CAMusElement::timeLength
virtual int timeLength() const
Definition: muselement.h:53
CAMusElement::color
const QColor color()
Definition: muselement.h:67
CAMark::Articulation
@ Articulation
Definition: mark.h:30
CAMusElement::addMark
void addMark(CAMark *mark)
Definition: muselement.cpp:135
CAMusElement::Syllable
@ Syllable
Definition: muselement.h:34
CAMusElement::realTimeStart
virtual int realTimeStart()
Definition: muselement.h:57
CAMusElement::_color
QColor _color
Definition: muselement.h:94
CAMusElement::FunctionMark
@ FunctionMark
Definition: muselement.h:35
CAMusElement::KeySignature
@ KeySignature
Definition: muselement.h:31
CAMusElement::name
const QString name()
Definition: muselement.h:61
CAMusElement
An abstract class which represents every music element in the score.
Definition: muselement.h:21
CAMusElement::addMarks
void addMarks(QList< CAMark * > marks)
Definition: muselement.cpp:153
CAMusElement::~CAMusElement
virtual ~CAMusElement()
Definition: muselement.cpp:52
articulation.h
CAMusElement::_visible
bool _visible
Definition: muselement.h:93
CAMusElement::isVisible
const bool isVisible()
Definition: muselement.h:64
CAMusElement::setTimeStart
void setTimeStart(int time)
Definition: muselement.h:52
CAMusElement::Rest
@ Rest
Definition: muselement.h:26
CAContext::remove
virtual bool remove(CAMusElement *elt)=0
CAMusElement::isPlayable
bool isPlayable()
Definition: muselement.cpp:78
CAMusElement::timeEnd
int timeEnd()
Definition: muselement.h:55
CAMusElement::_markList
QList< CAMark * > _markList
Definition: muselement.h:88
CAMusElement::musElementTypeToString
static const QString musElementTypeToString(CAMusElementType)
Definition: muselement.cpp:88
CANoteCheckerError
Class representing the error produced by the note checker.
Definition: notecheckererror.h:13
CAMusElement::compare
virtual int compare(CAMusElement *elt)=0
CAMusElement::Note
@ Note
Definition: muselement.h:25
CAMusElement::addNoteCheckerError
void addNoteCheckerError(CANoteCheckerError *nce)
Definition: muselement.h:76
CAMusElement::FiguredBassMark
@ FiguredBassMark
Definition: muselement.h:36
context.h
CAMusElement::timeStart
virtual int timeStart() const
Definition: muselement.h:51
muselement.h
CAContext
Line of music elements in the sheet.
Definition: context.h:16
CAMusElement::_musElementType
CAMusElementType _musElementType
Definition: muselement.h:87
CAMark
Marks that depend on other music elements.
Definition: mark.h:15
CAMusElement::CAMusElement
CAMusElement(CAContext *context, int timeStart, int timeLength=0)
Definition: muselement.cpp:39
staff.h
CAMusElement::setVisible
void setVisible(const bool v)
Definition: muselement.h:65
CAMusElement::musElementType
CAMusElementType musElementType()
Definition: muselement.h:46
mark.h
CAMusElement::setName
void setName(const QString name)
Definition: muselement.h:62
CAMusElement::_timeStart
int _timeStart
Definition: muselement.h:91
CAMusElement::Slur
@ Slur
Definition: muselement.h:32
CAMusElement::musElementTypeFromString
static CAMusElementType musElementTypeFromString(const QString)
Definition: muselement.cpp:114
CAMusElement::clone
virtual CAMusElement * clone(CAContext *context=0)=0