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

Method DeleteModule

Source/ModuleContainer.cpp:333–379  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

331}
332
333void ModuleContainer::DeleteModule(IDrawableModule* module, bool fail /*= true*/)
334{
335 if (!module->CanBeDeleted())
336 return;
337
338 if (module->HasSpecialDelete())
339 {
340 module->DoSpecialDelete();
341 RemoveFromVector(module, mModules, fail);
342 return;
343 }
344
345 if (module->GetParent())
346 module->GetParent()->GetModuleParent()->RemoveChild(module);
347
348 RemoveFromVector(module, mModules, fail);
349 for (const auto iter : mModules)
350 {
351 if (iter->GetPatchCableSource())
352 {
353 std::vector<PatchCable*> cablesToDestroy;
354 for (auto cable : iter->GetPatchCableSource()->GetPatchCables())
355 {
356 if (cable->GetTarget() == module)
357 cablesToDestroy.push_back(cable);
358 }
359 for (const auto cable : cablesToDestroy)
360 cable->Destroy(false);
361 }
362 }
363
364 // Remove all cables that targeted controls on this module
365 IUIControl::DestroyCablesTargetingControls(module->GetUIControls());
366
367 for (const auto child : module->GetChildren())
368 {
369 child->MarkAsDeleted();
370 child->SetEnabled(false);
371 child->Exit();
372 TheSynth->OnModuleDeleted(child);
373 }
374
375 module->MarkAsDeleted();
376 module->SetEnabled(false);
377 module->Exit();
378 TheSynth->OnModuleDeleted(module);
379}
380
381void ModuleContainer::DeleteCablesForControl(const IUIControl* control)
382{

Callers 8

ButtonClickedMethod · 0.80
RemoveTrackMethod · 0.80
ButtonClickedMethod · 0.80
PollMethod · 0.80
ButtonClickedMethod · 0.80
KeyPressedMethod · 0.80
ButtonClickedMethod · 0.80
PollMethod · 0.80

Calls 15

RemoveFromVectorFunction · 0.85
CanBeDeletedMethod · 0.80
GetParentMethod · 0.80
RemoveChildMethod · 0.80
GetModuleParentMethod · 0.80
DestroyMethod · 0.80
GetUIControlsMethod · 0.80
GetChildrenMethod · 0.80
MarkAsDeletedMethod · 0.80
OnModuleDeletedMethod · 0.80
HasSpecialDeleteMethod · 0.45
DoSpecialDeleteMethod · 0.45

Tested by

no test coverage detected