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

Method ButtonClicked

Source/Prefab.cpp:224–254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

222}
223
224void Prefab::ButtonClicked(ClickButton* button, double time)
225{
226 using namespace juce;
227 if (button == mSaveButton)
228 {
229 FileChooser chooser("Save prefab as...", File(ofToDataPath("prefabs/prefab.pfb")), "*.pfb", true, false, TheSynth->GetFileChooserParent());
230 if (chooser.browseForFileToSave(true))
231 {
232 std::string savePath = chooser.getResult().getFullPathName().toStdString();
233 SavePrefab(savePath);
234 }
235 }
236
237 if (button == mLoadButton)
238 {
239 FileChooser chooser("Load prefab...", File(ofToDataPath("prefabs")), "*.pfb", true, false, TheSynth->GetFileChooserParent());
240 if (chooser.browseForFileToOpen())
241 {
242 std::string loadPath = chooser.getResult().getFullPathName().toStdString();
243 LoadPrefab(ofToDataPath(loadPath));
244 }
245 }
246
247 if (button == mDisbandButton)
248 {
249 auto modules = mModuleContainer.GetModules();
250 for (auto* module : modules)
251 GetOwningContainer()->TakeModule(module);
252 GetOwningContainer()->DeleteModule(this);
253 }
254}
255
256void Prefab::CheckboxUpdated(Checkbox* checkbox, double time)
257{

Callers

nothing calls this directly

Calls 4

ofToDataPathFunction · 0.85
GetFileChooserParentMethod · 0.80
TakeModuleMethod · 0.80
DeleteModuleMethod · 0.80

Tested by

no test coverage detected