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

Method FindValidTargets

Source/PatchCableSource.cpp:622–662  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

620}
621
622void PatchCableSource::FindValidTargets()
623{
624 mValidTargets.clear();
625 std::vector<IDrawableModule*> allModules;
626 TheSynth->GetAllModules(allModules);
627 for (auto module : allModules)
628 {
629 if (module == mOwner)
630 continue;
631 if ((mType == kConnectionType_Pulse || mType == kConnectionType_Modulator || mType == kConnectionType_ValueSetter || mType == kConnectionType_UIControl || mType == kConnectionType_Grid) && module != TheTitleBar)
632 {
633 for (auto uicontrol : module->GetUIControls())
634 {
635 if (uicontrol->IsShowing() &&
636 (uicontrol->GetShouldSaveState() || dynamic_cast<ClickButton*>(uicontrol) != nullptr) &&
637 uicontrol->CanBeTargetedBy(this))
638 mValidTargets.push_back(uicontrol);
639 }
640 for (auto uigrid : module->GetUIGrids())
641 {
642 if (uigrid->IsShowing() &&
643 uigrid->CanBeTargetedBy(this))
644 mValidTargets.push_back(uigrid);
645 }
646 }
647 if (module == mOwner->GetParent())
648 continue;
649 if (mTypeFilter.empty() == false && !VectorContains(module->GetTypeName(), mTypeFilter))
650 continue;
651 if (mType == kConnectionType_Audio && module->CanReceiveAudio())
652 mValidTargets.push_back(module);
653 if (mType == kConnectionType_Note && module->CanReceiveNotes())
654 mValidTargets.push_back(module);
655 if (mType == kConnectionType_Pulse && module->CanReceivePulses())
656 mValidTargets.push_back(module);
657 if (mType == kConnectionType_Special)
658 {
659 mValidTargets.push_back(module);
660 }
661 }
662}
663
664void PatchCableSource::CableGrabbed()
665{

Callers 4

PollMethod · 0.80
OnMidiNoteMethod · 0.80
SetPatchCableTargetMethod · 0.80
MouseMovedMethod · 0.80

Calls 13

VectorContainsFunction · 0.85
GetUIControlsMethod · 0.80
IsShowingMethod · 0.80
GetShouldSaveStateMethod · 0.80
GetUIGridsMethod · 0.80
GetParentMethod · 0.80
emptyMethod · 0.80
GetTypeNameMethod · 0.80
CanReceiveAudioMethod · 0.80
CanReceiveNotesMethod · 0.80
CanReceivePulsesMethod · 0.80
GetAllModulesMethod · 0.45

Tested by

no test coverage detected