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

Method TakeModule

Source/ModuleContainer.cpp:310–331  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

308}
309
310void ModuleContainer::TakeModule(IDrawableModule* module)
311{
312 assert(module->GetOwningContainer()); //module must already be in a container
313 ofVec2f oldOwnerPos = module->GetOwningContainer()->GetOwnerPosition();
314 if (module->GetOwningContainer()->mOwner)
315 module->GetOwningContainer()->mOwner->RemoveChild(module);
316 RemoveFromVector(module, module->GetOwningContainer()->mModules);
317
318 std::string newName = GetUniqueName(module->Name(), mModules);
319
320 mModules.push_back(module);
321 MoveToFront(module);
322
323 ofVec2f offset = oldOwnerPos - GetOwnerPosition();
324 module->SetPosition(module->GetPosition(true).x + offset.x,
325 module->GetPosition(true).y + offset.y);
326 module->SetOwningContainer(this);
327 if (mOwner)
328 mOwner->AddChild(module);
329 else //root modulecontainer
330 module->SetName(newName.c_str());
331}
332
333void ModuleContainer::DeleteModule(IDrawableModule* module, bool fail /*= true*/)
334{

Callers 5

CheckboxUpdatedMethod · 0.80
MouseReleasedMethod · 0.80
PostRepatchMethod · 0.80
ButtonClickedMethod · 0.80
AddTrackMethod · 0.80

Calls 11

RemoveFromVectorFunction · 0.85
GetUniqueNameFunction · 0.85
GetOwningContainerMethod · 0.80
GetOwnerPositionMethod · 0.80
RemoveChildMethod · 0.80
SetOwningContainerMethod · 0.80
AddChildMethod · 0.80
NameMethod · 0.45
SetPositionMethod · 0.45
GetPositionMethod · 0.45
SetNameMethod · 0.45

Tested by

no test coverage detected