13 #ifndef __CustomControls__ 14 #define __CustomControls__ 16 #include "vstgui/lib/controls/cbuttons.h" 17 #include "vstgui/lib/controls/cknob.h" 18 #include "vstgui/lib/cframe.h" 19 #include "vstgui/lib/controls/cslider.h" 20 #include "vstgui/lib/controls/cvumeter.h" 21 #include "vstgui/lib/controls/cxypad.h" 22 #include "vstgui/vstgui.h" 23 #include "vstgui/lib/vstguibase.h" 41 enum mouseAction {mouseDirUpAndDown, mouseDirUp, mouseDirDown};
58 CKickButtonEx(
const CRect& size, IControlListener* listener, int32_t tag, CBitmap* background,
const CPoint& offset = CPoint (0, 0));
65 virtual CMouseEventResult
onMouseDown (CPoint& where,
const CButtonState& buttons)
override;
72 virtual CMouseEventResult
onMouseUp (CPoint& where,
const CButtonState& buttons)
override;
81 float entryState = 0.0;
82 unsigned int mouseBehavior = 0;
100 TextButtonEx(
const CRect& size, IControlListener* listener, int32_t tag, UTF8StringPtr title = 0, CTextButton::Style = kKickStyle);
102 void draw(CDrawContext* context)
override;
109 virtual CMouseEventResult
onMouseDown(CPoint& where,
const CButtonState& buttons)
override;
116 virtual CMouseEventResult
onMouseMoved(CPoint& where,
const CButtonState& buttons)
override;
123 virtual CMouseEventResult
onMouseUp(CPoint& where,
const CButtonState& buttons)
override;
132 float entryState = 0.0;
133 unsigned int mouseBehavior = 0;
151 CAnimKnobEx(
const CRect& size, IControlListener* listener, int32_t tag, int32_t subPixmaps,
152 CCoord heightOfOneImage, CBitmap* background,
const CPoint &offset,
153 bool bSwitchKnob =
false);
155 virtual void draw (CDrawContext* pContext)
override;
162 CMouseEventResult
onMouseUp(CPoint& where,
const CButtonState& buttons)
override;
169 CMouseEventResult
onMouseDown(CPoint& where,
const CButtonState& buttons)
override;
176 virtual CMouseEventResult
onMouseMoved (CPoint& where,
const CButtonState& buttons)
override;
178 bool checkDefaultValue (CButtonState button)
override;
179 virtual void valueChanged()
override;
206 bool switchKnob =
false;
207 bool aaxKnob =
false;
208 float maxControlValue = 1.0;
218 CButtonState oldButton;
238 CVerticalSliderEx (
const CRect& size, IControlListener* listener, int32_t tag, int32_t iMinPos, int32_t iMaxPos, CBitmap* handle, CBitmap* background,
const CPoint& offset = CPoint (0, 0),
const int32_t style = kBottom);
241 virtual void draw (CDrawContext*)
override;
248 CMouseEventResult
onMouseUp(CPoint& where,
const CButtonState& buttons)
override;
255 CMouseEventResult
onMouseDown(CPoint& where,
const CButtonState& buttons)
override;
262 virtual CMouseEventResult
onMouseMoved (CPoint& where,
const CButtonState& buttons)
override;
264 bool checkDefaultValue (CButtonState button)
override;
302 float maxControlValue;
308 CButtonState oldButton;
309 CPoint mouseStartPoint;
328 CHorizontalSliderEx (
const CRect& size, IControlListener* listener, int32_t tag, int32_t iMinPos, int32_t iMaxPos, CBitmap* handle, CBitmap* background,
const CPoint& offset = CPoint (0, 0),
const int32_t style = kLeft);
331 virtual void draw (CDrawContext*)
override;
338 CMouseEventResult
onMouseUp(CPoint& where,
const CButtonState& buttons)
override;
345 CMouseEventResult
onMouseDown(CPoint& where,
const CButtonState& buttons)
override;
352 virtual CMouseEventResult
onMouseMoved (CPoint& where,
const CButtonState& buttons)
override;
354 bool checkDefaultValue (CButtonState button)
override;
391 float maxControlValue;
398 CButtonState oldButton;
399 CPoint mouseStartPoint;
423 void init(
float samplerate,
float attack_in_ms,
float release_in_ms,
bool bAnalogTC,
unsigned int uDetect,
bool bLogDetector);
427 void setTCModeAnalog(
bool _analogTC);
430 void setAttackTime(
float attack_in_ms);
431 void setReleaseTime(
float release_in_ms);
438 void setDetectMode(
unsigned int _detectMode) {detectMode = _detectMode;}
440 void setSampleRate(
float f)
442 detectorSampleRate = f;
444 setAttackTime(attackTime_mSec);
445 setReleaseTime(releaseTime_mSec);
448 void setLogDetect(
bool b) {logDetector = b;}
451 float detect(
float input);
454 void prepareForPlay();
456 void resetPeakHold(){ peakEnvelope = -1.0; }
457 void setPeakHold(
bool b) { peakHold = b; }
461 float m_fReleaseTime;
462 float attackTime_mSec;
463 float releaseTime_mSec;
464 float detectorSampleRate;
469 unsigned int detectMode;
472 void setEnvelope(
float value)
481 if(value > peakEnvelope)
483 peakEnvelope = value;
504 CVuMeterEx(
const CRect& size, CBitmap* onBitmap, CBitmap* offBitmap, int32_t nbLed,
bool bInverted,
bool bAnalogVU, int32_t style = kVertical);
510 virtual void draw(CDrawContext* pContext)
override;
511 virtual void setViewSize (
const CRect& newSize,
bool invalid =
true)
override;
513 inline void initDetector(
float samplerate,
float attack_in_ms,
float release_in_ms,
bool bAnalogTC,
unsigned int uDetect,
bool bLogDetector)
515 detector.init(samplerate, attack_in_ms, release_in_ms, bAnalogTC, uDetect, bLogDetector);
516 detector.prepareForPlay();
519 void setHtOneImage(
double d){heightOfOneImage = d;}
520 void setImageCount(
double d){subPixMaps = d;}
521 void setZero_dB_Frame(
double d){zero_dB_Frame = d;}
526 double zero_dB_Frame;
527 double heightOfOneImage;
548 CXYPadEx(
const CRect& size = CRect (0, 0, 0, 0));
552 void setTagX(int32_t tag){tagX = tag;}
553 int32_t getTagX(){
return tagX;}
555 void setTagY(int32_t tag){tagY = tag;}
556 int32_t getTagY(){
return tagY;}
559 void draw(CDrawContext* context)
override;
566 CMouseEventResult
onMouseMoved(CPoint& where,
const CButtonState& buttons)
override;
573 CMouseEventResult
onMouseUp(CPoint& where,
const CButtonState& buttons)
override;
580 CMouseEventResult
onMouseDown(CPoint& where,
const CButtonState& buttons)
override;
581 virtual void setValue(
float val)
override;
584 inline int pointInPolygon(
int nvert,
float *vertx,
float *verty,
float testx,
float testy)
587 for (i = 0, j = nvert-1; i < nvert; j = i++)
589 if ( ((verty[i]>testy) != (verty[j]>testy)) &&
590 (testx < (vertx[j]-vertx[i]) * (testy-verty[i]) / (verty[j]-verty[i]) + vertx[i]) )
596 static void calculateXY (
float value,
float& x,
float& y)
598 x = std::floor (value * 1000.f + 0.5f) * 0.001f;
599 y = std::floor ((value - x) * 10000000.f + 0.5f) * 0.001f;
603 static float calculateValue (
float x,
float y)
606 x = std::floor (x * 1000.f + 0.5f) * 0.001f;
607 y = std::floor (y * 1000.f + 0.5f) * 0.0000001f;
virtual CMouseEventResult onMouseMoved(CPoint &where, const CButtonState &buttons) override
handle mouse moved event
Definition: customcontrols.cpp:97
CMouseEventResult onMouseUp(CPoint &where, const CButtonState &buttons) override
handle mouse up event
Definition: customcontrols.cpp:334
bool isAAXKnob()
query if control wants Pro Tools keyboard modifiers
Definition: customcontrols.h:203
virtual void setValue(float val) override
Definition: customcontrols.cpp:1189
The CAnimKnobEx object extends the VSTGUI CAnimKnob object with extra functionality. It is used in the PluginGUI object for creating custom views.
Definition: customcontrols.h:148
CMouseEventResult onMouseDown(CPoint &where, const CButtonState &buttons) override
handle mouse down event
Definition: customcontrols.cpp:278
bool isAAXSlider()
query if control wants Pro Tools keyboard modifiers
Definition: customcontrols.h:294
The TextButtonEx object extends the VSTGUI CTextButton object with extra functionality. It is used in the PluginGUI object for creating custom views.
Definition: customcontrols.h:97
void setSwitchMax(float f)
set max discrete switching value
Definition: customcontrols.h:270
CMouseEventResult onMouseDown(CPoint &where, const CButtonState &buttons) override
handle mouse down event
Definition: customcontrols.cpp:1222
CMouseEventResult onMouseDown(CPoint &where, const CButtonState &buttons) override
handle mouse down event
Definition: customcontrols.cpp:560
void setAAXSlider(bool b)
sets the AAX flag for this control
Definition: customcontrols.h:378
CMouseEventResult onMouseDown(CPoint &where, const CButtonState &buttons) override
handle mouse down event
Definition: customcontrols.cpp:808
bool isSwitchKnob()
query if control is in "switch" mode
Definition: customcontrols.h:191
CMouseEventResult onMouseUp(CPoint &where, const CButtonState &buttons) override
handle mouse up event
Definition: customcontrols.cpp:1241
bool isSwitchSlider()
query if control is in "switch" mode
Definition: customcontrols.h:372
void setMouseMode(unsigned int uMode)
set the mouse behavior (down, up, or down/up)
Definition: customcontrols.h:129
void setAAXKnob(bool b)
sets the AAX flag for this control
Definition: customcontrols.h:197
virtual CMouseEventResult onMouseMoved(CPoint &where, const CButtonState &buttons) override
handle mouse moved event
Definition: customcontrols.cpp:340
mouseAction
Use this enum to set the mouse behavior for kick button.
Definition: customcontrols.h:41
Definition: customcontrols.cpp:20
void setSwitchMax(float f)
set max discrete switching value
Definition: customcontrols.h:185
virtual CMouseEventResult onMouseMoved(CPoint &where, const CButtonState &buttons) override
handle mouse moved event
Definition: customcontrols.cpp:600
The CVuMeterEx object extends the VSTGUI CVuMeter object with extra functionality. It is used in the PluginGUI object for creating custom views.
Definition: customcontrols.h:501
The CHorizontalSliderEx object extends the VSTGUI CHorizontalSlider object with extra functionality...
Definition: customcontrols.h:325
globally utilized constants and enumerations
virtual CMouseEventResult onMouseMoved(CPoint &where, const CButtonState &buttons) override
handle mouse moved event
Definition: customcontrols.cpp:848
void setSwitchMax(float f)
set max discrete switching value
Definition: customcontrols.h:360
void setSwitchSlider(bool b)
sets the control into "switch" mode
Definition: customcontrols.h:366
TextButtonEx(const CRect &size, IControlListener *listener, int32_t tag, UTF8StringPtr title=0, CTextButton::Style=kKickStyle)
TextButtonEx constructor.
Definition: customcontrols.cpp:90
CMouseEventResult onMouseUp(CPoint &where, const CButtonState &buttons) override
handle mouse up event
Definition: customcontrols.cpp:841
void setSwitchSlider(bool b)
sets the control into "switch" mode
Definition: customcontrols.h:282
The CXYPadEx object extends the CXYPad CVuMeter object with extra functionality. It is used in the Pl...
Definition: customcontrols.h:545
virtual CMouseEventResult onMouseDown(CPoint &where, const CButtonState &buttons) override
handle mouse down event
Definition: customcontrols.cpp:184
virtual CMouseEventResult onMouseUp(CPoint &where, const CButtonState &buttons) override
handle mouse up event
Definition: customcontrols.cpp:151
The CVerticalSliderEx object extends the VSTGUI CVerticalSlider object with extra functionality...
Definition: customcontrols.h:235
CMouseEventResult onMouseMoved(CPoint &where, const CButtonState &buttons) override
handle mouse moved event
Definition: customcontrols.cpp:1246
bool isAAXSlider()
query if control wants Pro Tools keyboard modifiers
Definition: customcontrols.h:384
bool isSwitchSlider()
query if control is in "switch" mode
Definition: customcontrols.h:276
void setAAXSlider(bool b)
sets the AAX flag for this control
Definition: customcontrols.h:288
CMouseEventResult onMouseUp(CPoint &where, const CButtonState &buttons) override
handle mouse up event
Definition: customcontrols.cpp:593
The CMeterDetector object provides a dedicated detector for VU meter objects.
Definition: customcontrols.h:413