Canorus  0.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
/home/iurt/rpm/BUILD/canorus-0.7.R1002/src/core/lyricscontext.h
Go to the documentation of this file.
00001 
00008 #ifndef LYRICSCONTEXT_H_
00009 #define LYRICSCONTEXT_H_
00010 
00011 #include "core/context.h"
00012 #include "core/voice.h"
00013 
00014 #include <QList>
00015 #include <QHash>
00016 
00017 class CASyllable;
00018 
00019 class CALyricsContext : public CAContext {
00020 public:
00021         CALyricsContext( const QString name, int stanzaNumber, CAVoice *v );
00022         CALyricsContext( const QString name, int stanzaNumber, CASheet *s );
00023         ~CALyricsContext();
00024         void clear();
00025         CALyricsContext *clone( CASheet *s );
00026         void cloneLyricsContextProperties( CALyricsContext* );
00027         
00028         void repositSyllables();
00029         
00030         CAMusElement* next(CAMusElement*);
00031         CAMusElement* previous(CAMusElement*);
00032         QList<CAMusElement*> musElementList();
00033         bool remove( CAMusElement* );
00034         void removeAt( int i );
00035                 
00036         bool addSyllable( CASyllable*, bool replace=true );
00037         bool addEmptySyllable( int timeStart, int timeLength );
00038         CASyllable* removeSyllableAtTimeStart( int timeStart );
00039         CASyllable* syllableAt( int idx ) { return _syllableList[idx]; }
00040         CASyllable* syllableAtTimeStart( int timeStart );
00041         inline QList<CASyllable*> syllableList() { return _syllableList; }
00042         inline int syllableCount() { return _syllableList.size(); }
00043         
00044         inline CAVoice *associatedVoice() { return _associatedVoice; }
00045         inline void setAssociatedVoice( CAVoice *v ) {
00046                 if (_associatedVoice)
00047                         _associatedVoice->removeLyricsContext(this);
00048                 if (v)
00049                         v->addLyricsContext(this);
00050                 _associatedVoice = v;
00051                 repositSyllables();
00052         }
00053         inline int stanzaNumber() { return _stanzaNumber; }
00054         inline void setStanzaNumber( int sn ) { _stanzaNumber = sn; }
00055         inline QString customStanzaName() { return _customStanzaName; }
00056         inline void setCustomStanzaName( QString name ) { _customStanzaName = name; }
00057 
00058 private:
00059         QList< CASyllable* > _syllableList;
00060         CAVoice *_associatedVoice;
00061         int _stanzaNumber;
00062         QString _customStanzaName;
00063 };
00064 
00065 #endif /* LYRICSCONTEXT_H_ */