23
#ifndef BEZIERCURVECONTROL2_H
24
#define BEZIERCURVECONTROL2_H
26
#include "PaintLayer.h"
41
Knot2() : m_X(0), m_Y(0), m_IsSelected(false) {} //Constructors
42
Knot2(float ptX, float ptY) :
43
m_X(ptX), m_Y(ptY), m_IsSelected(false) {}
45
void setPoint(float x, float y) {m_X = x; m_Y = y;} //Setting
48
//Operator overloading
49
void operator = (Knot2 knot) {m_X = knot.m_X; m_Y = knot.m_Y;}
50
bool operator != (Knot2 knot)
53
b = ((m_X != knot.m_X) || (m_Y != knot.m_Y)) ? true : false;
59
typedef float (*FunctionCallback)(float);
61
class BezierCurveControl2 : public ActiveInterfaceObject
64
BezierCurveControl2();
65
~BezierCurveControl2();
66
virtual long ProcessEvent(IEvent &ievent, long TraverseInfo, long ProcessEventInfo);
67
virtual void Draw(GraphicsContext& GfxContext, bool force_draw);
68
virtual void DrawContent(GraphicsContext& GfxContext, bool force_draw);
69
virtual void PostDraw(GraphicsContext& GfxContext, bool force_draw);
71
void EnablePanning(bool b) { m_bPanningEnabled = b; }
72
bool IsPanningEnabled() const { return m_bPanningEnabled; }
73
void EnableZooming(bool b) { m_bZoomingEnabled = b; }
74
bool IsZoomingEnable() const { return m_bZoomingEnabled; }
76
void RecvMouseUp(int x, int y, unsigned long button_flags, unsigned long key_flags);
77
void RecvMouseDown(int x, int y, unsigned long button_flags, unsigned long key_flags);
78
void RecvMouseDrag(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);
82
GraphicsContext& GfxContext , /*Graphics Context for text operation*/
83
unsigned long eventType , /*event type*/
84
unsigned long keysym , /*event keysym*/
85
unsigned long state , /*event state*/
86
const char* character , /*character*/
87
bool isRepeated , /*true if the key is repeated more than once*/
88
unsigned short keyCount /*key repeat count*/
92
void DrawRuler(GraphicsContext& GfxContext);
93
void DrawGrid(GraphicsContext& GfxContext);
94
void DrawCoordinateSystem(GraphicsContext& GfxContext);
96
void SetXAxisBounds(float minX, float maxX);
97
void SetYAxisBounds(float minY, float maxY);
98
void SetFunctionCallback(FunctionCallback f);
99
float EvalFunction(float x);
102
void ManipulateBezier(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);
103
void ProcessPanning(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);
104
void ProcessZooming(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);
106
std::vector<Knot2> m_control_knot;
108
float m_minX, m_minY, m_maxX, m_maxY;
109
FunctionCallback m_FunctionCallback;
111
AbstractPaintLayer* m_Background;
113
bool m_bControlPointSelected;
114
bool m_bPanningEnabled;
115
bool m_bZoomingEnabled;
126
#endif // BEZIERCURVECONTROL2_H
23
#ifndef BEZIERCURVECONTROL2_H
24
#define BEZIERCURVECONTROL2_H
26
#include "PaintLayer.h"
41
Knot2() : m_X(0), m_Y(0), m_IsSelected(false) {} //Constructors
42
Knot2(float ptX, float ptY) :
43
m_X(ptX), m_Y(ptY), m_IsSelected(false) {}
45
void setPoint(float x, float y) {m_X = x; m_Y = y;} //Setting
48
//Operator overloading
49
void operator = (Knot2 knot) {m_X = knot.m_X; m_Y = knot.m_Y;}
50
bool operator != (Knot2 knot)
53
b = ((m_X != knot.m_X) || (m_Y != knot.m_Y)) ? true : false;
59
typedef float (*FunctionCallback)(float);
61
class BezierCurveControl2 : public ActiveInterfaceObject
64
BezierCurveControl2();
65
~BezierCurveControl2();
66
virtual long ProcessEvent(IEvent &ievent, long TraverseInfo, long ProcessEventInfo);
67
virtual void Draw(GraphicsContext& GfxContext, bool force_draw);
68
virtual void DrawContent(GraphicsContext& GfxContext, bool force_draw);
69
virtual void PostDraw(GraphicsContext& GfxContext, bool force_draw);
71
void EnablePanning(bool b) { m_bPanningEnabled = b; }
72
bool IsPanningEnabled() const { return m_bPanningEnabled; }
73
void EnableZooming(bool b) { m_bZoomingEnabled = b; }
74
bool IsZoomingEnable() const { return m_bZoomingEnabled; }
76
void RecvMouseUp(int x, int y, unsigned long button_flags, unsigned long key_flags);
77
void RecvMouseDown(int x, int y, unsigned long button_flags, unsigned long key_flags);
78
void RecvMouseDrag(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);
82
GraphicsContext& GfxContext , /*Graphics Context for text operation*/
83
unsigned long eventType , /*event type*/
84
unsigned long keysym , /*event keysym*/
85
unsigned long state , /*event state*/
86
const char* character , /*character*/
87
bool isRepeated , /*true if the key is repeated more than once*/
88
unsigned short keyCount /*key repeat count*/
92
void DrawRuler(GraphicsContext& GfxContext);
93
void DrawGrid(GraphicsContext& GfxContext);
94
void DrawCoordinateSystem(GraphicsContext& GfxContext);
96
void SetXAxisBounds(float minX, float maxX);
97
void SetYAxisBounds(float minY, float maxY);
98
void SetFunctionCallback(FunctionCallback f);
99
float EvalFunction(float x);
102
void ManipulateBezier(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);
103
void ProcessPanning(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);
104
void ProcessZooming(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);
106
std::vector<Knot2> m_control_knot;
108
float m_minX, m_minY, m_maxX, m_maxY;
109
FunctionCallback m_FunctionCallback;
111
AbstractPaintLayer* m_Background;
113
bool m_bControlPointSelected;
114
bool m_bPanningEnabled;
115
bool m_bZoomingEnabled;
126
#endif // BEZIERCURVECONTROL2_H