martin@0: //----------------------------------------------------------------------------- martin@0: // VSTGUI: Graphical User Interface Framework for VST plugins : martin@0: // martin@0: // Version 3.5 martin@0: // martin@0: //----------------------------------------------------------------------------- martin@0: // VSTGUI LICENSE martin@0: // © 2008, Steinberg Media Technologies, All Rights Reserved martin@0: //----------------------------------------------------------------------------- martin@0: // Redistribution and use in source and binary forms, with or without modification, martin@0: // are permitted provided that the following conditions are met: martin@0: // martin@0: // * Redistributions of source code must retain the above copyright notice, martin@0: // this list of conditions and the following disclaimer. martin@0: // * Redistributions in binary form must reproduce the above copyright notice, martin@0: // this list of conditions and the following disclaimer in the documentation martin@0: // and/or other materials provided with the distribution. martin@0: // * Neither the name of the Steinberg Media Technologies nor the names of its martin@0: // contributors may be used to endorse or promote products derived from this martin@0: // software without specific prior written permission. martin@0: // martin@0: // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND martin@0: // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED martin@0: // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. martin@0: // IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, martin@0: // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, martin@0: // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, martin@0: // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF martin@0: // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE martin@0: // OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED martin@0: // OF THE POSSIBILITY OF SUCH DAMAGE. martin@0: //----------------------------------------------------------------------------- martin@0: martin@0: #include "GUI.h" martin@0: #include martin@0: #include martin@0: martin@0: martin@0: martin@0: martin@0: //------------------------------------------------------------------------------------ martin@0: AEffGUIEditor* createEditor (AudioEffectX* effect) martin@0: { martin@0: return new MyEditor (effect); martin@0: } martin@0: martin@0: //------------------------------------------------------------------------------------ martin@0: MyEditor::MyEditor (void* ptr) martin@0: : AEffGUIEditor (ptr) martin@0: { martin@0: //CBitmap* plugin_background = new CBitmap ("icme_plugin.png"); martin@0: rect.left = 0; martin@0: rect.top = 0; martin@0: rect.right = 545;//plugin_background->getWidth (); martin@0: rect.bottom = 360;//plugin_background->getHeight (); martin@0: } martin@0: martin@0: //------------------------------------------------------------------------------------ martin@0: bool MyEditor::open (void* ptr) martin@0: { martin@0: martin@0: //Knob Images martin@0: knob_360 = new CBitmap ("360_knob.png"); martin@0: knob_red = new CBitmap ("red_knob.png"); martin@0: knob_blue = new CBitmap ("blue_knob.png"); martin@0: knob_red_blue = new CBitmap ("red_blue_knob.png"); martin@0: knob_mode2 = new CBitmap ("mode2_knob.png"); martin@0: knob_mode4 = new CBitmap ("mode4_knob.png"); martin@0: martin@0: bRotations = new CBitmap ("rotations.png"); martin@0: bZoom = new CBitmap ("zoom.png"); martin@0: bStereo = new CBitmap ("stereo.png"); martin@0: bName = new CBitmap ("my_name.png"); martin@0: martin@0: martin@0: //-- first we create the frame martin@0: //CBitmap* plugin_background = new CBitmap ("icme_plugin.png"); martin@0: //CRect frameSize (0, 0, plugin_background->getWidth (), plugin_background->getHeight ()); martin@0: frameSize (0, 0, 545, 360); martin@0: CFrame* newFrame = new CFrame (frameSize, ptr, this); martin@0: newFrame->setBackgroundColor (CColor(23,25,26,255)); //CColor(47,51,53,255) martin@0: martin@0: martin@0: martin@0: martin@0: martin@0: martin@0: //-- IMPLEMENTATION OF SWITCHES AND KNOBS --// martin@0: //-- TEXT DISPLAYES FOR SWITCHES AND KNOBS --// martin@0: kDisplayText = CColor(255,255,255,255);//(R,G,B,Alpha) martin@0: kDisplayBackground = CColor(94,102,106,255);//(R,G,B,Alpha) martin@0: kLabelText = CColor(82,116,193,255);//(R,G,B,Alpha) martin@0: kBlank = CColor(0,0,0,0); martin@0: martin@0: martin@0: textDepth = 15; martin@0: textDepthLarge = 20; martin@0: labelOffset = -20; martin@0: displayOffset = 7; martin@0: martin@0: martin@0: //Transforms martin@0: int transformsSep = 25; martin@0: int transformsHoz = transformsSep; martin@0: int transformsEl = 50; martin@0: transformsDisplay(transformsHoz, transformsEl, transformsSep, newFrame); martin@0: martin@0: martin@0: martin@0: //Zooming martin@0: //int zoomHoz = transformsHoz+ 0.5*(knob_red_blue->getWidth()+transformsSep); martin@0: //int zoomEl = transformsEl + textDepth + textDepthLarge + knob_red_blue->getHeight()/110+ 40 ; martin@0: int zoomHoz = transformsHoz + 3*knob_red_blue->getWidth() + 6*transformsSep; martin@0: int zoomEl = transformsEl; martin@0: int zoomSep = transformsSep; martin@0: zoomDisplay(zoomHoz, zoomEl, zoomSep, newFrame); martin@0: martin@0: martin@0: martin@0: //Stereo Decoding martin@0: int stereoHoz = transformsHoz; martin@0: int stereoEl = transformsEl + knob_mode2->getHeight()/2 + displayOffset + textDepth + 2*transformsSep; martin@0: int stereoSep = transformsSep; martin@0: stereoDisplay(stereoHoz, stereoEl, stereoSep, newFrame); martin@0: martin@0: martin@0: //My Name martin@0: nameDisplay(stereoHoz, stereoEl, stereoSep, newFrame); martin@0: martin@0: martin@0: martin@0: martin@0: //Stereo Plot martin@0: // CRect size (20, 150, 50, 180); martin@0: // CPoint offset (0, 0); martin@0: // CBitmap* hPolarPlot = new CBitmap ("pink.png"); martin@0: //PolarPlot = new MyPlot(mySize, this, 0, pink, offset); martin@0: //PolarPlot = new MyPlot; martin@0: martin@0: martin@0: martin@0: martin@0: //Forget Images martin@0: knob_360->forget(); martin@0: knob_red->forget(); martin@0: knob_blue->forget(); martin@0: knob_red_blue->forget(); martin@0: knob_mode2->forget(); martin@0: knob_mode4->forget(); martin@0: martin@0: bRotations->forget (); martin@0: bZoom->forget (); martin@0: bStereo->forget (); martin@0: bName->forget (); martin@0: martin@0: martin@0: //-- remember our controls so that we can sync them with the state of the effect martin@0: controls[kRotate] = knobRotate; martin@0: controls[kTilt] = knobTilt; martin@0: controls[kTumble] = knobTumble; martin@0: controls[kZoomMethod] = knobZoomMethod; martin@0: controls[kZoom] = knobZoom; martin@0: controls[kWidth] = knobWidth; martin@0: controls[kPattern] = knobPattern; martin@0: controls[kMode] = knobMode; martin@0: controls[kRearVerb] = knobRearVerb; martin@0: controls[kHiVerb] = knobHiVerb; martin@0: martin@0: martin@0: martin@0: martin@0: //newFrame->addView (new LineStyleTestView (CRect (0, 0, 0, 0))); martin@0: martin@0: //-- set the member frame to the newly created frame martin@0: //-- we do it this way because it is possible that the setParameter method is called martin@0: //-- in between of constructing the frame and it's controls martin@0: frame = newFrame; martin@0: martin@0: //-- sync parameters martin@0: for (int i = 0; i < kNumParameters; i++) martin@0: setParameter (i, effect->getParameter (i)); martin@0: martin@0: martin@0: return true; martin@0: } martin@0: martin@0: martin@0: martin@0: //------------------------------------------------------------------------------------ martin@0: void MyEditor::close () martin@0: { martin@0: //-- on close we need to delete the frame object. martin@0: //-- once again we make sure that the member frame variable is set to zero before we delete it martin@0: //-- so that calls to setParameter won't crash. martin@0: martin@0: martin@0: } martin@0: martin@0: martin@0: //------------------------------------------------------------------------------------ martin@0: void MyEditor::transformsDisplay(int &transformsHoz, int &transformsEl, int &transformsSep, CFrame* newFrame) martin@0: { martin@0: CRect transSize = CRect (0, 0, bRotations->getWidth (),bRotations->getHeight ()); martin@0: transSize.offset(transformsHoz-transformsSep/2, transformsEl+labelOffset-textDepthLarge); martin@0: CView* transforms_view = new CView (transSize); martin@0: transforms_view->setBackground (bRotations); martin@0: newFrame->addView (transforms_view); martin@0: martin@0: //Rotate martin@0: r (0, 0, knob_red_blue->getWidth (), knob_red_blue->getHeight () / 101); martin@0: r.offset(transformsHoz, transformsEl); martin@0: knobRotate = new CAnimKnob (r, this, kRotate, 101, knob_360->getHeight () / 101, knob_360, CPoint (0, 0));//101, 64, martin@0: newFrame->addView (knobRotate); martin@0: //knobRotate->forget (); martin@0: martin@0: //Tilt martin@0: r.offset(knob_red_blue->getWidth()+transformsSep, 0); martin@0: knobTilt = new CAnimKnob (r, this, kTilt, 101, knob_360->getHeight () / 101, knob_360, CPoint (0, 0)); martin@0: newFrame->addView (knobTilt); martin@0: //knobTilt->forget (); martin@0: martin@0: //Tumble martin@0: r.offset(knob_red_blue->getWidth()+transformsSep, 0); martin@0: knobTumble = new CAnimKnob (r, this, kTumble, 101, knob_360->getHeight () / 101, knob_360, CPoint (0, 0)); martin@0: newFrame->addView (knobTumble); martin@0: //knobTumble->forget (); martin@0: martin@0: martin@0: martin@0: martin@0: martin@0: martin@0: martin@0: martin@0: //--CTextLabel-------------------------------------- martin@0: //Label Rotate martin@0: LabelSize (0, 0, knob_red_blue->getWidth (), textDepth); martin@0: LabelSize.offset (transformsHoz, transformsEl+labelOffset); martin@0: CTextLabel* labelRotate = new CTextLabel (LabelSize, 0, 0, kCenterText); martin@0: labelRotate->setFont (kNormalFontSmall); martin@0: labelRotate->setFontColor (kLabelText); martin@0: labelRotate->setBackColor (kBlank); martin@0: labelRotate->setFrameColor (kBlank); martin@0: labelRotate->setText("Rotate"); martin@0: newFrame->addView (labelRotate); martin@0: martin@0: //Label Tilt martin@0: LabelSize.offset (knob_red_blue->getWidth()+transformsSep, 0); martin@0: CTextLabel* labelTilt = new CTextLabel (LabelSize, 0, 0, kCenterText); martin@0: labelTilt->setFont (kNormalFontSmall); martin@0: labelTilt->setFontColor (kLabelText); martin@0: labelTilt->setBackColor (kBlank); martin@0: labelTilt->setFrameColor (kBlank); martin@0: labelTilt->setText("Tilt"); martin@0: newFrame->addView (labelTilt); martin@0: martin@0: //Label Tumble martin@0: LabelSize.offset (knob_red_blue->getWidth()+transformsSep, 0); martin@0: CTextLabel* labelTumble = new CTextLabel (LabelSize, 0, 0, kCenterText); martin@0: labelTumble->setFont (kNormalFontSmall); martin@0: labelTumble->setFontColor (kLabelText); martin@0: labelTumble->setBackColor (kBlank); martin@0: labelTumble->setFrameColor (kBlank); martin@0: labelTumble->setText("Tumble"); martin@0: newFrame->addView (labelTumble); martin@0: martin@0: martin@0: //Label Section martin@0: LabelSize (0, 0, knob_red_blue->getWidth ()*3 + transformsSep*2, textDepthLarge); martin@0: LabelSize.offset (transformsHoz, transformsEl+labelOffset - textDepthLarge); martin@0: CTextLabel* labelTransforms = new CTextLabel (LabelSize, 0, 0, kCenterText); martin@0: labelTransforms->setFont (kNormalFontBig); martin@0: labelTransforms->setFontColor (kLabelText); martin@0: labelTransforms->setBackColor (kBlank); martin@0: labelTransforms->setFrameColor (kBlank); martin@0: labelTransforms->setText("Transforms"); martin@0: newFrame->addView (labelTransforms); martin@0: martin@0: martin@0: martin@0: martin@0: //--CTextLabel-------------------------------------- martin@0: //Rotate Value martin@0: DisplaySize (0, 0, knob_red_blue->getWidth (), textDepth); martin@0: DisplaySize.offset (transformsHoz, transformsEl+knob_red_blue->getHeight()/110+displayOffset); martin@0: paramRotate = new CTextLabel (DisplaySize, 0, 0, kCenterText); martin@0: paramRotate->setHoriAlign(kCenterText); martin@0: paramRotate->setFont (kNormalFontVerySmall); martin@0: paramRotate->setFontColor (kDisplayText); martin@0: paramRotate->setBackColor (kDisplayBackground); martin@0: paramRotate->setFrameColor (kBlackCColor); martin@0: newFrame->addView (paramRotate); martin@0: paramRotate->setText("TEST"); martin@0: martin@0: martin@0: //Tilt Value martin@0: DisplaySize.offset (knob_red_blue->getWidth()+transformsSep, 0); martin@0: paramTilt = new CTextLabel (DisplaySize, 0, 0, kCenterText); martin@0: paramTilt->setHoriAlign(kCenterText); martin@0: paramTilt->setFont (kNormalFontVerySmall); martin@0: paramTilt->setFontColor (kDisplayText); martin@0: paramTilt->setBackColor (kDisplayBackground); martin@0: paramTilt->setFrameColor (kBlackCColor); martin@0: newFrame->addView (paramTilt); martin@0: martin@0: martin@0: //Tumble Value martin@0: DisplaySize.offset (knob_red_blue->getWidth()+transformsSep, 0); martin@0: paramTumble = new CTextLabel (DisplaySize, 0, 0, kCenterText); martin@0: paramTumble->setHoriAlign(kCenterText); martin@0: paramTumble->setFont (kNormalFontVerySmall); martin@0: paramTumble->setFontColor (kDisplayText); martin@0: paramTumble->setBackColor (kDisplayBackground); martin@0: paramTumble->setFrameColor (kBlackCColor); martin@0: newFrame->addView (paramTumble); martin@0: } martin@0: martin@0: martin@0: //------------------------------------------------------------------------------------ martin@0: void MyEditor::zoomDisplay(int &zoomHoz, int &zoomEl, int &zoomSep, CFrame* newFrame) martin@0: { martin@0: CRect zoomSize = CRect (0, 0, bZoom->getWidth (),bZoom->getHeight ()); martin@0: zoomSize.offset(zoomHoz-zoomSep/2, zoomEl+labelOffset-textDepthLarge); martin@0: CView* zoom_view = new CView (zoomSize); martin@0: zoom_view->setBackground (bZoom); martin@0: newFrame->addView (zoom_view); martin@0: martin@0: //ZoomMethod martin@0: CRect r (0, 0, knob_red_blue->getWidth (), knob_red_blue->getHeight () / 101); martin@0: r.offset(zoomHoz, zoomEl); martin@0: knobZoomMethod = new CHorizontalSwitch (r, this, kZoomMethod, 4, knob_mode4->getHeight () / 4, 4, knob_mode4, CPoint (0, 0)); martin@0: newFrame->addView (knobZoomMethod); martin@0: //knobZoomMethod->forget (); martin@0: martin@0: //Zoom martin@0: r.offset(knob_mode4->getWidth()+zoomSep, 0); martin@0: knobZoom = new CAnimKnob (r, this, kZoom, 101, knob_red_blue->getHeight () / 101, knob_red_blue, CPoint (0, 0)); martin@0: newFrame->addView (knobZoom); martin@0: //knobZoom->forget (); martin@0: martin@0: martin@0: //--CTextLabel-------------------------------------- martin@0: //Label ZoomMethod martin@0: LabelSize (0, 0, knob_red_blue->getWidth (), textDepth); martin@0: LabelSize.offset (zoomHoz, zoomEl+labelOffset); martin@0: CTextLabel* labelZoomMethod = new CTextLabel (LabelSize, 0, 0, kCenterText); martin@0: labelZoomMethod->setFont (kNormalFontSmall); martin@0: labelZoomMethod->setFontColor (kLabelText); martin@0: labelZoomMethod->setBackColor (kBlank); martin@0: labelZoomMethod->setFrameColor (kBlank); martin@0: labelZoomMethod->setText("Zoom Type"); martin@0: newFrame->addView (labelZoomMethod); martin@0: martin@0: //Label Zoom martin@0: LabelSize.offset (knob_mode4->getWidth()+zoomSep, 0); martin@0: CTextLabel* labelZoom = new CTextLabel (LabelSize, 0, 0, kCenterText); martin@0: labelZoom->setFont (kNormalFontSmall); martin@0: labelZoom->setFontColor (kLabelText); martin@0: labelZoom->setBackColor (kBlank); martin@0: labelZoom->setFrameColor (kBlank); martin@0: labelZoom->setText("Zoom"); martin@0: newFrame->addView (labelZoom); martin@0: martin@0: //Label Section martin@0: LabelSize (0, 0, knob_red_blue->getWidth ()*2 + zoomSep*1, textDepthLarge); martin@0: LabelSize.offset (zoomHoz, zoomEl+labelOffset - textDepthLarge); martin@0: CTextLabel* labelTransforms = new CTextLabel (LabelSize, 0, 0, kCenterText); martin@0: labelTransforms->setFont (kNormalFontBig); martin@0: labelTransforms->setFontColor (kLabelText); martin@0: labelTransforms->setBackColor (kBlank); martin@0: labelTransforms->setFrameColor (kBlank); martin@0: labelTransforms->setText("Zooming"); martin@0: newFrame->addView (labelTransforms); martin@0: martin@0: martin@0: //--CTextLabel-------------------------------------- martin@0: //Zoom Method martin@0: DisplaySize (0, 0, knob_red_blue->getWidth (), textDepth); martin@0: DisplaySize.offset (zoomHoz, zoomEl+knob_red_blue->getHeight()/110+displayOffset); martin@0: paramZoomMethod = new CTextLabel (DisplaySize, 0, 0, kCenterText); martin@0: paramZoomMethod->setHoriAlign(kCenterText); martin@0: paramZoomMethod->setFont (kNormalFontVerySmall); martin@0: paramZoomMethod->setFontColor (kDisplayText); martin@0: paramZoomMethod->setBackColor (kDisplayBackground); martin@0: paramZoomMethod->setFrameColor (kBlackCColor); martin@0: newFrame->addView (paramZoomMethod); martin@0: martin@0: //Zoom Value martin@0: DisplaySize.offset (knob_red_blue->getWidth()+zoomSep, 0); martin@0: paramZoom = new CTextLabel (DisplaySize, 0, 0, kCenterText); martin@0: paramZoom->setHoriAlign(kCenterText); martin@0: paramZoom->setFont (kNormalFontVerySmall); martin@0: paramZoom->setFontColor (kDisplayText); martin@0: paramZoom->setBackColor (kDisplayBackground); martin@0: paramZoom->setFrameColor (kBlackCColor); martin@0: newFrame->addView (paramZoom); martin@0: martin@0: } martin@0: martin@0: martin@0: //------------------------------------------------------------------------------------ martin@0: void MyEditor::stereoDisplay(int &stereoHoz, int &stereoEl, int &stereoSep, CFrame* newFrame) martin@0: { martin@0: CRect stereoSize = CRect (0, 0, bStereo->getWidth (),bStereo->getHeight ()); martin@0: stereoSize.offset(stereoHoz-stereoSep/2, stereoEl+labelOffset-textDepthLarge); martin@0: CView* stereo_view = new CView (stereoSize); martin@0: stereo_view->setBackground (bStereo); martin@0: newFrame->addView (stereo_view); martin@0: martin@0: //Mode martin@0: r (0, 0, knob_mode2->getWidth (), knob_mode2->getHeight () / 2); martin@0: r.offset(stereoHoz, stereoEl); martin@0: knobMode = new CHorizontalSwitch (r, this, kMode, 2, knob_mode2->getHeight () / 2, 2, knob_mode2, CPoint (0, 0)); martin@0: newFrame->addView (knobMode); martin@0: //knobMode->forget (); martin@0: martin@0: //Width martin@0: r.offset(knob_mode2->getWidth()+stereoSep, 0); martin@0: knobWidth = new CAnimKnob (r, this, kWidth, 101, knob_red->getHeight () / 101, knob_red, CPoint (0, 0)); martin@0: newFrame->addView (knobWidth); martin@0: //knobWidth->forget (); martin@0: martin@0: //Pattern martin@0: r.offset(knob_red_blue->getWidth()+stereoSep, 0); martin@0: knobPattern = new CAnimKnob (r, this, kPattern, 101, knob_blue->getHeight () / 101, knob_blue, CPoint (0, 0)); martin@0: newFrame->addView (knobPattern); martin@0: //knobPattern->forget (); martin@0: martin@0: //RearVerb martin@0: r.offset(knob_mode2->getWidth()+stereoSep*4, 0); martin@0: knobRearVerb = new CAnimKnob (r, this, kRearVerb, 101, knob_red_blue->getHeight () / 101, knob_red, CPoint (0, 0)); martin@0: newFrame->addView (knobRearVerb); martin@0: //knobRearVerb->forget (); martin@0: martin@0: //HiVerb martin@0: r.offset(knob_red_blue->getWidth()+stereoSep, 0); martin@0: knobHiVerb = new CAnimKnob (r, this, kHiVerb, 101, knob_red_blue->getHeight () / 101, knob_blue, CPoint (0, 0)); martin@0: newFrame->addView (knobHiVerb); martin@0: //knobHiVerb->forget (); martin@0: martin@0: martin@0: martin@0: martin@0: martin@0: martin@0: martin@0: martin@0: martin@0: //--CTextLabel-------------------------------------- martin@0: //Label Mode martin@0: LabelSize (0, 0, knob_red_blue->getWidth (), textDepth); martin@0: LabelSize.offset (stereoHoz, stereoEl+labelOffset); martin@0: CTextLabel* labelMode = new CTextLabel (LabelSize, 0, 0, kCenterText); martin@0: labelMode->setFont (kNormalFontSmall); martin@0: labelMode->setFontColor (kLabelText); martin@0: labelMode->setBackColor (kBlank); martin@0: labelMode->setFrameColor (kBlank); martin@0: labelMode->setText("Mode"); martin@0: newFrame->addView (labelMode); martin@0: martin@0: //Label Width martin@0: LabelSize.offset (knob_red_blue->getWidth()+stereoSep, 0); martin@0: CTextLabel* labelWidth = new CTextLabel (LabelSize, 0, 0, kCenterText); martin@0: labelWidth->setFont (kNormalFontSmall); martin@0: labelWidth->setFontColor (kLabelText); martin@0: labelWidth->setBackColor (kBlank); martin@0: labelWidth->setFrameColor (kBlank); martin@0: labelWidth->setText("Width"); martin@0: newFrame->addView (labelWidth); martin@0: martin@0: //Label Pattern martin@0: LabelSize.offset (knob_red_blue->getWidth()+stereoSep, 0); martin@0: CTextLabel* labelPattern = new CTextLabel (LabelSize, 0, 0, kCenterText); martin@0: labelPattern->setFont (kNormalFontSmall); martin@0: labelPattern->setFontColor (kLabelText); martin@0: labelPattern->setBackColor (kBlank); martin@0: labelPattern->setFrameColor (kBlank); martin@0: labelPattern->setText("Pattern"); martin@0: newFrame->addView (labelPattern); martin@0: martin@0: //Label RearVerb martin@0: LabelSize.offset (knob_red_blue->getWidth()+stereoSep*4, 0); martin@0: CTextLabel* labelRearVerb = new CTextLabel (LabelSize, 0, 0, kCenterText); martin@0: labelRearVerb->setFont (kNormalFontSmall); martin@0: labelRearVerb->setFontColor (kLabelText); martin@0: labelRearVerb->setBackColor (kBlank); martin@0: labelRearVerb->setFrameColor (kBlank); martin@0: labelRearVerb->setText("RearVerb"); martin@0: newFrame->addView (labelRearVerb); martin@0: martin@0: //Label HiVerb martin@0: LabelSize.offset (knob_red_blue->getWidth()+stereoSep, 0); martin@0: CTextLabel* labelHiVerb = new CTextLabel (LabelSize, 0, 0, kCenterText); martin@0: labelHiVerb->setFont (kNormalFontSmall); martin@0: labelHiVerb->setFontColor (kLabelText); martin@0: labelHiVerb->setBackColor (kBlank); martin@0: labelHiVerb->setFrameColor (kBlank); martin@0: labelHiVerb->setText("HiVerb"); martin@0: newFrame->addView (labelHiVerb); martin@0: martin@0: martin@0: martin@0: martin@0: martin@0: martin@0: //Label Section martin@0: LabelSize (0, 0, knob_red_blue->getWidth ()*5 + stereoSep*7, textDepthLarge); martin@0: LabelSize.offset (stereoHoz, stereoEl+labelOffset - textDepthLarge); martin@0: CTextLabel* labelStereo = new CTextLabel (LabelSize, 0, 0, kCenterText); martin@0: labelStereo->setFont (kNormalFontBig); martin@0: labelStereo->setFontColor (kLabelText); martin@0: labelStereo->setBackColor (kBlank); martin@0: labelStereo->setFrameColor (kBlank); martin@0: labelStereo->setText("Stereo Decoding & Reverb"); martin@0: newFrame->addView (labelStereo); martin@0: martin@0: martin@0: martin@0: martin@0: //--CTextLabel-------------------------------------- martin@0: //Mode Value martin@0: DisplaySize (0, 0, knob_red_blue->getWidth (), textDepth); martin@0: DisplaySize.offset (stereoHoz, stereoEl+knob_red_blue->getHeight()/110+displayOffset); martin@0: paramMode = new CTextLabel (DisplaySize, 0, 0, kCenterText); martin@0: paramMode->setHoriAlign(kCenterText); martin@0: paramMode->setFont (kNormalFontVerySmall); martin@0: paramMode->setFontColor (kDisplayText); martin@0: paramMode->setBackColor (kDisplayBackground); martin@0: paramMode->setFrameColor (kBlackCColor); martin@0: newFrame->addView (paramMode); martin@0: paramMode->forget(); martin@0: martin@0: //Width Value martin@0: DisplaySize.offset (knob_red_blue->getWidth()+stereoSep, 0); martin@0: paramWidth = new CTextLabel (DisplaySize, 0, 0, kCenterText); martin@0: paramWidth->setHoriAlign(kCenterText); martin@0: paramWidth->setFont (kNormalFontVerySmall); martin@0: paramWidth->setFontColor (kDisplayText); martin@0: paramWidth->setBackColor (kDisplayBackground); martin@0: paramWidth->setFrameColor (kBlackCColor); martin@0: newFrame->addView (paramWidth); martin@0: paramWidth->forget(); martin@0: martin@0: //Pattern Value martin@0: DisplaySize.offset (knob_red_blue->getWidth()+stereoSep, 0); martin@0: paramPattern = new CTextLabel (DisplaySize, 0, 0, kCenterText); martin@0: paramPattern->setHoriAlign(kCenterText); martin@0: paramPattern->setFont (kNormalFontVerySmall); martin@0: paramPattern->setFontColor (kDisplayText); martin@0: paramPattern->setBackColor (kDisplayBackground); martin@0: paramPattern->setFrameColor (kBlackCColor); martin@0: newFrame->addView (paramPattern); martin@0: paramPattern->forget(); martin@0: martin@0: //RearVerb Value martin@0: DisplaySize.offset (knob_red_blue->getWidth()+stereoSep*4, 0); martin@0: paramRearVerb = new CTextLabel (DisplaySize, 0, 0, kCenterText); martin@0: paramRearVerb->setHoriAlign(kCenterText); martin@0: paramRearVerb->setFont (kNormalFontVerySmall); martin@0: paramRearVerb->setFontColor (kDisplayText); martin@0: paramRearVerb->setBackColor (kDisplayBackground); martin@0: paramRearVerb->setFrameColor (kBlackCColor); martin@0: newFrame->addView (paramRearVerb); martin@0: paramRearVerb->forget(); martin@0: martin@0: //HiVerb Value martin@0: DisplaySize.offset (knob_red_blue->getWidth()+stereoSep, 0); martin@0: paramHiVerb = new CTextLabel (DisplaySize, 0, 0, kCenterText); martin@0: paramHiVerb->setHoriAlign(kCenterText); martin@0: paramHiVerb->setFont (kNormalFontVerySmall); martin@0: paramHiVerb->setFontColor (kDisplayText); martin@0: paramHiVerb->setBackColor (kDisplayBackground); martin@0: paramHiVerb->setFrameColor (kBlackCColor); martin@0: newFrame->addView (paramHiVerb); martin@0: paramHiVerb->forget(); martin@0: martin@0: //ModeStereo Value martin@0: DisplaySize.offset (-7*stereoSep-4*knob_red->getWidth(), 0); martin@0: paramModeStereo = new CTextLabel (DisplaySize, 0, 0, kCenterText); martin@0: paramModeStereo->setHoriAlign(kCenterText); martin@0: paramModeStereo->setFont (kNormalFontVerySmall); martin@0: paramModeStereo->setFontColor (kDisplayText); martin@0: paramModeStereo->setBackColor (kDisplayBackground); martin@0: paramModeStereo->setFrameColor (kBlackCColor); martin@0: newFrame->addView (paramModeStereo); martin@0: paramModeStereo->forget(); martin@0: } martin@0: martin@0: martin@0: martin@0: //------------------------------------------------------------------------------------ martin@0: void MyEditor::nameDisplay(int &nameHoz, int &nameEl, int &nameSep, CFrame* newFrame) martin@0: { martin@0: CRect nameSize = CRect (0, 0, bName->getWidth (),bName->getHeight ()); martin@0: nameSize.offset(nameHoz-nameSep/2, nameEl+knob_mode2->getHeight()/2+displayOffset+textDepth+nameSep/2); martin@0: CView* name_view = new CView (nameSize); martin@0: name_view->setBackground (bName); martin@0: newFrame->addView (name_view); martin@0: martin@0: LabelSize (0, 0, 160, textDepth); martin@0: LabelSize.offset(nameHoz, nameEl+knob_mode2->getHeight()/2+displayOffset+textDepth+nameSep/2+40); martin@0: //LabelSize.offset (nameHoz, nameEl+labelOffset); martin@0: CTextLabel *vendor_version = new CTextLabel(LabelSize, 0, 0, kLeftText); martin@0: martin@0: char text[100]; martin@0: int i1=(int)floor(VERSION/1000.0); martin@0: int i2= (int)floor((VERSION-i1*1000)/100.0); martin@0: int i3= (int)floor((VERSION-i1*1000-i2*100)/10.0); martin@0: int i4= (int)floor(VERSION-i1*1000-i2*100-i3*10); martin@0: sprintf(text, "Version: %d.%d.%d.%d", i1, i2,i3,i4); martin@0: vendor_version->setText(text); martin@0: vendor_version->setFont (kNormalFontSmall); martin@0: vendor_version->setFontColor (kLabelText); martin@0: vendor_version->setHoriAlign(kLeftText); martin@0: vendor_version->setBackColor (kBlank); martin@0: vendor_version->setFrameColor (kBlank); martin@0: newFrame->addView (vendor_version); martin@0: vendor_version->forget(); martin@0: martin@0: LabelSize.offset(0, -20); martin@0: bitMode = new CTextLabel(LabelSize, 0, 0, kLeftText); martin@0: int b = effect->getParameter(50); martin@0: sprintf(text,"Bit Mode: %d", b); martin@0: bitMode->setText(text); martin@0: bitMode->setFont (kNormalFontSmall); martin@0: bitMode->setFontColor (kLabelText); martin@0: bitMode->setHoriAlign(kLeftText); martin@0: bitMode->setBackColor (kBlank); martin@0: bitMode->setFrameColor (kBlank); martin@0: newFrame->addView (bitMode); martin@0: martin@0: martin@0: martin@0: } martin@0: martin@0: martin@0: martin@0: martin@0: //------------------------------------------------------------------------------------ martin@0: void MyEditor::stereoPlot(int &plotHoz, int &plotEl) martin@0: { martin@0: martin@0: } martin@0: martin@0: martin@0: //------------------------------------------------------------------------------------ martin@0: void MyEditor::suspendDisplay() martin@0: { martin@0: suspend = new CTextLabel(frameSize, 0, 0, kCenterText); martin@0: suspend->setBackColor(CColor(23,25,26,150)); martin@0: suspend->setFont (kNormalFontVeryBig); martin@0: suspend->setFontColor (CColor (255,255,255,255)); martin@0: suspend->setText("Currently Suspended"); martin@0: getFrame()->addView (suspend); martin@0: } martin@0: martin@0: //------------------------------------------------------------------------------------ martin@0: void MyEditor::resumeDisplay() martin@0: { martin@0: getFrame()->removeView(suspend); martin@0: } martin@0: martin@0: martin@0: martin@0: //------------------------------------------------------------------------------------ martin@0: void MyEditor::valueChanged (CControl* pControl) martin@0: { martin@0: //-- valueChanged is called whenever the user changes one of the controls in the User Interface (UI) martin@0: effect->setParameterAutomated (pControl->getTag (), pControl->getValue ()); martin@0: martin@0: //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: setParameter (pControl->getTag (), pControl->getValue ()); martin@0: } martin@0: martin@0: //------------------------------------------------------------------------------------ martin@0: void MyEditor::setParameter (VstInt32 index, float value) martin@0: { martin@0: //paramModeStereo->setText("tits"); martin@0: //-- setParameter is called when the host automates one of the effects parameter. martin@0: //-- The UI should reflect this state so we set the value of the control to the new value. martin@0: //-- VSTGUI will automaticly redraw changed controls in the next idle (as this call happens to be in the process thread). martin@0: if (frame && index < kNumParameters) martin@0: { //First write the value into the GUI value container martin@0: controls[index]->setValue (value); martin@0: martin@0: //Call getParameterDisplay to get the char to display martin@0: getParameterDisplay (index, &displayText); martin@0: } martin@0: else if (frame && index == 100) { martin@0: suspendDisplay(); martin@0: } martin@0: else if (frame && index == 101) { martin@0: resumeDisplay(); martin@0: } martin@0: martin@0: martin@0: } martin@0: martin@0: martin@0: //------------------------------------------------------------------------ martin@0: void MyEditor::getParameterDisplay (VstInt32 index, char *text) //GET display value shown for Parameters martin@0: { martin@0: effect->getParameterDisplay(index, text); martin@0: switch (index) martin@0: { martin@0: case kMode : martin@0: paramModeStereo->setText(text); martin@0: break; martin@0: case kWidth: martin@0: paramWidth->setText(text); martin@0: break; martin@0: case kPattern: martin@0: paramPattern->setText(text); martin@0: break; martin@0: case kRotate : martin@0: paramRotate->setText(text); martin@0: break; martin@0: case kTilt: martin@0: paramTilt->setText(text); martin@0: break; martin@0: case kTumble: martin@0: paramTumble->setText(text); martin@0: break; martin@0: case kZoom: martin@0: paramZoom->setText(text); martin@0: break; martin@0: case kZoomMethod: martin@0: paramZoomMethod->setText(text); martin@0: break; martin@0: case kRearVerb : martin@0: paramRearVerb->setText(text); martin@0: break; martin@0: case kHiVerb : martin@0: paramHiVerb->setText(text); martin@0: break; martin@0: } martin@0: } martin@0: martin@0: martin@0: martin@0: martin@0: martin@0: martin@0: martin@0: martin@0: martin@0: martin@0: //------------------------------------------------------------------------ martin@0: //------------------------------------------------------------------------ martin@0: //------------------------------------------------------------------------