| 572 | } |
| 573 | |
| 574 | PatchCablePos PatchCable::GetPatchCablePos() |
| 575 | { |
| 576 | ofVec2f start = mOwner->GetCableStart(mSourceIndex); |
| 577 | |
| 578 | float wThat, hThat, xThat, yThat; |
| 579 | |
| 580 | int yThatAdjust = 0; |
| 581 | IClickable* target = mTarget; |
| 582 | if (mTempDrawTarget != nullptr) |
| 583 | target = mTempDrawTarget; |
| 584 | IDrawableModule* targetModule = dynamic_cast<IDrawableModule*>(target); |
| 585 | |
| 586 | if (targetModule != nullptr && targetModule->IsDeleted()) |
| 587 | { |
| 588 | targetModule = nullptr; |
| 589 | target = nullptr; |
| 590 | } |
| 591 | |
| 592 | if (targetModule && targetModule->HasTitleBar() && !mDragging) |
| 593 | yThatAdjust = IDrawableModule::TitleBarHeight(); |
| 594 | |
| 595 | if (mDragging) |
| 596 | { |
| 597 | int mouseX = TheSynth->GetMouseX(GetOwningModule()->GetOwningContainer()); |
| 598 | int mouseY = TheSynth->GetMouseY(GetOwningModule()->GetOwningContainer()); |
| 599 | wThat = 0; |
| 600 | hThat = 0; |
| 601 | xThat = mouseX; |
| 602 | yThat = mouseY; |
| 603 | } |
| 604 | else if (target) |
| 605 | { |
| 606 | target->GetDimensions(wThat, hThat); |
| 607 | target->GetPosition(xThat, yThat); |
| 608 | |
| 609 | IDrawableModule* targetModuleParent = dynamic_cast<IDrawableModule*>(target->GetParent()); |
| 610 | IDrawableModule* targetModuleGrandparent = dynamic_cast<IDrawableModule*>(targetModuleParent ? targetModuleParent->GetParent() : nullptr); |
| 611 | ModuleContainer* targetModuleParentContainer = targetModuleParent ? targetModuleParent->GetOwningContainer() : nullptr; |
| 612 | IDrawableModule* targetModuleParentContainerModule = targetModuleParentContainer ? targetModuleParentContainer->GetOwner() : nullptr; |
| 613 | if (targetModuleParentContainerModule && targetModuleParentContainerModule->Minimized()) |
| 614 | targetModuleParent = targetModuleParentContainerModule; |
| 615 | if (targetModuleParent && (targetModuleParent->Minimized() || target->IsShowing() == false)) |
| 616 | { |
| 617 | targetModuleParent->GetPosition(xThat, yThat); |
| 618 | targetModuleParent->GetDimensions(wThat, hThat); |
| 619 | if (targetModuleParent->HasTitleBar() && !mDragging) |
| 620 | yThatAdjust = IDrawableModule::TitleBarHeight(); |
| 621 | } |
| 622 | if (targetModuleGrandparent && (targetModuleGrandparent->Minimized() || target->IsShowing() == false)) |
| 623 | { |
| 624 | targetModuleGrandparent->GetPosition(xThat, yThat); |
| 625 | targetModuleGrandparent->GetDimensions(wThat, hThat); |
| 626 | if (targetModuleGrandparent->HasTitleBar() && !mDragging) |
| 627 | yThatAdjust = IDrawableModule::TitleBarHeight(); |
| 628 | } |
| 629 | } |
| 630 | else |
| 631 | { |
nothing calls this directly
no test coverage detected