|
Canorus
0.7
|
00001 00008 #ifndef DRAWABLEFUNCTIONMARK_H_ 00009 #define DRAWABLEFUNCTIONMARK_H_ 00010 00011 #include "drawable/drawablemuselement.h" 00012 #include "core/functionmark.h" 00013 00014 class CAFunctionMark; 00015 class CADrawableFunctionMarkContext; 00016 00017 class CADrawableFunctionMark : public CADrawableMusElement { 00018 public: 00019 CADrawableFunctionMark(CAFunctionMark *function, CADrawableFunctionMarkContext *context, double x, double y); 00020 ~CADrawableFunctionMark(); 00021 00022 void draw(QPainter *p, const CADrawSettings s); 00023 CADrawableFunctionMark *clone(CADrawableContext* newContext = 0); 00024 00025 inline CAFunctionMark *functionMark() { return (CAFunctionMark*)_musElement; }; 00026 inline CADrawableFunctionMarkContext *drawableFunctionMarkContext() { return (CADrawableFunctionMarkContext*)_drawableContext; }; 00027 00028 bool isExtenderLineVisible() { return _extenderLineVisible; } 00029 void setExtenderLineVisible(bool visible) { _extenderLineVisible = visible; } 00030 bool isExtenderLineOnly() { return _extenderLineOnly; } 00031 void setExtenderLineOnly( bool line ) { _extenderLineOnly = line; } 00032 00033 private: 00034 bool _extenderLineVisible; // Should the function draw a horizontal line until the end of the function 00035 QString _text; // Function transformed to String which is rendered then 00036 bool _extenderLineOnly; // Only extender line should be rendered over the whole width of the function 00037 }; 00038 00039 class CADrawableFunctionMarkSupport : public CADrawableMusElement { 00040 public: 00041 enum CADrawableFunctionMarkSupportType { 00042 Key, 00043 Rectangle, 00044 ChordArea, 00045 Tonicization, 00046 Ellipse, 00047 Alterations 00048 }; 00049 // Key constructor 00050 CADrawableFunctionMarkSupport(CADrawableFunctionMarkSupportType, const QString key, CADrawableContext *c, double x, double y); 00051 // Rectangle, ChordArea, Tonicization, Ellipse constructor 00052 CADrawableFunctionMarkSupport(CADrawableFunctionMarkSupportType, CADrawableFunctionMark *function, CADrawableContext *c, double x, double y, CADrawableFunctionMark *function2=0); 00053 // Alterations consructor 00054 CADrawableFunctionMarkSupport(CADrawableFunctionMarkSupportType, CAFunctionMark *function, CADrawableContext *c, double x, double y); 00055 00056 ~CADrawableFunctionMarkSupport(); 00057 00058 void draw(QPainter *p, const CADrawSettings s); 00059 CADrawableFunctionMarkSupport *clone(CADrawableContext* newContext = 0); 00060 CADrawableFunctionMarkSupportType drawableFunctionMarkSupportType() { return _drawableFunctionMarkSupportType; } 00061 00062 bool isExtenderLineVisible() { return _extenderLineVisible; } 00063 void setExtenderLineVisible(bool visible) { _extenderLineVisible = visible; } 00064 bool rectWider() { return _rectWider; } 00065 void setRectWider(bool wider) { if (!_rectWider) { _rectWider = wider; _yPos -= 3; _height += 6; } } 00066 00067 private: 00068 CADrawableFunctionMarkSupportType _drawableFunctionMarkSupportType; 00069 QString _key; 00070 CADrawableFunctionMark *_function1, *_function2; // Tonicization's start/end functions 00071 bool _extenderLineVisible; // Extender line when tonicization used after 00072 bool _rectWider; // Is rectangle wider in height. Default: false. Useful when doing a series of modulations where you don't know which rectangle belongs to which function. Every 2nd rectangle is then a bit higher than the others. 00073 }; 00074 00075 #endif /* DRAWABLEFUNCTIONMARK_H_ */
1.8.0