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