| 331 | } |
| 332 | |
| 333 | void 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 | |
| 381 | void ModuleContainer::DeleteCablesForControl(const IUIControl* control) |
| 382 | { |
no test coverage detected