/media/hdb5/canorusNightlyBuildSystem/trunk/src/core/mark.cpp

Go to the documentation of this file.
00001 
00008 #include "core/mark.h"
00009 #include "core/note.h"
00010 
00019 CAMark::CAMark( CAMarkType type, CAMusElement *associatedElt, int timeStart, int timeLength )
00020  : CAMusElement( associatedElt->context(),
00021                  (timeStart==-1)?associatedElt->timeStart():timeStart,
00022                  (timeLength==-1)?associatedElt->timeLength():timeLength ) {
00023         setMusElementType( Mark );      
00024         setMarkType( type );
00025         setAssociatedElement( associatedElt );
00026         setCommon( true );
00027 }
00028 
00029 CAMark::CAMark( CAMarkType type, CAContext *c, int timeStart, int timeLength )
00030  : CAMusElement( c,
00031                  timeStart,
00032                  timeLength ) {
00033         setMusElementType( Mark );      
00034         setMarkType( type );
00035         setAssociatedElement( 0 );
00036         setCommon( true );
00037 }
00038 
00044 const QString CAMark::markTypeToString( CAMark::CAMarkType t ) {
00045         switch (t) {
00046                 case Text:
00047                         return "Text";
00048                 case Tempo:
00049                         return "Tempo";
00050                 case Ritardando:
00051                         return "Ritardando";
00052                 case Dynamic:
00053                         return "Dynamic";
00054                 case Crescendo:
00055                         return "Crescendo";
00056                 case Pedal:
00057                         return "Pedal";
00058                 case InstrumentChange:
00059                         return "InstrumentChange";
00060                 case BookMark:
00061                         return "BookMark";
00062                 case RehersalMark:
00063                         return "RehersalMark";
00064                 case Fermata:
00065                         return "Fermata";
00066                 case RepeatMark:
00067                         return "RepeatMark";
00068                 case Articulation:
00069                         return "Articulation";
00070                 case Fingering:
00071                         return "Fingering";
00072                 default:
00073                         return "Undefined";
00074         }
00075 }
00076 
00082 CAMark::CAMarkType CAMark::markTypeFromString( const QString s ) {
00083         if ( s=="Text" ) {
00084                 return Text;
00085         } else
00086         if ( s=="Tempo" ) {
00087                 return Tempo;
00088         } else
00089         if ( s=="Ritardando" ) {
00090                 return Ritardando;
00091         } else
00092         if ( s=="Dynamic" ) {
00093                 return Dynamic;
00094         } else
00095         if ( s=="Crescendo" ) {
00096                 return Crescendo;
00097         } else
00098         if ( s=="Pedal" ) {
00099                 return Pedal;
00100         } else
00101         if ( s=="InstrumentChange" ) {
00102                 return InstrumentChange;
00103         } else
00104         if ( s=="BookMark" ) {
00105                 return BookMark;
00106         } else
00107         if ( s=="RehersalMark" ) {
00108                 return RehersalMark;
00109         } else
00110         if ( s=="Fermata" ) {
00111                 return Fermata;
00112         } else
00113         if ( s=="RepeatMark" ) {
00114                 return RepeatMark;
00115         } else
00116         if ( s=="Articulation" ) {
00117                 return Articulation;
00118         } else
00119         if ( s=="Fingering" ) {
00120                 return Fingering;
00121         } else {
00122                 return Undefined;
00123         }
00124 }
00125 
00126 CAMark::~CAMark() {
00127         if (associatedElement()) {
00128                 associatedElement()->removeMark(this);
00129         }
00130 }
00131 
00132 CAMusElement *CAMark::clone() {
00133         return new CAMark( markType(), associatedElement(), timeStart(), timeLength() );
00134 }
00135 
00136 int CAMark::compare( CAMusElement *elt ) {
00137         if (elt->musElementType()!=CAMusElement::Mark) {
00138                 return -1;
00139         } else
00140         if (static_cast<CAMark*>(elt)->markType()!=markType()) {
00141                 return -1;
00142         } else {
00143                 return 0;
00144         }
00145 }
00146 

Generated on Sat Feb 9 13:06:25 2008 for Canorus by  doxygen 1.5.3