@@ -14,6 +14,7 @@ struct Wire; | |||
struct RackWidget; | |||
struct ParamWidget; | |||
struct Port; | |||
struct SVGPanel; | |||
//////////////////// | |||
// module | |||
@@ -23,11 +24,15 @@ struct Port; | |||
#define RACK_GRID_WIDTH 15 | |||
#define RACK_GRID_HEIGHT 380 | |||
static const Vec RACK_GRID_SIZE = Vec(15, 380); | |||
struct ModuleWidget : OpaqueWidget { | |||
Model *model = NULL; | |||
/** Owns the module pointer */ | |||
Module *module = NULL; | |||
SVGPanel *panel = NULL; | |||
std::vector<Port*> inputs; | |||
std::vector<Port*> outputs; | |||
std::vector<ParamWidget*> params; | |||
@@ -38,6 +43,7 @@ struct ModuleWidget : OpaqueWidget { | |||
void addInput(Port *input); | |||
void addOutput(Port *output); | |||
void addParam(ParamWidget *param); | |||
void setPanel(std::shared_ptr<SVG> svg); | |||
virtual json_t *toJson(); | |||
virtual void fromJson(json_t *rootJ); | |||
@@ -446,8 +446,6 @@ struct NKK : SVGSwitch, ToggleSwitch { | |||
addFrame(SVG::load(assetGlobal("res/ComponentLibrary/NKK_0.svg"))); | |||
addFrame(SVG::load(assetGlobal("res/ComponentLibrary/NKK_1.svg"))); | |||
addFrame(SVG::load(assetGlobal("res/ComponentLibrary/NKK_2.svg"))); | |||
sw->wrap(); | |||
box.size = sw->box.size; | |||
} | |||
}; | |||
@@ -455,8 +453,6 @@ struct CKSS : SVGSwitch, ToggleSwitch { | |||
CKSS() { | |||
addFrame(SVG::load(assetGlobal("res/ComponentLibrary/CKSS_0.svg"))); | |||
addFrame(SVG::load(assetGlobal("res/ComponentLibrary/CKSS_1.svg"))); | |||
sw->wrap(); | |||
box.size = sw->box.size; | |||
} | |||
}; | |||
@@ -464,8 +460,6 @@ struct CKD6 : SVGSwitch, MomentarySwitch { | |||
CKD6() { | |||
addFrame(SVG::load(assetGlobal("res/ComponentLibrary/CKD6_0.svg"))); | |||
addFrame(SVG::load(assetGlobal("res/ComponentLibrary/CKD6_1.svg"))); | |||
sw->wrap(); | |||
box.size = sw->box.size; | |||
} | |||
}; | |||
@@ -473,16 +467,12 @@ struct TL1105 : SVGSwitch, MomentarySwitch { | |||
TL1105() { | |||
addFrame(SVG::load(assetGlobal("res/ComponentLibrary/TL1105_0.svg"))); | |||
addFrame(SVG::load(assetGlobal("res/ComponentLibrary/TL1105_1.svg"))); | |||
sw->wrap(); | |||
box.size = sw->box.size; | |||
} | |||
}; | |||
struct LEDButton : SVGSwitch, MomentarySwitch { | |||
LEDButton() { | |||
addFrame(SVG::load(assetGlobal("res/ComponentLibrary/LEDButton.svg"))); | |||
sw->wrap(); | |||
box.size = sw->box.size; | |||
} | |||
}; | |||
@@ -491,8 +481,6 @@ struct BefacoSwitch : SVGSwitch, ToggleSwitch { | |||
addFrame(SVG::load(assetGlobal("res/ComponentLibrary/BefacoSwitch_0.svg"))); | |||
addFrame(SVG::load(assetGlobal("res/ComponentLibrary/BefacoSwitch_1.svg"))); | |||
addFrame(SVG::load(assetGlobal("res/ComponentLibrary/BefacoSwitch_2.svg"))); | |||
sw->wrap(); | |||
box.size = sw->box.size; | |||
} | |||
}; | |||
@@ -500,17 +488,12 @@ struct BefacoPush : SVGSwitch, MomentarySwitch { | |||
BefacoPush() { | |||
addFrame(SVG::load(assetGlobal("res/ComponentLibrary/BefacoPush_0.svg"))); | |||
addFrame(SVG::load(assetGlobal("res/ComponentLibrary/BefacoPush_1.svg"))); | |||
sw->wrap(); | |||
box.size = sw->box.size; | |||
} | |||
}; | |||
struct PB61303 : SVGSwitch, MomentarySwitch { | |||
PB61303() { | |||
addFrame(SVG::load(assetGlobal("res/ComponentLibrary/PB61303_0.svg"))); | |||
addFrame(SVG::load(assetGlobal("res/ComponentLibrary/PB61303_1.svg"))); | |||
sw->wrap(); | |||
box.size = sw->box.size; | |||
addFrame(SVG::load(assetGlobal("res/ComponentLibrary/PB61303.svg"))); | |||
} | |||
}; | |||
@@ -521,16 +504,14 @@ struct PB61303 : SVGSwitch, MomentarySwitch { | |||
struct ScrewSilver : SVGScrew { | |||
ScrewSilver() { | |||
sw->svg = SVG::load(assetGlobal("res/ComponentLibrary/ScrewSilver.svg")); | |||
sw->wrap(); | |||
sw->setSVG(SVG::load(assetGlobal("res/ComponentLibrary/ScrewSilver.svg"))); | |||
box.size = sw->box.size; | |||
} | |||
}; | |||
struct ScrewBlack : SVGScrew { | |||
ScrewBlack() { | |||
sw->svg = SVG::load(assetGlobal("res/ComponentLibrary/ScrewBlack.svg")); | |||
sw->wrap(); | |||
sw->setSVG(SVG::load(assetGlobal("res/ComponentLibrary/ScrewBlack.svg"))); | |||
box.size = sw->box.size; | |||
} | |||
}; | |||
@@ -18,15 +18,6 @@ namespace rack { | |||
//////////////////// | |||
inline Vec in2px(Vec inches) { | |||
return inches.mult(SVG_DPI); | |||
} | |||
inline Vec mm2px(Vec millimeters) { | |||
return millimeters.mult(SVG_DPI / 25.4); | |||
} | |||
template <class TModuleWidget> | |||
Model *createModel(std::string manufacturerSlug, std::string manufacturerName, std::string slug, std::string name) { | |||
struct TModel : Model { | |||
@@ -16,6 +16,15 @@ | |||
namespace rack { | |||
inline Vec in2px(Vec inches) { | |||
return inches.mult(SVG_DPI); | |||
} | |||
inline Vec mm2px(Vec millimeters) { | |||
return millimeters.mult(SVG_DPI / 25.4); | |||
} | |||
//////////////////// | |||
// resources | |||
//////////////////// | |||
@@ -0,0 +1,263 @@ | |||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | |||
<!-- Created with Inkscape (http://www.inkscape.org/) --> | |||
<svg | |||
xmlns:dc="http://purl.org/dc/elements/1.1/" | |||
xmlns:cc="http://creativecommons.org/ns#" | |||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | |||
xmlns:svg="http://www.w3.org/2000/svg" | |||
xmlns="http://www.w3.org/2000/svg" | |||
xmlns:xlink="http://www.w3.org/1999/xlink" | |||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" | |||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" | |||
width="10.000438mm" | |||
height="10.000403mm" | |||
viewBox="0 0 10.000438 10.000403" | |||
version="1.1" | |||
id="svg81475" | |||
inkscape:version="0.92.2 5c3e80d, 2017-08-06" | |||
sodipodi:docname="PB61303.svg"> | |||
<defs | |||
id="defs81469"> | |||
<clipPath | |||
id="clip176"> | |||
<rect | |||
y="0" | |||
x="0" | |||
width="23" | |||
height="23" | |||
id="rect5578" /> | |||
</clipPath> | |||
<clipPath | |||
id="clip177"> | |||
<path | |||
inkscape:connector-curvature="0" | |||
d="M 0.335938,0.0585938 H 22.300781 V 22.023438 H 0.335938 Z m 0,0" | |||
id="path5566" /> | |||
</clipPath> | |||
<clipPath | |||
id="clip178"> | |||
<path | |||
inkscape:connector-curvature="0" | |||
d="m 11.316406,0.0585938 c -6.0625,0 -10.980468,4.9179682 -10.980468,10.9843752 0,6.0625 4.917968,10.980469 10.980468,10.980469 6.070313,0 10.988282,-4.917969 10.988282,-10.980469 0,-6.066407 -4.917969,-10.9843752 -10.988282,-10.9843752 m 0,0.5000002 c 5.785156,0 10.488282,4.703125 10.488282,10.484375 0,5.777343 -4.703126,10.480469 -10.488282,10.480469 -5.777344,0 -10.480468,-4.703126 -10.480468,-10.480469 0,-5.78125 4.703124,-10.484375 10.480468,-10.484375" | |||
id="path5569" /> | |||
</clipPath> | |||
<mask | |||
id="mask89"> | |||
<g | |||
style="filter:url(#alpha)" | |||
id="g5575"> | |||
<image | |||
y="-0.00263398" | |||
x="-0.51525402" | |||
xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABcAAAAXCAYAAADgKtSgAAAABmJLR0QA/wD/AP+gvaeTAAABMklEQVRIia3UuUoEQRDG8d+2432hoIIHCBqIqWAqGGiggan4CoKJYCr4Tia+hhiLmRhosGKg7Bp0r7ses85q/6Goobr6m5mqrq7pTq3Dmsm3aHbYj/SVxAsMpedGsuYXq2EgWWv9V8YxUiUxETCJwd8SZ6oklTCF0bLF2W6LFZnXLucHw1j4pzCxD6tfg2ti7XIwI1ZBQH8KNjKJP3SKL+I+k3CLAiGIv/GUWfwFE0E8epUGoFfxQrvmOQlSWQZ8vjNyMI16EOs9l1l8Ho8B19jILD6G14C6eC7LbsheWcddZ2AZ+xmEazhO/mPkb8UmrPxT/AhXfjjaAWdY+qPwAXa7JRQ4xVYPooM4wXbVDXu4wKby23IchzgXe/aNbsNTYCe94C3lNpLvwzMucVP1i7PyDvnKKY/BOBMhAAAAAElFTkSuQmCC" | |||
height="0.27702156" | |||
width="0.27702156" | |||
id="use5573" | |||
transform="rotate(-90)" /> | |||
</g> | |||
</mask> | |||
<filter | |||
id="alpha" | |||
filterUnits="objectBoundingBox" | |||
x="0" | |||
y="0" | |||
width="1" | |||
height="1"> | |||
<feColorMatrix | |||
type="matrix" | |||
in="SourceGraphic" | |||
values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0" | |||
id="feColorMatrix4149" /> | |||
</filter> | |||
<mask | |||
id="mask88"> | |||
<g | |||
style="filter:url(#alpha)" | |||
id="g5563" | |||
transform="scale(0.26458333)"> | |||
<rect | |||
x="0" | |||
y="0" | |||
width="3052.8701" | |||
height="3351.5" | |||
style="fill:#000000;fill-opacity:0.33000201;stroke:none" | |||
id="rect5561" /> | |||
</g> | |||
</mask> | |||
<filter | |||
id="filter81423" | |||
filterUnits="objectBoundingBox" | |||
x="0" | |||
y="0" | |||
width="1" | |||
height="1"> | |||
<feColorMatrix | |||
type="matrix" | |||
in="SourceGraphic" | |||
values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0" | |||
id="feColorMatrix81421" /> | |||
</filter> | |||
<clipPath | |||
id="clipPath81427"> | |||
<rect | |||
y="0" | |||
x="0" | |||
width="23" | |||
height="23" | |||
id="rect81425" /> | |||
</clipPath> | |||
<clipPath | |||
id="clipPath81431"> | |||
<path | |||
inkscape:connector-curvature="0" | |||
d="M 0.335938,0.0585938 H 22.300781 V 22.023438 H 0.335938 Z m 0,0" | |||
id="path81429" /> | |||
</clipPath> | |||
<clipPath | |||
id="clipPath81435"> | |||
<path | |||
inkscape:connector-curvature="0" | |||
d="m 11.316406,0.0585938 c -6.0625,0 -10.980468,4.9179682 -10.980468,10.9843752 0,6.0625 4.917968,10.980469 10.980468,10.980469 6.070313,0 10.988282,-4.917969 10.988282,-10.980469 0,-6.066407 -4.917969,-10.9843752 -10.988282,-10.9843752 m 0,0.5000002 c 5.785156,0 10.488282,4.703125 10.488282,10.484375 0,5.777343 -4.703126,10.480469 -10.488282,10.480469 -5.777344,0 -10.480468,-4.703126 -10.480468,-10.480469 0,-5.78125 4.703124,-10.484375 10.480468,-10.484375" | |||
id="path81433" /> | |||
</clipPath> | |||
<mask | |||
id="mask81441"> | |||
<g | |||
style="filter:url(#alpha)" | |||
id="g81439"> | |||
<image | |||
y="-0.00263398" | |||
x="-0.51525402" | |||
xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABcAAAAXCAYAAADgKtSgAAAABmJLR0QA/wD/AP+gvaeTAAABMklEQVRIia3UuUoEQRDG8d+2432hoIIHCBqIqWAqGGiggan4CoKJYCr4Tia+hhiLmRhosGKg7Bp0r7ses85q/6Goobr6m5mqrq7pTq3Dmsm3aHbYj/SVxAsMpedGsuYXq2EgWWv9V8YxUiUxETCJwd8SZ6oklTCF0bLF2W6LFZnXLucHw1j4pzCxD6tfg2ti7XIwI1ZBQH8KNjKJP3SKL+I+k3CLAiGIv/GUWfwFE0E8epUGoFfxQrvmOQlSWQZ8vjNyMI16EOs9l1l8Ho8B19jILD6G14C6eC7LbsheWcddZ2AZ+xmEazhO/mPkb8UmrPxT/AhXfjjaAWdY+qPwAXa7JRQ4xVYPooM4wXbVDXu4wKby23IchzgXe/aNbsNTYCe94C3lNpLvwzMucVP1i7PyDvnKKY/BOBMhAAAAAElFTkSuQmCC" | |||
height="0.27702156" | |||
width="0.27702156" | |||
id="use81437" | |||
transform="rotate(-90)" /> | |||
</g> | |||
</mask> | |||
<filter | |||
id="filter81445" | |||
filterUnits="objectBoundingBox" | |||
x="0" | |||
y="0" | |||
width="1" | |||
height="1"> | |||
<feColorMatrix | |||
type="matrix" | |||
in="SourceGraphic" | |||
values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0" | |||
id="feColorMatrix81443" /> | |||
</filter> | |||
<clipPath | |||
id="clip174"> | |||
<rect | |||
y="0" | |||
x="0" | |||
width="27" | |||
height="26" | |||
id="rect5553" /> | |||
</clipPath> | |||
<clipPath | |||
id="clip175"> | |||
<path | |||
inkscape:connector-curvature="0" | |||
d="M 0.558594,0.289062 H 26.070312 V 25.800781 H 0.558594 Z m 0,0" | |||
id="path5550" /> | |||
</clipPath> | |||
<mask | |||
id="mask87"> | |||
<g | |||
style="filter:url(#alpha)" | |||
id="g5547" | |||
transform="scale(0.26458333)"> | |||
<rect | |||
x="0" | |||
y="0" | |||
width="3052.8701" | |||
height="3351.5" | |||
style="fill:#000000;fill-opacity:0.33000201;stroke:none" | |||
id="rect5545" /> | |||
</g> | |||
</mask> | |||
<filter | |||
id="filter81456" | |||
filterUnits="objectBoundingBox" | |||
x="0" | |||
y="0" | |||
width="1" | |||
height="1"> | |||
<feColorMatrix | |||
type="matrix" | |||
in="SourceGraphic" | |||
values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0" | |||
id="feColorMatrix81454" /> | |||
</filter> | |||
<clipPath | |||
id="clipPath81460"> | |||
<rect | |||
y="0" | |||
x="0" | |||
width="27" | |||
height="26" | |||
id="rect81458" /> | |||
</clipPath> | |||
<clipPath | |||
id="clipPath81464"> | |||
<path | |||
inkscape:connector-curvature="0" | |||
d="M 0.558594,0.289062 H 26.070312 V 25.800781 H 0.558594 Z m 0,0" | |||
id="path81462" /> | |||
</clipPath> | |||
</defs> | |||
<sodipodi:namedview | |||
id="base" | |||
pagecolor="#ffffff" | |||
bordercolor="#666666" | |||
borderopacity="1.0" | |||
inkscape:pageopacity="0.0" | |||
inkscape:pageshadow="2" | |||
inkscape:zoom="3.959798" | |||
inkscape:cx="-30.133384" | |||
inkscape:cy="16.667692" | |||
inkscape:document-units="mm" | |||
inkscape:current-layer="layer1" | |||
showgrid="false" | |||
fit-margin-top="0" | |||
fit-margin-left="0" | |||
fit-margin-right="0" | |||
fit-margin-bottom="0" | |||
inkscape:window-width="2560" | |||
inkscape:window-height="1422" | |||
inkscape:window-x="0" | |||
inkscape:window-y="18" | |||
inkscape:window-maximized="0" /> | |||
<metadata | |||
id="metadata81472"> | |||
<rdf:RDF> | |||
<cc:Work | |||
rdf:about=""> | |||
<dc:format>image/svg+xml</dc:format> | |||
<dc:type | |||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> | |||
<dc:title></dc:title> | |||
</cc:Work> | |||
</rdf:RDF> | |||
</metadata> | |||
<g | |||
inkscape:label="Layer 1" | |||
inkscape:groupmode="layer" | |||
id="layer1" | |||
transform="translate(-57.743829,-79.577179)"> | |||
<path | |||
inkscape:connector-curvature="0" | |||
id="path9091" | |||
d="m 67.744267,84.578086 c 0,2.760204 -2.239327,4.999496 -5.000907,4.999496 -2.760204,0 -4.999531,-2.239292 -4.999531,-4.999496 0,-2.761614 2.239327,-5.000907 4.999531,-5.000907 2.76158,0 5.000907,2.239293 5.000907,5.000907" | |||
style="fill:#211e1e;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.35277775" /> | |||
<path | |||
id="path81613" | |||
d="m 67.244028,84.578086 c 0,2.484579 -2.014678,4.499293 -4.500668,4.499293 -2.484614,0 -4.499293,-2.014714 -4.499293,-4.499293 0,-2.485989 2.014679,-4.500668 4.499293,-4.500668 2.48599,0 4.500668,2.014679 4.500668,4.500668" | |||
style="clip-rule:nonzero;fill:#6a6868;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.35277775" | |||
inkscape:connector-curvature="0" /> | |||
</g> | |||
</svg> |
@@ -1,234 +0,0 @@ | |||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | |||
<!-- Created with Inkscape (http://www.inkscape.org/) --> | |||
<svg | |||
xmlns:dc="http://purl.org/dc/elements/1.1/" | |||
xmlns:cc="http://creativecommons.org/ns#" | |||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | |||
xmlns:svg="http://www.w3.org/2000/svg" | |||
xmlns="http://www.w3.org/2000/svg" | |||
xmlns:xlink="http://www.w3.org/1999/xlink" | |||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" | |||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" | |||
width="29" | |||
height="28.999998" | |||
viewBox="0 0 7.6729169 7.672916" | |||
version="1.1" | |||
id="svg18405" | |||
inkscape:version="0.92.2 5c3e80d, 2017-08-06" | |||
sodipodi:docname="PB61303_0.svg"> | |||
<defs | |||
id="defs18399"> | |||
<linearGradient | |||
inkscape:collect="always" | |||
id="linearGradient19429"> | |||
<stop | |||
style="stop-color:#000000;stop-opacity:0.50196081" | |||
offset="0" | |||
id="stop19425" /> | |||
<stop | |||
style="stop-color:#000000;stop-opacity:0;" | |||
offset="1" | |||
id="stop19427" /> | |||
</linearGradient> | |||
<linearGradient | |||
id="linearGradient18002" | |||
spreadMethod="pad" | |||
gradientTransform="matrix(0,21.967773,-21.967773,0,4.883e-4,-10.983887)" | |||
gradientUnits="userSpaceOnUse" | |||
y2="0" | |||
x2="1" | |||
y1="0" | |||
x1="0"> | |||
<stop | |||
id="stop19357" | |||
offset="0" | |||
style="stop-opacity:1;stop-color:#ff0003" /> | |||
<stop | |||
id="stop19359" | |||
offset="1" | |||
style="stop-opacity:1;stop-color:#00ff00" /> | |||
</linearGradient> | |||
<clipPath | |||
clipPathUnits="userSpaceOnUse" | |||
id="clipPath17960"> | |||
<path | |||
d="M -14.1729,14.1729 H 14.1729 V -14.1729 H -14.1729 Z" | |||
id="path17958" | |||
inkscape:connector-curvature="0" /> | |||
</clipPath> | |||
<clipPath | |||
clipPathUnits="userSpaceOnUse" | |||
id="clipPath17972"> | |||
<path | |||
d="M -12.7554,12.7552 H 12.7564 V -12.7552 H -12.7554 Z" | |||
id="path17970" | |||
inkscape:connector-curvature="0" /> | |||
</clipPath> | |||
<clipPath | |||
clipPathUnits="userSpaceOnUse" | |||
id="clipPath17988"> | |||
<path | |||
d="M -10.9839,10.9839 H 10.9849 V -10.9839 H -10.9839 Z" | |||
id="path17986" | |||
inkscape:connector-curvature="0" /> | |||
</clipPath> | |||
<clipPath | |||
clipPathUnits="userSpaceOnUse" | |||
id="clipPath17992"> | |||
<path | |||
d="m 0,-10.984 c -6.067,0 -10.984,4.919 -10.984,10.984 0,6.065 4.917,10.984 10.984,10.984 C 6.068,10.984 10.985,6.065 10.985,0 10.985,-6.065 6.068,-10.984 0,-10.984 m 0,0.5 c 5.782,0 10.485,4.703 10.485,10.484 0,5.781 -4.703,10.484 -10.485,10.484 -5.781,0 -10.484,-4.703 -10.484,-10.484 0,-5.781 4.703,-10.484 10.484,-10.484" | |||
id="path17990" | |||
inkscape:connector-curvature="0" /> | |||
</clipPath> | |||
<mask | |||
maskUnits="userSpaceOnUse" | |||
x="0" | |||
y="0" | |||
width="1" | |||
height="1" | |||
id="mask18004"> | |||
<g | |||
id="g18014"> | |||
<g | |||
clip-path="url(#clipPath17996)" | |||
id="g18012"> | |||
<g | |||
id="g18010"> | |||
<g | |||
id="g18008"> | |||
<path | |||
d="M -32768,32767 H 32767 V -32768 H -32768 Z" | |||
style="fill:url(#linearGradient18002-3);stroke:none" | |||
id="path18006" | |||
inkscape:connector-curvature="0" /> | |||
</g> | |||
</g> | |||
</g> | |||
</g> | |||
</mask> | |||
<clipPath | |||
clipPathUnits="userSpaceOnUse" | |||
id="clipPath17996"> | |||
<path | |||
d="M -32768,32767 H 32767 V -32768 H -32768 Z" | |||
id="path17994" | |||
inkscape:connector-curvature="0" /> | |||
</clipPath> | |||
<linearGradient | |||
x1="0" | |||
y1="0" | |||
x2="1" | |||
y2="0" | |||
gradientUnits="userSpaceOnUse" | |||
gradientTransform="matrix(0,21.967773,-21.967773,0,4.883e-4,-10.983887)" | |||
spreadMethod="pad" | |||
id="linearGradient18002-3"> | |||
<stop | |||
style="stop-opacity:0;stop-color:#ffffff" | |||
offset="0" | |||
id="stop17998" /> | |||
<stop | |||
style="stop-opacity:1;stop-color:#ffffff" | |||
offset="1" | |||
id="stop18000" /> | |||
</linearGradient> | |||
<linearGradient | |||
x1="0" | |||
y1="0" | |||
x2="1" | |||
y2="0" | |||
gradientUnits="userSpaceOnUse" | |||
gradientTransform="matrix(0,21.967773,-21.967773,0,4.883e-4,-10.983887)" | |||
spreadMethod="pad" | |||
id="linearGradient18020"> | |||
<stop | |||
style="stop-opacity:1;stop-color:#231f20" | |||
offset="0" | |||
id="stop18016" /> | |||
<stop | |||
style="stop-opacity:1;stop-color:#231f20" | |||
offset="1" | |||
id="stop18018" /> | |||
</linearGradient> | |||
<linearGradient | |||
inkscape:collect="always" | |||
xlink:href="#linearGradient19429" | |||
id="linearGradient19435" | |||
x1="79.279854" | |||
y1="73.994049" | |||
x2="87.030029" | |||
y2="73.994049" | |||
gradientUnits="userSpaceOnUse" | |||
gradientTransform="matrix(0,-0.93432349,0.93432349,0,14.020561,151.68766)" /> | |||
</defs> | |||
<sodipodi:namedview | |||
id="base" | |||
pagecolor="#ffffff" | |||
bordercolor="#666666" | |||
borderopacity="1.0" | |||
inkscape:pageopacity="0.0" | |||
inkscape:pageshadow="2" | |||
inkscape:zoom="22.4" | |||
inkscape:cx="8.0466627" | |||
inkscape:cy="13.743925" | |||
inkscape:document-units="mm" | |||
inkscape:current-layer="g19440" | |||
showgrid="true" | |||
fit-margin-top="0" | |||
fit-margin-left="0" | |||
fit-margin-right="0" | |||
fit-margin-bottom="0" | |||
inkscape:window-width="2560" | |||
inkscape:window-height="1422" | |||
inkscape:window-x="0" | |||
inkscape:window-y="18" | |||
inkscape:window-maximized="0" | |||
inkscape:snap-page="true" | |||
inkscape:snap-bbox="true" | |||
inkscape:bbox-nodes="true" | |||
inkscape:object-nodes="false" | |||
units="px"> | |||
<inkscape:grid | |||
type="xygrid" | |||
id="grid20375" /> | |||
</sodipodi:namedview> | |||
<metadata | |||
id="metadata18402"> | |||
<rdf:RDF> | |||
<cc:Work | |||
rdf:about=""> | |||
<dc:format>image/svg+xml</dc:format> | |||
<dc:type | |||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> | |||
<dc:title></dc:title> | |||
</cc:Work> | |||
</rdf:RDF> | |||
</metadata> | |||
<g | |||
inkscape:label="Layer 1" | |||
inkscape:groupmode="layer" | |||
id="layer1" | |||
transform="translate(-78.154807,-71.321052)"> | |||
<g | |||
id="g19440" | |||
transform="matrix(0.76730402,0,0,0.76730402,18.186309,18.381579)" | |||
style="stroke-width:1.30326438"> | |||
<path | |||
d="m 88.154646,73.994048 c 0,2.761192 -2.238728,4.999919 -4.999919,4.999919 -2.761192,0 -4.99992,-2.238727 -4.99992,-4.999919 0,-2.761192 2.238728,-4.999919 4.99992,-4.999919 2.761191,0 4.999919,2.238727 4.999919,4.999919" | |||
style="fill:#231f20;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.45976272" | |||
id="path17964" | |||
inkscape:connector-curvature="0" /> | |||
<path | |||
inkscape:connector-curvature="0" | |||
id="path17974" | |||
style="fill:#6b6969;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.45976272" | |||
d="m 87.465003,73.994048 c 0,2.380367 -1.929341,4.310275 -4.3101,4.310275 -2.380759,0 -4.310099,-1.929908 -4.310099,-4.310275 0,-2.380367 1.92934,-4.310275 4.310099,-4.310275 2.380759,0 4.3101,1.929908 4.3101,4.310275" /> | |||
<path | |||
inkscape:connector-curvature="0" | |||
id="path18024" | |||
style="fill:url(#linearGradient19435);fill-opacity:1;stroke:none;stroke-width:0.45976272" | |||
d="m 79.534519,73.994213 c 0,1.999735 1.621344,3.62042 3.620419,3.62042 1.999076,0 3.620421,-1.620685 3.620421,-3.62042 0,-2.000066 -1.621345,-3.620751 -3.620421,-3.620751 -1.999075,0 -3.620419,1.620685 -3.620419,3.620751 m 0.164804,0 c 0,-1.905797 1.550149,-3.455946 3.455615,-3.455946 1.905467,0 3.455616,1.550149 3.455616,3.455946 0,1.905466 -1.550149,3.455615 -3.455616,3.455615 -1.905466,0 -3.455615,-1.550149 -3.455615,-3.455615" /> | |||
</g> | |||
</g> | |||
</svg> |
@@ -1,234 +0,0 @@ | |||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | |||
<!-- Created with Inkscape (http://www.inkscape.org/) --> | |||
<svg | |||
xmlns:dc="http://purl.org/dc/elements/1.1/" | |||
xmlns:cc="http://creativecommons.org/ns#" | |||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | |||
xmlns:svg="http://www.w3.org/2000/svg" | |||
xmlns="http://www.w3.org/2000/svg" | |||
xmlns:xlink="http://www.w3.org/1999/xlink" | |||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" | |||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" | |||
width="29" | |||
height="28.999998" | |||
viewBox="0 0 7.6729169 7.672916" | |||
version="1.1" | |||
id="svg18405" | |||
inkscape:version="0.92.2 5c3e80d, 2017-08-06" | |||
sodipodi:docname="PB61303_1.svg"> | |||
<defs | |||
id="defs18399"> | |||
<linearGradient | |||
inkscape:collect="always" | |||
id="linearGradient19429"> | |||
<stop | |||
style="stop-color:#000000;stop-opacity:0.50196081" | |||
offset="0" | |||
id="stop19425" /> | |||
<stop | |||
style="stop-color:#000000;stop-opacity:0;" | |||
offset="1" | |||
id="stop19427" /> | |||
</linearGradient> | |||
<linearGradient | |||
id="linearGradient18002" | |||
spreadMethod="pad" | |||
gradientTransform="matrix(0,21.967773,-21.967773,0,4.883e-4,-10.983887)" | |||
gradientUnits="userSpaceOnUse" | |||
y2="0" | |||
x2="1" | |||
y1="0" | |||
x1="0"> | |||
<stop | |||
id="stop19357" | |||
offset="0" | |||
style="stop-opacity:1;stop-color:#ff0003" /> | |||
<stop | |||
id="stop19359" | |||
offset="1" | |||
style="stop-opacity:1;stop-color:#00ff00" /> | |||
</linearGradient> | |||
<clipPath | |||
clipPathUnits="userSpaceOnUse" | |||
id="clipPath17960"> | |||
<path | |||
d="M -14.1729,14.1729 H 14.1729 V -14.1729 H -14.1729 Z" | |||
id="path17958" | |||
inkscape:connector-curvature="0" /> | |||
</clipPath> | |||
<clipPath | |||
clipPathUnits="userSpaceOnUse" | |||
id="clipPath17972"> | |||
<path | |||
d="M -12.7554,12.7552 H 12.7564 V -12.7552 H -12.7554 Z" | |||
id="path17970" | |||
inkscape:connector-curvature="0" /> | |||
</clipPath> | |||
<clipPath | |||
clipPathUnits="userSpaceOnUse" | |||
id="clipPath17988"> | |||
<path | |||
d="M -10.9839,10.9839 H 10.9849 V -10.9839 H -10.9839 Z" | |||
id="path17986" | |||
inkscape:connector-curvature="0" /> | |||
</clipPath> | |||
<clipPath | |||
clipPathUnits="userSpaceOnUse" | |||
id="clipPath17992"> | |||
<path | |||
d="m 0,-10.984 c -6.067,0 -10.984,4.919 -10.984,10.984 0,6.065 4.917,10.984 10.984,10.984 C 6.068,10.984 10.985,6.065 10.985,0 10.985,-6.065 6.068,-10.984 0,-10.984 m 0,0.5 c 5.782,0 10.485,4.703 10.485,10.484 0,5.781 -4.703,10.484 -10.485,10.484 -5.781,0 -10.484,-4.703 -10.484,-10.484 0,-5.781 4.703,-10.484 10.484,-10.484" | |||
id="path17990" | |||
inkscape:connector-curvature="0" /> | |||
</clipPath> | |||
<mask | |||
maskUnits="userSpaceOnUse" | |||
x="0" | |||
y="0" | |||
width="1" | |||
height="1" | |||
id="mask18004"> | |||
<g | |||
id="g18014"> | |||
<g | |||
clip-path="url(#clipPath17996)" | |||
id="g18012"> | |||
<g | |||
id="g18010"> | |||
<g | |||
id="g18008"> | |||
<path | |||
d="M -32768,32767 H 32767 V -32768 H -32768 Z" | |||
style="fill:url(#linearGradient18002-3);stroke:none" | |||
id="path18006" | |||
inkscape:connector-curvature="0" /> | |||
</g> | |||
</g> | |||
</g> | |||
</g> | |||
</mask> | |||
<clipPath | |||
clipPathUnits="userSpaceOnUse" | |||
id="clipPath17996"> | |||
<path | |||
d="M -32768,32767 H 32767 V -32768 H -32768 Z" | |||
id="path17994" | |||
inkscape:connector-curvature="0" /> | |||
</clipPath> | |||
<linearGradient | |||
x1="0" | |||
y1="0" | |||
x2="1" | |||
y2="0" | |||
gradientUnits="userSpaceOnUse" | |||
gradientTransform="matrix(0,21.967773,-21.967773,0,4.883e-4,-10.983887)" | |||
spreadMethod="pad" | |||
id="linearGradient18002-3"> | |||
<stop | |||
style="stop-opacity:0;stop-color:#ffffff" | |||
offset="0" | |||
id="stop17998" /> | |||
<stop | |||
style="stop-opacity:1;stop-color:#ffffff" | |||
offset="1" | |||
id="stop18000" /> | |||
</linearGradient> | |||
<linearGradient | |||
x1="0" | |||
y1="0" | |||
x2="1" | |||
y2="0" | |||
gradientUnits="userSpaceOnUse" | |||
gradientTransform="matrix(0,21.967773,-21.967773,0,4.883e-4,-10.983887)" | |||
spreadMethod="pad" | |||
id="linearGradient18020"> | |||
<stop | |||
style="stop-opacity:1;stop-color:#231f20" | |||
offset="0" | |||
id="stop18016" /> | |||
<stop | |||
style="stop-opacity:1;stop-color:#231f20" | |||
offset="1" | |||
id="stop18018" /> | |||
</linearGradient> | |||
<linearGradient | |||
inkscape:collect="always" | |||
xlink:href="#linearGradient19429" | |||
id="linearGradient19435" | |||
x1="79.279854" | |||
y1="73.994049" | |||
x2="87.030029" | |||
y2="73.994049" | |||
gradientUnits="userSpaceOnUse" | |||
gradientTransform="matrix(0,-0.93432349,0.93432349,0,14.020561,151.68766)" /> | |||
</defs> | |||
<sodipodi:namedview | |||
id="base" | |||
pagecolor="#ffffff" | |||
bordercolor="#666666" | |||
borderopacity="1.0" | |||
inkscape:pageopacity="0.0" | |||
inkscape:pageshadow="2" | |||
inkscape:zoom="22.4" | |||
inkscape:cx="8.0466627" | |||
inkscape:cy="13.743925" | |||
inkscape:document-units="mm" | |||
inkscape:current-layer="layer1" | |||
showgrid="true" | |||
fit-margin-top="0" | |||
fit-margin-left="0" | |||
fit-margin-right="0" | |||
fit-margin-bottom="0" | |||
inkscape:window-width="2560" | |||
inkscape:window-height="1422" | |||
inkscape:window-x="0" | |||
inkscape:window-y="18" | |||
inkscape:window-maximized="0" | |||
inkscape:snap-page="true" | |||
inkscape:snap-bbox="true" | |||
inkscape:bbox-nodes="true" | |||
inkscape:object-nodes="false" | |||
units="px"> | |||
<inkscape:grid | |||
type="xygrid" | |||
id="grid20375" /> | |||
</sodipodi:namedview> | |||
<metadata | |||
id="metadata18402"> | |||
<rdf:RDF> | |||
<cc:Work | |||
rdf:about=""> | |||
<dc:format>image/svg+xml</dc:format> | |||
<dc:type | |||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> | |||
<dc:title></dc:title> | |||
</cc:Work> | |||
</rdf:RDF> | |||
</metadata> | |||
<g | |||
inkscape:label="Layer 1" | |||
inkscape:groupmode="layer" | |||
id="layer1" | |||
transform="translate(-78.154807,-71.321052)"> | |||
<g | |||
id="g19440" | |||
transform="matrix(0.76730402,0,0,-0.76730402,18.186309,131.93344)" | |||
style="stroke-width:1.30326438"> | |||
<path | |||
d="m 88.154646,73.994048 c 0,2.761192 -2.238728,4.999919 -4.999919,4.999919 -2.761192,0 -4.99992,-2.238727 -4.99992,-4.999919 0,-2.761192 2.238728,-4.999919 4.99992,-4.999919 2.761191,0 4.999919,2.238727 4.999919,4.999919" | |||
style="fill:#231f20;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.45976272" | |||
id="path17964" | |||
inkscape:connector-curvature="0" /> | |||
<path | |||
inkscape:connector-curvature="0" | |||
id="path17974" | |||
style="fill:#6b6969;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.45976272" | |||
d="m 87.465003,73.994048 c 0,2.380367 -1.929341,4.310275 -4.3101,4.310275 -2.380759,0 -4.310099,-1.929908 -4.310099,-4.310275 0,-2.380367 1.92934,-4.310275 4.310099,-4.310275 2.380759,0 4.3101,1.929908 4.3101,4.310275" /> | |||
<path | |||
inkscape:connector-curvature="0" | |||
id="path18024" | |||
style="fill:url(#linearGradient19435);fill-opacity:1;stroke:none;stroke-width:0.45976272" | |||
d="m 79.534519,73.994213 c 0,1.999735 1.621344,3.62042 3.620419,3.62042 1.999076,0 3.620421,-1.620685 3.620421,-3.62042 0,-2.000066 -1.621345,-3.620751 -3.620421,-3.620751 -1.999075,0 -3.620419,1.620685 -3.620419,3.620751 m 0.164804,0 c 0,-1.905797 1.550149,-3.455946 3.455615,-3.455946 1.905467,0 3.455616,1.550149 3.455616,3.455946 0,1.905466 -1.550149,3.455615 -3.455616,3.455615 -1.905466,0 -3.455615,-1.550149 -3.455615,-3.455615" /> | |||
</g> | |||
</g> | |||
</svg> |
@@ -42,6 +42,21 @@ void ModuleWidget::addParam(ParamWidget *param) { | |||
addChild(param); | |||
} | |||
void ModuleWidget::setPanel(std::shared_ptr<SVG> svg) { | |||
// Remove old panel | |||
if (panel) { | |||
removeChild(panel); | |||
panel = NULL; | |||
} | |||
panel = new SVGPanel(); | |||
panel->setBackground(svg); | |||
addChild(panel); | |||
box.size = panel->box.size; | |||
} | |||
json_t *ModuleWidget::toJson() { | |||
json_t *rootJ = json_object(); | |||
@@ -19,19 +19,20 @@ struct PanelBorder : TransparentWidget { | |||
void SVGPanel::step() { | |||
if (nearf(gPixelRatio, 1.0)) { | |||
// Small details draw poorly at low DPI, so oversample when drawing to the framebuffer | |||
oversample = 2.0; | |||
} | |||
FramebufferWidget::step(); | |||
} | |||
void SVGPanel::setBackground(std::shared_ptr<SVG> svg) { | |||
clearChildren(); | |||
SVGWidget *sw = new SVGWidget(); | |||
sw->wrap(); | |||
sw->svg = svg; | |||
sw->setSVG(svg); | |||
addChild(sw); | |||
// Set size | |||
box.size = sw->box.size.div(RACK_GRID_SIZE).round().mult(RACK_GRID_SIZE); | |||
PanelBorder *pb = new PanelBorder(); | |||
pb->box.size = box.size; | |||
addChild(pb); | |||
@@ -11,10 +11,11 @@ SVGSwitch::SVGSwitch() { | |||
void SVGSwitch::addFrame(std::shared_ptr<SVG> svg) { | |||
frames.push_back(svg); | |||
// Automatically set the frame as this SVG file. | |||
// This allows us to wrap() the widget after calling | |||
if (!sw->svg) | |||
sw->svg = svg; | |||
// If this is our first frame, automatically set SVG and size | |||
if (!sw->svg) { | |||
sw->setSVG(svg); | |||
box.size = sw->box.size; | |||
} | |||
} | |||
void SVGSwitch::step() { | |||
@@ -22,9 +23,9 @@ void SVGSwitch::step() { | |||
} | |||
void SVGSwitch::onChange() { | |||
int index = roundf(rescalef(value, minValue, maxValue, 0, frames.size() - 1)); | |||
if (0 <= index && index < (int)frames.size()) | |||
sw->svg = frames[index]; | |||
assert(frames.size() > 0); | |||
int index = clampi((int) roundf(value), 0, frames.size() - 1); | |||
sw->setSVG(frames[index]); | |||
dirty = true; | |||
Switch::onChange(); | |||
} | |||
@@ -35,13 +35,19 @@ static float smoothValue; | |||
float Light::getBrightness() { | |||
// Scale by sqrt(2) since the RMS of a rectified sine is 1 / sqrt(2) | |||
return sqrtf(fmaxf(0.0, value) * 2.0); | |||
return sqrtf(fmaxf(0.0, value)); | |||
} | |||
void Light::setBrightnessSmooth(float brightness) { | |||
// lambda = 3 * framerate | |||
value += (brightness * brightness - value) * sampleTime * (60.0 * 3.0); | |||
float v = brightness * brightness; | |||
if (v < value) { | |||
// Fade out light with lambda = 3 * framerate | |||
value += (v - value) * sampleTime * (60.0 * 3.0); | |||
} | |||
else { | |||
// Immediately illuminate light | |||
value = v; | |||
} | |||
} | |||
@@ -46,6 +46,8 @@ void FramebufferWidget::draw(NVGcontext *vg) { | |||
assert(fabsf(xform[2]) < 1e-6); | |||
Vec s = Vec(xform[0], xform[3]); | |||
Vec b = Vec(xform[4], xform[5]); | |||
Vec bi = b.floor(); | |||
Vec bf = b.minus(bi); | |||
// Render to framebuffer | |||
if (dirty) { | |||
@@ -78,8 +80,7 @@ void FramebufferWidget::draw(NVGcontext *vg) { | |||
nvgScale(gFramebufferVg, gPixelRatio * oversample, gPixelRatio * oversample); | |||
// Use local scaling | |||
Vec bFrac = Vec(fmodf(b.x, 1.0), fmodf(b.y, 1.0)); | |||
nvgTranslate(gFramebufferVg, bFrac.x, bFrac.y); | |||
nvgTranslate(gFramebufferVg, bf.x, bf.y); | |||
nvgScale(gFramebufferVg, s.x, s.y); | |||
Widget::draw(gFramebufferVg); | |||
@@ -92,10 +93,9 @@ void FramebufferWidget::draw(NVGcontext *vg) { | |||
} | |||
// Draw framebuffer image, using world coordinates | |||
b = b.floor(); | |||
nvgSave(vg); | |||
nvgResetTransform(vg); | |||
nvgTranslate(vg, b.x, b.y); | |||
nvgTranslate(vg, bi.x, bi.y); | |||
nvgBeginPath(vg); | |||
nvgRect(vg, internal->box.pos.x, internal->box.pos.y, internal->box.size.x, internal->box.size.y); | |||