00001 00008 #include "core/fermata.h" 00009 #include "core/playable.h" 00010 #include "core/barline.h" 00011 00020 CAFermata::CAFermata( CAPlayable *p, CAFermataType t ) 00021 : CAMark( CAMark::Fermata, p ) { 00022 setFermataType( t ); 00023 } 00024 00025 CAFermata::CAFermata( CABarline *b, CAFermataType t ) 00026 : CAMark( CAMark::Fermata, b ) { 00027 setFermataType( t ); 00028 } 00029 00030 CAFermata::~CAFermata() { 00031 } 00032 00033 CAMusElement *CAFermata::clone() { 00034 if (associatedElement()->isPlayable()) { 00035 return new CAFermata( static_cast<CAPlayable*>(associatedElement()), fermataType() ); 00036 } else { 00037 return new CAFermata( static_cast<CABarline*>(associatedElement()), fermataType() ); 00038 } 00039 } 00040 00041 int CAFermata::compare( CAMusElement *elt ) { 00042 if (elt->musElementType()!=CAMusElement::Mark) 00043 return -2; 00044 else if (static_cast<CAMark*>(elt)->markType()!=CAMark::Fermata) 00045 return -1; 00046 else if (static_cast<CAFermata*>(elt)->fermataType()!=fermataType()) 00047 return 1; 00048 00049 return 0; 00050 } 00051 00052 const QString CAFermata::fermataTypeToString( CAFermataType t ) { 00053 switch (t) { 00054 case NormalFermata: 00055 return "NormalFermata"; 00056 case ShortFermata: 00057 return "ShortFermata"; 00058 case LongFermata: 00059 return "LongFermata"; 00060 case VeryLongFermata: 00061 return "VeryLongFermata"; 00062 } 00063 } 00064 00065 CAFermata::CAFermataType CAFermata::fermataTypeFromString( const QString r ) { 00066 if (r=="NormalFermata") { 00067 return NormalFermata; 00068 } else 00069 if (r=="ShortFermata") { 00070 return ShortFermata; 00071 } else 00072 if (r=="LongFermata") { 00073 return LongFermata; 00074 } else 00075 if (r=="VeryLongFermata") { 00076 return VeryLongFermata; 00077 } 00078 }
1.5.3