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

Method FindUIControl

Source/ModuleContainer.cpp:451–485  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

449}
450
451IUIControl* ModuleContainer::FindUIControl(std::string path)
452{
453 /*string ownerPath = "";
454 if (mOwner)
455 ownerPath = mOwner->Path();
456 if (strstr(path.c_str(), ownerPath.c_str()) != path.c_str()) //path doesn't start with ownerPath
457 return nullptr;
458
459 path = path.substr(ownerPath.length());*/
460
461 if (path == "")
462 return nullptr;
463
464 std::vector<std::string> tokens = ofSplitString(path, "~");
465 std::string control = tokens[tokens.size() - 1];
466 std::string modulePath = path.substr(0, path.length() - (control.length() + 1));
467 IDrawableModule* module = FindModule(modulePath, false);
468
469 if (module)
470 {
471 try
472 {
473 module->OnUIControlRequested(control.c_str());
474 return module->FindUIControl(control.c_str());
475 }
476 catch (UnknownUIControlException& e)
477 {
478 TheSynth->LogEvent("Couldn't find UI control at path \"" + path + "\"", kLogEventType_Error);
479 return nullptr;
480 }
481 }
482
483 TheSynth->LogEvent("Couldn't find module at path \"" + modulePath + "\"", kLogEventType_Error);
484 return nullptr;
485}
486
487bool ModuleContainer::IsHigherThan(IDrawableModule* checkFor, IDrawableModule* checkAgainst) const
488{

Callers

nothing calls this directly

Calls 5

ofSplitStringFunction · 0.85
sizeMethod · 0.80
lengthMethod · 0.80
LogEventMethod · 0.80
OnUIControlRequestedMethod · 0.45

Tested by

no test coverage detected