computerscare-vcv-modules

computerscare modules for VCV Rack
Log | Files | Refs

commit b62d2f86da86342637bb968ed74d7ffe2fd4745a
parent b6f549faf35c99b44c3be94c16b716d52cd5b57d
Author: Adam M <aemalone@gmail.com>
Date:   Sat, 11 Apr 2020 09:56:12 -0500

Puttons gets disabled look for buttons

Diffstat:
Mres/computerscare-iso-button-small-down-grey.svg | 8++++----
Mres/computerscare-iso-button-small-up-grey.svg | 4++--
Msrc/Computerscare.hpp | 25+++++++++++++++----------
Msrc/ComputerscareBolyPuttons.cpp | 19+++++++++++++++----
Msrc/ComputerscarePolyModule.hpp | 4----
5 files changed, 36 insertions(+), 24 deletions(-)

diff --git a/res/computerscare-iso-button-small-down-grey.svg b/res/computerscare-iso-button-small-down-grey.svg @@ -34,7 +34,7 @@ inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="15.839192" - inkscape:cx="1.5446239" + inkscape:cx="11.646149" inkscape:cy="12.208888" inkscape:document-units="mm" inkscape:current-layer="layer1" @@ -66,7 +66,7 @@ id="layer1" transform="translate(0,-289)"> <path - style="fill:#42595b;fill-opacity:1;stroke:#000000;stroke-width:0.17936714px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + style="fill:#878e8f;fill-opacity:1;stroke:#000000;stroke-width:0.17936714px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" d="m 7.6997832,291.09096 c -5.6745886,-0.0497 -5.7223016,0.0508 -5.7223016,0.0508 l 0.016704,5.62316 5.7676146,0.0158 z" id="path1551" inkscape:connector-curvature="0" @@ -77,13 +77,13 @@ id="path2175" inkscape:connector-curvature="0" /> <path - style="fill:#1d3335;fill-opacity:1;stroke:#000000;stroke-width:0.19468118px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + style="fill:#3a4446;fill-opacity:1;stroke:#000000;stroke-width:0.19468118px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" d="m 2.7583609,296.71643 -0.047277,-4.96564 v 0 l -0.7168975,-0.72599 -0.1988388,3e-4 0.1988391,5.74019 v 0 z" id="path2177" inkscape:connector-curvature="0" sodipodi:nodetypes="cccccccc" /> <path - style="fill:#899e99;fill-opacity:1;stroke:#000000;stroke-width:0.19468118px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + style="fill:#a6afad;fill-opacity:1;stroke:#000000;stroke-width:0.19468118px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" d="m 1.9941859,291.0248 c 1.9018658,0.0221 3.8037316,0.044 5.7055973,0.0662 l 0.00699,0.62149 -4.9956948,0.0383 z" id="path2181" inkscape:connector-curvature="0" diff --git a/res/computerscare-iso-button-small-up-grey.svg b/res/computerscare-iso-button-small-up-grey.svg @@ -63,7 +63,7 @@ id="layer1" transform="translate(0,-289)"> <path - style="fill:#3c4f4c;fill-opacity:1;stroke:#000000;stroke-width:0.18299402;stroke-linecap:butt;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + style="fill:#989d9b;fill-opacity:1;stroke:#000000;stroke-width:0.18299402;stroke-linecap:butt;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="m 0.13498472,296.1192 2.17320148,0.63818 5.5061789,0.0256 -0.1796201,-5.60982 c -0.4937595,-0.16251 -1.0888666,-0.94602 -1.760248,-0.93658" id="path1553" inkscape:connector-curvature="0" @@ -75,7 +75,7 @@ inkscape:connector-curvature="0" sodipodi:nodetypes="ccc" /> <path - style="fill:#92a19e;fill-opacity:1;stroke:#000000;stroke-width:0.18299402;stroke-linecap:butt;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + style="fill:#d7dcdb;fill-opacity:1;stroke:#000000;stroke-width:0.18299402;stroke-linecap:butt;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="m 5.9048249,290.2249 c -5.71885349,-0.0513 -5.75010404,-0.0682 -5.75010404,-0.0682 v 0 5.92022 l 5.81260524,0.0171 z" id="path1551" inkscape:connector-curvature="0" diff --git a/src/Computerscare.hpp b/src/Computerscare.hpp @@ -140,23 +140,28 @@ struct SmallIsoButton : app::SvgSwitch { disabledFrames.push_back(APP->window->loadSvg(asset::plugin(pluginInstance, "res/computerscare-iso-button-small-down-grey.svg"))); - //addFrame(enabledFrames[0]); - //addFrame(enabledFrames[1]); + addFrame(enabledFrames[0]); + addFrame(enabledFrames[1]); shadow->opacity = 0.f; } - void draw(const DrawArgs& args) override { + void step() override { if (disabled != lastDisabled) { - DEBUG("AH HA!!!"); - frames.empty(); - addFrame(disabled ? disabledFrames[0] : enabledFrames[0]); - addFrame(disabled ? disabledFrames[1] : enabledFrames[1]); - - //setSvg(candidate ? disabledSvg : enabledSvg); + if(disabled) { + frames[0]=disabledFrames[0]; + frames[1]=disabledFrames[1]; + } + else { + frames[0]=enabledFrames[0]; + frames[1]=enabledFrames[1]; + } + onChange(*(new event::Change())); + fb->dirty=true; dirtyValue = -20.f; lastDisabled = disabled; + } - SvgSwitch::draw(args); + SvgSwitch::step(); } }; struct ComputerscareIsoThree : app::SvgSwitch { diff --git a/src/ComputerscareBolyPuttons.cpp b/src/ComputerscareBolyPuttons.cpp @@ -175,15 +175,18 @@ struct ComputerscareBolyPuttons : ComputerscarePolyModule { }; -struct DisableableParamWidget : ParamWidget { +struct DisableableParamWidget : SmallIsoButton { ComputerscarePolyModule *module; - bool disabled; int channel; + + DisableableParamWidget() { + SmallIsoButton(); + } void step() override { if (module) { disabled = channel > module->polyChannels - 1; } - ParamWidget::step(); + SmallIsoButton::step(); } }; @@ -224,7 +227,14 @@ struct ComputerscareBolyPuttonsWidget : ModuleWidget { } void addLabeledButton(std::string label, int x, int y, ComputerscareBolyPuttons *module, int index, float labelDx, float labelDy) { - addParam(createParam<SmallIsoButton>(Vec(x, y), module, ComputerscareBolyPuttons::TOGGLE + index)); + DisableableParamWidget* button = createParam<DisableableParamWidget>(Vec(x, y), module, ComputerscareBolyPuttons::TOGGLE + index); + + button->module=module; + button->channel=index; + addParam(button); + + + //addParam(createParam<DisableableParamWidget>(Vec(x, y), module, ComputerscareBolyPuttons::TOGGLE + index)); smallLetterDisplay = new SmallLetterDisplay(); smallLetterDisplay->box.size = Vec(5, 10); @@ -244,6 +254,7 @@ struct ComputerscareBolyPuttonsWidget : ModuleWidget { } void appendContextMenu(Menu *menu) override; + DisableableParamWidget* button; PolyOutputChannelsWidget* channelWidget; ComputerscareBolyPuttons *bolyPuttons; SmallLetterDisplay* smallLetterDisplay; diff --git a/src/ComputerscarePolyModule.hpp b/src/ComputerscarePolyModule.hpp @@ -82,16 +82,12 @@ struct PolyOutputChannelsWidget : Widget { PolyChannelsDisplay *channelCountDisplay; TinyChannelsSnapKnob *channelsKnob; PolyOutputChannelsWidget(math::Vec pos,ComputerscarePolyModule *mod,int paramId) { - //Vec(8, 26) +7,+3 - // //addParam(createParam<TinyChannelsSnapKnob>(Vec(8, 26), module, ComputerscareKnolyPobs::POLY_CHANNELS)); module = mod; - channelsKnob = createParam<TinyChannelsSnapKnob>(pos.plus(Vec(7,3)),module,paramId); channelsKnob->module=module; channelsKnob->paramId=paramId; - channelCountDisplay = new PolyChannelsDisplay(pos); channelCountDisplay->module = module;