ASPiK SDK
Loading...
Searching...
No Matches
plugingui.h
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------
2// ASPiK Plugin Kernel File: plugingui.h
3//
12// -----------------------------------------------------------------------------
13#pragma once
14#ifndef __PluginGUI__
15#define __PluginGUI__
16
17#define DOXYDOC 1
18
19#ifdef DOXYDOC
20
21#define AUPLUGIN 1
22#define AAXPLUGIN 1
23#define VSTPLUGIN 1
24#define RAFXPLUGIN 1
25
26#endif
27
28// --- custom VSTGUI4 derived classes
29#include "customcontrols.h"
30
31// --- VSTGUI
32#include "vstgui/vstgui.h"
33#include "vstgui/uidescription/uiviewswitchcontainer.h"
34#include "vstgui/vstgui_uidescription.h"
35#include "vstgui/lib/crect.h"
36
37// --- 4.9
38#include "vstgui/uidescription/cstream.h"
39
40// --- 4.10 new way to initialize the library
41#include "vstgui/lib/vstguiinit.h"
42
43#if VSTGUI_LIVE_EDITING
44#include "vstgui/uidescription/editing/uieditcontroller.h"
45#include "vstgui/uidescription/editing/uieditmenucontroller.h"
46#endif
47
48#ifdef AUPLUGIN
49#import <CoreFoundation/CoreFoundation.h>
50#import <AudioUnit/AudioUnit.h>
51#import <AudioToolbox/AudioToolbox.h>
52#endif
53
54#ifdef AAXPLUGIN
55#include "AAX_IEffectParameters.h"
57#endif
58
59// --- plugin stuff
60#include "pluginparameter.h"
61
62// --- std::
63#include <sstream>
64#include <algorithm>
65#include <functional>
66#include <cctype>
67#include <locale>
68#include <map>
69
70// --- const for host choice knob mode
71const uint32_t kHostChoice = 3;
72
73namespace VSTGUI {
74
90{
91public:
93 ControlUpdateReceiver(CControl* control, PluginParameter* pluginParameterPtr, bool _isControlListener)
94 {
95 hasRefGuiControl = pluginParameterPtr ? true : false;
96
98 refGuiControl = *pluginParameterPtr;
99
100 addControl(control);
101 isControlListener = _isControlListener;
102 }
103
106 {
107 for(std::vector<CControl*>::iterator it = guiControls.begin(); it != guiControls.end(); ++it)
108 {
109 CControl* ctrl = *it;
110 ctrl->forget();
111 }
112 }
113
118 bool hasControl(CControl* control)
119 {
120 return std::find(guiControls.begin (), guiControls.end (), control) != guiControls.end ();
121 }
122
126 void addControl(CControl* control)
127 {
128 if(hasControl(control))
129 return;
130
131 control->remember();
132 guiControls.push_back(control);
133
134 // --- set default value (rather than from XML, which is a pain because it must be normalized)
136 {
137 float normalizedValue = (float)refGuiControl.getDefaultValueNormalized();
138 control->setDefaultValue(normalizedValue);
139 }
140 }
141
145 void removeControl(CControl* control)
146 {
147 for(std::vector<CControl*>::iterator it = guiControls.begin(); it != guiControls.end(); ++it)
148 {
149 CControl* ctrl = *it;
150 if(ctrl == control)
151 {
152 ctrl->forget();
153 guiControls.erase(it);
154 return;
155 }
156 }
157 }
158
164 {
165 for(std::vector<CControl*>::iterator it = guiControls.begin(); it != guiControls.end(); ++it)
166 {
167 CControl* ctrl = *it;
168 if(ctrl && ctrl->isEditing())
169 return true;
170 }
171 return false;
172 }
173
178 float getActualValueWithNormalizedValue(float normalizedValue)
179 {
181 {
182 if (normalizedValue == (float)refGuiControl.getDefaultValueNormalized())
183 {
184 return (float)refGuiControl.getDefaultValue();
185 }
186 }
187
188 return (float)refGuiControl.getControlValueWithNormalizedValue(normalizedValue);
189 }
190
195 float getNormalizedValueWithActualValue(float actualValue)
196 {
198 }
199
203 void updateControlsWithControl(CControl* control)
204 {
205 updateControlsWithActualValue(getActualValueWithNormalizedValue(control->getValueNormalized()), control);
206 }
207
212 void updateControlsWithNormalizedValue(float normalizedValue, CControl* control = nullptr)
213 {
214 // --- is this the defalt value?
216 {
217 if (normalizedValue == (float)refGuiControl.getDefaultValueNormalized())
218 {
220 return;
221 }
222 }
223
225 }
226
230 void initControl(CControl* control)
231 {
232 float actualValue = (float)refGuiControl.getControlValue();
233 updateControlsWithActualValue(actualValue, control);
234 }
235
240 void updateControlsWithActualValue(float actualValue, CControl* control = nullptr)
241 {
242 // --- eliminiate glitching from AAX parameter loop
243 if(!control && controlInRxGroupIsEditing())
244 return;
245
246 // --- store on our reference control
247 refGuiControl.setControlValue(actualValue);
248
249 // --- synchoronize all controls that share this controlID
250 for(std::vector<CControl*>::iterator it = guiControls.begin(); it != guiControls.end(); ++it)
251 {
252 CControl* guiCtrl = *it;
253 if(guiCtrl && control != guiCtrl) // nned the check for XY pads
254 {
255 // --- need to take care of multiple control types, slight differences in setup
256 CTextLabel* label = dynamic_cast<CTextLabel*>(guiCtrl);
257 COptionMenu* oMenu = dynamic_cast<COptionMenu*>(guiCtrl);
258 CXYPadEx* xyPad = dynamic_cast<CXYPadEx*>(guiCtrl);
259 CVuMeter* meter = dynamic_cast<CVuMeter*>(guiCtrl);
260
261 if(meter)
262 {
263 continue;
264 }
265 else if(label)
266 {
267 label->setText(refGuiControl.getControlValueAsString().c_str());
268 label->invalid();
269 }
270 else if(oMenu)
271 {
272 // --- current rafx GUI Designer does not set max to anything
273 guiCtrl->setMin((float)refGuiControl.getGUIMin());
274 guiCtrl->setMax((float)refGuiControl.getGUIMin());
275
276 // --- load for first time, NOT dynamic loading here
277 oMenu->removeAllEntry();
278
279 for (uint32_t i = 0; i < refGuiControl.getStringCount(); i++)
280 {
281 oMenu->addEntry(refGuiControl.getStringByIndex(i).c_str(), i);
282 }
283
284 oMenu->setValue((float)refGuiControl.getControlValue());
285 }
286 else if(xyPad)
287 {
288 float x = 0.f;
289 float y = 0.f;
290 xyPad->calculateXY(xyPad->getValue(), x, y);
291
292 // --- retrieve the X and Y tags on the CXYPadEx
293 int32_t tagX = xyPad->getTagX();
294 int32_t tagY = xyPad->getTagY();
295
296 if(tagX == refGuiControl.getControlID())
298 if(tagY == refGuiControl.getControlID())
300
301 if(tagX >= 0 && tagY >= 0 && !guiCtrl->isEditing())
302 xyPad->setValue(xyPad->calculateValue(x, y));
303 }
304 else if(!guiCtrl->isEditing())
305 guiCtrl->setValueNormalized((float)refGuiControl.getControlValueNormalized());
306
307 guiCtrl->invalid();
308 }
309 }
310 }
311
317
322
327 inline bool controlAndContainerVisible(CControl* ctrl)
328 {
329 if(!ctrl) return false;
330
331 bool stickyVisible = ctrl->isVisible();
332
333 if(!stickyVisible)
334 return false;
335
336 // --- check parents
337 CView* parent = ctrl->getParentView();
338 while(parent)
339 {
340 stickyVisible = parent->isVisible();
341 if(!stickyVisible)
342 return false;
343
344 parent = parent->getParentView();
345 }
346 return stickyVisible;
347 }
348
354 int getControlID_WithMouseCoords(const CPoint& where)
355 {
356 CPoint mousePoint = where;
357
358 for(std::vector<CControl*>::iterator it = guiControls.begin(); it != guiControls.end(); ++it)
359 {
360 CControl* ctrl = *it;
361 if(ctrl && controlAndContainerVisible(ctrl))
362 {
363 CPoint point = ctrl->frameToLocal(mousePoint);
364 CRect rect = ctrl->getViewSize();
365 if(rect.pointInside(point))
366 {
367 int tag = ctrl->getTag();
368 if(isReservedTag(tag))
369 return -1;
370 else
371 return tag;
372 }
373 }
374 }
375 return -1;
376 }
377
383 CControl* getControl_WithMouseCoords(const CPoint& where)
384 {
385 CPoint mousePoint = where;
386
387 for(std::vector<CControl*>::iterator it = guiControls.begin(); it != guiControls.end(); ++it)
388 {
389 CControl* ctrl = *it;
390 if(ctrl && controlAndContainerVisible(ctrl))
391 {
392 CPoint point = ctrl->frameToLocal(mousePoint);
393 CRect rect = ctrl->getViewSize();
394 if(rect.pointInside(point))
395 return ctrl;
396 }
397 }
398 return nullptr;
399 }
400
401protected:
403 std::vector<CControl*> guiControls;
404 bool hasRefGuiControl = false;
405 bool isControlListener = false;
406};
407
408
434class PluginGUI : public IController,
435 public IViewAddedRemovedObserver,
436 public OldMouseObserverAdapter /*IMouseObserver*/,
437 public VSTGUIEditorInterface,
438 public CBaseObject,
439 public ICommandMenuItemTarget,
440 public IGUIView
441{
442
443public:
445 PluginGUI(UTF8StringPtr _xmlFile);
446
448 virtual ~PluginGUI();
449
451 bool open(UTF8StringPtr _viewName,
452 void* parent,
453 const std::vector<PluginParameter*>* pluginParameterPtr,
454 const PlatformType& platformType = PlatformType::kDefaultNative,
455 IGUIPluginConnector* _guiPluginConnector = nullptr,
456 void* data = nullptr);
457
459 void close();
460
462 void syncGUIControl(uint32_t controlID);
463
465 void getSize(float& width, float& height);
466
468 void scaleGUISize(uint32_t controlValue);
469
471 void writeToPresetFile();
472
475
476 // --- for AAX-Windows ONLY
478 static void initVSTGUILib(void* hInstance);
479
481 static void exitVSTGUILib();
482
483protected:
485 virtual void idle();
486
488 void preCreateGUI();
489
491 bool createGUI(bool bShowGUIEditor);
492
494 void save(bool saveAs = false);
495
497 virtual int32_t getKnobMode() const override;
498
501 {
502 for(std::vector<PluginParameter*>::iterator it = pluginParameters.begin(); it != pluginParameters.end(); ++it) {
503 delete *it;
504 }
505 pluginParameters.clear();
506 }
507
516 {
517 for(std::vector<PluginParameter*>::iterator it = pluginParameters.begin(); it != pluginParameters.end(); ++it) {
518 PluginParameter* ctrl = *it;
519 if(ctrl->getControlID() == tag)
520 return ctrl;
521 }
522 return nullptr;
523 }
524
525 // --- protected variables
527 UIDescription* description = nullptr;
528 std::string viewName;
529 std::string xmlFile;
530
531 uint32_t numUIControls = 0;
532 double zoomFactor = 1.0;
533 CVSTGUITimer* timer;
534
535 CPoint minSize;
536 CPoint maxSize;
538
539 // --- flags for showing view
540 bool showGUIEditor = false;
541 bool createNewView = true;
542
545 float guiWidth;
546 float guiHeight;
547
549 CFrame* guiEditorFrame = nullptr;
550 uint32_t knobAction = kLinearMode;
551
553 std::string getGUIDesignerSize();
554
556 int getControlID_WithMouseCoords(const CPoint& where);
557
559 CControl* getControl_WithMouseCoords(const CPoint& where);
560
562 CMouseEventResult sendAAXMouseDown(int controlID, const CButtonState& buttons);
563
565 CMouseEventResult sendAAXMouseMoved(int controlID, const CButtonState& buttons, const CPoint& where);
566
568 CMouseEventResult sendAUMouseDown(CControl* control, const CButtonState& buttons);
569
571 CMouseEventResult sendAUMouseMoved(CControl* control, const CButtonState& buttons, const CPoint& where) { return kMouseEventNotImplemented; }
572
584 void setPluginParameterFromGUIControl(CControl* control, int tag, float actualValue, float normalizedValue)
585 {
586#ifdef AUPLUGIN
587 setAUEventFromGUIControl(control, tag, actualValue);
588#endif
589
590#ifdef AAXPLUGIN
591 setAAXParameterFromGUIControl(control, tag, actualValue, normalizedValue);
592#endif
593
594#ifdef VSTPLUGIN
595 setVSTParameterFromGUIControl(control, tag, actualValue, normalizedValue);
596#endif
597
598#ifdef RAFXPLUGIN
599 setRAFXParameterFromGUIControl(control, tag, actualValue, normalizedValue);
600#endif
601}
602
606#ifdef AAXPLUGIN
607public:
612 void setAAXViewContainer(AAX_IViewContainer* _aaxViewContainer){ aaxViewContainer = _aaxViewContainer;}
613
615 void setAAXParameterFromGUIControl(CControl* control, int tag, float actualValue, float normalizedValue);
616
618 void updateGUIControlAAX(int tag, float actualPluginValue, float normalizedValue = 0.f, bool useNormalized = false);
619protected:
620#endif
621
622
623#ifdef AUPLUGIN
624 AudioUnit m_AU;
625 AUEventListenerRef AUEventListener;
626
627public:
629 void dispatchAUControlChange(int tag, float actualPluginValue, int message = -1, bool fromEventListener = false);
630
634 void setAU(AudioUnit inAU){m_AU = inAU;}
635
636protected:
638 void setAUEventFromGUIControl(CControl* control, int tag, float normalizedValue);
639#endif
640
641#ifdef VSTPLUGIN
643 void setVSTParameterFromGUIControl(CControl* control, int tag, float actualValue, float normalizedValue);
644
646 void updateGUIControlVST(int tag, float normalizedValue);
647#endif
648
649#ifdef RAFXPLUGIN
651 void setRAFXParameterFromGUIControl(CControl* control, int tag, float actualValue, float normalizedValue);
652
654 void updateGUIControlRAFX(int tag, float normalizedValue);
655#endif
656
657
658public:
660 CMessageResult notify(CBaseObject* sender, IdStringPtr message) override;
661
663 virtual void valueChanged(VSTGUI::CControl* pControl) override;
664
666 virtual int32_t controlModifierClicked(VSTGUI::CControl* pControl, VSTGUI::CButtonState button) override { return 0; }
667
669 virtual void controlBeginEdit(VSTGUI::CControl* pControl) override;
670
672 virtual void controlEndEdit(VSTGUI::CControl* pControl) override;
673
675 virtual void controlTagWillChange(VSTGUI::CControl* pControl) override;
676
678 virtual void controlTagDidChange(VSTGUI::CControl* pControl) override;
679#if DEBUG
681 virtual char controlModifierClicked(VSTGUI::CControl* pControl, long button) { return 0; }
682#endif
683
685 CView* createUserCustomView(std::string viewname, const CRect rect, IControlListener* listener, int32_t tag);
686
688 CView* createView(const UIAttributes& attributes, const IUIDescription* description) override;
689
691 IController* createSubController(UTF8StringPtr name, const IUIDescription* description) override;
692
694 ControlUpdateReceiver* getControlUpdateReceiver(int32_t tag) const;
695
697 void onViewAdded(CFrame* frame, CView* view) override {}
698
700 void onViewRemoved(CFrame* frame, CView* view) override;
701
703 void onMouseEntered(CView* view, CFrame* frame) override {}
704
706 void onMouseExited(CView* view, CFrame* frame) override {}
707
709 CMouseEventResult onMouseDown(CFrame* frame, const CPoint& where, const CButtonState& buttons) override;
710
712 CMouseEventResult onMouseMoved(CFrame* frame, const CPoint& where, const CButtonState& buttons) override;
713
715 virtual bool validateCommandMenuItem(CCommandMenuItem* item) override;
716
718 virtual bool onCommandMenuItemSelected(CCommandMenuItem* item) override;
719
726 virtual void setGUIWindowFrame(IGUIWindowFrame* frame) override
727 {
728 // --- we keep for resiging here
729 guiWindowFrame = frame;
730 }
731
737 inline static bool parseSize (const std::string& str, CPoint& point)
738 {
739 size_t sep = str.find (',', 0);
740 if (sep != std::string::npos)
741 {
742 point.x = strtol (str.c_str (), 0, 10);
743 point.y = strtol (str.c_str () + sep+1, 0, 10);
744 return true;
745 }
746 return false;
747 }
748
749 // --- for Meters only right now, but could be used to mark any control as writeable
757 bool hasWriteableControl(CControl* control)
758 {
759 return std::find (writeableControls.begin (), writeableControls.end (), control) != writeableControls.end ();
760 }
761
768 void checkAddWriteableControl(PluginParameter* piParam, CControl* control)
769 {
770 if(!piParam)
771 return;
772 if(!control)
773 return;
774 if(!piParam->getIsWritable())
775 return;
776 if(!hasWriteableControl(control))
777 {
778 writeableControls.push_back(control);
779 control->remember();
780 }
781 }
782
788 void checkRemoveWriteableControl(CControl* control)
789 {
790 if(!hasWriteableControl(control)) return;
791
792 for(std::vector<CControl*>::iterator it = writeableControls.begin(); it != writeableControls.end(); ++it)
793 {
794 CControl* ctrl = *it;
795 if(ctrl == control)
796 {
797 ctrl->forget();
798 writeableControls.erase(it);
799 return;
800 }
801 }
802 }
803
804
809 {
810 for (ControlUpdateReceiverMap::const_iterator it = controlUpdateReceivers.begin(), end = controlUpdateReceivers.end(); it != end; ++it)
811 {
812 delete it->second;
813 }
814 controlUpdateReceivers.clear();
815 }
816
821 {
822 for (std::vector<CControl*>::iterator it = writeableControls.begin(); it != writeableControls.end(); ++it)
823 {
824 CControl* ctrl = *it;
825 ctrl->forget();
826 }
827 writeableControls.clear();
828 }
829
837 bool hasICustomView(CView* view)
838 {
839 ICustomView* customView = dynamic_cast<ICustomView*>(view);
840 if (customView)
841 return true;
842 return false;
843 }
844
852 bool hasICustomView(IController* subController)
853 {
854 ICustomView* customView = dynamic_cast<ICustomView*>(subController);
855 if (customView)
856 return true;
857 return false;
858 }
859
860private:
861 typedef std::map<int32_t, ControlUpdateReceiver*> ControlUpdateReceiverMap;
862 ControlUpdateReceiverMap controlUpdateReceivers;
863 std::vector<CControl*> writeableControls;
864 std::vector<PluginParameter*> pluginParameters;
865
866#ifdef AAXPLUGIN
867 AAX_IViewContainer* aaxViewContainer = nullptr;
868#endif
869};
870
871}
872
873#endif
provided by AVID in the VSTGUI example in SDK
Custom View interface to allow plugin core to create safe communication channels with GUI custom view...
Definition: pluginstructures.h:1462
Custom interface so that GUI can pass information to plugin shell in a thread-safe manner.
Definition: pluginstructures.h:1540
Custom interface to allow resizing of GUI window; this is mainly used for the GUI designer.
Definition: pluginstructures.h:1521
Custom interface to allow resizing of GUI window; this is mainly used for the GUI designer.
Definition: pluginstructures.h:1497
The PluginParameter object stores all of the data needed for any type of plugin parameter....
Definition: pluginparameter.h:52
double getControlValue()
the main function to access the underlying atomic double value
Definition: pluginparameter.h:167
double getControlValueWithNormalizedValue(double normalizedValue, bool applyTaper=true)
get the new control value as if it were set with a normalized value
Definition: pluginparameter.h:309
uint32_t getControlID()
get ID value
Definition: pluginparameter.h:81
double getGUIMin()
Definition: pluginparameter.h:349
void setControlValue(double actualParamValue, bool ignoreSmoothing=false)
the main function to set the underlying atomic double value
Definition: pluginparameter.h:175
double getControlValueNormalized(bool applyTaper=true)
get control value as normalied value
Definition: pluginparameter.h:279
double getDefaultValueNormalized()
get default value as normalied value
Definition: pluginparameter.h:253
size_t getStringCount()
get the number of individual strings in a string-list control
Definition: pluginparameter.h:227
bool getIsWritable()
query writable control (meter)
Definition: pluginparameter.h:152
double getNormalizedControlValueWithActualValue(double actualValue)
get the new normalized control value as if it were set with an actual value
Definition: pluginparameter.h:346
double getDefaultValue()
get default value
Definition: pluginparameter.h:99
std::string getStringByIndex(uint32_t index)
get string-list string by index
Definition: pluginparameter.cpp:281
std::string getControlValueAsString()
the main function to access the underlying atomic double value as a string
Definition: pluginparameter.cpp:227
The CXYPadEx object extends the CXYPad CVuMeter object with extra functionality. It is used in the Pl...
Definition: customcontrols.h:540
virtual void setValue(float val) override
Definition: customcontrols.cpp:842
The ControlUpdateReceiver object is the connection mechanism between PluginParameter objects and thei...
Definition: plugingui.h:90
std::vector< CControl * > guiControls
list of controls that share the control tag with this one
Definition: plugingui.h:403
bool controlInRxGroupIsEditing()
Definition: plugingui.h:163
ControlUpdateReceiver(CControl *control, PluginParameter *pluginParameterPtr, bool _isControlListener)
Definition: plugingui.h:93
CControl * getControl_WithMouseCoords(const CPoint &where)
Definition: plugingui.h:383
bool hasControl(CControl *control)
Definition: plugingui.h:118
~ControlUpdateReceiver()
Definition: plugingui.h:105
int getControlID_WithMouseCoords(const CPoint &where)
Definition: plugingui.h:354
PluginParameter refGuiControl
single parameter with this control tag
Definition: plugingui.h:402
bool hasRefGuiControl
internal flag
Definition: plugingui.h:404
const PluginParameter getGuiControl()
Definition: plugingui.h:316
void updateControlsWithActualValue(float actualValue, CControl *control=nullptr)
Definition: plugingui.h:240
int32_t getControlID()
Definition: plugingui.h:321
bool isControlListener
internal flag
Definition: plugingui.h:405
void updateControlsWithControl(CControl *control)
Definition: plugingui.h:203
float getNormalizedValueWithActualValue(float actualValue)
Definition: plugingui.h:195
void initControl(CControl *control)
Definition: plugingui.h:230
float getActualValueWithNormalizedValue(float normalizedValue)
Definition: plugingui.h:178
void addControl(CControl *control)
Definition: plugingui.h:126
void updateControlsWithNormalizedValue(float normalizedValue, CControl *control=nullptr)
Definition: plugingui.h:212
void removeControl(CControl *control)
Definition: plugingui.h:145
bool controlAndContainerVisible(CControl *ctrl)
Definition: plugingui.h:327
The PluginGUI object that maintains the entire GUI operation and has #defines to use with AAX,...
Definition: plugingui.h:441
void setAAXViewContainer(AAX_IViewContainer *_aaxViewContainer)
AAX ONLY: plugin shell GUI object sets this after creation.
Definition: plugingui.h:612
CRect nonEditRect
non-edit area for GUI designer
Definition: plugingui.h:537
void checkRemoveWriteableControl(CControl *control)
check to see if we already store this meter control and remove it if we do
Definition: plugingui.h:788
virtual void controlEndEdit(VSTGUI::CControl *pControl) override
end of control/auomation notification
Definition: plugingui.cpp:1648
double guiDesignerWidth
GUI Designer's frame size.
Definition: plugingui.h:543
virtual void controlTagDidChange(VSTGUI::CControl *pControl) override
called when a control is being created on the GUI (step 2)
Definition: plugingui.cpp:1704
CVSTGUITimer * timer
timer object (this is platform dependent)
Definition: plugingui.h:533
void dispatchAUControlChange(int tag, float actualPluginValue, int message=-1, bool fromEventListener=false)
set the GUI control from the AU event generator; this is part of the thread-safe event system....
Definition: plugingui.cpp:1343
void setAUEventFromGUIControl(CControl *control, int tag, float normalizedValue)
set the AU event from the GUI congrol; this is part of the thread-safe event system....
Definition: plugingui.cpp:1358
bool hasWriteableControl(CControl *control)
check to see if we already store this meter control
Definition: plugingui.h:757
AudioUnit m_AU
AU ONLY: the AU plugin reference.
Definition: plugingui.h:624
CMouseEventResult sendAUMouseMoved(CControl *control, const CButtonState &buttons, const CPoint &where)
Definition: plugingui.h:571
bool hasICustomView(CView *view)
simple helper function to test view for ICustomView
Definition: plugingui.h:837
CMouseEventResult onMouseMoved(CFrame *frame, const CPoint &where, const CButtonState &buttons) override
message handler for mouse move event
Definition: plugingui.cpp:2633
std::string xmlFile
the XML file name
Definition: plugingui.h:529
void onMouseExited(CView *view, CFrame *frame) override
Definition: plugingui.h:706
void updateGUIControlVST(int tag, float normalizedValue)
set the GUI control from the VST parameter
Definition: plugingui.cpp:1398
CView * createUserCustomView(std::string viewname, const CRect rect, IControlListener *listener, int32_t tag)
add your custom views here; this is where you can create and register the views outside of the create...
Definition: plugingui.cpp:1798
void setVSTParameterFromGUIControl(CControl *control, int tag, float actualValue, float normalizedValue)
set the VST parameter from the GUI control
Definition: plugingui.cpp:1385
void setPluginParameterFromGUIControl(CControl *control, int tag, float actualValue, float normalizedValue)
safely set a plugin shell parameter with a GUI control
Definition: plugingui.h:584
void deleteControlUpdateReceivers()
delete all reciever objects
Definition: plugingui.h:808
static bool parseSize(const std::string &str, CPoint &point)
simple helper function to get size from string
Definition: plugingui.h:737
float guiHeight
embedded GUI size
Definition: plugingui.h:546
virtual void controlTagWillChange(VSTGUI::CControl *pControl) override
called when a control is being removed from the GUI, or when it is being created (step 1)
Definition: plugingui.cpp:1680
bool showGUIEditor
show the GUI designer
Definition: plugingui.h:540
float guiWidth
embedded GUI size
Definition: plugingui.h:545
void preCreateGUI()
one-time pre-create init, currently used for AU only
Definition: plugingui.cpp:666
virtual void idle()
perform idling operation; called directly from timer thread
Definition: plugingui.cpp:630
int getControlID_WithMouseCoords(const CPoint &where)
control finder, for AAX only, part of Pro Tools automation keyboard shortcut
Definition: plugingui.cpp:1140
void writeToPresetFile()
writes the current state of all GUI controls into a text file so that yuu can simply cut and paste th...
Definition: plugingui.cpp:498
virtual ~PluginGUI()
PluginGUI destructor.
Definition: plugingui.cpp:168
AUEventListenerRef AUEventListener
AU ONLY: the event listener token.
Definition: plugingui.h:625
void save(bool saveAs=false)
save GUI state in XML file
Definition: plugingui.cpp:1005
std::string viewName
name
Definition: plugingui.h:528
static void exitVSTGUILib()
Definition: plugingui.cpp:2666
virtual void setGUIWindowFrame(IGUIWindowFrame *frame) override
set the interface pointer for resizing from the GUI
Definition: plugingui.h:726
CView * createView(const UIAttributes &attributes, const IUIDescription *description) override
this is called for every view obeject in the XML file that will be visible to check and see if you wa...
Definition: plugingui.cpp:1848
void getSize(float &width, float &height)
returns the size into the pass-by-reference variables
Definition: plugingui.cpp:422
void checkAddWriteableControl(PluginParameter *piParam, CControl *control)
check to see if we already store this meter control and add it if we don't
Definition: plugingui.h:768
CPoint minSize
the min size of the GUI window
Definition: plugingui.h:535
void deleteGUIControlList()
Definition: plugingui.h:500
void setRAFXParameterFromGUIControl(CControl *control, int tag, float actualValue, float normalizedValue)
set the RAFX2 parameter from the GUI control
Definition: plugingui.cpp:1418
IController * createSubController(UTF8StringPtr name, const IUIDescription *description) override
for advanced users: you can create and even register sub-controllers here
Definition: plugingui.cpp:2454
IGUIWindowFrame * guiWindowFrame
interface to allow plugin shell to resize our window
Definition: plugingui.h:548
CMouseEventResult sendAUMouseDown(CControl *control, const CButtonState &buttons)
mouse down handler for AU automation
Definition: plugingui.cpp:1265
CMouseEventResult onMouseDown(CFrame *frame, const CPoint &where, const CButtonState &buttons) override
message handler for mouse down event
Definition: plugingui.cpp:2569
IGUIPluginConnector * guiPluginConnector
the plugin shell interface that arrives with the open( ) function; OK if NULL for standalone GUIs
Definition: plugingui.h:526
void updateGUIControlAAX(int tag, float actualPluginValue, float normalizedValue=0.f, bool useNormalized=false)
set the GUI control from the plugin shell GUI object (thread-safe)
Definition: plugingui.cpp:1316
bool open(UTF8StringPtr _viewName, void *parent, const std::vector< PluginParameter * > *pluginParameterPtr, const PlatformType &platformType=PlatformType::kDefaultNative, IGUIPluginConnector *_guiPluginConnector=nullptr, void *data=nullptr)
creates the GUI control objects, creates outer frame, inserts contents into window
Definition: plugingui.cpp:204
void onViewRemoved(CFrame *frame, CView *view) override
called before GUI control is removed from the view
Definition: plugingui.cpp:2508
static void initVSTGUILib(void *hInstance)
VSTGUI4 Library Initializer for AAX/Windows only.
Definition: plugingui.cpp:2660
std::string getGUIDesignerSize()
get size string
Definition: plugingui.cpp:1115
virtual int32_t getKnobMode() const override
returns mode
Definition: plugingui.cpp:1096
bool createNewView
show the normal GUI
Definition: plugingui.h:541
CControl * getControl_WithMouseCoords(const CPoint &where)
control finder, for AAX only, part of Pro Tools automation keyboard shortcut
Definition: plugingui.cpp:1165
bool createGUI(bool bShowGUIEditor)
creates either the GUI or the GUI Designer
Definition: plugingui.cpp:868
void setAU(AudioUnit inAU)
Definition: plugingui.h:634
CFrame * guiEditorFrame
pointer to our frame
Definition: plugingui.h:549
virtual int32_t controlModifierClicked(VSTGUI::CControl *pControl, VSTGUI::CButtonState button) override
return 1 if you want the control to not handle it, otherwise 0
Definition: plugingui.h:666
PluginParameter * getGuiControlWithTag(int tag)
find the local PluginParameter that is connected to the same control ID
Definition: plugingui.h:515
double zoomFactor
scaling factor for built-in scaling
Definition: plugingui.h:532
virtual void valueChanged(VSTGUI::CControl *pControl) override
THE function that all controls pour their control changes into. The result of this function is to pus...
Definition: plugingui.cpp:1476
ControlUpdateReceiver * getControlUpdateReceiver(int32_t tag) const
find the receiver for a given tag; there can be only one receiver for any tag
Definition: plugingui.cpp:2485
UIDescription * description
the description version of the XML file
Definition: plugingui.h:527
virtual void controlBeginEdit(VSTGUI::CControl *pControl) override
start of control/auomation notification
Definition: plugingui.cpp:1617
CMouseEventResult sendAAXMouseDown(int controlID, const CButtonState &buttons)
mouse down handler for Pro Tools keyboard shortcuts
Definition: plugingui.cpp:1196
void updateGUIControlRAFX(int tag, float normalizedValue)
set the GUI control from the RAFX2 parameter
Definition: plugingui.cpp:1431
void onViewAdded(CFrame *frame, CView *view) override
Definition: plugingui.h:697
void syncGUIControl(uint32_t controlID)
safely sets the GUI control value based on the plugin parameter value
Definition: plugingui.cpp:364
void scaleGUISize(uint32_t controlValue)
scales the GUI; this is the handler for the special scaling GUI control
Definition: plugingui.cpp:435
double guiDesignerHeight
GUI Designer's frame size.
Definition: plugingui.h:544
void clearGUIPluginConnector()
Definition: plugingui.h:474
CMouseEventResult sendAAXMouseMoved(int controlID, const CButtonState &buttons, const CPoint &where)
mouse moved handler for Pro Tools keyboard shortcuts
Definition: plugingui.cpp:1230
void forgetWriteableControls()
forget all writeable (neter) controls
Definition: plugingui.h:820
void setAAXParameterFromGUIControl(CControl *control, int tag, float actualValue, float normalizedValue)
set the plugin shelll parameter from GUI control using thread-safe mechanism
Definition: plugingui.cpp:1298
CPoint maxSize
the max size of the GUI window
Definition: plugingui.h:536
virtual bool validateCommandMenuItem(CCommandMenuItem *item) override
validates menu item selections to prevent crashing
Definition: plugingui.cpp:733
bool hasICustomView(IController *subController)
simple helper function to test sub-controller for ICustomView
Definition: plugingui.h:852
virtual bool onCommandMenuItemSelected(CCommandMenuItem *item) override
message handler for GUI Designer menu
Definition: plugingui.cpp:780
uint32_t knobAction
knob mode
Definition: plugingui.h:550
uint32_t numUIControls
control counter
Definition: plugingui.h:531
void onMouseEntered(CView *view, CFrame *frame) override
Definition: plugingui.h:703
void close()
prepares the GUI control objects for destruction, cleans up
Definition: plugingui.cpp:322
CMessageResult notify(CBaseObject *sender, IdStringPtr message) override
incoming VSTGUI4 message handler
Definition: plugingui.cpp:1449
interface file for ASPiK custom control objects (knobs, buttons, meters, etc...)
bool isReservedTag(int tag)
check to see if a tag is reserved: ASPiK defines several reserved control ID values.
Definition: guiconstants.h:49
base class interface file for ASPiK pluginparameter object