MCPcopy Create free account
hub / github.com/BespokeSynth/BespokeSynth / DrawModule

Method DrawModule

Source/EnvelopeEditor.cpp:458–510  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

456}
457
458void EnvelopeEditor::DrawModule()
459{
460 if (!mPinned)
461 {
462 float w, h;
463 GetDimensions(w, h);
464
465 ofPushStyle();
466 ofSetColor(0, 0, 0);
467 ofFill();
468 ofSetLineWidth(.5f);
469 ofRect(0, 0, w, h);
470 ofNoFill();
471 ofSetColor(255, 255, 255);
472 ofRect(0, 0, w, h);
473 ofPopStyle();
474 }
475
476 mMaxSustainSlider->SetShowing(mADSRDisplay != nullptr && mADSRDisplay->GetADSR()->GetHasSustainStage());
477
478 mADSRViewLengthSlider->Draw();
479 mMaxSustainSlider->Draw();
480 mFreeReleaseLevelCheckbox->Draw();
481 if (!mPinned)
482 mPinButton->Draw();
483
484 if (mADSRDisplay != nullptr)
485 mEnvelopeControl.SetViewLength(mADSRDisplay->GetMaxTime());
486 mEnvelopeControl.Draw();
487
488 if (mADSRDisplay != nullptr)
489 {
490 int numStages = mADSRDisplay->GetADSR()->GetNumStages();
491 for (int i = 0; i < (int)mStageControls.size(); ++i)
492 {
493 mStageControls[i].mIsSustainStage = mADSRDisplay->GetADSR()->GetHasSustainStage() && (mADSRDisplay->GetADSR()->GetSustainStage() == i);
494
495 mStageControls[i].mTargetSlider->SetShowing(i < numStages);
496 mStageControls[i].mTimeSlider->SetShowing(i < numStages);
497 mStageControls[i].mCurveSlider->SetShowing(i < numStages);
498 mStageControls[i].mSustainCheckbox->SetShowing(i > 0 && i < numStages - 1);
499
500 mStageControls[i].mTargetSlider->Draw();
501 mStageControls[i].mTimeSlider->Draw();
502 mStageControls[i].mCurveSlider->Draw();
503 mStageControls[i].mSustainCheckbox->Draw();
504 }
505
506 //move release level checkbox below final stage control
507 ofVec2f pos = mStageControls[numStages - 1].mSustainCheckbox->GetPosition(K(local));
508 mFreeReleaseLevelCheckbox->SetPosition(pos.x, pos.y);
509 }
510}
511
512void EnvelopeEditor::Resize(float w, float h)
513{

Callers

nothing calls this directly

Calls 15

ofPushStyleFunction · 0.85
ofSetColorFunction · 0.85
ofFillFunction · 0.85
ofSetLineWidthFunction · 0.85
ofRectFunction · 0.85
ofNoFillFunction · 0.85
ofPopStyleFunction · 0.85
SetViewLengthMethod · 0.80
GetMaxTimeMethod · 0.80
GetNumStagesMethod · 0.80
sizeMethod · 0.80
SetShowingMethod · 0.45

Tested by

no test coverage detected