MCPcopy Create free account
hub / github.com/VCVRack/Rack / updateExpanders

Method updateExpanders

src/app/RackWidget.cpp:1646–1676  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1644
1645
1646void RackWidget::updateExpanders() {
1647 for (widget::Widget* w : internal->moduleContainer->children) {
1648 ModuleWidget* mw = (ModuleWidget*) w;
1649
1650 math::Vec pLeft = mw->getGridBox().getTopLeft();
1651 math::Vec pRight = mw->getGridBox().getTopRight();
1652 ModuleWidget* mwLeft = NULL;
1653 ModuleWidget* mwRight = NULL;
1654
1655 // Find adjacent modules
1656 for (widget::Widget* w2 : internal->moduleContainer->children) {
1657 ModuleWidget* mw2 = (ModuleWidget*) w2;
1658 if (mw2 == mw)
1659 continue;
1660
1661 math::Vec p2Left = mw2->getGridBox().getTopLeft();
1662 math::Vec p2Right = mw2->getGridBox().getTopRight();
1663
1664 // Check if this is a left module
1665 if (p2Right.equals(pLeft))
1666 mwLeft = mw2;
1667
1668 // Check if this is a right module
1669 if (p2Left.equals(pRight))
1670 mwRight = mw2;
1671 }
1672
1673 mw->module->leftExpander.moduleId = mwLeft ? mwLeft->module->id : -1;
1674 mw->module->rightExpander.moduleId = mwRight ? mwRight->module->id : -1;
1675 }
1676}
1677
1678
1679} // namespace app

Callers 4

undoMethod · 0.80
redoMethod · 0.80
cloneActionMethod · 0.80
removeActionMethod · 0.80

Calls 4

getTopLeftMethod · 0.80
getGridBoxMethod · 0.80
getTopRightMethod · 0.80
equalsMethod · 0.45

Tested by

no test coverage detected