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" 
   41enum 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);
 
  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);
 
  245    CMouseEventResult 
onMouseUp(CPoint& where, 
const CButtonState& buttons) 
override;
 
  252    CMouseEventResult 
onMouseDown(CPoint& where, 
const CButtonState& buttons) 
override;
 
  259    virtual CMouseEventResult 
onMouseMoved (CPoint& where, 
const CButtonState& buttons) 
override;
 
  261    bool checkDefaultValue (CButtonState button);
 
  299    float maxControlValue;
 
  305    CButtonState oldButton;
 
  306    CPoint mouseStartPoint;
 
  325    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);
 
  332    CMouseEventResult 
onMouseUp(CPoint& where, 
const CButtonState& buttons) 
override;
 
  339    CMouseEventResult 
onMouseDown(CPoint& where, 
const CButtonState& buttons) 
override;
 
  346    virtual CMouseEventResult 
onMouseMoved (CPoint& where, 
const CButtonState& buttons) 
override;
 
  348    bool checkDefaultValue (CButtonState button);
 
  385    float maxControlValue;
 
  392    CButtonState oldButton;
 
  393    CPoint mouseStartPoint;
 
  417    void init(
float samplerate, 
float attack_in_ms, 
float release_in_ms, 
bool bAnalogTC, 
unsigned int uDetect, 
bool bLogDetector);
 
  421    void setTCModeAnalog(
bool _analogTC);
 
  424    void setAttackTime(
float attack_in_ms);
 
  425    void setReleaseTime(
float release_in_ms);
 
  432    void setDetectMode(
unsigned int _detectMode) {detectMode = _detectMode;}
 
  434    void setSampleRate(
float f)
 
  436        detectorSampleRate = f;
 
  438        setAttackTime(attackTime_mSec);
 
  439        setReleaseTime(releaseTime_mSec);
 
  442    void setLogDetect(
bool b) {logDetector = b;}
 
  445    float detect(
float input);
 
  448    void prepareForPlay();
 
  450    void resetPeakHold(){ peakEnvelope = -1.0; }
 
  451    void setPeakHold(
bool b) { peakHold = b; }
 
  455    float m_fReleaseTime;
 
  456    float attackTime_mSec;
 
  457    float releaseTime_mSec;
 
  458    float detectorSampleRate;
 
  463    unsigned int  detectMode;
 
  466    void setEnvelope(
float value)
 
  475        if(value > peakEnvelope)
 
  477            peakEnvelope = value;
 
  498    CVuMeterEx(
const CRect& size, CBitmap* onBitmap, CBitmap* offBitmap, int32_t nbLed, 
bool bInverted, 
bool bAnalogVU, int32_t style = kVertical);
 
  504    virtual void draw(CDrawContext* pContext) 
override;
 
  505    virtual void setViewSize (
const CRect& newSize, 
bool invalid = 
true) 
override;
 
  507    inline void initDetector(
float samplerate, 
float attack_in_ms, 
float release_in_ms, 
bool bAnalogTC, 
unsigned int uDetect, 
bool bLogDetector)
 
  509        detector.init(samplerate, attack_in_ms, release_in_ms, bAnalogTC, uDetect, bLogDetector);
 
  510        detector.prepareForPlay();
 
  513    void setHtOneImage(
double d){heightOfOneImage = d;}
 
  514    void setImageCount(
double d){subPixMaps = d;}
 
  515    void setZero_dB_Frame(
double d){zero_dB_Frame = d;}
 
  520    double zero_dB_Frame;
 
  521    double heightOfOneImage;
 
  542    CXYPadEx(
const CRect& size = CRect (0, 0, 0, 0));
 
  546    void setTagX(int32_t tag){tagX = tag;}
 
  547    int32_t getTagX(){
return tagX;}
 
  549    void setTagY(int32_t tag){tagY = tag;}
 
  550    int32_t getTagY(){
return tagY;}
 
  553    void draw(CDrawContext* context) 
override;
 
  560    CMouseEventResult 
onMouseMoved(CPoint& where, 
const CButtonState& buttons) 
override;
 
  567    CMouseEventResult 
onMouseUp(CPoint& where, 
const CButtonState& buttons) 
override;
 
  574    CMouseEventResult 
onMouseDown(CPoint& where, 
const CButtonState& buttons) 
override;
 
  575    virtual void setValue(
float val) 
override;
 
  578    inline int pointInPolygon(
int nvert, 
float *vertx, 
float *verty, 
float testx, 
float testy)
 
  581        for (i = 0, j = nvert-1; i < nvert; j = i++)
 
  583            if ( ((verty[i]>testy) != (verty[j]>testy)) &&
 
  584                (testx < (vertx[j]-vertx[i]) * (testy-verty[i]) / (verty[j]-verty[i]) + vertx[i]) )
 
  590    static void calculateXY (
float value, 
float& x, 
float& y)
 
  592        x = std::floor (value * 1000.f + 0.5f) * 0.001f;
 
  593        y = std::floor ((value - x)  * 10000000.f + 0.5f) * 0.001f;
 
  597    static float calculateValue (
float x, 
float y)
 
  600        x = std::floor (x * 1000.f + 0.5f) * 0.001f;
 
  601        y = std::floor (y * 1000.f + 0.5f) * 0.0000001f;
 
  621    CReadOnlyKnob(
const CRect& size, IControlListener* listener, int32_t tag, int32_t subPixmaps,
 
  622        CCoord heightOfOneImage, CBitmap* background, 
const CPoint &offset)
 
  623        : CAnimKnob(size, listener, tag, subPixmaps, heightOfOneImage, background, offset)
 
  631    CMouseEventResult 
onMouseUp(CPoint& where, 
const CButtonState& buttons)
 override 
  633        return kMouseEventHandled;
 
  641    CMouseEventResult 
onMouseDown(CPoint& where, 
const CButtonState& buttons)
 override 
  643        return kMouseEventHandled;
 
  651    virtual CMouseEventResult 
onMouseMoved(CPoint& where, 
const CButtonState& buttons)
 override 
  653        return kMouseEventHandled;
 
  656    virtual void valueChanged()
 override 
  662    virtual ~CReadOnlyKnob(
void) {}
 
The CAnimKnobEx object extends the VSTGUI CAnimKnob object with extra functionality....
Definition: customcontrols.h:149
CMouseEventResult onMouseUp(CPoint &where, const CButtonState &buttons) override
handle mouse up event
Definition: customcontrols.cpp:339
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:345
bool isSwitchKnob()
query if control is in "switch" mode
Definition: customcontrols.h:191
void setAAXKnob(bool b)
sets the AAX flag for this control
Definition: customcontrols.h:197
bool isAAXKnob()
query if control wants Pro Tools keyboard modifiers
Definition: customcontrols.h:203
CMouseEventResult onMouseDown(CPoint &where, const CButtonState &buttons) override
handle mouse down event
Definition: customcontrols.cpp:283
The CHorizontalSliderEx object extends the VSTGUI CHorizontalSlider object with extra functionality....
Definition: customcontrols.h:323
void setAAXSlider(bool b)
sets the AAX flag for this control
Definition: customcontrols.h:372
virtual CMouseEventResult onMouseMoved(CPoint &where, const CButtonState &buttons) override
handle mouse moved event
Definition: customcontrols.cpp:534
void setSwitchSlider(bool b)
sets the control into "switch" mode
Definition: customcontrols.h:360
void setSwitchMax(float f)
set max discrete switching value
Definition: customcontrols.h:354
bool isSwitchSlider()
query if control is in "switch" mode
Definition: customcontrols.h:366
CMouseEventResult onMouseUp(CPoint &where, const CButtonState &buttons) override
handle mouse up event
Definition: customcontrols.cpp:527
CMouseEventResult onMouseDown(CPoint &where, const CButtonState &buttons) override
handle mouse down event
Definition: customcontrols.cpp:516
bool isAAXSlider()
query if control wants Pro Tools keyboard modifiers
Definition: customcontrols.h:378
The CMeterDetector object provides a dedicated detector for VU meter objects.
Definition: customcontrols.h:408
Definition: customcontrols.h:619
CMouseEventResult onMouseDown(CPoint &where, const CButtonState &buttons) override
handle mouse down event
Definition: customcontrols.h:641
virtual CMouseEventResult onMouseMoved(CPoint &where, const CButtonState &buttons) override
handle mouse moved event
Definition: customcontrols.h:651
CMouseEventResult onMouseUp(CPoint &where, const CButtonState &buttons) override
handle mouse up event
Definition: customcontrols.h:631
The CVerticalSliderEx object extends the VSTGUI CVerticalSlider object with extra functionality....
Definition: customcontrols.h:236
void setSwitchMax(float f)
set max discrete switching value
Definition: customcontrols.h:267
virtual CMouseEventResult onMouseMoved(CPoint &where, const CButtonState &buttons) override
handle mouse moved event
Definition: customcontrols.cpp:460
CMouseEventResult onMouseUp(CPoint &where, const CButtonState &buttons) override
handle mouse up event
Definition: customcontrols.cpp:453
void setSwitchSlider(bool b)
sets the control into "switch" mode
Definition: customcontrols.h:279
CMouseEventResult onMouseDown(CPoint &where, const CButtonState &buttons) override
handle mouse down event
Definition: customcontrols.cpp:442
bool isSwitchSlider()
query if control is in "switch" mode
Definition: customcontrols.h:273
bool isAAXSlider()
query if control wants Pro Tools keyboard modifiers
Definition: customcontrols.h:291
void setAAXSlider(bool b)
sets the AAX flag for this control
Definition: customcontrols.h:285
The CVuMeterEx object extends the VSTGUI CVuMeter object with extra functionality....
Definition: customcontrols.h:496
The CXYPadEx object extends the CXYPad CVuMeter object with extra functionality. It is used in the Pl...
Definition: customcontrols.h:540
CMouseEventResult onMouseUp(CPoint &where, const CButtonState &buttons) override
handle mouse up event
Definition: customcontrols.cpp:894
CMouseEventResult onMouseDown(CPoint &where, const CButtonState &buttons) override
handle mouse down event
Definition: customcontrols.cpp:875
CMouseEventResult onMouseMoved(CPoint &where, const CButtonState &buttons) override
handle mouse moved event
Definition: customcontrols.cpp:899
virtual void setValue(float val) override
Definition: customcontrols.cpp:842
The TextButtonEx object extends the VSTGUI CTextButton object with extra functionality....
Definition: customcontrols.h:98
virtual CMouseEventResult onMouseUp(CPoint &where, const CButtonState &buttons) override
handle mouse up event
Definition: customcontrols.cpp:151
void setMouseMode(unsigned int uMode)
set the mouse behavior (down, up, or down/up)
Definition: customcontrols.h:129
virtual CMouseEventResult onMouseMoved(CPoint &where, const CButtonState &buttons) override
handle mouse moved event
Definition: customcontrols.cpp:97
virtual CMouseEventResult onMouseDown(CPoint &where, const CButtonState &buttons) override
handle mouse down event
Definition: customcontrols.cpp:184
mouseAction
Use this enum to set the mouse behavior for kick button.
Definition: customcontrols.h:41
globally utilized constants and enumerations