ASPiK SDK
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 #if VSTGUI_LIVE_EDITING
38 #include "vstgui/uidescription/editing/uieditcontroller.h"
39 #include "vstgui/uidescription/editing/uieditmenucontroller.h"
40 #endif
41 
42 #ifdef AUPLUGIN
43 #import <CoreFoundation/CoreFoundation.h>
44 #import <AudioUnit/AudioUnit.h>
45 #import <AudioToolbox/AudioToolbox.h>
46 #endif
47 
48 #ifdef AAXPLUGIN
49 #include "AAX_IEffectParameters.h"
50 #include "AAXtoVSTGUIButtonState.h"
51 #endif
52 
53 // --- plugin stuff
54 #include "pluginparameter.h"
55 
56 // --- std::
57 #include <sstream>
58 #include <algorithm>
59 #include <functional>
60 #include <cctype>
61 #include <locale>
62 #include <map>
63 
64 // --- const for host choice knob mode
65 const uint32_t kHostChoice = 3;
66 
67 namespace VSTGUI {
68 
84 {
85 public:
87  ControlUpdateReceiver(CControl* control, PluginParameter* pluginParameterPtr, bool _isControlListener)
88  {
89  hasRefGuiControl = pluginParameterPtr ? true : false;
90 
92  refGuiControl = *pluginParameterPtr;
93 
94  addControl(control);
95  isControlListener = _isControlListener;
96  }
97 
100  {
101  for(std::vector<CControl*>::iterator it = guiControls.begin(); it != guiControls.end(); ++it)
102  {
103  CControl* ctrl = *it;
104  ctrl->forget();
105  }
106  }
107 
112  bool hasControl(CControl* control)
113  {
114  return std::find(guiControls.begin (), guiControls.end (), control) != guiControls.end ();
115  }
116 
120  void addControl(CControl* control)
121  {
122  if(hasControl(control))
123  return;
124 
125  control->remember();
126  guiControls.push_back(control);
127 
128  // --- set default value (rather than from XML, which is a pain because it must be normalized)
129  if(hasRefGuiControl)
130  {
131  float normalizedValue = (float)refGuiControl.getDefaultValueNormalized();
132  control->setDefaultValue(normalizedValue);
133  }
134  }
135 
139  void removeControl(CControl* control)
140  {
141  for(std::vector<CControl*>::iterator it = guiControls.begin(); it != guiControls.end(); ++it)
142  {
143  CControl* ctrl = *it;
144  if(ctrl == control)
145  {
146  ctrl->forget();
147  guiControls.erase(it);
148  return;
149  }
150  }
151  }
152 
158  {
159  for(std::vector<CControl*>::iterator it = guiControls.begin(); it != guiControls.end(); ++it)
160  {
161  CControl* ctrl = *it;
162  if(ctrl && ctrl->isEditing())
163  return true;
164  }
165  return false;
166  }
167 
172  float getActualValueWithNormalizedValue(float normalizedValue)
173  {
174  return (float)refGuiControl.getControlValueWithNormalizedValue(normalizedValue);
175  }
176 
181  float getNormalizedValueWithActualValue(float actualValue)
182  {
183  return (float)refGuiControl.getNormalizedControlValueWithActualValue(actualValue);
184  }
185 
189  void updateControlsWithControl(CControl* control)
190  {
191  updateControlsWithActualValue(getActualValueWithNormalizedValue(control->getValueNormalized()), control);
192  }
193 
198  void updateControlsWithNormalizedValue(float normalizedValue, CControl* control = nullptr)
199  {
201  }
202 
206  void initControl(CControl* control)
207  {
208  float actualValue = (float)refGuiControl.getControlValue();
209  updateControlsWithActualValue(actualValue, control);
210  }
211 
216  void updateControlsWithActualValue(float actualValue, CControl* control = nullptr)
217  {
218  // --- eliminiate glitching from AAX parameter loop
219  if(!control && controlInRxGroupIsEditing())
220  return;
221 
222  // --- store on our reference control
223  refGuiControl.setControlValue(actualValue);
224 
225  // --- synchoronize all controls that share this controlID
226  for(std::vector<CControl*>::iterator it = guiControls.begin(); it != guiControls.end(); ++it)
227  {
228  CControl* guiCtrl = *it;
229  if(guiCtrl && control != guiCtrl) // nned the check for XY pads
230  {
231  // --- need to take care of multiple control types, slight differences in setup
232  CTextLabel* label = dynamic_cast<CTextLabel*>(guiCtrl);
233  COptionMenu* oMenu = dynamic_cast<COptionMenu*>(guiCtrl);
234  CXYPadEx* xyPad = dynamic_cast<CXYPadEx*>(guiCtrl);
235  CVuMeter* meter = dynamic_cast<CVuMeter*>(guiCtrl);
236 
237  if(meter)
238  {
239  continue;
240  }
241  else if(label)
242  {
243  label->setText(refGuiControl.getControlValueAsString().c_str());
244  label->invalid();
245  }
246  else if(oMenu)
247  {
248  // --- current rafx GUI Designer does not set max to anything
249  guiCtrl->setMin((float)refGuiControl.getGUIMin());
250  guiCtrl->setMax((float)refGuiControl.getGUIMin());
251 
252  // --- load for first time, NOT dynamic loading here
253  oMenu->removeAllEntry();
254 
255  for (uint32_t i = 0; i < refGuiControl.getStringCount(); i++)
256  {
257  oMenu->addEntry(refGuiControl.getStringByIndex(i).c_str());
258  }
259 
260  oMenu->setValue((float)refGuiControl.getControlValue());
261  }
262  else if(xyPad)
263  {
264  float x = 0.f;
265  float y = 0.f;
266  xyPad->calculateXY(xyPad->getValue(), x, y);
267 
268  // --- retrieve the X and Y tags on the CXYPadEx
269  int32_t tagX = xyPad->getTagX();
270  int32_t tagY = xyPad->getTagY();
271 
272  if(tagX == refGuiControl.getControlID())
274  if(tagY == refGuiControl.getControlID())
276 
277  if(tagX >= 0 && tagY >= 0 && !guiCtrl->isEditing())
278  xyPad->setValue(xyPad->calculateValue(x, y));
279  }
280  else if(!guiCtrl->isEditing())
281  guiCtrl->setValueNormalized((float)refGuiControl.getControlValueNormalized());
282 
283  guiCtrl->invalid();
284  }
285  }
286  }
287 
293 
297  int32_t getControlID(){ return refGuiControl.getControlID(); }
298 
303  inline bool controlAndContainerVisible(CControl* ctrl)
304  {
305  if(!ctrl) return false;
306 
307  bool stickyVisible = ctrl->isVisible();
308 
309  if(!stickyVisible)
310  return false;
311 
312  // --- check parents
313  CView* parent = ctrl->getParentView();
314  while(parent)
315  {
316  stickyVisible = parent->isVisible();
317  if(!stickyVisible)
318  return false;
319 
320  parent = parent->getParentView();
321  }
322  return stickyVisible;
323  }
324 
330  int getControlID_WithMouseCoords(const CPoint& where)
331  {
332  CPoint mousePoint = where;
333 
334  for(std::vector<CControl*>::iterator it = guiControls.begin(); it != guiControls.end(); ++it)
335  {
336  CControl* ctrl = *it;
337  if(ctrl && controlAndContainerVisible(ctrl))
338  {
339  CPoint point = ctrl->frameToLocal(mousePoint);
340  CRect rect = ctrl->getViewSize();
341  if(rect.pointInside(point))
342  {
343  int tag = ctrl->getTag();
344  if(isReservedTag(tag))
345  return -1;
346  else
347  return tag;
348  }
349  }
350  }
351  return -1;
352  }
353 
359  CControl* getControl_WithMouseCoords(const CPoint& where)
360  {
361  CPoint mousePoint = where;
362 
363  for(std::vector<CControl*>::iterator it = guiControls.begin(); it != guiControls.end(); ++it)
364  {
365  CControl* ctrl = *it;
366  if(ctrl && controlAndContainerVisible(ctrl))
367  {
368  CPoint point = ctrl->frameToLocal(mousePoint);
369  CRect rect = ctrl->getViewSize();
370  if(rect.pointInside(point))
371  return ctrl;
372  }
373  }
374  return nullptr;
375  }
376 
377 protected:
379  std::vector<CControl*> guiControls;
380  bool hasRefGuiControl = false;
381  bool isControlListener = false;
382 };
383 
384 
410 class PluginGUI : public IController,
411  public IViewAddedRemovedObserver,
412  public IMouseObserver,
413  public IKeyboardHook,
414  public VSTGUIEditorInterface,
415  public CBaseObject,
416  public IGUIView
417 {
418 
419 public:
421  PluginGUI(UTF8StringPtr _xmlFile);
422 
424  virtual ~PluginGUI();
425 
427  bool open(UTF8StringPtr _viewName,
428  void* parent,
429  const std::vector<PluginParameter*>* pluginParameterPtr,
430  const PlatformType& platformType = kDefaultNative,
431  IGUIPluginConnector* _guiPluginConnector = nullptr,
432  void* data = nullptr);
433 
435  void close();
436 
438  void syncGUIControl(uint32_t controlID);
439 
441  void getSize(float& width, float& height);
442 
444  void scaleGUISize(uint32_t controlValue);
445 
447  void writeToPresetFile();
448 
449 protected:
451  virtual void idle();
452 
454  void preCreateGUI();
455 
457  bool createGUI(bool bShowGUIEditor);
458 
460  void save(bool saveAs = false);
461 
463  virtual int32_t getKnobMode() const override;
464 
467  {
468  for(std::vector<PluginParameter*>::iterator it = pluginParameters.begin(); it != pluginParameters.end(); ++it) {
469  delete *it;
470  }
471  pluginParameters.clear();
472  }
473 
482  {
483  for(std::vector<PluginParameter*>::iterator it = pluginParameters.begin(); it != pluginParameters.end(); ++it) {
484  PluginParameter* ctrl = *it;
485  if(ctrl->getControlID() == tag)
486  return ctrl;
487  }
488  return nullptr;
489  }
490 
491  // --- protected variables
493  UIDescription* description = nullptr;
494  std::string viewName;
495  std::string xmlFile;
496 
497  uint32_t numUIControls = 0;
498  double zoomFactor = 1.0;
499  CVSTGUITimer* timer;
500 
501  CPoint minSize;
502  CPoint maxSize;
503  CRect nonEditRect;
504 
505  // --- flags for showing view
506  bool showGUIEditor = false;
507  bool createNewView = true;
508 
511  float guiWidth;
512  float guiHeight;
513 
515  CFrame* guiEditorFrame = nullptr;
516  uint32_t knobAction = kLinearMode;
517 
519  std::string getGUIDesignerSize();
520 
522  int getControlID_WithMouseCoords(const CPoint& where);
523 
525  CControl* getControl_WithMouseCoords(const CPoint& where);
526 
528  CMouseEventResult sendAAXMouseDown(int controlID, const CButtonState& buttons);
529 
531  CMouseEventResult sendAAXMouseMoved(int controlID, const CButtonState& buttons, const CPoint& where);
532 
534  CMouseEventResult sendAUMouseDown(CControl* control, const CButtonState& buttons);
535 
537  CMouseEventResult sendAUMouseMoved(CControl* control, const CButtonState& buttons, const CPoint& where) { return kMouseEventNotImplemented; }
538 
550  void setPluginParameterFromGUIControl(CControl* control, int tag, float actualValue, float normalizedValue)
551  {
552 #ifdef AUPLUGIN
553  setAUEventFromGUIControl(control, tag, actualValue);
554 #endif
555 
556 #ifdef AAXPLUGIN
557  setAAXParameterFromGUIControl(control, tag, actualValue, normalizedValue);
558 #endif
559 
560 #ifdef VSTPLUGIN
561  setVSTParameterFromGUIControl(control, tag, actualValue, normalizedValue);
562 #endif
563 
564 #ifdef RAFXPLUGIN
565  setRAFXParameterFromGUIControl(control, tag, actualValue, normalizedValue);
566 #endif
567 }
568 
572 #ifdef AAXPLUGIN
573 public:
578  void setAAXViewContainer(AAX_IViewContainer* _aaxViewContainer){ aaxViewContainer = _aaxViewContainer;}
579 
581  void setAAXParameterFromGUIControl(CControl* control, int tag, float actualValue, float normalizedValue);
582 
584  void updateGUIControlAAX(int tag, float actualPluginValue, float normalizedValue = 0.f, bool useNormalized = false);
585 protected:
586 #endif
587 
588 
589 #ifdef AUPLUGIN
590  AudioUnit m_AU;
591  AUEventListenerRef AUEventListener;
592 
593 public:
595  void dispatchAUControlChange(int tag, float actualPluginValue, int message = -1, bool fromEventListener = false);
596 
600  void setAU(AudioUnit inAU){m_AU = inAU;}
601 
602 protected:
604  void setAUEventFromGUIControl(CControl* control, int tag, float normalizedValue);
605 #endif
606 
607 #ifdef VSTPLUGIN
608 
609  void setVSTParameterFromGUIControl(CControl* control, int tag, float actualValue, float normalizedValue);
610 
612  void updateGUIControlVST(int tag, float normalizedValue);
613 #endif
614 
615 #ifdef RAFXPLUGIN
616 
617  void setRAFXParameterFromGUIControl(CControl* control, int tag, float actualValue, float normalizedValue);
618 
620  void updateGUIControlRAFX(int tag, float normalizedValue);
621 #endif
622 
623 
624 public:
626  CMessageResult notify(CBaseObject* sender, IdStringPtr message) override;
627 
629  virtual void valueChanged(VSTGUI::CControl* pControl) override;
630 
632  virtual int32_t controlModifierClicked(VSTGUI::CControl* pControl, VSTGUI::CButtonState button) override { return 0; }
633 
635  virtual void controlBeginEdit(VSTGUI::CControl* pControl) override;
636 
638  virtual void controlEndEdit(VSTGUI::CControl* pControl) override;
639 
641  virtual void controlTagWillChange(VSTGUI::CControl* pControl) override;
642 
644  virtual void controlTagDidChange(VSTGUI::CControl* pControl) override;
645 #if DEBUG
646 
647  virtual char controlModifierClicked(VSTGUI::CControl* pControl, long button) { return 0; }
648 #endif
649 
651  CView* createUserCustomView(std::string viewname, const CRect rect, IControlListener* listener, int32_t tag);
652 
654  CView* createView(const UIAttributes& attributes, const IUIDescription* description) override;
655 
657  IController* createSubController(UTF8StringPtr name, const IUIDescription* description) override;
658 
660  ControlUpdateReceiver* getControlUpdateReceiver(int32_t tag) const;
661 
663  void onViewAdded(CFrame* frame, CView* view) override {}
664 
666  void onViewRemoved(CFrame* frame, CView* view) override;
667 
669  void onMouseEntered(CView* view, CFrame* frame) override {}
670 
672  void onMouseExited(CView* view, CFrame* frame) override {}
673 
675  CMouseEventResult onMouseDown(CFrame* frame, const CPoint& where, const CButtonState& buttons) override;
676 
678  CMouseEventResult onMouseMoved(CFrame* frame, const CPoint& where, const CButtonState& buttons) override;
679 
681  int32_t onKeyDown(const VstKeyCode& code, CFrame* frame) override { return -1; }
682 
684  int32_t onKeyUp(const VstKeyCode& code, CFrame* frame) override { return -1; }
685 
692  virtual void setGUIWindowFrame(IGUIWindowFrame* frame) override
693  {
694  // --- we keep for resiging here
695  guiWindowFrame = frame;
696  }
697 
703  inline static bool parseSize (const std::string& str, CPoint& point)
704  {
705  size_t sep = str.find (',', 0);
706  if (sep != std::string::npos)
707  {
708  point.x = strtol (str.c_str (), 0, 10);
709  point.y = strtol (str.c_str () + sep+1, 0, 10);
710  return true;
711  }
712  return false;
713  }
714 
715  // --- for Meters only right now, but could be used to mark any control as writeable
723  bool hasWriteableControl(CControl* control)
724  {
725  return std::find (writeableControls.begin (), writeableControls.end (), control) != writeableControls.end ();
726  }
727 
734  void checkAddWriteableControl(PluginParameter* piParam, CControl* control)
735  {
736  if(!piParam)
737  return;
738  if(!control)
739  return;
740  if(!piParam->getIsWritable())
741  return;
742  if(!hasWriteableControl(control))
743  {
744  writeableControls.push_back(control);
745  control->remember();
746  }
747  }
748 
754  void checkRemoveWriteableControl(CControl* control)
755  {
756  if(!hasWriteableControl(control)) return;
757 
758  for(std::vector<CControl*>::iterator it = writeableControls.begin(); it != writeableControls.end(); ++it)
759  {
760  CControl* ctrl = *it;
761  if(ctrl == control)
762  {
763  ctrl->forget();
764  writeableControls.erase(it);
765  return;
766  }
767  }
768  }
769 
770 
775  {
776  for (ControlUpdateReceiverMap::const_iterator it = controlUpdateReceivers.begin(), end = controlUpdateReceivers.end(); it != end; ++it)
777  {
778  delete it->second;
779  }
780  controlUpdateReceivers.clear();
781  }
782 
787  {
788  for (std::vector<CControl*>::iterator it = writeableControls.begin(); it != writeableControls.end(); ++it)
789  {
790  CControl* ctrl = *it;
791  ctrl->forget();
792  }
793  writeableControls.clear();
794  }
795 
803  bool hasICustomView(CView* view)
804  {
805  ICustomView* customView = dynamic_cast<ICustomView*>(view);
806  if (customView)
807  return true;
808  return false;
809  }
810 
818  bool hasICustomView(IController* subController)
819  {
820  ICustomView* customView = dynamic_cast<ICustomView*>(subController);
821  if (customView)
822  return true;
823  return false;
824  }
825 
826 private:
827  typedef std::map<int32_t, ControlUpdateReceiver*> ControlUpdateReceiverMap;
828  ControlUpdateReceiverMap controlUpdateReceivers;
829  std::vector<CControl*> writeableControls;
830  std::vector<PluginParameter*> pluginParameters;
831 
832 #ifdef AAXPLUGIN
833  AAX_IViewContainer* aaxViewContainer = nullptr;
834 #endif
835 };
836 
837 }
838 
839 #endif
double getControlValue()
the main function to access the underlying atomic double value
Definition: pluginparameter.h:167
CVSTGUITimer * timer
timer object (this is platform dependent)
Definition: plugingui.h:499
IGUIPluginConnector * guiPluginConnector
the plugin shell interface that arrives with the open( ) function; OK if NULL for standalone GUIs ...
Definition: plugingui.h:492
void checkAddWriteableControl(PluginParameter *piParam, CControl *control)
check to see if we already store this meter control and add it if we don&#39;t
Definition: plugingui.h:734
bool hasICustomView(IController *subController)
simple helper function to test sub-controller for ICustomView
Definition: plugingui.h:818
IGUIWindowFrame * guiWindowFrame
interface to allow plugin shell to resize our window
Definition: plugingui.h:514
CControl * getControl_WithMouseCoords(const CPoint &where)
Definition: plugingui.h:359
virtual void setValue(float val) override
Definition: customcontrols.cpp:1189
const PluginParameter getGuiControl()
Definition: plugingui.h:292
The PluginGUI object that maintains the entire GUI operation and has #defines to use with AAX...
Definition: plugingui.h:410
bool createGUI(bool bShowGUIEditor)
creates either the GUI or the GUI Designer
Definition: plugingui.cpp:752
void updateControlsWithControl(CControl *control)
Definition: plugingui.h:189
~ControlUpdateReceiver()
Definition: plugingui.h:99
uint32_t numUIControls
control counter
Definition: plugingui.h:497
void save(bool saveAs=false)
save GUI state in XML file
Definition: plugingui.cpp:884
float getActualValueWithNormalizedValue(float normalizedValue)
Definition: plugingui.h:172
virtual void controlEndEdit(VSTGUI::CControl *pControl) override
end of control/auomation notification
Definition: plugingui.cpp:1607
void getSize(float &width, float &height)
returns the size into the pass-by-reference variables
Definition: plugingui.cpp:438
PluginGUI(UTF8StringPtr _xmlFile)
PluginGUI constructor; note that this maintains both Mac and Windows contexts, the bundle ref for Mac...
Definition: plugingui.cpp:136
double getControlValueNormalized()
get control value as normalied value
Definition: pluginparameter.h:279
void removeControl(CControl *control)
Definition: plugingui.h:139
provided by AVID in the VSTGUI example in SDK
bool getIsWritable()
query writable control (meter)
Definition: pluginparameter.h:152
void syncGUIControl(uint32_t controlID)
safely sets the GUI control value based on the plugin parameter value
Definition: plugingui.cpp:380
uint32_t getControlID()
get ID value
Definition: pluginparameter.h:81
std::string getGUIDesignerSize()
get size string
Definition: plugingui.cpp:991
std::string getControlValueAsString()
the main function to access the underlying atomic double value as a string
Definition: pluginparameter.cpp:227
void scaleGUISize(uint32_t controlValue)
scales the GUI; this is the handler for the special scaling GUI control
Definition: plugingui.cpp:451
double getGUIMin()
Definition: pluginparameter.h:345
void deleteGUIControlList()
Definition: plugingui.h:466
bool showGUIEditor
show the GUI designer
Definition: plugingui.h:506
double guiDesignerWidth
GUI Designer&#39;s frame size.
Definition: plugingui.h:509
void onViewRemoved(CFrame *frame, CView *view) override
called before GUI control is removed from the view
Definition: plugingui.cpp:2455
double zoomFactor
scaling factor for built-in scaling
Definition: plugingui.h:498
CMouseEventResult sendAUMouseDown(CControl *control, const CButtonState &buttons)
mouse down handler for AU automation
Definition: plugingui.cpp:1141
void addControl(CControl *control)
Definition: plugingui.h:120
bool hasWriteableControl(CControl *control)
check to see if we already store this meter control
Definition: plugingui.h:723
bool controlAndContainerVisible(CControl *ctrl)
Definition: plugingui.h:303
void preCreateGUI()
one-time pre-create init, currently used for AU only
Definition: plugingui.cpp:682
CRect nonEditRect
non-edit area for GUI designer
Definition: plugingui.h:503
void updateControlsWithNormalizedValue(float normalizedValue, CControl *control=nullptr)
Definition: plugingui.h:198
int getControlID_WithMouseCoords(const CPoint &where)
control finder, for AAX only, part of Pro Tools automation keyboard shortcut
Definition: plugingui.cpp:1016
bool controlInRxGroupIsEditing()
Definition: plugingui.h:157
std::string getStringByIndex(uint32_t index)
get string-list string by index
Definition: pluginparameter.cpp:281
float getNormalizedValueWithActualValue(float actualValue)
Definition: plugingui.h:181
CFrame * guiEditorFrame
pointer to our frame
Definition: plugingui.h:515
CMouseEventResult sendAUMouseMoved(CControl *control, const CButtonState &buttons, const CPoint &where)
Definition: plugingui.h:537
float guiWidth
embedded GUI size
Definition: plugingui.h:511
void close()
prepares the GUI control objects for destruction, cleans up
Definition: plugingui.cpp:338
int32_t onKeyDown(const VstKeyCode &code, CFrame *frame) override
Definition: plugingui.h:681
CPoint minSize
the min size of the GUI window
Definition: plugingui.h:501
Custom interface so that GUI can pass information to plugin shell in a thread-safe manner...
Definition: pluginstructures.h:1219
float guiHeight
embedded GUI size
Definition: plugingui.h:512
double getControlValueWithNormalizedValue(double normalizedValue, bool applyTaper=true)
get the new control value as if it were set with a normalized value
Definition: pluginparameter.h:305
Custom View interface to allow plugin core to create safe communication channels with GUI custom view...
Definition: pluginstructures.h:1141
bool hasRefGuiControl
internal flag
Definition: plugingui.h:380
virtual void controlTagDidChange(VSTGUI::CControl *pControl) override
called when a control is being created on the GUI (step 2)
Definition: plugingui.cpp:1663
bool isReservedTag(int tag)
check to see if a tag is reserved: ASPiK defines several reserved control ID values.
Definition: guiconstants.h:49
Definition: customcontrols.cpp:20
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:514
std::string viewName
name
Definition: plugingui.h:494
size_t getStringCount()
get the number of individual strings in a string-list control
Definition: pluginparameter.h:227
void setControlValue(double actualParamValue, bool ignoreSmoothing=false)
the main function to set the underlying atomic double value
Definition: pluginparameter.h:175
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:1757
int getControlID_WithMouseCoords(const CPoint &where)
Definition: plugingui.h:330
uint32_t knobAction
knob mode
Definition: plugingui.h:516
CMessageResult notify(CBaseObject *sender, IdStringPtr message) override
incoming VSTGUI4 message handler
Definition: plugingui.cpp:1325
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:1454
double getDefaultValueNormalized()
get default value as normalied value
Definition: pluginparameter.h:253
void onMouseEntered(CView *view, CFrame *frame) override
Definition: plugingui.h:669
virtual void controlBeginEdit(VSTGUI::CControl *pControl) override
start of control/auomation notification
Definition: plugingui.cpp:1576
void onMouseExited(CView *view, CFrame *frame) override
Definition: plugingui.h:672
ControlUpdateReceiver(CControl *control, PluginParameter *pluginParameterPtr, bool _isControlListener)
Definition: plugingui.h:87
CControl * getControl_WithMouseCoords(const CPoint &where)
control finder, for AAX only, part of Pro Tools automation keyboard shortcut
Definition: plugingui.cpp:1041
The ControlUpdateReceiver object is the connection mechanism between PluginParameter objects and thei...
Definition: plugingui.h:83
bool open(UTF8StringPtr _viewName, void *parent, const std::vector< PluginParameter *> *pluginParameterPtr, const PlatformType &platformType=kDefaultNative, IGUIPluginConnector *_guiPluginConnector=nullptr, void *data=nullptr)
creates the GUI control objects, creates outer frame, inserts contents into window ...
Definition: plugingui.cpp:221
base class interface file for ASPiK pluginparameter object
bool hasICustomView(CView *view)
simple helper function to test view for ICustomView
Definition: plugingui.h:803
int32_t onKeyUp(const VstKeyCode &code, CFrame *frame) override
Definition: plugingui.h:684
bool hasControl(CControl *control)
Definition: plugingui.h:112
CMouseEventResult sendAAXMouseMoved(int controlID, const CButtonState &buttons, const CPoint &where)
mouse moved handler for Pro Tools keyboard shortcuts
Definition: plugingui.cpp:1106
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:2432
virtual ~PluginGUI()
PluginGUI destructor.
Definition: plugingui.cpp:189
std::vector< CControl * > guiControls
list of controls that share the control tag with this one
Definition: plugingui.h:379
The PluginParameter object stores all of the data needed for any type of plugin parameter. It is a large object, but it is not complex as it really just stores LOTS of information about plugin parameters.
Definition: pluginparameter.h:51
virtual void setGUIWindowFrame(IGUIWindowFrame *frame) override
set the interface pointer for resizing from the GUI
Definition: plugingui.h:692
interface file for ASPiK custom control objects (knobs, buttons, meters, etc...)
Custom interface to allow resizing of GUI window; this is mainly used for the GUI designer...
Definition: pluginstructures.h:1200
void initControl(CControl *control)
Definition: plugingui.h:206
bool createNewView
show the normal GUI
Definition: plugingui.h:507
Custom interface to allow resizing of GUI window; this is mainly used for the GUI designer...
Definition: pluginstructures.h:1176
CMouseEventResult onMouseDown(CFrame *frame, const CPoint &where, const CButtonState &buttons) override
message handler for mouse down event
Definition: plugingui.cpp:2516
virtual int32_t getKnobMode() const override
returns mode
Definition: plugingui.cpp:972
double guiDesignerHeight
GUI Designer&#39;s frame size.
Definition: plugingui.h:510
The CXYPadEx object extends the CXYPad CVuMeter object with extra functionality. It is used in the Pl...
Definition: customcontrols.h:545
void onViewAdded(CFrame *frame, CView *view) override
Definition: plugingui.h:663
static bool parseSize(const std::string &str, CPoint &point)
simple helper function to get size from string
Definition: plugingui.h:703
PluginParameter * getGuiControlWithTag(int tag)
find the local PluginParameter that is connected to the same control ID
Definition: plugingui.h:481
double getNormalizedControlValueWithActualValue(double actualValue)
get the new normalized control value as if it were set with an actual value
Definition: pluginparameter.h:342
UIDescription * description
the description version of the XML file
Definition: plugingui.h:493
void deleteControlUpdateReceivers()
delete all reciever objects
Definition: plugingui.h:774
CMouseEventResult onMouseMoved(CFrame *frame, const CPoint &where, const CButtonState &buttons) override
message handler for mouse move event
Definition: plugingui.cpp:2577
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:1795
void checkRemoveWriteableControl(CControl *control)
check to see if we already store this meter control and remove it if we do
Definition: plugingui.h:754
PluginParameter refGuiControl
single parameter with this control tag
Definition: plugingui.h:378
void setPluginParameterFromGUIControl(CControl *control, int tag, float actualValue, float normalizedValue)
safely set a plugin shell parameter with a GUI control
Definition: plugingui.h:550
CMouseEventResult sendAAXMouseDown(int controlID, const CButtonState &buttons)
mouse down handler for Pro Tools keyboard shortcuts
Definition: plugingui.cpp:1072
IController * createSubController(UTF8StringPtr name, const IUIDescription *description) override
for advanced users: you can create and even register sub-controllers here
Definition: plugingui.cpp:2401
bool isControlListener
internal flag
Definition: plugingui.h:381
void forgetWriteableControls()
forget all writeable (neter) controls
Definition: plugingui.h:786
int32_t getControlID()
Definition: plugingui.h:297
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:1639
virtual void idle()
perform idling operation; called directly from timer thread
Definition: plugingui.cpp:646
CPoint maxSize
the max size of the GUI window
Definition: plugingui.h:502
std::string xmlFile
the XML file name
Definition: plugingui.h:495
void updateControlsWithActualValue(float actualValue, CControl *control=nullptr)
Definition: plugingui.h:216
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:632