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

Method ButtonClicked

Source/ModuleSaveDataPanel.cpp:315–356  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

313}
314
315void ModuleSaveDataPanel::ButtonClicked(ClickButton* button, double time)
316{
317 using namespace juce;
318
319 if (button == mApplyButton)
320 ApplyChanges();
321 if (button == mDeleteButton)
322 {
323 mSaveModule->GetOwningContainer()->DeleteModule(mSaveModule);
324 SetModule(nullptr);
325 }
326 if (button == mResetSequencerButton)
327 {
328 IDrivableSequencer* sequencer = dynamic_cast<IDrivableSequencer*>(mSaveModule);
329 if (sequencer && sequencer->HasExternalPulseSource())
330 sequencer->ResetExternalPulseSource();
331 }
332 if (button == mSavePresetAsButton && mSaveModule != nullptr)
333 {
334 juce::File(ofToDataPath("presets/" + mSaveModule->GetTypeName())).createDirectory();
335 FileChooser chooser("Save preset as...", File(ofToDataPath("presets/" + mSaveModule->GetTypeName() + "/preset.preset")), "*.preset", true, false, TheSynth->GetFileChooserParent());
336 if (chooser.browseForFileToSave(true))
337 {
338 std::string path = chooser.getResult().getFullPathName().toStdString();
339 FileStreamOut output(path);
340
341 output << ModularSynth::kSaveStateRev;
342 mSaveModule->SaveState(output);
343
344 RefreshPresetFiles();
345
346 for (size_t i = 0; i < mPresetFilePaths.size(); ++i)
347 {
348 if (mPresetFilePaths[i] == path)
349 {
350 mPresetFileIndex = (int)i;
351 break;
352 }
353 }
354 }
355 }
356}
357
358void ModuleSaveDataPanel::CheckboxUpdated(Checkbox* checkbox, double time)
359{

Callers

nothing calls this directly

Calls 9

ofToDataPathFunction · 0.85
DeleteModuleMethod · 0.80
GetOwningContainerMethod · 0.80
GetTypeNameMethod · 0.80
GetFileChooserParentMethod · 0.80
sizeMethod · 0.80
SaveStateMethod · 0.45

Tested by

no test coverage detected