MCPcopy Create free account
hub / github.com/baconpaul/airwin2rack / AW2RModuleWidget

Method AW2RModuleWidget

src-rack/Module.cpp:1646–1747  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1644 sst::rackhelpers::ui::BufferedDrawFunctionWidget *bg{nullptr};
1645
1646 AW2RModuleWidget(M *m)
1647 {
1648 awSkin.intialize();
1649 setModule(m);
1650 box.size = rack::Vec(SCREW_WIDTH * 10, RACK_HEIGHT);
1651
1652 clipperSvg = rack::Svg::load(rack::asset::plugin(pluginInstance, "res/clipper.svg"));
1653
1654 bg = new sst::rackhelpers::ui::BufferedDrawFunctionWidget(rack::Vec(0, 0), box.size,
1655 [this](auto vg) { drawBG(vg); });
1656 bg->box.pos = rack::Vec(0.0);
1657 bg->box.size = box.size;
1658 addChild(bg);
1659
1660 int headerSize{38};
1661
1662 auto tlab = new AWSelector;
1663 auto s = box;
1664 s.size.y = headerSize;
1665 s = s.shrink(rack::Vec(5, 5));
1666 tlab->box = s;
1667 tlab->module = m;
1668 tlab->setup();
1669 addChild(tlab);
1670
1671 auto hs = new AWHelp;
1672 hs->box.size = rack::Vec(12, 12);
1673 hs->box.pos.x = tlab->box.pos.x + tlab->box.size.x - 14;
1674 hs->box.pos.y = tlab->box.pos.y + 1;
1675 hs->isOpen = [this]() { return helpShowing; };
1676 hs->toggleHelp = [this]() { toggleHelp(); };
1677 hs->setup();
1678 addChild(hs);
1679
1680 auto pPos = headerSize + 1, dPP = 27;
1681
1682 for (int i = 0; i < M::maxParams; ++i)
1683 {
1684 auto tlab = new AWLabel;
1685 tlab->px = 12;
1686 tlab->box.pos.x = 5;
1687 tlab->box.pos.y = pPos;
1688 tlab->box.size.x = box.size.x - 76;
1689 tlab->box.size.y = dPP;
1690 tlab->label = "Param " + std::to_string(i);
1691 tlab->setup();
1692 parLabels[i] = tlab;
1693 addChild(tlab);
1694
1695 auto bp = box.size.x - 60;
1696 auto k = rack::createParamCentered<PixelKnob<20>>(rack::Vec(bp, pPos + dPP * 0.5),
1697 module, M::PARAM_0 + i);
1698 k->stripMenuTypein = true;
1699 parKnobs[i] = k;
1700 addParam(parKnobs[i]);
1701
1702 attenKnobs[i] = rack::createParamCentered<PixelKnob<12, true>>(
1703 rack::Vec(bp + 20, pPos + dPP * 0.5), module, M::ATTENUVERTER_0 + i);

Callers

nothing calls this directly

Calls 2

intializeMethod · 0.80
setupMethod · 0.45

Tested by

no test coverage detected