|
Canorus
0.7
|
00001 00008 #ifndef MUSELEMENT_H_ 00009 #define MUSELEMENT_H_ 00010 00011 #include <QString> 00012 #include <QList> 00013 #include <QColor> 00014 00015 class CAContext; 00016 class CAMusElement; 00017 class CAPlayable; 00018 class CAMark; 00019 00020 class CAMusElement { 00021 public: 00022 enum CAMusElementType { 00023 Undefined = 0, 00024 Note, 00025 Rest, 00026 Barline, 00027 Clef, 00028 TimeSignature, 00029 KeySignature, 00030 Slur, 00031 Tuplet, 00032 Syllable, 00033 FunctionMark, 00034 Mark 00035 }; 00036 00037 CAMusElement(CAContext *context, int timeStart, int timeLength=0); 00038 virtual ~CAMusElement(); 00039 00040 virtual CAMusElement* clone(CAContext* context=0) = 0; 00041 virtual int compare(CAMusElement *elt) = 0; 00042 00043 CAMusElementType musElementType() { return _musElementType; } 00044 00045 inline CAContext *context() { return _context; } 00046 inline CAContext *setContext(CAContext *context) { _context = context; } 00047 00048 inline virtual int timeStart() { return _timeStart; } 00049 inline void setTimeStart(int time) { _timeStart = time; } 00050 inline virtual int timeLength() { return _timeLength; } 00051 inline void setTimeLength(int length) { _timeLength = length; } 00052 inline int timeEnd() { return timeStart() + timeLength(); } 00053 00054 inline const QString name() { return _name; } 00055 inline void setName(const QString name) { _name = name; } 00056 00057 inline const bool isVisible() { return _visible; } 00058 inline void setVisible( const bool v ) { _visible = v; } 00059 00060 inline const QColor color() { return _color; } 00061 inline void setColor( const QColor c ) { _color = c; } 00062 00063 inline const QList<CAMark*> markList() { return _markList; } 00064 void addMark( CAMark *mark ); 00065 void addMarks( QList<CAMark*> marks ); 00066 inline void removeMark( CAMark* mark ) { _markList.removeAll(mark); } 00067 00068 bool isPlayable(); 00069 00070 static const QString musElementTypeToString(CAMusElementType); 00071 static CAMusElementType musElementTypeFromString(const QString); 00072 00073 protected: 00074 inline void setMusElementType( CAMusElementType type ) { _musElementType = type; } 00075 00076 QList< CAMark* > _markList; 00077 CAMusElementType _musElementType; 00078 CAContext *_context; 00079 int _timeStart; 00080 int _timeLength; 00081 bool _visible; 00082 QColor _color; 00083 QString _name; 00084 }; 00085 #endif /* MUSELEMENT_H_ */
1.8.0