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

Method ShowPage

Source/SampleBrowser.cpp:270–305  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

268}
269
270void SampleBrowser::ShowPage(int page)
271{
272 page = ofClamp(page, 0, GetNumPages() - 1);
273 mCurrentPage = page;
274 int offset = page * (int)mButtons.size();
275 for (int i = 0; i < (int)mButtons.size(); ++i)
276 {
277 if (i + offset < (int)mDirectoryListing.size())
278 {
279 mButtons[i]->SetShowing(true);
280 if (mDirectoryListing[i + offset] == ".." || File(mDirectoryListing[i + offset]).isDirectory())
281 {
282 mButtons[i]->SetDisplayStyle(ButtonDisplayStyle::kFolderIcon);
283 mPlayButtons[i]->SetShowing(false);
284 }
285 else
286 {
287 mButtons[i]->SetDisplayStyle(ButtonDisplayStyle::kSampleIcon);
288 mPlayButtons[i]->SetShowing(true);
289 }
290
291 if (mDirectoryListing[i + offset] == "..")
292 mButtons[i]->SetLabel("..");
293 else
294 mButtons[i]->SetLabel(File(mDirectoryListing[i + offset]).getFileName().toStdString().c_str());
295 }
296 else
297 {
298 mButtons[i]->SetShowing(false);
299 mPlayButtons[i]->SetShowing(false);
300 }
301 }
302
303 mBackButton->SetShowing(GetNumPages() > 1 && mCurrentPage > 0);
304 mForwardButton->SetShowing(GetNumPages() > 1 && mCurrentPage < GetNumPages() - 1);
305}
306
307int SampleBrowser::GetNumPages() const
308{

Callers

nothing calls this directly

Calls 5

ofClampFunction · 0.85
sizeMethod · 0.80
SetShowingMethod · 0.45
SetDisplayStyleMethod · 0.45
SetLabelMethod · 0.45

Tested by

no test coverage detected