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

Method DrawModule

Source/SampleBrowser.cpp:71–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71void SampleBrowser::DrawModule()
72{
73 if (Minimized() || IsVisible() == false)
74 return;
75
76 float fontSize = 13;
77 float stringWidth = gFont.GetStringWidth(mCurrentDirectory.toStdString(), fontSize);
78 float moduleWidth, moduleHeight;
79 GetModuleDimensions(moduleWidth, moduleHeight);
80 float textX = 3;
81 if (stringWidth > moduleWidth)
82 textX = moduleWidth - 3 - stringWidth;
83 gFont.DrawString(mCurrentDirectory.toStdString(), fontSize, textX, 15);
84
85 for (size_t i = 0; i < mButtons.size(); ++i)
86 mButtons[i]->Draw();
87 for (int i = 0; i < (int)mPlayButtons.size(); ++i)
88 {
89 mPlayButtons[i]->SetDisplayStyle(IsSamplePlaying(i) ? ButtonDisplayStyle::kStop : ButtonDisplayStyle::kPlay);
90 mPlayButtons[i]->Draw();
91 }
92 mBackButton->Draw();
93 mForwardButton->Draw();
94
95 int numPages = GetNumPages();
96 if (numPages > 1)
97 DrawTextNormal(ofToString(mCurrentPage + 1) + "/" + ofToString(numPages), 40, mBackButton->GetPosition(true).y + 12);
98}
99
100bool SampleBrowser::IsSamplePlaying(int index) const
101{

Callers

nothing calls this directly

Calls 8

DrawTextNormalFunction · 0.85
ofToStringFunction · 0.85
GetStringWidthMethod · 0.80
DrawStringMethod · 0.80
sizeMethod · 0.80
DrawMethod · 0.45
SetDisplayStyleMethod · 0.45
GetPositionMethod · 0.45

Tested by

no test coverage detected