| 506 | } |
| 507 | |
| 508 | bool PatchCableSource::TestClick(float x, float y, bool right, bool testOnly /* = false */) |
| 509 | { |
| 510 | if (!Enabled()) |
| 511 | return false; |
| 512 | |
| 513 | if (!mClickable) |
| 514 | return false; |
| 515 | |
| 516 | if (right) |
| 517 | return false; |
| 518 | |
| 519 | if (mHoverIndex != -1) |
| 520 | { |
| 521 | if (!testOnly) |
| 522 | { |
| 523 | if (mPatchCables.empty() || InAddCableMode()) |
| 524 | { |
| 525 | if (mPatchCables.empty() || |
| 526 | mType == kConnectionType_Note || |
| 527 | mType == kConnectionType_Pulse || |
| 528 | mType == kConnectionType_UIControl || |
| 529 | mType == kConnectionType_Special || |
| 530 | mType == kConnectionType_ValueSetter || |
| 531 | mType == kConnectionType_Modulator) |
| 532 | { |
| 533 | PatchCable* newCable = AddPatchCable(nullptr); |
| 534 | if (newCable) |
| 535 | newCable->Grab(); |
| 536 | } |
| 537 | else if (mType == kConnectionType_Audio) |
| 538 | { |
| 539 | ofVec2f spawnOffset(-20, 10); |
| 540 | ModuleFactory::Spawnable spawnable; |
| 541 | spawnable.mLabel = "send"; |
| 542 | AudioSend* send = dynamic_cast<AudioSend*>(TheSynth->SpawnModuleOnTheFly(spawnable, x + spawnOffset.x, y + spawnOffset.y)); |
| 543 | send->SetTarget(GetTarget()); |
| 544 | SetTarget(send); |
| 545 | send->SetSend(1, false); |
| 546 | TheSynth->SetMoveModule(send, spawnOffset.x, spawnOffset.y, false); |
| 547 | } |
| 548 | } |
| 549 | else |
| 550 | { |
| 551 | if (mPatchCables[mHoverIndex] != nullptr) |
| 552 | mPatchCables[mHoverIndex]->Grab(); |
| 553 | } |
| 554 | } |
| 555 | return true; |
| 556 | } |
| 557 | |
| 558 | //for (auto cable : mPatchCables) |
| 559 | //{ |
| 560 | // if (cable->TestClick(x, y, right, testOnly)) |
| 561 | // return true; |
| 562 | //} |
| 563 | |
| 564 | return false; |
| 565 | } |
nothing calls this directly
no test coverage detected