martin@0
|
1 //-----------------------------------------------------------------------------
|
martin@0
|
2 // VSTGUI: Graphical User Interface Framework for VST plugins :
|
martin@0
|
3 //
|
martin@0
|
4 // Version 3.5
|
martin@0
|
5 //
|
martin@0
|
6 //-----------------------------------------------------------------------------
|
martin@0
|
7 // VSTGUI LICENSE
|
martin@0
|
8 // © 2008, Steinberg Media Technologies, All Rights Reserved
|
martin@0
|
9 //-----------------------------------------------------------------------------
|
martin@0
|
10 // Redistribution and use in source and binary forms, with or without modification,
|
martin@0
|
11 // are permitted provided that the following conditions are met:
|
martin@0
|
12 //
|
martin@0
|
13 // * Redistributions of source code must retain the above copyright notice,
|
martin@0
|
14 // this list of conditions and the following disclaimer.
|
martin@0
|
15 // * Redistributions in binary form must reproduce the above copyright notice,
|
martin@0
|
16 // this list of conditions and the following disclaimer in the documentation
|
martin@0
|
17 // and/or other materials provided with the distribution.
|
martin@0
|
18 // * Neither the name of the Steinberg Media Technologies nor the names of its
|
martin@0
|
19 // contributors may be used to endorse or promote products derived from this
|
martin@0
|
20 // software without specific prior written permission.
|
martin@0
|
21 //
|
martin@0
|
22 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
martin@0
|
23 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
martin@0
|
24 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
martin@0
|
25 // IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
martin@0
|
26 // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
martin@0
|
27 // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
martin@0
|
28 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
martin@0
|
29 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
martin@0
|
30 // OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
martin@0
|
31 // OF THE POSSIBILITY OF SUCH DAMAGE.
|
martin@0
|
32 //-----------------------------------------------------------------------------
|
martin@0
|
33
|
martin@0
|
34 #include "GUI.h"
|
martin@0
|
35 #include <stdio.h>
|
martin@0
|
36 #include <vstgui.h>
|
martin@0
|
37
|
martin@0
|
38
|
martin@0
|
39
|
martin@0
|
40
|
martin@0
|
41 //------------------------------------------------------------------------------------
|
martin@0
|
42 AEffGUIEditor* createEditor (AudioEffectX* effect)
|
martin@0
|
43 {
|
martin@0
|
44 return new MyEditor (effect);
|
martin@0
|
45 }
|
martin@0
|
46
|
martin@0
|
47 //------------------------------------------------------------------------------------
|
martin@0
|
48 MyEditor::MyEditor (void* ptr)
|
martin@0
|
49 : AEffGUIEditor (ptr)
|
martin@0
|
50 {
|
martin@0
|
51 //CBitmap* plugin_background = new CBitmap ("icme_plugin.png");
|
martin@0
|
52 rect.left = 0;
|
martin@0
|
53 rect.top = 0;
|
martin@0
|
54 rect.right = 545;//plugin_background->getWidth ();
|
martin@0
|
55 rect.bottom = 360;//plugin_background->getHeight ();
|
martin@0
|
56 }
|
martin@0
|
57
|
martin@0
|
58 //------------------------------------------------------------------------------------
|
martin@0
|
59 bool MyEditor::open (void* ptr)
|
martin@0
|
60 {
|
martin@0
|
61
|
martin@0
|
62 //Knob Images
|
martin@0
|
63 knob_360 = new CBitmap ("360_knob.png");
|
martin@0
|
64 knob_red = new CBitmap ("red_knob.png");
|
martin@0
|
65 knob_blue = new CBitmap ("blue_knob.png");
|
martin@0
|
66 knob_red_blue = new CBitmap ("red_blue_knob.png");
|
martin@0
|
67 knob_mode2 = new CBitmap ("mode2_knob.png");
|
martin@0
|
68 knob_mode4 = new CBitmap ("mode4_knob.png");
|
martin@0
|
69
|
martin@0
|
70 bRotations = new CBitmap ("rotations.png");
|
martin@0
|
71 bZoom = new CBitmap ("zoom.png");
|
martin@0
|
72 bStereo = new CBitmap ("stereo.png");
|
martin@0
|
73 bName = new CBitmap ("my_name.png");
|
martin@0
|
74
|
martin@0
|
75
|
martin@0
|
76 //-- first we create the frame
|
martin@0
|
77 //CBitmap* plugin_background = new CBitmap ("icme_plugin.png");
|
martin@0
|
78 //CRect frameSize (0, 0, plugin_background->getWidth (), plugin_background->getHeight ());
|
martin@0
|
79 frameSize (0, 0, 545, 360);
|
martin@0
|
80 CFrame* newFrame = new CFrame (frameSize, ptr, this);
|
martin@0
|
81 newFrame->setBackgroundColor (CColor(23,25,26,255)); //CColor(47,51,53,255)
|
martin@0
|
82
|
martin@0
|
83
|
martin@0
|
84
|
martin@0
|
85
|
martin@0
|
86
|
martin@0
|
87
|
martin@0
|
88 //-- IMPLEMENTATION OF SWITCHES AND KNOBS --//
|
martin@0
|
89 //-- TEXT DISPLAYES FOR SWITCHES AND KNOBS --//
|
martin@0
|
90 kDisplayText = CColor(255,255,255,255);//(R,G,B,Alpha)
|
martin@0
|
91 kDisplayBackground = CColor(94,102,106,255);//(R,G,B,Alpha)
|
martin@0
|
92 kLabelText = CColor(82,116,193,255);//(R,G,B,Alpha)
|
martin@0
|
93 kBlank = CColor(0,0,0,0);
|
martin@0
|
94
|
martin@0
|
95
|
martin@0
|
96 textDepth = 15;
|
martin@0
|
97 textDepthLarge = 20;
|
martin@0
|
98 labelOffset = -20;
|
martin@0
|
99 displayOffset = 7;
|
martin@0
|
100
|
martin@0
|
101
|
martin@0
|
102 //Transforms
|
martin@0
|
103 int transformsSep = 25;
|
martin@0
|
104 int transformsHoz = transformsSep;
|
martin@0
|
105 int transformsEl = 50;
|
martin@0
|
106 transformsDisplay(transformsHoz, transformsEl, transformsSep, newFrame);
|
martin@0
|
107
|
martin@0
|
108
|
martin@0
|
109
|
martin@0
|
110 //Zooming
|
martin@0
|
111 //int zoomHoz = transformsHoz+ 0.5*(knob_red_blue->getWidth()+transformsSep);
|
martin@0
|
112 //int zoomEl = transformsEl + textDepth + textDepthLarge + knob_red_blue->getHeight()/110+ 40 ;
|
martin@0
|
113 int zoomHoz = transformsHoz + 3*knob_red_blue->getWidth() + 6*transformsSep;
|
martin@0
|
114 int zoomEl = transformsEl;
|
martin@0
|
115 int zoomSep = transformsSep;
|
martin@0
|
116 zoomDisplay(zoomHoz, zoomEl, zoomSep, newFrame);
|
martin@0
|
117
|
martin@0
|
118
|
martin@0
|
119
|
martin@0
|
120 //Stereo Decoding
|
martin@0
|
121 int stereoHoz = transformsHoz;
|
martin@0
|
122 int stereoEl = transformsEl + knob_mode2->getHeight()/2 + displayOffset + textDepth + 2*transformsSep;
|
martin@0
|
123 int stereoSep = transformsSep;
|
martin@0
|
124 stereoDisplay(stereoHoz, stereoEl, stereoSep, newFrame);
|
martin@0
|
125
|
martin@0
|
126
|
martin@0
|
127 //My Name
|
martin@0
|
128 nameDisplay(stereoHoz, stereoEl, stereoSep, newFrame);
|
martin@0
|
129
|
martin@0
|
130
|
martin@0
|
131
|
martin@0
|
132
|
martin@0
|
133 //Stereo Plot
|
martin@0
|
134 // CRect size (20, 150, 50, 180);
|
martin@0
|
135 // CPoint offset (0, 0);
|
martin@0
|
136 // CBitmap* hPolarPlot = new CBitmap ("pink.png");
|
martin@0
|
137 //PolarPlot = new MyPlot(mySize, this, 0, pink, offset);
|
martin@0
|
138 //PolarPlot = new MyPlot;
|
martin@0
|
139
|
martin@0
|
140
|
martin@0
|
141
|
martin@0
|
142
|
martin@0
|
143 //Forget Images
|
martin@0
|
144 knob_360->forget();
|
martin@0
|
145 knob_red->forget();
|
martin@0
|
146 knob_blue->forget();
|
martin@0
|
147 knob_red_blue->forget();
|
martin@0
|
148 knob_mode2->forget();
|
martin@0
|
149 knob_mode4->forget();
|
martin@0
|
150
|
martin@0
|
151 bRotations->forget ();
|
martin@0
|
152 bZoom->forget ();
|
martin@0
|
153 bStereo->forget ();
|
martin@0
|
154 bName->forget ();
|
martin@0
|
155
|
martin@0
|
156
|
martin@0
|
157 //-- remember our controls so that we can sync them with the state of the effect
|
martin@0
|
158 controls[kRotate] = knobRotate;
|
martin@0
|
159 controls[kTilt] = knobTilt;
|
martin@0
|
160 controls[kTumble] = knobTumble;
|
martin@0
|
161 controls[kZoomMethod] = knobZoomMethod;
|
martin@0
|
162 controls[kZoom] = knobZoom;
|
martin@0
|
163 controls[kWidth] = knobWidth;
|
martin@0
|
164 controls[kPattern] = knobPattern;
|
martin@0
|
165 controls[kMode] = knobMode;
|
martin@0
|
166 controls[kRearVerb] = knobRearVerb;
|
martin@0
|
167 controls[kHiVerb] = knobHiVerb;
|
martin@0
|
168
|
martin@0
|
169
|
martin@0
|
170
|
martin@0
|
171
|
martin@0
|
172 //newFrame->addView (new LineStyleTestView (CRect (0, 0, 0, 0)));
|
martin@0
|
173
|
martin@0
|
174 //-- set the member frame to the newly created frame
|
martin@0
|
175 //-- we do it this way because it is possible that the setParameter method is called
|
martin@0
|
176 //-- in between of constructing the frame and it's controls
|
martin@0
|
177 frame = newFrame;
|
martin@0
|
178
|
martin@0
|
179 //-- sync parameters
|
martin@0
|
180 for (int i = 0; i < kNumParameters; i++)
|
martin@0
|
181 setParameter (i, effect->getParameter (i));
|
martin@0
|
182
|
martin@0
|
183
|
martin@0
|
184 return true;
|
martin@0
|
185 }
|
martin@0
|
186
|
martin@0
|
187
|
martin@0
|
188
|
martin@0
|
189 //------------------------------------------------------------------------------------
|
martin@0
|
190 void MyEditor::close ()
|
martin@0
|
191 {
|
martin@0
|
192 //-- on close we need to delete the frame object.
|
martin@0
|
193 //-- once again we make sure that the member frame variable is set to zero before we delete it
|
martin@0
|
194 //-- so that calls to setParameter won't crash.
|
martin@0
|
195
|
martin@0
|
196
|
martin@0
|
197 }
|
martin@0
|
198
|
martin@0
|
199
|
martin@0
|
200 //------------------------------------------------------------------------------------
|
martin@0
|
201 void MyEditor::transformsDisplay(int &transformsHoz, int &transformsEl, int &transformsSep, CFrame* newFrame)
|
martin@0
|
202 {
|
martin@0
|
203 CRect transSize = CRect (0, 0, bRotations->getWidth (),bRotations->getHeight ());
|
martin@0
|
204 transSize.offset(transformsHoz-transformsSep/2, transformsEl+labelOffset-textDepthLarge);
|
martin@0
|
205 CView* transforms_view = new CView (transSize);
|
martin@0
|
206 transforms_view->setBackground (bRotations);
|
martin@0
|
207 newFrame->addView (transforms_view);
|
martin@0
|
208
|
martin@0
|
209 //Rotate
|
martin@0
|
210 r (0, 0, knob_red_blue->getWidth (), knob_red_blue->getHeight () / 101);
|
martin@0
|
211 r.offset(transformsHoz, transformsEl);
|
martin@0
|
212 knobRotate = new CAnimKnob (r, this, kRotate, 101, knob_360->getHeight () / 101, knob_360, CPoint (0, 0));//101, 64,
|
martin@0
|
213 newFrame->addView (knobRotate);
|
martin@0
|
214 //knobRotate->forget ();
|
martin@0
|
215
|
martin@0
|
216 //Tilt
|
martin@0
|
217 r.offset(knob_red_blue->getWidth()+transformsSep, 0);
|
martin@0
|
218 knobTilt = new CAnimKnob (r, this, kTilt, 101, knob_360->getHeight () / 101, knob_360, CPoint (0, 0));
|
martin@0
|
219 newFrame->addView (knobTilt);
|
martin@0
|
220 //knobTilt->forget ();
|
martin@0
|
221
|
martin@0
|
222 //Tumble
|
martin@0
|
223 r.offset(knob_red_blue->getWidth()+transformsSep, 0);
|
martin@0
|
224 knobTumble = new CAnimKnob (r, this, kTumble, 101, knob_360->getHeight () / 101, knob_360, CPoint (0, 0));
|
martin@0
|
225 newFrame->addView (knobTumble);
|
martin@0
|
226 //knobTumble->forget ();
|
martin@0
|
227
|
martin@0
|
228
|
martin@0
|
229
|
martin@0
|
230
|
martin@0
|
231
|
martin@0
|
232
|
martin@0
|
233
|
martin@0
|
234
|
martin@0
|
235 //--CTextLabel--------------------------------------
|
martin@0
|
236 //Label Rotate
|
martin@0
|
237 LabelSize (0, 0, knob_red_blue->getWidth (), textDepth);
|
martin@0
|
238 LabelSize.offset (transformsHoz, transformsEl+labelOffset);
|
martin@0
|
239 CTextLabel* labelRotate = new CTextLabel (LabelSize, 0, 0, kCenterText);
|
martin@0
|
240 labelRotate->setFont (kNormalFontSmall);
|
martin@0
|
241 labelRotate->setFontColor (kLabelText);
|
martin@0
|
242 labelRotate->setBackColor (kBlank);
|
martin@0
|
243 labelRotate->setFrameColor (kBlank);
|
martin@0
|
244 labelRotate->setText("Rotate");
|
martin@0
|
245 newFrame->addView (labelRotate);
|
martin@0
|
246
|
martin@0
|
247 //Label Tilt
|
martin@0
|
248 LabelSize.offset (knob_red_blue->getWidth()+transformsSep, 0);
|
martin@0
|
249 CTextLabel* labelTilt = new CTextLabel (LabelSize, 0, 0, kCenterText);
|
martin@0
|
250 labelTilt->setFont (kNormalFontSmall);
|
martin@0
|
251 labelTilt->setFontColor (kLabelText);
|
martin@0
|
252 labelTilt->setBackColor (kBlank);
|
martin@0
|
253 labelTilt->setFrameColor (kBlank);
|
martin@0
|
254 labelTilt->setText("Tilt");
|
martin@0
|
255 newFrame->addView (labelTilt);
|
martin@0
|
256
|
martin@0
|
257 //Label Tumble
|
martin@0
|
258 LabelSize.offset (knob_red_blue->getWidth()+transformsSep, 0);
|
martin@0
|
259 CTextLabel* labelTumble = new CTextLabel (LabelSize, 0, 0, kCenterText);
|
martin@0
|
260 labelTumble->setFont (kNormalFontSmall);
|
martin@0
|
261 labelTumble->setFontColor (kLabelText);
|
martin@0
|
262 labelTumble->setBackColor (kBlank);
|
martin@0
|
263 labelTumble->setFrameColor (kBlank);
|
martin@0
|
264 labelTumble->setText("Tumble");
|
martin@0
|
265 newFrame->addView (labelTumble);
|
martin@0
|
266
|
martin@0
|
267
|
martin@0
|
268 //Label Section
|
martin@0
|
269 LabelSize (0, 0, knob_red_blue->getWidth ()*3 + transformsSep*2, textDepthLarge);
|
martin@0
|
270 LabelSize.offset (transformsHoz, transformsEl+labelOffset - textDepthLarge);
|
martin@0
|
271 CTextLabel* labelTransforms = new CTextLabel (LabelSize, 0, 0, kCenterText);
|
martin@0
|
272 labelTransforms->setFont (kNormalFontBig);
|
martin@0
|
273 labelTransforms->setFontColor (kLabelText);
|
martin@0
|
274 labelTransforms->setBackColor (kBlank);
|
martin@0
|
275 labelTransforms->setFrameColor (kBlank);
|
martin@0
|
276 labelTransforms->setText("Transforms");
|
martin@0
|
277 newFrame->addView (labelTransforms);
|
martin@0
|
278
|
martin@0
|
279
|
martin@0
|
280
|
martin@0
|
281
|
martin@0
|
282 //--CTextLabel--------------------------------------
|
martin@0
|
283 //Rotate Value
|
martin@0
|
284 DisplaySize (0, 0, knob_red_blue->getWidth (), textDepth);
|
martin@0
|
285 DisplaySize.offset (transformsHoz, transformsEl+knob_red_blue->getHeight()/110+displayOffset);
|
martin@0
|
286 paramRotate = new CTextLabel (DisplaySize, 0, 0, kCenterText);
|
martin@0
|
287 paramRotate->setHoriAlign(kCenterText);
|
martin@0
|
288 paramRotate->setFont (kNormalFontVerySmall);
|
martin@0
|
289 paramRotate->setFontColor (kDisplayText);
|
martin@0
|
290 paramRotate->setBackColor (kDisplayBackground);
|
martin@0
|
291 paramRotate->setFrameColor (kBlackCColor);
|
martin@0
|
292 newFrame->addView (paramRotate);
|
martin@0
|
293 paramRotate->setText("TEST");
|
martin@0
|
294
|
martin@0
|
295
|
martin@0
|
296 //Tilt Value
|
martin@0
|
297 DisplaySize.offset (knob_red_blue->getWidth()+transformsSep, 0);
|
martin@0
|
298 paramTilt = new CTextLabel (DisplaySize, 0, 0, kCenterText);
|
martin@0
|
299 paramTilt->setHoriAlign(kCenterText);
|
martin@0
|
300 paramTilt->setFont (kNormalFontVerySmall);
|
martin@0
|
301 paramTilt->setFontColor (kDisplayText);
|
martin@0
|
302 paramTilt->setBackColor (kDisplayBackground);
|
martin@0
|
303 paramTilt->setFrameColor (kBlackCColor);
|
martin@0
|
304 newFrame->addView (paramTilt);
|
martin@0
|
305
|
martin@0
|
306
|
martin@0
|
307 //Tumble Value
|
martin@0
|
308 DisplaySize.offset (knob_red_blue->getWidth()+transformsSep, 0);
|
martin@0
|
309 paramTumble = new CTextLabel (DisplaySize, 0, 0, kCenterText);
|
martin@0
|
310 paramTumble->setHoriAlign(kCenterText);
|
martin@0
|
311 paramTumble->setFont (kNormalFontVerySmall);
|
martin@0
|
312 paramTumble->setFontColor (kDisplayText);
|
martin@0
|
313 paramTumble->setBackColor (kDisplayBackground);
|
martin@0
|
314 paramTumble->setFrameColor (kBlackCColor);
|
martin@0
|
315 newFrame->addView (paramTumble);
|
martin@0
|
316 }
|
martin@0
|
317
|
martin@0
|
318
|
martin@0
|
319 //------------------------------------------------------------------------------------
|
martin@0
|
320 void MyEditor::zoomDisplay(int &zoomHoz, int &zoomEl, int &zoomSep, CFrame* newFrame)
|
martin@0
|
321 {
|
martin@0
|
322 CRect zoomSize = CRect (0, 0, bZoom->getWidth (),bZoom->getHeight ());
|
martin@0
|
323 zoomSize.offset(zoomHoz-zoomSep/2, zoomEl+labelOffset-textDepthLarge);
|
martin@0
|
324 CView* zoom_view = new CView (zoomSize);
|
martin@0
|
325 zoom_view->setBackground (bZoom);
|
martin@0
|
326 newFrame->addView (zoom_view);
|
martin@0
|
327
|
martin@0
|
328 //ZoomMethod
|
martin@0
|
329 CRect r (0, 0, knob_red_blue->getWidth (), knob_red_blue->getHeight () / 101);
|
martin@0
|
330 r.offset(zoomHoz, zoomEl);
|
martin@0
|
331 knobZoomMethod = new CHorizontalSwitch (r, this, kZoomMethod, 4, knob_mode4->getHeight () / 4, 4, knob_mode4, CPoint (0, 0));
|
martin@0
|
332 newFrame->addView (knobZoomMethod);
|
martin@0
|
333 //knobZoomMethod->forget ();
|
martin@0
|
334
|
martin@0
|
335 //Zoom
|
martin@0
|
336 r.offset(knob_mode4->getWidth()+zoomSep, 0);
|
martin@0
|
337 knobZoom = new CAnimKnob (r, this, kZoom, 101, knob_red_blue->getHeight () / 101, knob_red_blue, CPoint (0, 0));
|
martin@0
|
338 newFrame->addView (knobZoom);
|
martin@0
|
339 //knobZoom->forget ();
|
martin@0
|
340
|
martin@0
|
341
|
martin@0
|
342 //--CTextLabel--------------------------------------
|
martin@0
|
343 //Label ZoomMethod
|
martin@0
|
344 LabelSize (0, 0, knob_red_blue->getWidth (), textDepth);
|
martin@0
|
345 LabelSize.offset (zoomHoz, zoomEl+labelOffset);
|
martin@0
|
346 CTextLabel* labelZoomMethod = new CTextLabel (LabelSize, 0, 0, kCenterText);
|
martin@0
|
347 labelZoomMethod->setFont (kNormalFontSmall);
|
martin@0
|
348 labelZoomMethod->setFontColor (kLabelText);
|
martin@0
|
349 labelZoomMethod->setBackColor (kBlank);
|
martin@0
|
350 labelZoomMethod->setFrameColor (kBlank);
|
martin@0
|
351 labelZoomMethod->setText("Zoom Type");
|
martin@0
|
352 newFrame->addView (labelZoomMethod);
|
martin@0
|
353
|
martin@0
|
354 //Label Zoom
|
martin@0
|
355 LabelSize.offset (knob_mode4->getWidth()+zoomSep, 0);
|
martin@0
|
356 CTextLabel* labelZoom = new CTextLabel (LabelSize, 0, 0, kCenterText);
|
martin@0
|
357 labelZoom->setFont (kNormalFontSmall);
|
martin@0
|
358 labelZoom->setFontColor (kLabelText);
|
martin@0
|
359 labelZoom->setBackColor (kBlank);
|
martin@0
|
360 labelZoom->setFrameColor (kBlank);
|
martin@0
|
361 labelZoom->setText("Zoom");
|
martin@0
|
362 newFrame->addView (labelZoom);
|
martin@0
|
363
|
martin@0
|
364 //Label Section
|
martin@0
|
365 LabelSize (0, 0, knob_red_blue->getWidth ()*2 + zoomSep*1, textDepthLarge);
|
martin@0
|
366 LabelSize.offset (zoomHoz, zoomEl+labelOffset - textDepthLarge);
|
martin@0
|
367 CTextLabel* labelTransforms = new CTextLabel (LabelSize, 0, 0, kCenterText);
|
martin@0
|
368 labelTransforms->setFont (kNormalFontBig);
|
martin@0
|
369 labelTransforms->setFontColor (kLabelText);
|
martin@0
|
370 labelTransforms->setBackColor (kBlank);
|
martin@0
|
371 labelTransforms->setFrameColor (kBlank);
|
martin@0
|
372 labelTransforms->setText("Zooming");
|
martin@0
|
373 newFrame->addView (labelTransforms);
|
martin@0
|
374
|
martin@0
|
375
|
martin@0
|
376 //--CTextLabel--------------------------------------
|
martin@0
|
377 //Zoom Method
|
martin@0
|
378 DisplaySize (0, 0, knob_red_blue->getWidth (), textDepth);
|
martin@0
|
379 DisplaySize.offset (zoomHoz, zoomEl+knob_red_blue->getHeight()/110+displayOffset);
|
martin@0
|
380 paramZoomMethod = new CTextLabel (DisplaySize, 0, 0, kCenterText);
|
martin@0
|
381 paramZoomMethod->setHoriAlign(kCenterText);
|
martin@0
|
382 paramZoomMethod->setFont (kNormalFontVerySmall);
|
martin@0
|
383 paramZoomMethod->setFontColor (kDisplayText);
|
martin@0
|
384 paramZoomMethod->setBackColor (kDisplayBackground);
|
martin@0
|
385 paramZoomMethod->setFrameColor (kBlackCColor);
|
martin@0
|
386 newFrame->addView (paramZoomMethod);
|
martin@0
|
387
|
martin@0
|
388 //Zoom Value
|
martin@0
|
389 DisplaySize.offset (knob_red_blue->getWidth()+zoomSep, 0);
|
martin@0
|
390 paramZoom = new CTextLabel (DisplaySize, 0, 0, kCenterText);
|
martin@0
|
391 paramZoom->setHoriAlign(kCenterText);
|
martin@0
|
392 paramZoom->setFont (kNormalFontVerySmall);
|
martin@0
|
393 paramZoom->setFontColor (kDisplayText);
|
martin@0
|
394 paramZoom->setBackColor (kDisplayBackground);
|
martin@0
|
395 paramZoom->setFrameColor (kBlackCColor);
|
martin@0
|
396 newFrame->addView (paramZoom);
|
martin@0
|
397
|
martin@0
|
398 }
|
martin@0
|
399
|
martin@0
|
400
|
martin@0
|
401 //------------------------------------------------------------------------------------
|
martin@0
|
402 void MyEditor::stereoDisplay(int &stereoHoz, int &stereoEl, int &stereoSep, CFrame* newFrame)
|
martin@0
|
403 {
|
martin@0
|
404 CRect stereoSize = CRect (0, 0, bStereo->getWidth (),bStereo->getHeight ());
|
martin@0
|
405 stereoSize.offset(stereoHoz-stereoSep/2, stereoEl+labelOffset-textDepthLarge);
|
martin@0
|
406 CView* stereo_view = new CView (stereoSize);
|
martin@0
|
407 stereo_view->setBackground (bStereo);
|
martin@0
|
408 newFrame->addView (stereo_view);
|
martin@0
|
409
|
martin@0
|
410 //Mode
|
martin@0
|
411 r (0, 0, knob_mode2->getWidth (), knob_mode2->getHeight () / 2);
|
martin@0
|
412 r.offset(stereoHoz, stereoEl);
|
martin@0
|
413 knobMode = new CHorizontalSwitch (r, this, kMode, 2, knob_mode2->getHeight () / 2, 2, knob_mode2, CPoint (0, 0));
|
martin@0
|
414 newFrame->addView (knobMode);
|
martin@0
|
415 //knobMode->forget ();
|
martin@0
|
416
|
martin@0
|
417 //Width
|
martin@0
|
418 r.offset(knob_mode2->getWidth()+stereoSep, 0);
|
martin@0
|
419 knobWidth = new CAnimKnob (r, this, kWidth, 101, knob_red->getHeight () / 101, knob_red, CPoint (0, 0));
|
martin@0
|
420 newFrame->addView (knobWidth);
|
martin@0
|
421 //knobWidth->forget ();
|
martin@0
|
422
|
martin@0
|
423 //Pattern
|
martin@0
|
424 r.offset(knob_red_blue->getWidth()+stereoSep, 0);
|
martin@0
|
425 knobPattern = new CAnimKnob (r, this, kPattern, 101, knob_blue->getHeight () / 101, knob_blue, CPoint (0, 0));
|
martin@0
|
426 newFrame->addView (knobPattern);
|
martin@0
|
427 //knobPattern->forget ();
|
martin@0
|
428
|
martin@0
|
429 //RearVerb
|
martin@0
|
430 r.offset(knob_mode2->getWidth()+stereoSep*4, 0);
|
martin@0
|
431 knobRearVerb = new CAnimKnob (r, this, kRearVerb, 101, knob_red_blue->getHeight () / 101, knob_red, CPoint (0, 0));
|
martin@0
|
432 newFrame->addView (knobRearVerb);
|
martin@0
|
433 //knobRearVerb->forget ();
|
martin@0
|
434
|
martin@0
|
435 //HiVerb
|
martin@0
|
436 r.offset(knob_red_blue->getWidth()+stereoSep, 0);
|
martin@0
|
437 knobHiVerb = new CAnimKnob (r, this, kHiVerb, 101, knob_red_blue->getHeight () / 101, knob_blue, CPoint (0, 0));
|
martin@0
|
438 newFrame->addView (knobHiVerb);
|
martin@0
|
439 //knobHiVerb->forget ();
|
martin@0
|
440
|
martin@0
|
441
|
martin@0
|
442
|
martin@0
|
443
|
martin@0
|
444
|
martin@0
|
445
|
martin@0
|
446
|
martin@0
|
447
|
martin@0
|
448
|
martin@0
|
449 //--CTextLabel--------------------------------------
|
martin@0
|
450 //Label Mode
|
martin@0
|
451 LabelSize (0, 0, knob_red_blue->getWidth (), textDepth);
|
martin@0
|
452 LabelSize.offset (stereoHoz, stereoEl+labelOffset);
|
martin@0
|
453 CTextLabel* labelMode = new CTextLabel (LabelSize, 0, 0, kCenterText);
|
martin@0
|
454 labelMode->setFont (kNormalFontSmall);
|
martin@0
|
455 labelMode->setFontColor (kLabelText);
|
martin@0
|
456 labelMode->setBackColor (kBlank);
|
martin@0
|
457 labelMode->setFrameColor (kBlank);
|
martin@0
|
458 labelMode->setText("Mode");
|
martin@0
|
459 newFrame->addView (labelMode);
|
martin@0
|
460
|
martin@0
|
461 //Label Width
|
martin@0
|
462 LabelSize.offset (knob_red_blue->getWidth()+stereoSep, 0);
|
martin@0
|
463 CTextLabel* labelWidth = new CTextLabel (LabelSize, 0, 0, kCenterText);
|
martin@0
|
464 labelWidth->setFont (kNormalFontSmall);
|
martin@0
|
465 labelWidth->setFontColor (kLabelText);
|
martin@0
|
466 labelWidth->setBackColor (kBlank);
|
martin@0
|
467 labelWidth->setFrameColor (kBlank);
|
martin@0
|
468 labelWidth->setText("Width");
|
martin@0
|
469 newFrame->addView (labelWidth);
|
martin@0
|
470
|
martin@0
|
471 //Label Pattern
|
martin@0
|
472 LabelSize.offset (knob_red_blue->getWidth()+stereoSep, 0);
|
martin@0
|
473 CTextLabel* labelPattern = new CTextLabel (LabelSize, 0, 0, kCenterText);
|
martin@0
|
474 labelPattern->setFont (kNormalFontSmall);
|
martin@0
|
475 labelPattern->setFontColor (kLabelText);
|
martin@0
|
476 labelPattern->setBackColor (kBlank);
|
martin@0
|
477 labelPattern->setFrameColor (kBlank);
|
martin@0
|
478 labelPattern->setText("Pattern");
|
martin@0
|
479 newFrame->addView (labelPattern);
|
martin@0
|
480
|
martin@0
|
481 //Label RearVerb
|
martin@0
|
482 LabelSize.offset (knob_red_blue->getWidth()+stereoSep*4, 0);
|
martin@0
|
483 CTextLabel* labelRearVerb = new CTextLabel (LabelSize, 0, 0, kCenterText);
|
martin@0
|
484 labelRearVerb->setFont (kNormalFontSmall);
|
martin@0
|
485 labelRearVerb->setFontColor (kLabelText);
|
martin@0
|
486 labelRearVerb->setBackColor (kBlank);
|
martin@0
|
487 labelRearVerb->setFrameColor (kBlank);
|
martin@0
|
488 labelRearVerb->setText("RearVerb");
|
martin@0
|
489 newFrame->addView (labelRearVerb);
|
martin@0
|
490
|
martin@0
|
491 //Label HiVerb
|
martin@0
|
492 LabelSize.offset (knob_red_blue->getWidth()+stereoSep, 0);
|
martin@0
|
493 CTextLabel* labelHiVerb = new CTextLabel (LabelSize, 0, 0, kCenterText);
|
martin@0
|
494 labelHiVerb->setFont (kNormalFontSmall);
|
martin@0
|
495 labelHiVerb->setFontColor (kLabelText);
|
martin@0
|
496 labelHiVerb->setBackColor (kBlank);
|
martin@0
|
497 labelHiVerb->setFrameColor (kBlank);
|
martin@0
|
498 labelHiVerb->setText("HiVerb");
|
martin@0
|
499 newFrame->addView (labelHiVerb);
|
martin@0
|
500
|
martin@0
|
501
|
martin@0
|
502
|
martin@0
|
503
|
martin@0
|
504
|
martin@0
|
505
|
martin@0
|
506 //Label Section
|
martin@0
|
507 LabelSize (0, 0, knob_red_blue->getWidth ()*5 + stereoSep*7, textDepthLarge);
|
martin@0
|
508 LabelSize.offset (stereoHoz, stereoEl+labelOffset - textDepthLarge);
|
martin@0
|
509 CTextLabel* labelStereo = new CTextLabel (LabelSize, 0, 0, kCenterText);
|
martin@0
|
510 labelStereo->setFont (kNormalFontBig);
|
martin@0
|
511 labelStereo->setFontColor (kLabelText);
|
martin@0
|
512 labelStereo->setBackColor (kBlank);
|
martin@0
|
513 labelStereo->setFrameColor (kBlank);
|
martin@0
|
514 labelStereo->setText("Stereo Decoding & Reverb");
|
martin@0
|
515 newFrame->addView (labelStereo);
|
martin@0
|
516
|
martin@0
|
517
|
martin@0
|
518
|
martin@0
|
519
|
martin@0
|
520 //--CTextLabel--------------------------------------
|
martin@0
|
521 //Mode Value
|
martin@0
|
522 DisplaySize (0, 0, knob_red_blue->getWidth (), textDepth);
|
martin@0
|
523 DisplaySize.offset (stereoHoz, stereoEl+knob_red_blue->getHeight()/110+displayOffset);
|
martin@0
|
524 paramMode = new CTextLabel (DisplaySize, 0, 0, kCenterText);
|
martin@0
|
525 paramMode->setHoriAlign(kCenterText);
|
martin@0
|
526 paramMode->setFont (kNormalFontVerySmall);
|
martin@0
|
527 paramMode->setFontColor (kDisplayText);
|
martin@0
|
528 paramMode->setBackColor (kDisplayBackground);
|
martin@0
|
529 paramMode->setFrameColor (kBlackCColor);
|
martin@0
|
530 newFrame->addView (paramMode);
|
martin@0
|
531 paramMode->forget();
|
martin@0
|
532
|
martin@0
|
533 //Width Value
|
martin@0
|
534 DisplaySize.offset (knob_red_blue->getWidth()+stereoSep, 0);
|
martin@0
|
535 paramWidth = new CTextLabel (DisplaySize, 0, 0, kCenterText);
|
martin@0
|
536 paramWidth->setHoriAlign(kCenterText);
|
martin@0
|
537 paramWidth->setFont (kNormalFontVerySmall);
|
martin@0
|
538 paramWidth->setFontColor (kDisplayText);
|
martin@0
|
539 paramWidth->setBackColor (kDisplayBackground);
|
martin@0
|
540 paramWidth->setFrameColor (kBlackCColor);
|
martin@0
|
541 newFrame->addView (paramWidth);
|
martin@0
|
542 paramWidth->forget();
|
martin@0
|
543
|
martin@0
|
544 //Pattern Value
|
martin@0
|
545 DisplaySize.offset (knob_red_blue->getWidth()+stereoSep, 0);
|
martin@0
|
546 paramPattern = new CTextLabel (DisplaySize, 0, 0, kCenterText);
|
martin@0
|
547 paramPattern->setHoriAlign(kCenterText);
|
martin@0
|
548 paramPattern->setFont (kNormalFontVerySmall);
|
martin@0
|
549 paramPattern->setFontColor (kDisplayText);
|
martin@0
|
550 paramPattern->setBackColor (kDisplayBackground);
|
martin@0
|
551 paramPattern->setFrameColor (kBlackCColor);
|
martin@0
|
552 newFrame->addView (paramPattern);
|
martin@0
|
553 paramPattern->forget();
|
martin@0
|
554
|
martin@0
|
555 //RearVerb Value
|
martin@0
|
556 DisplaySize.offset (knob_red_blue->getWidth()+stereoSep*4, 0);
|
martin@0
|
557 paramRearVerb = new CTextLabel (DisplaySize, 0, 0, kCenterText);
|
martin@0
|
558 paramRearVerb->setHoriAlign(kCenterText);
|
martin@0
|
559 paramRearVerb->setFont (kNormalFontVerySmall);
|
martin@0
|
560 paramRearVerb->setFontColor (kDisplayText);
|
martin@0
|
561 paramRearVerb->setBackColor (kDisplayBackground);
|
martin@0
|
562 paramRearVerb->setFrameColor (kBlackCColor);
|
martin@0
|
563 newFrame->addView (paramRearVerb);
|
martin@0
|
564 paramRearVerb->forget();
|
martin@0
|
565
|
martin@0
|
566 //HiVerb Value
|
martin@0
|
567 DisplaySize.offset (knob_red_blue->getWidth()+stereoSep, 0);
|
martin@0
|
568 paramHiVerb = new CTextLabel (DisplaySize, 0, 0, kCenterText);
|
martin@0
|
569 paramHiVerb->setHoriAlign(kCenterText);
|
martin@0
|
570 paramHiVerb->setFont (kNormalFontVerySmall);
|
martin@0
|
571 paramHiVerb->setFontColor (kDisplayText);
|
martin@0
|
572 paramHiVerb->setBackColor (kDisplayBackground);
|
martin@0
|
573 paramHiVerb->setFrameColor (kBlackCColor);
|
martin@0
|
574 newFrame->addView (paramHiVerb);
|
martin@0
|
575 paramHiVerb->forget();
|
martin@0
|
576
|
martin@0
|
577 //ModeStereo Value
|
martin@0
|
578 DisplaySize.offset (-7*stereoSep-4*knob_red->getWidth(), 0);
|
martin@0
|
579 paramModeStereo = new CTextLabel (DisplaySize, 0, 0, kCenterText);
|
martin@0
|
580 paramModeStereo->setHoriAlign(kCenterText);
|
martin@0
|
581 paramModeStereo->setFont (kNormalFontVerySmall);
|
martin@0
|
582 paramModeStereo->setFontColor (kDisplayText);
|
martin@0
|
583 paramModeStereo->setBackColor (kDisplayBackground);
|
martin@0
|
584 paramModeStereo->setFrameColor (kBlackCColor);
|
martin@0
|
585 newFrame->addView (paramModeStereo);
|
martin@0
|
586 paramModeStereo->forget();
|
martin@0
|
587 }
|
martin@0
|
588
|
martin@0
|
589
|
martin@0
|
590
|
martin@0
|
591 //------------------------------------------------------------------------------------
|
martin@0
|
592 void MyEditor::nameDisplay(int &nameHoz, int &nameEl, int &nameSep, CFrame* newFrame)
|
martin@0
|
593 {
|
martin@0
|
594 CRect nameSize = CRect (0, 0, bName->getWidth (),bName->getHeight ());
|
martin@0
|
595 nameSize.offset(nameHoz-nameSep/2, nameEl+knob_mode2->getHeight()/2+displayOffset+textDepth+nameSep/2);
|
martin@0
|
596 CView* name_view = new CView (nameSize);
|
martin@0
|
597 name_view->setBackground (bName);
|
martin@0
|
598 newFrame->addView (name_view);
|
martin@0
|
599
|
martin@0
|
600 LabelSize (0, 0, 160, textDepth);
|
martin@0
|
601 LabelSize.offset(nameHoz, nameEl+knob_mode2->getHeight()/2+displayOffset+textDepth+nameSep/2+40);
|
martin@0
|
602 //LabelSize.offset (nameHoz, nameEl+labelOffset);
|
martin@0
|
603 CTextLabel *vendor_version = new CTextLabel(LabelSize, 0, 0, kLeftText);
|
martin@0
|
604
|
martin@0
|
605 char text[100];
|
martin@0
|
606 int i1=(int)floor(VERSION/1000.0);
|
martin@0
|
607 int i2= (int)floor((VERSION-i1*1000)/100.0);
|
martin@0
|
608 int i3= (int)floor((VERSION-i1*1000-i2*100)/10.0);
|
martin@0
|
609 int i4= (int)floor(VERSION-i1*1000-i2*100-i3*10);
|
martin@0
|
610 sprintf(text, "Version: %d.%d.%d.%d", i1, i2,i3,i4);
|
martin@0
|
611 vendor_version->setText(text);
|
martin@0
|
612 vendor_version->setFont (kNormalFontSmall);
|
martin@0
|
613 vendor_version->setFontColor (kLabelText);
|
martin@0
|
614 vendor_version->setHoriAlign(kLeftText);
|
martin@0
|
615 vendor_version->setBackColor (kBlank);
|
martin@0
|
616 vendor_version->setFrameColor (kBlank);
|
martin@0
|
617 newFrame->addView (vendor_version);
|
martin@0
|
618 vendor_version->forget();
|
martin@0
|
619
|
martin@0
|
620 LabelSize.offset(0, -20);
|
martin@0
|
621 bitMode = new CTextLabel(LabelSize, 0, 0, kLeftText);
|
martin@0
|
622 int b = effect->getParameter(50);
|
martin@0
|
623 sprintf(text,"Bit Mode: %d", b);
|
martin@0
|
624 bitMode->setText(text);
|
martin@0
|
625 bitMode->setFont (kNormalFontSmall);
|
martin@0
|
626 bitMode->setFontColor (kLabelText);
|
martin@0
|
627 bitMode->setHoriAlign(kLeftText);
|
martin@0
|
628 bitMode->setBackColor (kBlank);
|
martin@0
|
629 bitMode->setFrameColor (kBlank);
|
martin@0
|
630 newFrame->addView (bitMode);
|
martin@0
|
631
|
martin@0
|
632
|
martin@0
|
633
|
martin@0
|
634 }
|
martin@0
|
635
|
martin@0
|
636
|
martin@0
|
637
|
martin@0
|
638
|
martin@0
|
639 //------------------------------------------------------------------------------------
|
martin@0
|
640 void MyEditor::stereoPlot(int &plotHoz, int &plotEl)
|
martin@0
|
641 {
|
martin@0
|
642
|
martin@0
|
643 }
|
martin@0
|
644
|
martin@0
|
645
|
martin@0
|
646 //------------------------------------------------------------------------------------
|
martin@0
|
647 void MyEditor::suspendDisplay()
|
martin@0
|
648 {
|
martin@0
|
649 suspend = new CTextLabel(frameSize, 0, 0, kCenterText);
|
martin@0
|
650 suspend->setBackColor(CColor(23,25,26,150));
|
martin@0
|
651 suspend->setFont (kNormalFontVeryBig);
|
martin@0
|
652 suspend->setFontColor (CColor (255,255,255,255));
|
martin@0
|
653 suspend->setText("Currently Suspended");
|
martin@0
|
654 getFrame()->addView (suspend);
|
martin@0
|
655 }
|
martin@0
|
656
|
martin@0
|
657 //------------------------------------------------------------------------------------
|
martin@0
|
658 void MyEditor::resumeDisplay()
|
martin@0
|
659 {
|
martin@0
|
660 getFrame()->removeView(suspend);
|
martin@0
|
661 }
|
martin@0
|
662
|
martin@0
|
663
|
martin@0
|
664
|
martin@0
|
665 //------------------------------------------------------------------------------------
|
martin@0
|
666 void MyEditor::valueChanged (CControl* pControl)
|
martin@0
|
667 {
|
martin@0
|
668 //-- valueChanged is called whenever the user changes one of the controls in the User Interface (UI)
|
martin@0
|
669 effect->setParameterAutomated (pControl->getTag (), pControl->getValue ());
|
martin@0
|
670
|
martin@0
|
671 //Change the display directly by the knob. Not accurate due to the internal parameter not being used, so the value shown and internally used might not match.
|
martin@0
|
672 setParameter (pControl->getTag (), pControl->getValue ());
|
martin@0
|
673 }
|
martin@0
|
674
|
martin@0
|
675 //------------------------------------------------------------------------------------
|
martin@0
|
676 void MyEditor::setParameter (VstInt32 index, float value)
|
martin@0
|
677 {
|
martin@0
|
678 //paramModeStereo->setText("tits");
|
martin@0
|
679 //-- setParameter is called when the host automates one of the effects parameter.
|
martin@0
|
680 //-- The UI should reflect this state so we set the value of the control to the new value.
|
martin@0
|
681 //-- VSTGUI will automaticly redraw changed controls in the next idle (as this call happens to be in the process thread).
|
martin@0
|
682 if (frame && index < kNumParameters)
|
martin@0
|
683 { //First write the value into the GUI value container
|
martin@0
|
684 controls[index]->setValue (value);
|
martin@0
|
685
|
martin@0
|
686 //Call getParameterDisplay to get the char to display
|
martin@0
|
687 getParameterDisplay (index, &displayText);
|
martin@0
|
688 }
|
martin@0
|
689 else if (frame && index == 100) {
|
martin@0
|
690 suspendDisplay();
|
martin@0
|
691 }
|
martin@0
|
692 else if (frame && index == 101) {
|
martin@0
|
693 resumeDisplay();
|
martin@0
|
694 }
|
martin@0
|
695
|
martin@0
|
696
|
martin@0
|
697 }
|
martin@0
|
698
|
martin@0
|
699
|
martin@0
|
700 //------------------------------------------------------------------------
|
martin@0
|
701 void MyEditor::getParameterDisplay (VstInt32 index, char *text) //GET display value shown for Parameters
|
martin@0
|
702 {
|
martin@0
|
703 effect->getParameterDisplay(index, text);
|
martin@0
|
704 switch (index)
|
martin@0
|
705 {
|
martin@0
|
706 case kMode :
|
martin@0
|
707 paramModeStereo->setText(text);
|
martin@0
|
708 break;
|
martin@0
|
709 case kWidth:
|
martin@0
|
710 paramWidth->setText(text);
|
martin@0
|
711 break;
|
martin@0
|
712 case kPattern:
|
martin@0
|
713 paramPattern->setText(text);
|
martin@0
|
714 break;
|
martin@0
|
715 case kRotate :
|
martin@0
|
716 paramRotate->setText(text);
|
martin@0
|
717 break;
|
martin@0
|
718 case kTilt:
|
martin@0
|
719 paramTilt->setText(text);
|
martin@0
|
720 break;
|
martin@0
|
721 case kTumble:
|
martin@0
|
722 paramTumble->setText(text);
|
martin@0
|
723 break;
|
martin@0
|
724 case kZoom:
|
martin@0
|
725 paramZoom->setText(text);
|
martin@0
|
726 break;
|
martin@0
|
727 case kZoomMethod:
|
martin@0
|
728 paramZoomMethod->setText(text);
|
martin@0
|
729 break;
|
martin@0
|
730 case kRearVerb :
|
martin@0
|
731 paramRearVerb->setText(text);
|
martin@0
|
732 break;
|
martin@0
|
733 case kHiVerb :
|
martin@0
|
734 paramHiVerb->setText(text);
|
martin@0
|
735 break;
|
martin@0
|
736 }
|
martin@0
|
737 }
|
martin@0
|
738
|
martin@0
|
739
|
martin@0
|
740
|
martin@0
|
741
|
martin@0
|
742
|
martin@0
|
743
|
martin@0
|
744
|
martin@0
|
745
|
martin@0
|
746
|
martin@0
|
747
|
martin@0
|
748 //------------------------------------------------------------------------
|
martin@0
|
749 //------------------------------------------------------------------------
|
martin@0
|
750 //------------------------------------------------------------------------
|