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

Method GetPatchCablePos

Source/PatchCable.cpp:574–663  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

572}
573
574PatchCablePos 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 {

Callers

nothing calls this directly

Calls 15

ofVec2fClass · 0.85
ofClampFunction · 0.85
GetCableStartMethod · 0.80
IsDeletedMethod · 0.80
GetOwningContainerMethod · 0.80
GetParentMethod · 0.80
MinimizedMethod · 0.80
IsShowingMethod · 0.80
GetCableStartDirMethod · 0.80
GetOptionPositionMethod · 0.80
dotMethod · 0.80
HasTitleBarMethod · 0.45

Tested by

no test coverage detected