commit f3c13ea1e09b8f353a7c35b6f4cce5ff8b7b6d41
parent fa2fdccba235045e9e23317dc259c08ed3186fad
Author: Adam M <aemalone@gmail.com>
Date: Sat, 9 Nov 2019 11:53:41 -0600
Fill background with same color as panel for blank
Diffstat:
4 files changed, 33 insertions(+), 6 deletions(-)
diff --git a/plugin.json b/plugin.json
@@ -28,7 +28,7 @@
},
{"slug":"computerscare-ohpeas",
"name":"Oh Peas!",
- "description":"Quad Quantenuverter. Attenuverter, Offsetter, Microtonal Quantizer",
+ "description":"Quad Quantenuverter. \nAttenuverter, Offsetter, Microtonal Quantizer",
"tags":["Polyphonic","Quantizer","Utility","Quad"]
},
{"slug":"computerscare-fatherandson",
@@ -73,7 +73,7 @@
},
{"slug":"computerscare-blank",
"name":"Custom Blank",
- "description":"Customizable, resizable, lovable blank panel. Load your own PNG, JPEG, BMP, or GIF. Translate image with A,S,D,W keys. Zoom in/out with Z,X keys.",
+ "description":"Customizable, resizable, lovable blank panel. \nLoad your own PNG, JPEG, BMP, or GIF. \nTranslate image with A,S,D,W keys. \nZoom in/out with Z,X keys.",
"tags":["Blank","Visual"]
}
]
diff --git a/res/ComputerscareCustomBlankPanel.svg b/res/ComputerscareCustomBlankPanel.svg
@@ -28,7 +28,7 @@
inkscape:pageshadow="2"
inkscape:zoom="22.627418"
inkscape:cx="103.92905"
- inkscape:cy="380.51735"
+ inkscape:cy="376.98182"
inkscape:document-units="mm"
inkscape:current-layer="g1669"
showgrid="false"
@@ -53,7 +53,7 @@
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title></dc:title>
+ <dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
@@ -143,7 +143,7 @@
inkscape:connector-curvature="0"
id="path1647"
d="M 0,196.45832 H 31.75 V 296.99999 H 0 Z"
- style="opacity:1;vector-effect:none;fill:#e0e0e0;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.4062123;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" />
+ style="opacity:1;vector-effect:none;fill:#e0e0d9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.4062123;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" />
<g
aria-label="computerscare"
transform="matrix(1.1664995,-0.0322966,0.25814602,2.2890491,-83.115495,-385.16453)"
diff --git a/src/Computerscare.hpp b/src/Computerscare.hpp
@@ -56,6 +56,7 @@ namespace app {
struct ComputerscareSVGPanel;
struct ComputerscareSVGPanel : widget::FramebufferWidget {
+ NVGcolor backgroundColor;
void step() override;
void setBackground(std::shared_ptr<Svg> svg);
};
@@ -75,7 +76,25 @@ struct ComputerscareSvgPort : PortWidget {
} // namespace app
} // namespace rack
+struct BGPanel : Widget {
+ NVGcolor color;
+ BGPanel(NVGcolor _color) {
+ color = _color;
+ }
+
+ void step() override {
+ Widget::step();
+ }
+
+ void draw(const DrawArgs &args) override {
+ nvgBeginPath(args.vg);
+ nvgRect(args.vg, 0.0, 0.0, box.size.x, box.size.y);
+ nvgFillColor(args.vg, color);
+ nvgFill(args.vg);
+ Widget::draw(args);
+ }
+};
struct IsoButton : SvgSwitch {
IsoButton() {
diff --git a/src/ComputerscareBlank.cpp b/src/ComputerscareBlank.cpp
@@ -21,7 +21,7 @@ struct ComputerscareBlank : Module {
std::string lastPath;
float width = 120;
float height = 380;
- bool invertY = false;
+ bool invertY = true;
float zoom = 1.f;
float xOffset = 0.f;
float yOffset = 0.f;
@@ -253,11 +253,16 @@ struct ComputerscareBlankWidget : ModuleWidget {
box.size = Vec(8 * 15, 380);
}
{
+ BGPanel *bgPanel = new BGPanel(nvgRGB(0xE0, 0xE0, 0xD9));
+ bgPanel->box.size = box.size;
+ this->bgPanel = bgPanel;
+ addChild(bgPanel);
ComputerscareSVGPanel *panel = new ComputerscareSVGPanel();
panel->box.size = box.size;
panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/ComputerscareCustomBlankPanel.svg")));
this->panel = panel;
addChild(panel);
+
}
if (module) {
@@ -312,6 +317,7 @@ struct ComputerscareBlankWidget : ModuleWidget {
ComputerscareBlank *blankModule;
PNGDisplay *pngDisplay;
ComputerscareSVGPanel *panel;
+ BGPanel *bgPanel;
TransparentWidget *display;
ComputerscareResizeHandle *leftHandle;
ComputerscareResizeHandle *rightHandle;
@@ -322,6 +328,7 @@ void ComputerscareBlankWidget::step() {
if (!blankModule->loadedJSON) {
box.size.x = blankModule->width;
panel->box.size.x = blankModule->width;
+ bgPanel->box.size.x=blankModule->width;
panel->box.pos.x = blankModule->width / 2 - 60.f;
pngDisplay->box.size.x = blankModule->width;
rightHandle->box.pos.x = blankModule->width - rightHandle->box.size.x;
@@ -332,6 +339,7 @@ void ComputerscareBlankWidget::step() {
blankModule->width = box.size.x;
panel->box.pos.x = box.size.x / 2 - panel->box.size.x / 2;
pngDisplay->box.size.x = box.size.x;
+ bgPanel->box.size.x=box.size.x;
rightHandle->box.pos.x = box.size.x - rightHandle->box.size.x;
}
}