bool DrawTestEditor::open (void *ptr) { AEffGUIEditor::open (ptr); CRect size (rect.left , rect.top, rect.right, rect.bottom); CFrame* frame = new CFrame (size, ptr, this); frame->setBackground (backgroundBitmap); size.inset (8, 8); size.top++; // the background bitmap is not correct size.left++; // the background bitmap is not correct // CView* testView = new PLinesView (size); // frame->addView (testView); setTabView (frame, size, CTabView::kPositionBottom); tooltipSupport = new CTooltipSupport; frame->setMouseObserver (tooltipSupport); // last but not least set the class variable frame to our newly created frame this->frame = frame; return true; }
// // open // bool SDEditor::open (void *ptr) { // !!! always call this !!! AEffGUIEditor::open (ptr); //--load some bitmaps CBitmap* hFaderBody = new CBitmap (kFaderBodyId); CBitmap* hFaderHandle = new CBitmap (kFaderHandleId); //--init background frame----------------------------------------------- // We use a local CFrame object so that calls to setParameter won't call into objects which may not exist yet. // If all GUI objects are created we assign our class member to this one. See bottom of this method. CRect size (0, 0, hBackground->getWidth (), hBackground->getHeight ()); CFrame* lFrame = new CFrame (size, ptr, this); lFrame->setBackground (hBackground); //--init the faders------------------------------------------------ int minPos = kFaderY; int maxPos = kFaderY + hFaderBody->getHeight () - hFaderHandle->getHeight () - 1; CPoint point (0, 0); CPoint offset (1, 0); // fine pitch size (kFaderX, kFaderY, kFaderX + hFaderBody->getWidth (), kFaderY + hFaderBody->getHeight ()); finePitchFader = new CVerticalSlider (size, this, kFinePitch, minPos, maxPos, hFaderHandle, hFaderBody, point); finePitchFader->setOffsetHandle (offset); finePitchFader->setValue (effect->getParameter (kFinePitch)); lFrame->addView (finePitchFader); // delay size.offset (kFaderInc + hFaderBody->getWidth (), 0); delayFader = new CVerticalSlider (size, this, kDelay, minPos, maxPos, hFaderHandle, hFaderBody, point); delayFader->setOffsetHandle (offset); delayFader->setValue (effect->getParameter (kDelay)); lFrame->addView (delayFader); // feedback size.offset (kFaderInc + hFaderBody->getWidth (), 0); feedbackFader = new CVerticalSlider (size, this, kFeedback, minPos, maxPos, hFaderHandle, hFaderBody, point); feedbackFader->setOffsetHandle (offset); feedbackFader->setValue (effect->getParameter (kFeedback)); lFrame->addView (feedbackFader); // Coarse pitch shift in steps size (kSelectX, kSelectY, kSelectX + kSelectWidth, kSelectY + kSelectHeight); coarsePitchOption = new COptionMenu(size, this, kCoarsePitch); coarsePitchOption->addEntry("+12"); coarsePitchOption->addEntry("+11"); coarsePitchOption->addEntry("+10"); coarsePitchOption->addEntry("+9"); coarsePitchOption->addEntry("+8"); coarsePitchOption->addEntry("+7"); coarsePitchOption->addEntry("+6"); coarsePitchOption->addEntry("+5"); coarsePitchOption->addEntry("+4"); coarsePitchOption->addEntry("+3"); coarsePitchOption->addEntry("+2"); coarsePitchOption->addEntry("+1"); coarsePitchOption->addEntry("0"); coarsePitchOption->addEntry("-1"); coarsePitchOption->addEntry("-2"); coarsePitchOption->addEntry("-3"); coarsePitchOption->addEntry("-4"); coarsePitchOption->addEntry("-5"); coarsePitchOption->addEntry("-6"); coarsePitchOption->addEntry("-7"); coarsePitchOption->addEntry("-8"); coarsePitchOption->addEntry("-9"); coarsePitchOption->addEntry("-10"); coarsePitchOption->addEntry("-11"); coarsePitchOption->addEntry("-12"); coarsePitchOption->setCurrent(ROUND((effect->getParameter(kCoarsePitch)*NUM_PITCHES))); lFrame->addView (coarsePitchOption); // Mix mode size.offset( 0, kSelectInc ); mixOption = new COptionMenu(size, this, kMixMode); mixOption->addEntry("mono"); mixOption->addEntry("wet only"); mixOption->addEntry("wet left"); mixOption->addEntry("wet right"); mixOption->addEntry("wet part left"); mixOption->addEntry("wet part right"); mixOption->addEntry("stereo"); mixOption->setCurrent((int)(effect->getParameter(kMixMode)*NUM_MIX_MODES)); lFrame->addView (mixOption); // Note : in the constructor of a CBitmap, the number of references is set to 1. // Then, each time the bitmap is used (for hinstance in a vertical slider), this // number is incremented. // As a consequence, everything happens as if the constructor by itself was adding // a reference. That's why we need til here a call to forget (). // You mustn't call delete here directly, because the bitmap is used by some CControls... // These "rules" apply to the other VSTGUI objects too. hFaderBody->forget (); hFaderHandle->forget (); frame = lFrame; return true; }
// // open // bool SDEditor::open (void *ptr) { // !!! always call this !!! AEffGUIEditor::open (ptr); //--load some bitmaps CBitmap* hFaderBody = new CBitmap (kFaderBodyId); CBitmap* hFaderHandle = new CBitmap (kFaderHandleId); //--init background frame----------------------------------------------- // We use a local CFrame object so that calls to setParameter won't call into objects which may not exist yet. // If all GUI objects are created we assign our class member to this one. See bottom of this method. CRect size (0, 0, hBackground->getWidth (), hBackground->getHeight ()); CFrame* lFrame = new CFrame (size, ptr, this); lFrame->setBackground (hBackground); //--init the faders------------------------------------------------ int minPos = kFaderY; int maxPos = kFaderY + hFaderBody->getHeight () - hFaderHandle->getHeight () - 1; CPoint point (0, 0); CPoint offset (1, 0); // Rate size (kFaderX, kFaderY, kFaderX + hFaderBody->getWidth (), kFaderY + hFaderBody->getHeight ()); rateFader = new CVerticalSlider (size, this, kRate, minPos, maxPos, hFaderHandle, hFaderBody, point); rateFader->setOffsetHandle (offset); rateFader->setValue (effect->getParameter (kRate)); lFrame->addView (rateFader); // Width size.offset (kFaderInc + hFaderBody->getWidth (), 0); widthFader = new CVerticalSlider (size, this, kWidth, minPos, maxPos, hFaderHandle, hFaderBody, point); widthFader->setOffsetHandle (offset); widthFader->setValue (effect->getParameter (kWidth)); lFrame->addView (widthFader); // Feedback //size.offset (kFaderInc + hFaderBody->getWidth (), 0); //feedbackFader = new CVerticalSlider (size, this, kFeedback, minPos, maxPos, hFaderHandle, hFaderBody, point); //feedbackFader->setOffsetHandle (offset); //feedbackFader->setValue (effect->getParameter (kFeedback)); //lFrame->addView (feedbackFader); // Stages size (kSelectX, kSelectY, kSelectX + kSelectWidth, kSelectY + kSelectHeight); delayOption = new COptionMenu(size, this, kDelay); delayOption->addEntry("1 ms"); delayOption->addEntry("1.2 ms"); delayOption->addEntry("2.5 ms"); delayOption->addEntry("4 ms"); delayOption->addEntry("6.3 ms"); delayOption->addEntry("10 ms"); delayOption->addEntry("12 ms"); delayOption->addEntry("25 ms"); delayOption->addEntry("40 ms"); delayOption->addEntry("63 ms"); delayOption->addEntry("100 ms"); delayOption->setCurrent(ROUND((effect->getParameter(kDelay)*NUM_DELAYS))); lFrame->addView (delayOption); // Mix mode size.offset( 0, kSelectInc ); mixOption = new COptionMenu(size, this, kMixMode); mixOption->addEntry("normal"); mixOption->addEntry("wet only"); mixOption->addEntry("wet left"); mixOption->addEntry("wet right"); mixOption->addEntry("wet left 75%"); mixOption->addEntry("wet right 75%"); mixOption->addEntry("stereo"); mixOption->setCurrent((int)(effect->getParameter(kMixMode)*NUM_MIX_MODES)); lFrame->addView (mixOption); // Note : in the constructor of a CBitmap, the number of references is set to 1. // Then, each time the bitmap is used (for hinstance in a vertical slider), this // number is incremented. // As a consequence, everything happens as if the constructor by itself was adding // a reference. That's why we need til here a call to forget (). // You mustn't call delete here directly, because the bitmap is used by some CControls... // These "rules" apply to the other VSTGUI objects too. hFaderBody->forget (); hFaderHandle->forget (); frame = lFrame; return true; }
//----------------------------------------------------------------------------- bool SDEditor::open (void *ptr) { // !!! always call this !!! AEffGUIEditor::open (ptr); //--load some bitmaps CBitmap* hFaderBody = new CBitmap (kFaderBodyId); CBitmap* hFaderHandle = new CBitmap (kFaderHandleId); //--init background frame----------------------------------------------- // We use a local CFrame object so that calls to setParameter won't call into objects which may not exist yet. // If all GUI objects are created we assign our class member to this one. See bottom of this method. CRect size (0, 0, hBackground->getWidth (), hBackground->getHeight ()); CFrame* lFrame = new CFrame (size, ptr, this); lFrame->setBackground (hBackground); //--init the faders------------------------------------------------ int minPos = kFaderY; int maxPos = kFaderY + hFaderBody->getHeight () - hFaderHandle->getHeight () - 1; CPoint point (0, 0); CPoint offset (1, 0); // Delay size (kFaderX, kFaderY, kFaderX + hFaderBody->getWidth (), kFaderY + hFaderBody->getHeight ()); delayFader = new CVerticalSlider (size, this, kDelay, minPos, maxPos, hFaderHandle, hFaderBody, point); delayFader->setOffsetHandle (offset); delayFader->setValue (effect->getParameter (kDelay)); lFrame->addView (delayFader); // FeedBack size.offset (kFaderInc + hFaderBody->getWidth (), 0); feedbackFader = new CVerticalSlider (size, this, kFeedBack, minPos, maxPos, hFaderHandle, hFaderBody, point); feedbackFader->setOffsetHandle (offset); feedbackFader->setValue (effect->getParameter (kFeedBack)); lFrame->addView (feedbackFader); // Volume size.offset (kFaderInc + hFaderBody->getWidth (), 0); volumeFader = new CVerticalSlider (size, this, kOut, minPos, maxPos, hFaderHandle, hFaderBody, point); volumeFader->setOffsetHandle (offset); volumeFader->setValue (effect->getParameter (kOut)); volumeFader->setDefaultValue (0.75f); lFrame->addView (volumeFader); //--init the display------------------------------------------------ // Delay size (kDisplayX, kDisplayY, kDisplayX + kDisplayXWidth, kDisplayY + kDisplayHeight); delayDisplay = new CParamDisplay (size, 0, kCenterText); delayDisplay->setFont (kNormalFontSmall); delayDisplay->setFontColor (kWhiteCColor); delayDisplay->setBackColor (kBlackCColor); delayDisplay->setFrameColor (kBlueCColor); delayDisplay->setValue (effect->getParameter (kDelay)); lFrame->addView (delayDisplay); // FeedBack size.offset (kFaderInc + hFaderBody->getWidth (), 0); feedbackDisplay = new CParamDisplay (size, 0, kCenterText); feedbackDisplay->setFont (kNormalFontSmall); feedbackDisplay->setFontColor (kWhiteCColor); feedbackDisplay->setBackColor (kBlackCColor); feedbackDisplay->setFrameColor (kBlueCColor); feedbackDisplay->setValue (effect->getParameter (kFeedBack)); feedbackDisplay->setStringConvert (percentStringConvert); lFrame->addView (feedbackDisplay); // Volume size.offset (kFaderInc + hFaderBody->getWidth (), 0); volumeDisplay = new CParamDisplay (size, 0, kCenterText); volumeDisplay->setFont (kNormalFontSmall); volumeDisplay->setFontColor (kWhiteCColor); volumeDisplay->setBackColor (kBlackCColor); volumeDisplay->setFrameColor (kBlueCColor); volumeDisplay->setValue (effect->getParameter (kOut)); volumeDisplay->setStringConvert (percentStringConvert); lFrame->addView (volumeDisplay); // Note : in the constructor of a CBitmap, the number of references is set to 1. // Then, each time the bitmap is used (for hinstance in a vertical slider), this // number is incremented. // As a consequence, everything happens as if the constructor by itself was adding // a reference. That's why we need til here a call to forget (). // You mustn't call delete here directly, because the bitmap is used by some CControls... // These "rules" apply to the other VSTGUI objects too. hFaderBody->forget (); hFaderHandle->forget (); frame = lFrame; return true; }
bool CSmartelectronixDisplayEditor::open(void* ptr) { CBitmap* hBackground = new CBitmap("body.bmp"); CRect frameSize (rect.left, rect.top, rect.right, rect.bottom); CFrame* newFrame = new CFrame (frameSize, this); newFrame->open (ptr); newFrame->setBackground(hBackground); newFrame->setBackgroundColor (kWhiteCColor); /* setKnobMode(kLinearMode); CBitmap* heads = new CBitmap(IDB_BITMAPHEADS); CBitmap* readout = new CBitmap(IDB_BITMAPREADOUT); //display = new CWaveDisplay(CRect(38,16,663,285),(CSmartelectronixDisplay*)effect,hBackground,heads,readout); display = new CWaveDisplay(CRect(38, 16, 665, 285), (CSmartelectronixDisplay*)effect, hBackground, heads, readout); frame->addView(display); heads->forget(); readout->forget(); // top row CBitmap* knob = new CBitmap(IDB_BITMAPKNOB); // time windows timeWindow = new CAnimKnob(CRect(697, 31, 697 + knob->getWidth(), 31 + knob->getHeight() / 75), this, CSmartelectronixDisplay::kTimeWindow, 75, 33, knob, CPoint(0, 0)); timeWindow->setDefaultValue(0.5f); timeWindow->setValue(effect->getParameter(CSmartelectronixDisplay::kTimeWindow)); frame->addView(timeWindow); ((CSmartelectronixDisplay*)effect)->getDisplay(CSmartelectronixDisplay::kTimeWindow, temp); timeLabel = new CLabel(CRect(696, 72, 730, 83), temp); frame->addView(timeLabel); // amp window ampWindow = new CAnimKnob(CRect(762, 31, 762 + knob->getWidth(), 31 + knob->getHeight() / 75), this, CSmartelectronixDisplay::kAmpWindow, 75, 33, knob, CPoint(0, 0)); ampWindow->setDefaultValue(0.5f); ampWindow->setValue(effect->getParameter(CSmartelectronixDisplay::kAmpWindow)); frame->addView(ampWindow); ((CSmartelectronixDisplay*)effect)->getDisplay(CSmartelectronixDisplay::kAmpWindow, temp); ampLabel = new CLabel(CRect(760, 72, 794, 83), temp); frame->addView(ampLabel); // trigger speed triggerSpeed = new CAnimKnob(CRect(700, 134, 700 + knob->getWidth(), 134 + knob->getHeight() / 75), this, CSmartelectronixDisplay::kTriggerSpeed, 75, 33, knob, CPoint(0, 0)); triggerSpeed->setDefaultValue(0.5f); triggerSpeed->setValue(effect->getParameter(CSmartelectronixDisplay::kTriggerSpeed)); frame->addView(triggerSpeed); ((CSmartelectronixDisplay*)effect)->getDisplay(CSmartelectronixDisplay::kTriggerSpeed, temp); trigLabel = new CLabel(CRect(698, 175, 732, 186), temp); frame->addView(trigLabel); // trigger limit triggerLimit = new CAnimKnob(CRect(765, 134, 765 + knob->getWidth(), 134 + knob->getHeight() / 75), this, CSmartelectronixDisplay::kTriggerLimit, 75, 33, knob, CPoint(0, 0)); triggerLimit->setDefaultValue(0.5f); triggerLimit->setValue(effect->getParameter(CSmartelectronixDisplay::kTriggerLimit)); frame->addView(triggerLimit); ((CSmartelectronixDisplay*)effect)->getDisplay(CSmartelectronixDisplay::kTriggerLimit, temp); threshLabel = new CLabel(CRect(765, 175, 799, 186), temp); frame->addView(threshLabel); knob->forget(); // trigger type CBitmap* triggerBitmap = new CBitmap(IDB_BITMAPTRIGGER); #if SIMPLE_VERSION trigger = new CMultiStateButton(CRect(718, 94, 718 + triggerBitmap->getWidth(), 94 + triggerBitmap->getHeight() / 5), this, CSmartelectronixDisplay::kTriggerType, triggerBitmap, 4, triggerBitmap->getHeight() / 5); #else trigger = new CMultiStateButton(CRect(718, 94, 718 + triggerBitmap->getWidth(), 94 + triggerBitmap->getHeight() / 5), this, CSmartelectronixDisplay::kTriggerType, triggerBitmap, 5, triggerBitmap->getHeight() / 5); #endif trigger->setValue(effect->getParameter(CSmartelectronixDisplay::kTriggerType)); frame->addView(trigger); triggerBitmap->forget(); CBitmap* onOff = new CBitmap(IDB_BITMAPONOFF); CBitmap* channel = new CBitmap(IDB_BITMAPCHANNEL); // sync redraw syncDraw = new COnOffButton(CRect(696, 221, 696 + onOff->getWidth(), 221 + onOff->getHeight() / 2), this, CSmartelectronixDisplay::kSyncDraw, onOff); syncDraw->setValue(effect->getParameter(CSmartelectronixDisplay::kSyncDraw)); frame->addView(syncDraw); // dc dc = new COnOffButton(CRect(690, 259, 690 + onOff->getWidth(), 259 + onOff->getHeight() / 2), this, CSmartelectronixDisplay::kDCKill, onOff); dc->setValue(effect->getParameter(CSmartelectronixDisplay::kDCKill)); frame->addView(dc); // freeze freeze = new COnOffButton(CRect(754, 221, 754 + onOff->getWidth(), 221 + onOff->getHeight() / 2), this, CSmartelectronixDisplay::kFreeze, onOff); freeze->setValue(effect->getParameter(CSmartelectronixDisplay::kFreeze)); frame->addView(freeze); // channel channelSelector = new COnOffButton(CRect(748, 259, 748 + onOff->getWidth(), 259 + onOff->getHeight() / 2), this, CSmartelectronixDisplay::kChannel, channel); channelSelector->setValue(effect->getParameter(CSmartelectronixDisplay::kChannel)); frame->addView(channelSelector); onOff->forget(); channel->forget(); //trigger level slider CBitmap* myFaderHandlePixmap = new CBitmap(IDB_BITMAPSLIDERHANDLE); int sliderWidth = myFaderHandlePixmap->getWidth(); int sliderHeight = 277; int sliderTop = 13; int sliderLeft = 11; int minPos = sliderTop; int maxPos = sliderTop + sliderHeight - myFaderHandlePixmap->getHeight() - 1; triggerLevel = new CSlider( CRect(sliderLeft, sliderTop, sliderLeft + sliderWidth, sliderTop + sliderHeight), this, CSmartelectronixDisplay::kTriggerLevel, minPos, maxPos, myFaderHandlePixmap, hBackground, CPoint(sliderLeft, sliderTop), kVertical | kBottom); triggerLevel->setDefaultValue(0.5f); triggerLevel->setValue(effect->getParameter(CSmartelectronixDisplay::kTriggerLevel)); triggerLevel->setDrawTransparentHandle(false); frame->addView(triggerLevel); myFaderHandlePixmap->forget();*/ frame = newFrame; hBackground->forget(); return true; }