commit d20da363635fca80040b3c8f5f38ea412cc2a310
parent 7394cd3a3e5ab0984e52d6465c7fda3655860e61
Author: Matt Demanett <matt@demanett.net>
Date: Thu, 6 Aug 2020 02:25:32 -0400
DARK MODE.
Diffstat:
111 files changed, 535 insertions(+), 826 deletions(-)
diff --git a/res/skin_css_values.json b/res/skin_css_values.json
Binary files differ.
diff --git a/scripts/svg_styles_to_json.rb b/scripts/svg_styles_to_json.rb
@@ -0,0 +1,42 @@
+#!/usr/bin/env ruby
+
+require 'css_parser'
+require 'json'
+
+def colors_for_styles(styles)
+ out = {}
+ parser = CssParser::Parser.new
+ parser.load_string!(styles)
+
+ out['background-fill'] = '#ddd'
+ if parser.find_by_selector('.background-fill').last =~ /fill:\s+(#\w+);/
+ out['background-fill'] = $1
+ end
+
+ out['path-stroke'] = '#333'
+ if parser.find_by_selector('path').last =~ /stroke:\s+(#\w+);/
+ out['path-stroke'] = $1
+ end
+
+ out
+end
+
+js = {}
+rsdir = File.absolute_path(File.join(File.dirname($0), '..', 'res-src'))
+if File.readable?(File.join(rsdir, 'styles.css'))
+ base_styles = File.read(File.join(rsdir, 'styles.css'))
+ js['light'] = colors_for_styles(base_styles)
+
+ Dir.glob(File.join(rsdir, 'skin-*.css')) do |fn|
+ if File.basename(fn) =~ /^skin-(\w+).css$/
+ skin = $1
+ skin_styles = File.read(fn)
+ js[skin] = colors_for_styles(base_styles + "\n" + skin_styles)
+ end
+ end
+end
+
+js = JSON.generate(js, indent: ' ', space: ' ', object_nl: "\n")
+outfn = File.absolute_path(File.join(File.dirname($0), '..', 'res', 'skin_css_values.json'))
+File.write(outfn, js + "\n")
+puts "Wrote #{outfn}..."
diff --git a/scripts/svg_widgets.rb b/scripts/svg_widgets.rb
@@ -53,13 +53,7 @@ struct %MODULE%Widget : ModuleWidget {
%MODULE%Widget(%MODULE%* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/%MODULE%.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "%MODULE%");
%SCREWS%
diff --git a/src/AD.cpp b/src/AD.cpp
@@ -130,13 +130,7 @@ struct ADWidget : BGModuleWidget {
ADWidget(AD* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/AD.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "AD");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/ADSR.cpp b/src/ADSR.cpp
@@ -100,13 +100,7 @@ struct ADSRWidget : BGModuleWidget {
ADSRWidget(ADSR* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/ADSR.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "ADSR");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/AMRM.cpp b/src/AMRM.cpp
@@ -57,13 +57,7 @@ struct AMRMWidget : BGModuleWidget {
AMRMWidget(AMRM* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/AMRM.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "AMRM");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/ASR.cpp b/src/ASR.cpp
@@ -117,13 +117,7 @@ struct ASRWidget : BGModuleWidget {
ASRWidget(ASR* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/ASR.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "ASR");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/Additator.cpp b/src/Additator.cpp
@@ -219,13 +219,7 @@ struct AdditatorWidget : BGModuleWidget {
AdditatorWidget(Additator* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Additator.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Additator");
addChild(createWidget<ScrewSilver>(Vec(15, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 0)));
diff --git a/src/AddrSeq.cpp b/src/AddrSeq.cpp
@@ -39,13 +39,7 @@ struct AddrSeqWidget : AddressableSequenceModuleWidget {
AddrSeqWidget(AddrSeq* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/AddrSeq.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "AddrSeq");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/Analyzer.cpp b/src/Analyzer.cpp
@@ -83,13 +83,7 @@ struct AnalyzerWidget : BGModuleWidget {
AnalyzerWidget(Analyzer* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- auto panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Analyzer.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Analyzer");
{
auto inset = Vec(10, 25);
diff --git a/src/AnalyzerXL.cpp b/src/AnalyzerXL.cpp
@@ -130,13 +130,7 @@ struct AnalyzerXLWidget : BGModuleWidget {
AnalyzerXLWidget(AnalyzerXL* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/AnalyzerXL.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "AnalyzerXL");
{
auto inset = Vec(30, 1);
diff --git a/src/AnalyzerXL.hpp b/src/AnalyzerXL.hpp
@@ -33,7 +33,9 @@ struct AnalyzerXL : AnalyzerBase {
AnalyzerCore::Quality _quality = AnalyzerCore::QUALITY_GOOD;
AnalyzerCore::Window _window = AnalyzerCore::WINDOW_KAISER;
- AnalyzerXL() : AnalyzerBase(8, NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS) {}
+ AnalyzerXL() : AnalyzerBase(8, NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS) {
+ _skinnable = false;
+ }
void reset() override;
void sampleRateChange() override;
diff --git a/src/Arp.cpp b/src/Arp.cpp
@@ -357,13 +357,7 @@ struct ArpWidget : BGModuleWidget {
ArpWidget(Arp* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Arp.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Arp");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/Assign.cpp b/src/Assign.cpp
@@ -111,13 +111,7 @@ struct AssignWidget : BGModuleWidget {
AssignWidget(Assign* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Assign.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Assign");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/Blank3.cpp b/src/Blank3.cpp
@@ -1,5 +1,6 @@
#include "Blank3.hpp"
+#include "skins.hpp"
void Blank3::sampleRateChange() {
_rms.setSampleRate(APP->engine->getSampleRate());
@@ -7,17 +8,16 @@ void Blank3::sampleRateChange() {
void Blank3::processChannel(const ProcessArgs& args, int _c) {
if (inputs[IN_INPUT].isConnected()) {
+ _haveLevel = true;
_level = _rms.next(inputs[IN_INPUT].getVoltageSum()) / 5.0f;
}
else {
- _level = -1.0f;
+ _haveLevel = false;
+ _level = 0.0f;
}
}
struct Blank3Display : OpaqueWidget {
- const NVGcolor textColor = nvgRGBA(0x33, 0x33, 0x33, 0xff);
- const NVGcolor bgTextColor = nvgRGBA(0xaa, 0xaa, 0xaa, 0xff);
- const NVGcolor bgColor = nvgRGBA(0xdd, 0xdd, 0xdd, 0xff);
Blank3* _module;
const char* _text;
std::shared_ptr<Font> _font;
@@ -30,11 +30,29 @@ struct Blank3Display : OpaqueWidget {
}
void draw(const DrawArgs& args) override {
- float level = -1.0f;
+ const Skins& skins = Skins::skins();
+ std::string skin = skins.defaultKey();
+ bool haveLevel = false;
+ float level = 0.0f;
if (_module) {
+ haveLevel = _module->_level;
level = _module->_level;
+ skin = _module->_skin;
}
+ NVGcolor textColor = nvgRGBA(0x33, 0x33, 0x33, 0xff);
+ // NVGcolor bgTextColor = nvgRGBA(0xaa, 0xaa, 0xaa, 0xff);
+ NVGcolor bgColor = nvgRGBA(0xdd, 0xdd, 0xdd, 0xff);
+ const char* pathStroke = skins.skinCssValue(skin, "path-stroke");
+ if (pathStroke) {
+ textColor = Skins::cssColorToNVGColor(pathStroke, textColor);
+ }
+ const char* backgroundFill = skins.skinCssValue(skin, "background-fill");
+ if (backgroundFill) {
+ bgColor = Skins::cssColorToNVGColor(backgroundFill, bgColor);
+ }
+ NVGcolor bgTextColor = nvgRGBAf(0.5f * (textColor.r + bgColor.r), 0.5f * (textColor.g + bgColor.g), 0.5f * (textColor.b + bgColor.b), 1.0f);
+
float offsetX = box.size.x / 2.0f;
float offsetY = box.size.y / 2.0f;
nvgSave(args.vg);
@@ -44,7 +62,7 @@ struct Blank3Display : OpaqueWidget {
nvgFontSize(args.vg, 54.0f);
nvgFontFaceId(args.vg, _font->handle);
nvgTextLetterSpacing(args.vg, 9.0f);
- if (level < 0.0f) {
+ if (!haveLevel) {
nvgFillColor(args.vg, textColor);
nvgText(args.vg, 0, 0, _text, NULL);
}
@@ -70,13 +88,7 @@ struct Blank3Widget : BGModuleWidget {
Blank3Widget(Blank3* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Blank3.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Blank3");
{
auto display = new Blank3Display(module, "BGA");
diff --git a/src/Blank3.hpp b/src/Blank3.hpp
@@ -24,6 +24,7 @@ struct Blank3 : BGModule {
};
RootMeanSquare _rms;
+ bool _haveLevel = false;
float _level = 0.0f;
Blank3() {
diff --git a/src/Blank6.cpp b/src/Blank6.cpp
@@ -1,5 +1,6 @@
#include "Blank6.hpp"
+#include "skins.hpp"
void Blank6::sampleRateChange() {
_rms.setSampleRate(APP->engine->getSampleRate());
@@ -7,17 +8,16 @@ void Blank6::sampleRateChange() {
void Blank6::processChannel(const ProcessArgs& args, int _c) {
if (inputs[IN_INPUT].isConnected()) {
+ _haveLevel = true;
_level = _rms.next(inputs[IN_INPUT].getVoltageSum()) / 5.0f;
}
else {
- _level = -1.0f;
+ _haveLevel = false;
+ _level = 0.0f;
}
}
struct Blank6Display : OpaqueWidget {
- const NVGcolor textColor = nvgRGBA(0x33, 0x33, 0x33, 0xff);
- const NVGcolor bgTextColor = nvgRGBA(0xaa, 0xaa, 0xaa, 0xff);
- const NVGcolor bgColor = nvgRGBA(0xdd, 0xdd, 0xdd, 0xff);
Blank6* _module;
const char* _text;
std::shared_ptr<Font> _font;
@@ -30,11 +30,29 @@ struct Blank6Display : OpaqueWidget {
}
void draw(const DrawArgs& args) override {
- float level = -1.0f;
+ const Skins& skins = Skins::skins();
+ std::string skin = skins.defaultKey();
+ bool haveLevel = false;
+ float level = 0.0f;
if (_module) {
+ haveLevel = _module->_level;
level = _module->_level;
+ skin = _module->_skin;
}
+ NVGcolor textColor = nvgRGBA(0x33, 0x33, 0x33, 0xff);
+ // NVGcolor bgTextColor = nvgRGBA(0xaa, 0xaa, 0xaa, 0xff);
+ NVGcolor bgColor = nvgRGBA(0xdd, 0xdd, 0xdd, 0xff);
+ const char* pathStroke = skins.skinCssValue(skin, "path-stroke");
+ if (pathStroke) {
+ textColor = Skins::cssColorToNVGColor(pathStroke, textColor);
+ }
+ const char* backgroundFill = skins.skinCssValue(skin, "background-fill");
+ if (backgroundFill) {
+ bgColor = Skins::cssColorToNVGColor(backgroundFill, bgColor);
+ }
+ NVGcolor bgTextColor = nvgRGBAf(0.5f * (textColor.r + bgColor.r), 0.5f * (textColor.g + bgColor.g), 0.5f * (textColor.b + bgColor.b), 1.0f);
+
float offsetX = box.size.x / 2.0f;
float offsetY = box.size.y / 2.0f;
nvgSave(args.vg);
@@ -44,7 +62,7 @@ struct Blank6Display : OpaqueWidget {
nvgFontSize(args.vg, 52.0f);
nvgFontFaceId(args.vg, _font->handle);
nvgTextLetterSpacing(args.vg, 9.0f);
- if (level < 0.0f) {
+ if (!haveLevel) {
nvgFillColor(args.vg, textColor);
nvgText(args.vg, 0, 0, _text, NULL);
}
@@ -70,13 +88,7 @@ struct Blank6Widget : BGModuleWidget {
Blank6Widget(Blank6* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Blank6.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Blank6");
{
auto display = new Blank6Display(module, "BOGAUDIO");
diff --git a/src/Blank6.hpp b/src/Blank6.hpp
@@ -24,6 +24,7 @@ struct Blank6 : BGModule {
};
RootMeanSquare _rms;
+ bool _haveLevel = false;
float _level = 0.0f;
Blank6() {
diff --git a/src/Bool.cpp b/src/Bool.cpp
@@ -26,13 +26,7 @@ struct BoolWidget : BGModuleWidget {
BoolWidget(Bool* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Bool.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Bool");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/CVD.cpp b/src/CVD.cpp
@@ -66,13 +66,7 @@ struct CVDWidget : BGModuleWidget {
CVDWidget(CVD* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/CVD.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "CVD");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/Clpr.cpp b/src/Clpr.cpp
@@ -68,13 +68,7 @@ struct ClprWidget : BGModuleWidget {
ClprWidget(Clpr* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Clpr.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Clpr");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/Cmp.cpp b/src/Cmp.cpp
@@ -156,13 +156,7 @@ struct CmpWidget : BGModuleWidget {
CmpWidget(Cmp* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Cmp.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Cmp");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/CmpDist.cpp b/src/CmpDist.cpp
@@ -124,13 +124,7 @@ struct CmpDistWidget : BGModuleWidget {
CmpDistWidget(CmpDist* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/CmpDist.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "CmpDist");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 0)));
diff --git a/src/DADSRH.cpp b/src/DADSRH.cpp
@@ -109,13 +109,7 @@ struct DADSRHWidget : TriggerOnLoadModuleWidget {
DADSRHWidget(DADSRH* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/DADSRH.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "DADSRH");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 0)));
diff --git a/src/DADSRHPlus.cpp b/src/DADSRHPlus.cpp
@@ -109,13 +109,7 @@ struct DADSRHPlusWidget : TriggerOnLoadModuleWidget {
DADSRHPlusWidget(DADSRHPlus* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/DADSRHPlus.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "DADSRHPlus");
addChild(createWidget<ScrewSilver>(Vec(15, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 0)));
diff --git a/src/DGate.cpp b/src/DGate.cpp
@@ -121,13 +121,7 @@ struct DGateWidget : TriggerOnLoadModuleWidget {
DGateWidget(DGate* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/DGate.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "DGate");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/Detune.cpp b/src/Detune.cpp
@@ -49,13 +49,7 @@ struct DetuneWidget : BGModuleWidget {
DetuneWidget(Detune* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Detune.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Detune");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/EQ.cpp b/src/EQ.cpp
@@ -55,13 +55,7 @@ struct EQWidget : BGModuleWidget {
EQWidget(EQ* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/EQ.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "EQ");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/EQS.cpp b/src/EQS.cpp
@@ -64,13 +64,7 @@ struct EQSWidget : BGModuleWidget {
EQSWidget(EQS* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/EQS.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "EQS");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/Edge.cpp b/src/Edge.cpp
@@ -100,13 +100,7 @@ struct EdgeWidget : BGModuleWidget {
EdgeWidget(Edge* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Edge.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Edge");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/EightFO.cpp b/src/EightFO.cpp
@@ -198,13 +198,7 @@ struct EightFOWidget : BGModuleWidget {
EightFOWidget(EightFO* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/EightFO.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "EightFO");
addChild(createWidget<ScrewSilver>(Vec(15, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 0)));
diff --git a/src/EightOne.cpp b/src/EightOne.cpp
@@ -43,13 +43,7 @@ struct EightOneWidget : AddressableSequenceModuleWidget {
EightOneWidget(EightOne* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/EightOne.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "EightOne");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/FFB.cpp b/src/FFB.cpp
@@ -141,13 +141,7 @@ struct FFBWidget : BGModuleWidget {
FFBWidget(FFB* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/FFB.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "FFB");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/FMOp.cpp b/src/FMOp.cpp
@@ -265,13 +265,7 @@ struct FMOpWidget : BGModuleWidget {
FMOpWidget(FMOp* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/FMOp.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "FMOp");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 0)));
diff --git a/src/FlipFlop.cpp b/src/FlipFlop.cpp
@@ -83,13 +83,7 @@ struct FlipFlopWidget : BGModuleWidget {
FlipFlopWidget(FlipFlop* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/FlipFlop.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "FlipFlop");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/Follow.cpp b/src/Follow.cpp
@@ -36,13 +36,7 @@ struct FollowWidget : BGModuleWidget {
FollowWidget(Follow* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Follow.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Follow");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/FourMan.cpp b/src/FourMan.cpp
@@ -39,13 +39,7 @@ struct FourManWidget : TriggerOnLoadModuleWidget {
{
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/FourMan.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "FourMan");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/Inv.cpp b/src/Inv.cpp
@@ -106,13 +106,7 @@ struct InvWidget : BGModuleWidget {
InvWidget(Inv* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Inv.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Inv");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/LFO.cpp b/src/LFO.cpp
@@ -140,13 +140,7 @@ struct LFOWidget : BGModuleWidget {
LFOWidget(LFO* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/LFO.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "LFO");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 0)));
diff --git a/src/LLFO.cpp b/src/LLFO.cpp
@@ -100,13 +100,7 @@ struct LLFOWidget : BGModuleWidget {
LLFOWidget(LLFO* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/LLFO.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "LLFO");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/LVCF.cpp b/src/LVCF.cpp
@@ -156,13 +156,7 @@ struct LVCFWidget : BGModuleWidget {
LVCFWidget(LVCF* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/LVCF.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "LVCF");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/LVCO.cpp b/src/LVCO.cpp
@@ -88,13 +88,7 @@ struct LVCOWidget : BGModuleWidget {
LVCOWidget(LVCO* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/LVCO.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "LVCO");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/Lag.cpp b/src/Lag.cpp
@@ -48,13 +48,7 @@ struct LagWidget : BGModuleWidget {
LagWidget(Lag* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Lag.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Lag");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/Lmtr.cpp b/src/Lmtr.cpp
@@ -90,13 +90,7 @@ struct LmtrWidget : BGModuleWidget {
LmtrWidget(Lmtr* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Lmtr.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Lmtr");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/Manual.cpp b/src/Manual.cpp
@@ -43,13 +43,7 @@ struct ManualWidget : TriggerOnLoadModuleWidget {
{
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Manual.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Manual");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/Matrix44.cpp b/src/Matrix44.cpp
@@ -7,13 +7,7 @@ struct Matrix44Widget : KnobMatrixModuleWidget {
Matrix44Widget(Matrix44* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Matrix44.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Matrix44");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 0)));
diff --git a/src/Matrix88.cpp b/src/Matrix88.cpp
@@ -7,13 +7,7 @@ struct Matrix88Widget : KnobMatrixModuleWidget {
Matrix88Widget(Matrix88* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Matrix88.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Matrix88");
addChild(createWidget<ScrewSilver>(Vec(15, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 0)));
diff --git a/src/Mix1.cpp b/src/Mix1.cpp
@@ -54,13 +54,7 @@ struct Mix1Widget : BGModuleWidget {
Mix1Widget(Mix1* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Mix1.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Mix1");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/Mix2.cpp b/src/Mix2.cpp
@@ -66,13 +66,7 @@ struct Mix2Widget : BGModuleWidget {
Mix2Widget(Mix2* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Mix2.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Mix2");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/Mix4.cpp b/src/Mix4.cpp
@@ -162,13 +162,7 @@ struct Mix4Widget : DimmableMixerWidget {
Mix4Widget(Mix4* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Mix4.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Mix4");
addChild(createWidget<ScrewSilver>(Vec(15, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 0)));
diff --git a/src/Mix4x.cpp b/src/Mix4x.cpp
@@ -95,13 +95,7 @@ struct Mix4xWidget : BGModuleWidget {
Mix4xWidget(Mix4x* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Mix4x.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Mix4x");
addChild(createWidget<ScrewSilver>(Vec(15, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 0)));
diff --git a/src/Mix8.cpp b/src/Mix8.cpp
@@ -170,13 +170,7 @@ struct Mix8Widget : DimmableMixerWidget {
Mix8Widget(Mix8* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Mix8.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Mix8");
addChild(createWidget<ScrewSilver>(Vec(15, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 0)));
diff --git a/src/Mix8x.cpp b/src/Mix8x.cpp
@@ -95,13 +95,7 @@ struct Mix8xWidget : BGModuleWidget {
Mix8xWidget(Mix8x* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Mix8x.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Mix8x");
addChild(createWidget<ScrewSilver>(Vec(15, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 0)));
diff --git a/src/Mono.cpp b/src/Mono.cpp
@@ -133,13 +133,7 @@ struct MonoWidget : BGModuleWidget {
MonoWidget(Mono* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Mono.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Mono");
{
auto display = new ChannelsDisplay(module);
diff --git a/src/Mult.cpp b/src/Mult.cpp
@@ -29,13 +29,7 @@ struct MultWidget : BGModuleWidget {
MultWidget(Mult* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Mult.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Mult");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/Mumix.cpp b/src/Mumix.cpp
@@ -60,13 +60,7 @@ struct MumixWidget : MatrixBaseModuleWidget {
MumixWidget(Mumix* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Mumix.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Mumix");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/Mute8.cpp b/src/Mute8.cpp
@@ -95,13 +95,7 @@ struct Mute8Widget : BGModuleWidget {
Mute8Widget(Mute8* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Mute8.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Mute8");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 0)));
diff --git a/src/Noise.cpp b/src/Noise.cpp
@@ -42,13 +42,7 @@ struct NoiseWidget : BGModuleWidget {
NoiseWidget(Noise* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Noise.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Noise");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/Nsgt.cpp b/src/Nsgt.cpp
@@ -96,13 +96,7 @@ struct NsgtWidget : BGModuleWidget {
NsgtWidget(Nsgt* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Nsgt.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Nsgt");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/Offset.cpp b/src/Offset.cpp
@@ -35,13 +35,7 @@ struct OffsetWidget : DisableOutputLimitModuleWidget {
OffsetWidget(Offset* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Offset.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Offset");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/OneEight.cpp b/src/OneEight.cpp
@@ -54,13 +54,7 @@ struct OneEightWidget : AddressableSequenceModuleWidget {
OneEightWidget(OneEight* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/OneEight.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "OneEight");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/PEQ.cpp b/src/PEQ.cpp
@@ -74,13 +74,7 @@ struct PEQWidget : BGModuleWidget {
PEQWidget(PEQ* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/PEQ.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "PEQ");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 0)));
diff --git a/src/PEQ14.cpp b/src/PEQ14.cpp
@@ -124,13 +124,7 @@ struct PEQ14Widget : BGModuleWidget {
PEQ14Widget(PEQ14* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/PEQ14.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "PEQ14");
addChild(createWidget<ScrewSilver>(Vec(15, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 0)));
diff --git a/src/PEQ14XF.cpp b/src/PEQ14XF.cpp
@@ -70,13 +70,7 @@ struct PEQ14XFWidget : BGModuleWidget {
PEQ14XFWidget(PEQ14XF* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/PEQ14XF.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "PEQ14XF");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/PEQ14XR.cpp b/src/PEQ14XR.cpp
@@ -89,13 +89,7 @@ struct PEQ14XRWidget : BGModuleWidget {
PEQ14XRWidget(PEQ14XR* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/PEQ14XR.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "PEQ14XR");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/PEQ14XV.cpp b/src/PEQ14XV.cpp
@@ -161,13 +161,7 @@ struct PEQ14XVWidget : BGModuleWidget {
PEQ14XVWidget(PEQ14XV* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/PEQ14XV.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "PEQ14XV");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/PEQ6.cpp b/src/PEQ6.cpp
@@ -106,13 +106,7 @@ struct PEQ6Widget : BGModuleWidget {
PEQ6Widget(PEQ6* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/PEQ6.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "PEQ6");
addChild(createWidget<ScrewSilver>(Vec(15, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 0)));
diff --git a/src/PEQ6XF.cpp b/src/PEQ6XF.cpp
@@ -60,13 +60,7 @@ struct PEQ6XFWidget : BGModuleWidget {
PEQ6XFWidget(PEQ6XF* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/PEQ6XF.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "PEQ6XF");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/Pan.cpp b/src/Pan.cpp
@@ -47,13 +47,7 @@ struct PanWidget : BGModuleWidget {
PanWidget(Pan* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Pan.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Pan");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/Pgmr.cpp b/src/Pgmr.cpp
@@ -135,13 +135,7 @@ struct PgmrWidget : AddressableSequenceBaseModuleWidget {
PgmrWidget(Pgmr* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Pgmr.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Pgmr");
addChild(createWidget<ScrewSilver>(Vec(15, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 0)));
diff --git a/src/PgmrX.cpp b/src/PgmrX.cpp
@@ -45,13 +45,7 @@ struct PgmrXWidget : BGModuleWidget {
PgmrXWidget(PgmrX* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/PgmrX.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "PgmrX");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 0)));
diff --git a/src/PolyCon16.cpp b/src/PolyCon16.cpp
@@ -26,13 +26,7 @@ struct PolyCon16Widget : BGModuleWidget {
PolyCon16Widget(PolyCon16* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/PolyCon16.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "PolyCon16");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/PolyCon8.cpp b/src/PolyCon8.cpp
@@ -23,13 +23,7 @@ struct PolyCon8Widget : BGModuleWidget {
PolyCon8Widget(PolyCon8* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/PolyCon8.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "PolyCon8");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/PolyMult.cpp b/src/PolyMult.cpp
@@ -26,13 +26,7 @@ struct PolyMultWidget : BGModuleWidget {
PolyMultWidget(PolyMult* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/PolyMult.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "PolyMult");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/PolyOff16.cpp b/src/PolyOff16.cpp
@@ -44,13 +44,7 @@ struct PolyOff16Widget : BGModuleWidget {
PolyOff16Widget(PolyOff16* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/PolyOff16.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "PolyOff16");
addChild(createWidget<ScrewSilver>(Vec(15, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 0)));
diff --git a/src/PolyOff8.cpp b/src/PolyOff8.cpp
@@ -44,13 +44,7 @@ struct PolyOff8Widget : BGModuleWidget {
PolyOff8Widget(PolyOff8* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/PolyOff8.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "PolyOff8");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/Pressor.cpp b/src/Pressor.cpp
@@ -201,13 +201,7 @@ struct PressorWidget : BGModuleWidget {
PressorWidget(Pressor* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Pressor.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Pressor");
{
auto display = new CompressionDisplay(module);
diff --git a/src/Pulse.cpp b/src/Pulse.cpp
@@ -59,13 +59,7 @@ struct PulseWidget : BGModuleWidget {
PulseWidget(Pulse* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Pulse.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Pulse");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/Reftone.cpp b/src/Reftone.cpp
@@ -195,13 +195,7 @@ struct ReftoneWidget : BGModuleWidget {
ReftoneWidget(Reftone* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Reftone.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Reftone");
{
auto inset = Vec(3.5, 18);
diff --git a/src/SampleHold.cpp b/src/SampleHold.cpp
@@ -132,13 +132,7 @@ struct SampleHoldWidget : BGModuleWidget {
SampleHoldWidget(SampleHold* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/SampleHold.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "SampleHold");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/Shaper.cpp b/src/Shaper.cpp
@@ -92,13 +92,7 @@ struct ShaperWidget : TriggerOnLoadModuleWidget {
ShaperWidget(Shaper* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Shaper.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Shaper");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 0)));
diff --git a/src/ShaperPlus.cpp b/src/ShaperPlus.cpp
@@ -92,13 +92,7 @@ struct ShaperPlusWidget : TriggerOnLoadModuleWidget {
ShaperPlusWidget(ShaperPlus* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/ShaperPlus.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "ShaperPlus");
addChild(createWidget<ScrewSilver>(Vec(15, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 0)));
diff --git a/src/Sine.cpp b/src/Sine.cpp
@@ -104,13 +104,7 @@ struct SineWidget : BGModuleWidget {
SineWidget(Sine* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Sine.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Sine");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/Slew.cpp b/src/Slew.cpp
@@ -67,13 +67,7 @@ struct SlewWidget : BGModuleWidget {
SlewWidget(Slew* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Slew.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Slew");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/Stack.cpp b/src/Stack.cpp
@@ -48,13 +48,7 @@ struct StackWidget : BGModuleWidget {
StackWidget(Stack* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Stack.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Stack");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/Sums.cpp b/src/Sums.cpp
@@ -41,13 +41,7 @@ struct SumsWidget : DisableOutputLimitModuleWidget {
SumsWidget(Sums* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Sums.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Sums");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/Switch.cpp b/src/Switch.cpp
@@ -124,13 +124,7 @@ struct SwitchWidget : BGModuleWidget {
SwitchWidget(bogaudio::Switch* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Switch.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Switch");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/Switch1616.cpp b/src/Switch1616.cpp
@@ -7,13 +7,7 @@ struct Switch1616Widget : SwitchMatrixModuleWidget {
Switch1616Widget(Switch1616* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Switch1616.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Switch1616");
addChild(createWidget<ScrewSilver>(Vec(15, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 0)));
diff --git a/src/Switch44.cpp b/src/Switch44.cpp
@@ -7,13 +7,7 @@ struct Switch44Widget : SwitchMatrixModuleWidget {
Switch44Widget(Switch44* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Switch44.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Switch44");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 0)));
diff --git a/src/Switch88.cpp b/src/Switch88.cpp
@@ -7,13 +7,7 @@ struct Switch88Widget : SwitchMatrixModuleWidget {
Switch88Widget(Switch88* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Switch88.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Switch88");
addChild(createWidget<ScrewSilver>(Vec(15, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 0)));
diff --git a/src/Test.cpp b/src/Test.cpp
@@ -507,13 +507,7 @@ struct TestWidget : BGModuleWidget {
TestWidget(Test* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Test.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Test");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/Test2.cpp b/src/Test2.cpp
@@ -110,13 +110,7 @@ struct Test2Widget : BGModuleWidget {
Test2Widget(Test2* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Test2.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Test2");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/TestExpander.cpp b/src/TestExpander.cpp
@@ -26,13 +26,7 @@ struct TestExpanderBaseWidget : BGModuleWidget {
TestExpanderBaseWidget(TestExpanderBase* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/TestExpanderBase.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "TestExpanderBase");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
@@ -78,13 +72,7 @@ struct TestExpanderExtensionWidget : BGModuleWidget {
TestExpanderExtensionWidget(TestExpanderExtension* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/TestExpanderExtension.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "TestExpanderExtension");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/TestVCF.cpp b/src/TestVCF.cpp
@@ -832,13 +832,7 @@ struct TestVCFWidget : BGModuleWidget {
TestVCFWidget(TestVCF* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/TestVCF.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "TestVCF");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 0)));
diff --git a/src/UMix.cpp b/src/UMix.cpp
@@ -70,13 +70,7 @@ struct UMixWidget : MatrixBaseModuleWidget {
UMixWidget(UMix* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/UMix.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "UMix");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/Unison.cpp b/src/Unison.cpp
@@ -46,13 +46,7 @@ struct UnisonWidget : BGModuleWidget {
UnisonWidget(Unison* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Unison.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Unison");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/VCA.cpp b/src/VCA.cpp
@@ -50,13 +50,7 @@ struct VCAWidget : BGModuleWidget {
VCAWidget(VCA* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/VCA.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "VCA");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/VCAmp.cpp b/src/VCAmp.cpp
@@ -40,13 +40,7 @@ struct VCAmpWidget : BGModuleWidget {
VCAmpWidget(VCAmp* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/VCAmp.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "VCAmp");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/VCF.cpp b/src/VCF.cpp
@@ -189,13 +189,7 @@ struct VCFWidget : BGModuleWidget {
VCFWidget(VCF* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/VCF.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "VCF");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 0)));
diff --git a/src/VCM.cpp b/src/VCM.cpp
@@ -54,13 +54,7 @@ struct VCMWidget : DisableOutputLimitModuleWidget {
VCMWidget(VCM* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/VCM.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "VCM");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 0)));
diff --git a/src/VCO.cpp b/src/VCO.cpp
@@ -58,13 +58,7 @@ struct VCOWidget : BGModuleWidget {
VCOWidget(VCO* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/VCO.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "VCO");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 0)));
diff --git a/src/VU.cpp b/src/VU.cpp
@@ -128,13 +128,7 @@ struct VUWidget : BGModuleWidget {
VUWidget(VU* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/VU.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "VU");
{
auto display = new VUDisplay(module);
diff --git a/src/Walk.cpp b/src/Walk.cpp
@@ -131,13 +131,7 @@ struct WalkWidget : BGModuleWidget {
WalkWidget(Walk* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Walk.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Walk");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/Walk2.cpp b/src/Walk2.cpp
@@ -485,13 +485,7 @@ struct Walk2Widget : BGModuleWidget {
Walk2Widget(Walk2* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Walk2.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "Walk2");
{
auto inset = Vec(10, 25);
diff --git a/src/XCO.cpp b/src/XCO.cpp
@@ -302,13 +302,7 @@ struct XCOWidget : BGModuleWidget {
XCOWidget(XCO* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/XCO.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "XCO");
addChild(createWidget<ScrewSilver>(Vec(15, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 0)));
diff --git a/src/XFade.cpp b/src/XFade.cpp
@@ -49,13 +49,7 @@ struct XFadeWidget : BGModuleWidget {
XFadeWidget(XFade* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/XFade.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "XFade");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
diff --git a/src/module.cpp b/src/module.cpp
@@ -1,8 +1,13 @@
#include "module.hpp"
+#include "bogaudio.hpp"
+#include "skins.hpp"
+#include <cstdio>
using namespace bogaudio;
+#define SKIN "skin"
+
void BGModule::onReset() {
_steps = _modulationSteps;
reset();
@@ -15,10 +20,21 @@ void BGModule::onSampleRateChange() {
}
json_t* BGModule::dataToJson() {
- return toJson(json_object());
+ json_t* root = json_object();
+ if (_skinnable && _skin != "default") {
+ json_object_set_new(root, SKIN, json_string(_skin.c_str()));
+ }
+ return toJson(root);
}
void BGModule::dataFromJson(json_t* root) {
+ if (_skinnable) {
+ json_t* s = json_object_get(root, SKIN);
+ if (s) {
+ setSkin(json_string_value(s));
+ }
+ }
+
fromJson(root);
}
@@ -69,7 +85,82 @@ void BGModule::process(const ProcessArgs& args) {
postProcessAlways(args);
}
+void BGModule::setSkin(std::string skin) {
+ if (skin == "default" || Skins::skins().validKey(skin)) {
+ _skin = skin;
+ if (_skinChangeListener) {
+ _skinChangeListener->skinChanged();
+ }
+ }
+}
+
+void BGModule::setSkinChangeListener(BGModuleWidget* widget) {
+ _skinChangeListener = widget;
+}
+
void BGModuleWidget::appendContextMenu(Menu* menu) {
+ auto m = dynamic_cast<BGModule*>(module);
+ assert(m);
+ if (m->_skinnable) {
+ auto skins = Skins::skins().available();
+ if (skins.size() > 0) {
+ // menu->addChild(new MenuLabel());
+ OptionsMenuItem* s = new OptionsMenuItem("Skin");
+ s->addItem(OptionMenuItem("Default", [m]() { return m->_skin == "default"; }, [m]() { m->setSkin("default"); }));
+ for (auto skin : skins) {
+ std::string key = skin.key;
+ s->addItem(OptionMenuItem(skin.display.c_str(), [m, key]() { return m->_skin == key; }, [m, key]() { m->setSkin(key); }));
+ }
+ OptionsMenuItem::addToMenu(s, menu);
+ }
+ }
+
contextMenu(menu);
}
+
+void BGModuleWidget::skinChanged() {
+ updatePanel();
+}
+
+void BGModuleWidget::setPanel(Vec size, std::string slug) {
+ _size = size;
+ _slug = slug;
+ if (module) {
+ auto m = dynamic_cast<BGModule*>(module);
+ assert(m);
+ m->setSkinChangeListener(this);
+ }
+ updatePanel();
+}
+
+void BGModuleWidget::updatePanel() {
+ if (_panel) {
+ removeChild(_panel);
+ delete _panel;
+ _panel = NULL;
+ }
+
+ std::string skin = Skins::skins().defaultKey();
+ if (module) {
+ auto m = dynamic_cast<BGModule*>(module);
+ assert(m);
+ skin = m->_skin;
+ if (skin == "default") {
+ skin = Skins::skins().defaultKey();
+ }
+ }
+
+ const int n = 100;
+ char svg[n];
+ if (skin == "light") {
+ snprintf(svg, n, "res/%s.svg", _slug.c_str());
+ }
+ else {
+ snprintf(svg, n, "res/%s-%s.svg", _slug.c_str(), skin.c_str());
+ }
+ _panel = new SvgPanel();
+ _panel->box.size = _size;
+ addChildBottom(_panel);
+ _panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, svg)));
+}
diff --git a/src/module.hpp b/src/module.hpp
@@ -1,11 +1,14 @@
#pragma once
#include "rack.hpp"
+#include <string>
using namespace rack;
namespace bogaudio {
+struct BGModuleWidget;
+
struct BGModule : Module {
int _modulationSteps = 100;
int _steps = -1;
@@ -14,6 +17,10 @@ struct BGModule : Module {
int _channels = 0;
float _inverseChannels = 0.0f;
+ bool _skinnable = true;
+ std::string _skin = "default";
+ BGModuleWidget* _skinChangeListener = NULL;
+
BGModule() {
}
virtual ~BGModule() {
@@ -45,12 +52,23 @@ struct BGModule : Module {
virtual void processChannel(const ProcessArgs& args, int c) {}
virtual void postProcess(const ProcessArgs& args) {}
virtual void postProcessAlways(const ProcessArgs& args) {} // modulate() may not have been called.
+
+ void setSkin(std::string skin);
+ void setSkinChangeListener(BGModuleWidget* widget);
};
struct BGModuleWidget : ModuleWidget {
+ SvgPanel* _panel = NULL;
+ Vec _size;
+ std::string _slug;
+
void appendContextMenu(Menu* menu) override;
virtual void contextMenu(Menu* menu) {}
+
+ void skinChanged();
+ void setPanel(Vec size, const std::string slug);
+ void updatePanel();
};
} // namespace bogaudio
diff --git a/src/skins.cpp b/src/skins.cpp
@@ -0,0 +1,173 @@
+
+#include "skins.hpp"
+#include "bogaudio.hpp"
+#include <unistd.h>
+
+const Skins& Skins::skins() {
+ static Skins instance;
+ std::lock_guard<std::mutex> lock(instance._lock);
+ if (!instance._loaded) {
+ instance.loadSkins();
+ instance.loadCssValues();
+ instance._loaded = true;
+ }
+ return instance;
+}
+
+bool Skins::validKey(const std::string& key) const {
+ for (auto s : _available) {
+ if (s.key == key) {
+ return true;
+ }
+ }
+ return false;
+}
+
+const char* Skins::skinCssValue(const std::string& skinKey, const std::string& valueKey) const {
+ std::string sk = skinKey;
+ if (sk == "default") {
+ sk = defaultKey();
+ }
+ if (!validKey(sk)) {
+ return NULL;
+ }
+
+ auto values = _skinCssValues.find(sk);
+ if (values == _skinCssValues.end()) {
+ return NULL;
+ }
+ auto value = values->second.find(valueKey);
+ if (value == values->second.end()) {
+ return NULL;
+ }
+ return value->second.c_str();
+}
+
+NVGcolor Skins::cssColorToNVGColor(const char* color, NVGcolor& ifError) {
+ auto h2i = [](char h) {
+ switch (h) {
+ case '0': return 0;
+ case '1': return 1;
+ case '2': return 2;
+ case '3': return 3;
+ case '4': return 4;
+ case '5': return 5;
+ case '6': return 6;
+ case '7': return 7;
+ case '8': return 8;
+ case '9': return 9;
+ case 'A': return 10;
+ case 'B': return 11;
+ case 'C': return 12;
+ case 'D': return 13;
+ case 'E': return 14;
+ case 'F': return 15;
+ case 'a': return 10;
+ case 'b': return 11;
+ case 'c': return 12;
+ case 'd': return 13;
+ case 'e': return 14;
+ case 'f': return 15;
+ default: return -1;
+ }
+ };
+ if (color[0] == '#') {
+ if (strlen(color) == 4) {
+ int i1 = h2i(color[1]);
+ int i2 = h2i(color[2]);
+ int i3 = h2i(color[3]);
+ if (i1 >= 0 && i2 >= 0 && i3 >= 0) {
+ return nvgRGBA(16*i1 + i1, 16*i2 + i2, 16*i3 + i3, 0xff);
+ }
+ }
+ else if (strlen(color) == 7) {
+ int i11 = h2i(color[1]);
+ int i12 = h2i(color[1]);
+ int i21 = h2i(color[3]);
+ int i22 = h2i(color[4]);
+ int i31 = h2i(color[5]);
+ int i32 = h2i(color[6]);
+ if (i11 >= 0 && i12 >= 0 && i21 >= 0 && i22 >= 0 && i31 >= 0 && i32 >= 0) {
+ return nvgRGBA(16*i11 + i12, 16*i21 + i22, 16*i31 + i32, 0xff);
+ }
+ }
+ }
+ return ifError;
+}
+
+void Skins::loadSkins() {
+ _available.push_back(Skin("light", "Light"));
+ _available.push_back(Skin("dark", "Dark"));
+ _default = "light";
+
+ std::string path = rack::asset::user("BogaudioModules.json");
+ if (access(path.c_str(), R_OK) != 0) {
+ return;
+ }
+
+ json_error_t error;
+ json_t* root = json_load_file(path.c_str(), 0, &error);
+ if (!root) {
+ WARN("Bogaudio: JSON error loading skins data from %s: %s\n", path.c_str(), error.text);
+ return;
+ }
+
+ json_t* skins = json_object_get(root, "skins");
+ if (!skins) {
+ WARN("Bogaudio: no \"skins\" section found in %s\n", path.c_str());
+ }
+ else {
+ json_t* d = json_object_get(skins, "default");
+ if (!d) {
+ WARN("Bogaudio: \"skins\" section has no key \"default\" in %s\n", path.c_str());
+ }
+ else {
+ std::string dk = json_string_value(d);
+ if (!validKey(dk)) {
+ WARN("Bogaudio: \"skins\" \"default\" value \"%s\" is invalid in %s\n", dk.c_str(), path.c_str());
+ WARN("Bogaudio: available skins are:\n");
+ for (auto s : _available) {
+ WARN("Bogaudio: %s\n", s.key.c_str());
+ }
+ }
+ else {
+ _default = dk;
+ INFO("Bogaudio: skin information loaded successfully from %s\n", path.c_str());
+ }
+ }
+ }
+
+ json_decref(root);
+}
+
+void Skins::loadCssValues() {
+ std::string path = rack::asset::plugin(pluginInstance, "res/skin_css_values.json");
+ if (access(path.c_str(), R_OK) != 0) {
+ return;
+ }
+
+ json_error_t error;
+ json_t* root = json_load_file(path.c_str(), 0, &error);
+ if (!root) {
+ WARN("Bogaudio: JSON error loading CSS values data from %s: %s\n", path.c_str(), error.text);
+ return;
+ }
+
+ void* i = json_object_iter(root);
+ while (i) {
+ const char* skin = json_object_iter_key(i);
+ json_t* values = json_object_iter_value(i);
+ void* j = json_object_iter(values);
+ css_values_map valuesMap;
+ while (j) {
+ const char* k = json_object_iter_key(j);
+ const char* v = json_string_value(json_object_iter_value(j));
+ valuesMap.insert(css_values_map::value_type(k, v));
+ j = json_object_iter_next(values, j);
+ }
+ _skinCssValues.insert(skin_css_values_map::value_type(skin, valuesMap));
+ i = json_object_iter_next(root, i);
+ }
+
+ json_decref(root);
+}
diff --git a/src/skins.hpp b/src/skins.hpp
@@ -0,0 +1,41 @@
+#pragma once
+
+#include "rack.hpp"
+#include <mutex>
+#include <string>
+#include <unordered_map>
+#include <vector>
+
+struct Skin {
+ std::string key;
+ std::string display;
+
+ Skin(const char* key, const char* display) : key(key), display(display) {}
+};
+
+class Skins {
+private:
+ typedef std::unordered_map<std::string, std::string> css_values_map;
+ typedef std::unordered_map<std::string, css_values_map> skin_css_values_map;
+ std::vector<Skin> _available;
+ std::string _default;
+ skin_css_values_map _skinCssValues;
+ bool _loaded = false;
+ std::mutex _lock;
+
+public:
+ Skins() {}
+ Skins(const Skins&) = delete;
+ void operator=(const Skins&) = delete;
+
+ static const Skins& skins();
+ inline const std::vector<Skin>& available() const { return _available; }
+ inline const std::string& defaultKey() const { return _default; }
+ bool validKey(const std::string& key) const;
+ const char* skinCssValue(const std::string& skinKey, const std::string& valueKey) const;
+ static NVGcolor cssColorToNVGColor(const char* color, NVGcolor& ifError);
+
+private:
+ void loadSkins();
+ void loadCssValues();
+};
diff --git a/src/template_panels.cpp b/src/template_panels.cpp
@@ -5,13 +5,7 @@ struct ThreeHPWidget : BGModuleWidget {
ThreeHPWidget(Module* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * 3, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/ThreeHP.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "ThreeHP");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
@@ -25,13 +19,7 @@ struct FiveHPWidget : BGModuleWidget {
FiveHPWidget(Module* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * 5, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/FiveHP.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "FiveHP");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
@@ -45,13 +33,7 @@ struct SixHPWidget : BGModuleWidget {
SixHPWidget(Module* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * 6, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/SixHP.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "SixHP");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
@@ -65,13 +47,7 @@ struct EightHPWidget : BGModuleWidget {
EightHPWidget(Module* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * 8, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/EightHP.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "EightHP");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
@@ -85,13 +61,7 @@ struct TenHPWidget : BGModuleWidget {
TenHPWidget(Module* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * 10, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/TenHP.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "TenHP");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 0)));
@@ -107,13 +77,7 @@ struct TwelveHPWidget : BGModuleWidget {
TwelveHPWidget(Module* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * 12, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/TwelveHP.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "TwelveHP");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 0)));
@@ -129,13 +93,7 @@ struct ThirteenHPWidget : BGModuleWidget {
ThirteenHPWidget(Module* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * 13, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/ThirteenHP.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "ThirteenHP");
addChild(createWidget<ScrewSilver>(Vec(0, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 0)));
@@ -151,13 +109,7 @@ struct FifteenHPWidget : BGModuleWidget {
FifteenHPWidget(Module* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * 15, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/FifteenHP.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "FifteenHP");
addChild(createWidget<ScrewSilver>(Vec(15, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 0)));
@@ -173,13 +125,7 @@ struct SixteenHPWidget : BGModuleWidget {
SixteenHPWidget(Module* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * 16, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/SixteenHP.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "SixteenHP");
addChild(createWidget<ScrewSilver>(Vec(15, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 0)));
@@ -195,13 +141,7 @@ struct EighteenHPWidget : BGModuleWidget {
EighteenHPWidget(Module* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * 18, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/EighteenHP.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "EighteenHP");
addChild(createWidget<ScrewSilver>(Vec(15, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 0)));
@@ -217,13 +157,7 @@ struct TwentyHPWidget : BGModuleWidget {
TwentyHPWidget(Module* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * 20, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/TwentyHP.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "TwentyHP");
addChild(createWidget<ScrewSilver>(Vec(15, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 0)));
@@ -239,13 +173,7 @@ struct TwentyTwoHPWidget : BGModuleWidget {
TwentyTwoHPWidget(Module* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * 22, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/TwentyTwoHP.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "TwentyTwoHP");
addChild(createWidget<ScrewSilver>(Vec(15, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 0)));
@@ -261,13 +189,7 @@ struct TwentyFiveHPWidget : BGModuleWidget {
TwentyFiveHPWidget(Module* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * 25, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/TwentyFiveHP.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "TwentyFiveHP");
addChild(createWidget<ScrewSilver>(Vec(15, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 0)));
@@ -283,13 +205,7 @@ struct ThirtyHPWidget : BGModuleWidget {
ThirtyHPWidget(Module* module) {
setModule(module);
box.size = Vec(RACK_GRID_WIDTH * 30, RACK_GRID_HEIGHT);
-
- {
- SvgPanel *panel = new SvgPanel();
- panel->box.size = box.size;
- panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/ThirtyHP.svg")));
- addChild(panel);
- }
+ setPanel(box.size, "ThirtyHP");
addChild(createWidget<ScrewSilver>(Vec(15, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 0)));