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

Method DrawModule

Source/ControlSequencer.cpp:179–235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

177}
178
179void ControlSequencer::DrawModule()
180{
181 if (Minimized() || IsVisible() == false)
182 return;
183
184 mGrid->SetShowing(!mSliderMode);
185 mGrid->Draw();
186 mIntervalSelector->Draw();
187 mLengthSlider->Draw();
188 mRandomize->Draw();
189 mRecordCheckbox->Draw();
190
191 DrawTextNormal("length: " + ofToString((TheTransport->GetDuration(mInterval) * mLength) / TheTransport->MsPerBar(), 2) + " measures",
192 mRecordCheckbox->GetRect(K(local)).getMaxX() + 5, mRecordCheckbox->GetRect(K(local)).getMinY() + 12);
193
194 int currentHover = mGrid->CurrentHover();
195 if (!mSliderMode && currentHover != -1 && GetUIControl())
196 {
197 ofPushStyle();
198 ofSetColor(ofColor::grey);
199 float val = mGrid->GetVal(currentHover % mGrid->GetCols(), currentHover / mGrid->GetCols());
200 DrawTextNormal(GetUIControl()->GetDisplayValue(GetUIControl()->GetValueForMidiCC(val)), mGrid->GetPosition(true).x, mGrid->GetPosition(true).y + 12);
201 ofPopStyle();
202 }
203
204 for (int i = 0; i < (int)mStepSliders.size(); ++i)
205 {
206 if (mSliderMode)
207 {
208 bool showing = i < mLength;
209 mStepSliders[i]->SetShowing(showing);
210 mStepSliders[i]->Draw();
211
212 auto rect = mStepSliders[i]->GetRect(true);
213
214 if (showing && GetUIControl())
215 {
216 float val = mGrid->GetVal(i, 0);
217
218 DrawTextNormal(GetUIControl()->GetDisplayValue(GetUIControl()->GetValueForMidiCC(val)), rect.getMaxX() + 5, rect.y + 12);
219 }
220
221 if (i == mStep)
222 {
223 ofPushStyle();
224 ofSetColor(0, 255, 0);
225 ofFill();
226 ofRect(rect.x - 12, rect.y + 3, 10, 10);
227 ofPopStyle();
228 }
229 }
230 else
231 {
232 mStepSliders[i]->SetShowing(false);
233 }
234 }
235}
236

Callers

nothing calls this directly

Calls 15

DrawTextNormalFunction · 0.85
ofToStringFunction · 0.85
ofPushStyleFunction · 0.85
ofSetColorFunction · 0.85
ofPopStyleFunction · 0.85
ofFillFunction · 0.85
ofRectFunction · 0.85
GetDurationMethod · 0.80
MsPerBarMethod · 0.80
getMaxXMethod · 0.80
getMinYMethod · 0.80
CurrentHoverMethod · 0.80

Tested by

no test coverage detected