Vuo  2.0.0
VuoInputEditorTransform.hh
Go to the documentation of this file.
1 
10 #pragma once
11 
12 #include "VuoDoubleSpinBox.hh"
14 
15 extern "C" {
16 #include "VuoTransform.h"
17 #include "VuoReal.h"
18 }
19 
24 {
25  Q_OBJECT
26  Q_PLUGIN_METADATA(IID "org.vuo.inputEditor" FILE "VuoInputEditorTransform.json")
27  Q_INTERFACES(VuoInputEditorFactory)
28 
29 public:
30  virtual VuoInputEditor * newInputEditor(void);
31 };
32 
52 {
53  Q_OBJECT
54 
55 protected:
56  void setUpDialog(QDialog &dialog, json_object *originalValue, json_object *details);
58 
62  virtual bool supportsTabbingBetweenPorts(void) { return true; }
63 
64 private:
65 
66  VuoTransform currentTransform;
67 
68  enum coord
69  {
70  xTranslation,
71  yTranslation,
72  zTranslation,
73  xRotation,
74  yRotation,
75  zRotation,
76  xScale,
77  yScale,
78  zScale
79  };
80 
81  map<coord, double> suggestedMinForCoord;
82  map<coord, double> suggestedMaxForCoord;
83  map<coord, double> suggestedStepForCoord;
84 
85  map<coord, QSlider *> sliderForCoord;
86  map<coord, VuoDoubleSpinBox *> spinboxForCoord;
87 
88  coord getCoordFromQObject(QObject* sender);
89  void setCoordMap(map<coord, double>* coordMap, VuoTransform transform);
90  void setTransformProperty(coord whichCoord, double value);
91 
92  VuoDoubleSpinBox* initSpinBox(coord whichCoord, QDialog& dialog, double initialValue);
93  QSlider* initSlider(coord c, QDialog& dialog, double initialValue);
94 
95 private slots:
96  void onSliderUpdate(int sliderValue);
97  void onSpinboxUpdate(QString spinboxValue);
98 };
99