예제 #1
0
//-----------------------------------------------------------------------------------
bool TutorialEditor::open (void* ptr)
{
	//-- first we create the frame with a size of 300, 300 and set the background to white
	CRect frameSize (0, 0, 300, 300);
	CFrame* newFrame = new CFrame (frameSize, ptr, this);
	newFrame->setBackgroundColor (kWhiteCColor);

	//-- load some bitmaps we need
	CBitmap* background = new CBitmap ("KnobBackground.png");
	CBitmap* handle = new CBitmap ("KnobHandle.png");
	CBitmap* handleHighlight = new CBitmap ("KnobHandleHighlight.png");

	//-- creating a knob and adding it to the frame
	CRect r (0, 0, background->getWidth (), background->getHeight ());
	CKnob* knob1 = new MyKnob (r, this, kLeftVolumeParameter, background, handle, handleHighlight);
	newFrame->addView (knob1);

	//-- creating another knob, we are offsetting the rect, so that the knob is next to the previous knob
	r.offset (background->getWidth () + 5, 0);
	CKnob* knob2 = new MyKnob (r, this, kRightVolumeParameter, background, handle, handleHighlight);
	newFrame->addView (knob2);

	//-- forget the bitmaps
	background->forget ();
	handle->forget ();

	//-- remember our controls so that we can sync them with the state of the effect
	controls[kLeftVolumeParameter] = knob1;
	controls[kRightVolumeParameter] = knob2;

	//-- set the member frame to our frame
	frame = newFrame;

	//-- sync parameters
	for (int i = 0; i < kNumParameters; i++)
		setParameter (i, effect->getParameter (i));
	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;
}