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

Method OnSelectItem

Source/QuickSpawnMenu.cpp:498–532  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

496}
497
498void QuickSpawnMenu::OnSelectItem(int index)
499{
500 if (mMenuMode == MenuMode::SingleLetter || mMenuMode == MenuMode::Search || mMenuMode == MenuMode::SingleCategory)
501 {
502 if (index >= 0 && index < mElements.size())
503 {
504 IDrawableModule* module = TheSynth->SpawnModuleOnTheFly(mElements[index], TheSynth->GetMouseX(TheSynth->GetRootContainer()) + kModuleGrabOffset.x, TheSynth->GetMouseY(TheSynth->GetRootContainer()) + kModuleGrabOffset.y);
505 TheSynth->SetMoveModule(module, kModuleGrabOffset.x, kModuleGrabOffset.y, true);
506 if (mFilterForCable != nullptr)
507 {
508 mFilterForCable->SetTempDrawTarget(nullptr);
509 if (mMainContainerFollower->mTempConnectionCable->IsShowing())
510 module->SetTarget(mMainContainerFollower->mTempConnectionCable->GetTarget());
511 mFilterForCable->GetOwner()->SetPatchCableTarget(mFilterForCable, module, true);
512 mFilterForCable = nullptr;
513 }
514 }
515 Hide();
516 }
517
518 if (mMenuMode == MenuMode::ModuleCategories)
519 {
520 if (index >= 0 && index < mElements.size())
521 {
522 mSelectedCategoryIndex = mCategoryIndices[index];
523 mMenuMode = MenuMode::SingleCategory;
524 ResetAppearPos();
525 UpdateDisplay();
526 }
527 else
528 {
529 Hide();
530 }
531 }
532}
533
534std::string QuickSpawnMenu::GetHoveredModuleTypeName()
535{

Callers

nothing calls this directly

Calls 12

sizeMethod · 0.80
SpawnModuleOnTheFlyMethod · 0.80
GetRootContainerMethod · 0.80
SetMoveModuleMethod · 0.80
SetTempDrawTargetMethod · 0.80
IsShowingMethod · 0.80
SetPatchCableTargetMethod · 0.80
GetMouseXMethod · 0.45
GetMouseYMethod · 0.45
SetTargetMethod · 0.45
GetTargetMethod · 0.45
GetOwnerMethod · 0.45

Tested by

no test coverage detected