1 class IXYPad
: public IControl
4 IXYPad(IPlugBase
*pPlug
, IRECT pR
, int handleRadius
, int paramA
, int paramB
)
6 , mHandleRadius(handleRadius
)
7 , mHandleColor(COLOR_WHITE
)
13 bool Draw(IGraphics
* pGraphics
)
15 double xpos
= GetAuxParam(0)->mValue
* mRECT
.W();
16 double ypos
= GetAuxParam(1)->mValue
* mRECT
.H();
18 pGraphics
->DrawLine(&mHandleColor
, xpos
+mRECT
.L
, mRECT
.T
, xpos
+mRECT
.L
, mRECT
.B
, 0, false);
19 pGraphics
->DrawLine(&mHandleColor
, mRECT
.L
, ypos
+mRECT
.T
, mRECT
.R
, ypos
+mRECT
.T
, 0, false);
20 pGraphics
->FillCircle(&mHandleColor
, xpos
+mRECT
.L
, ypos
+mRECT
.T
, mHandleRadius
, 0, true);
25 // void OnMouseOver(int x, int y, IMouseMod* pMod)
27 // return SnapToMouse(x, y);
30 void OnMouseDown(int x
, int y
, IMouseMod
* pMod
)
32 mHandleColor
= COLOR_BLACK
;
33 return SnapToMouse(x
, y
);
36 void OnMouseUp(int x
, int y
, IMouseMod
* pMod
)
38 mHandleColor
= COLOR_WHITE
;
41 void OnMouseDrag(int x
, int y
, int dX
, int dY
, IMouseMod
* pMod
)
43 return SnapToMouse(x
, y
);
46 void SnapToMouse(int x
, int y
)
48 GetAuxParam(0)->mValue
= BOUNDED((double)x
/ (double)mRECT
.W(), 0, 1);
49 GetAuxParam(1)->mValue
= BOUNDED((double)y
/ (double)mRECT
.H(), 0, 1);
54 void SetDirty(bool pushParamToPlug
= true)
58 if (pushParamToPlug
&& mPlug
)
60 SetAllAuxParamsFromGUI();