From 1076329fd16ceeccb3ad7adde12c4c46ddc2aee5 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Tue, 9 Nov 2021 10:51:38 -0500 Subject: [PATCH] Add and implement BefacoTinyKnob and Knurlie component redesigns from Pyer. --- res/BefacoTinyKnobBlack.svg | 85 -------------------- res/BefacoTinyKnobBlack_bg.svg | 52 ++++++++++++ res/BefacoTinyKnobDarkGrey.svg | 85 -------------------- res/BefacoTinyKnobDarkGrey_bg.svg | 52 ++++++++++++ res/BefacoTinyKnobLightGrey.svg | 85 -------------------- res/BefacoTinyKnobLightGrey_bg.svg | 59 ++++++++++++++ res/BefacoTinyKnobRed.svg | 85 -------------------- res/BefacoTinyKnobRed_bg.svg | 60 ++++++++++++++ res/BefacoTinyPointWhite.svg | 10 +++ res/Knurlie.svg | 123 ++++++----------------------- src/plugin.hpp | 68 +++++++--------- 11 files changed, 287 insertions(+), 477 deletions(-) delete mode 100644 res/BefacoTinyKnobBlack.svg create mode 100644 res/BefacoTinyKnobBlack_bg.svg delete mode 100644 res/BefacoTinyKnobDarkGrey.svg create mode 100644 res/BefacoTinyKnobDarkGrey_bg.svg delete mode 100644 res/BefacoTinyKnobLightGrey.svg create mode 100644 res/BefacoTinyKnobLightGrey_bg.svg delete mode 100644 res/BefacoTinyKnobRed.svg create mode 100644 res/BefacoTinyKnobRed_bg.svg create mode 100644 res/BefacoTinyPointWhite.svg diff --git a/res/BefacoTinyKnobBlack.svg b/res/BefacoTinyKnobBlack.svg deleted file mode 100644 index c72289e..0000000 --- a/res/BefacoTinyKnobBlack.svg +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - image/svg+xml - - - - - - - - - - - - - diff --git a/res/BefacoTinyKnobBlack_bg.svg b/res/BefacoTinyKnobBlack_bg.svg new file mode 100644 index 0000000..4455452 --- /dev/null +++ b/res/BefacoTinyKnobBlack_bg.svg @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/res/BefacoTinyKnobDarkGrey.svg b/res/BefacoTinyKnobDarkGrey.svg deleted file mode 100644 index 6954d84..0000000 --- a/res/BefacoTinyKnobDarkGrey.svg +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - image/svg+xml - - - - - - - - - - - - - diff --git a/res/BefacoTinyKnobDarkGrey_bg.svg b/res/BefacoTinyKnobDarkGrey_bg.svg new file mode 100644 index 0000000..af65824 --- /dev/null +++ b/res/BefacoTinyKnobDarkGrey_bg.svg @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/res/BefacoTinyKnobLightGrey.svg b/res/BefacoTinyKnobLightGrey.svg deleted file mode 100644 index 8776e38..0000000 --- a/res/BefacoTinyKnobLightGrey.svg +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - image/svg+xml - - - - - - - - - - - - - diff --git a/res/BefacoTinyKnobLightGrey_bg.svg b/res/BefacoTinyKnobLightGrey_bg.svg new file mode 100644 index 0000000..302b04b --- /dev/null +++ b/res/BefacoTinyKnobLightGrey_bg.svg @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/res/BefacoTinyKnobRed.svg b/res/BefacoTinyKnobRed.svg deleted file mode 100644 index 2fea4c0..0000000 --- a/res/BefacoTinyKnobRed.svg +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - image/svg+xml - - - - - - - - - - - - - diff --git a/res/BefacoTinyKnobRed_bg.svg b/res/BefacoTinyKnobRed_bg.svg new file mode 100644 index 0000000..0ce3e43 --- /dev/null +++ b/res/BefacoTinyKnobRed_bg.svg @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/res/BefacoTinyPointWhite.svg b/res/BefacoTinyPointWhite.svg new file mode 100644 index 0000000..b867c6c --- /dev/null +++ b/res/BefacoTinyPointWhite.svg @@ -0,0 +1,10 @@ + + + + + + + diff --git a/res/Knurlie.svg b/res/Knurlie.svg index e743343..2948a60 100644 --- a/res/Knurlie.svg +++ b/res/Knurlie.svg @@ -1,98 +1,25 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/src/plugin.hpp b/src/plugin.hpp index 2ca52ec..e3bc039 100644 --- a/src/plugin.hpp +++ b/src/plugin.hpp @@ -25,102 +25,92 @@ extern Model* modelSTMix; extern Model* modelMuxlicer; extern Model* modelMex; + struct Knurlie : SvgScrew { Knurlie() { - sw->svg = APP->window->loadSvg(asset::plugin(pluginInstance, "res/Knurlie.svg")); - sw->wrap(); - box.size = sw->box.size; + setSvg(Svg::load(asset::plugin(pluginInstance, "res/Knurlie.svg"))); } }; -struct BefacoTinyKnobRed : app::SvgKnob { - BefacoTinyKnobRed() { - minAngle = -0.8 * M_PI; - maxAngle = 0.8 * M_PI; - setSvg(APP->window->loadSvg(asset::plugin(pluginInstance, "res/BefacoTinyKnobRed.svg"))); - } +struct BefacoTinyKnobWhite : BefacoTinyKnob { + BefacoTinyKnobWhite() {} }; -struct BefacoTinyKnobWhite : app::SvgKnob { - BefacoTinyKnobWhite() { - minAngle = -0.8 * M_PI; - maxAngle = 0.8 * M_PI; - setSvg(APP->window->loadSvg(asset::system("res/ComponentLibrary/BefacoTinyKnob.svg"))); +struct BefacoTinyKnobRed : BefacoTinyKnob { + BefacoTinyKnobRed() { + setSvg(Svg::load(asset::plugin(pluginInstance, "res/BefacoTinyPointWhite.svg"))); + bg->setSvg(Svg::load(asset::plugin(pluginInstance, "res/BefacoTinyKnobRed_bg.svg"))); } }; -struct BefacoTinyKnobDarkGrey : app::SvgKnob { +struct BefacoTinyKnobDarkGrey : BefacoTinyKnob { BefacoTinyKnobDarkGrey() { - minAngle = -0.8 * M_PI; - maxAngle = 0.8 * M_PI; - setSvg(APP->window->loadSvg(asset::plugin(pluginInstance, "res/BefacoTinyKnobDarkGrey.svg"))); + setSvg(Svg::load(asset::plugin(pluginInstance, "res/BefacoTinyPointWhite.svg"))); + bg->setSvg(Svg::load(asset::plugin(pluginInstance, "res/BefacoTinyKnobDarkGrey_bg.svg"))); } }; -struct BefacoTinyKnobLightGrey : app::SvgKnob { +struct BefacoTinyKnobLightGrey : BefacoTinyKnob { BefacoTinyKnobLightGrey() { - minAngle = -0.8 * M_PI; - maxAngle = 0.8 * M_PI; - setSvg(APP->window->loadSvg(asset::plugin(pluginInstance, "res/BefacoTinyKnobLightGrey.svg"))); + bg->setSvg(Svg::load(asset::plugin(pluginInstance, "res/BefacoTinyKnobLightGrey_bg.svg"))); } }; -struct BefacoTinyKnobBlack : app::SvgKnob { +struct BefacoTinyKnobBlack : BefacoTinyKnob { BefacoTinyKnobBlack() { - minAngle = -0.8 * M_PI; - maxAngle = 0.8 * M_PI; - setSvg(APP->window->loadSvg(asset::plugin(pluginInstance, "res/BefacoTinyKnobBlack.svg"))); + setSvg(Svg::load(asset::plugin(pluginInstance, "res/BefacoTinyPointWhite.svg"))); + bg->setSvg(Svg::load(asset::plugin(pluginInstance, "res/BefacoTinyKnobBlack_bg.svg"))); } }; struct Davies1900hLargeGreyKnob : Davies1900hKnob { Davies1900hLargeGreyKnob() { - setSvg(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Davies1900hLargeGrey.svg"))); + setSvg(Svg::load(asset::plugin(pluginInstance, "res/Davies1900hLargeGrey.svg"))); } }; struct Davies1900hLightGreyKnob : Davies1900hWhiteKnob { Davies1900hLightGreyKnob() { - setSvg(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Davies1900hLightGrey.svg"))); + setSvg(Svg::load(asset::plugin(pluginInstance, "res/Davies1900hLightGrey.svg"))); } }; struct Davies1900hDarkGreyKnob : Davies1900hWhiteKnob { Davies1900hDarkGreyKnob() { - setSvg(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Davies1900hDarkGrey.svg"))); + setSvg(Svg::load(asset::plugin(pluginInstance, "res/Davies1900hDarkGrey.svg"))); } }; // library black Davies1900h doesn't work well on black backgrounds struct Davies1900hDarkBlackAlt : Davies1900hWhiteKnob { Davies1900hDarkBlackAlt() { - setSvg(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Davies1900hBlack.svg"))); + setSvg(Svg::load(asset::plugin(pluginInstance, "res/Davies1900hBlack.svg"))); } }; struct BefacoOutputPort : app::SvgPort { BefacoOutputPort() { - setSvg(APP->window->loadSvg(asset::plugin(pluginInstance, "res/BefacoOutputPort.svg"))); + setSvg(Svg::load(asset::plugin(pluginInstance, "res/BefacoOutputPort.svg"))); } }; struct BefacoInputPort : app::SvgPort { BefacoInputPort() { - setSvg(APP->window->loadSvg(asset::plugin(pluginInstance, "res/BefacoInputPort.svg"))); + setSvg(Svg::load(asset::plugin(pluginInstance, "res/BefacoInputPort.svg"))); } }; struct CKSSNarrow : app::SvgSwitch { CKSSNarrow() { - addFrame(APP->window->loadSvg(asset::plugin(pluginInstance, "res/SwitchNarrow_0.svg"))); - addFrame(APP->window->loadSvg(asset::plugin(pluginInstance, "res/SwitchNarrow_1.svg"))); + addFrame(Svg::load(asset::plugin(pluginInstance, "res/SwitchNarrow_0.svg"))); + addFrame(Svg::load(asset::plugin(pluginInstance, "res/SwitchNarrow_1.svg"))); } }; struct Crossfader : app::SvgSlider { Crossfader() { - setBackgroundSvg(APP->window->loadSvg(asset::plugin(pluginInstance, "res/CrossfaderBackground.svg"))); - setHandleSvg(APP->window->loadSvg(asset::plugin(pluginInstance, "res/CrossfaderHandle.svg"))); + setBackgroundSvg(Svg::load(asset::plugin(pluginInstance, "res/CrossfaderBackground.svg"))); + setHandleSvg(Svg::load(asset::plugin(pluginInstance, "res/CrossfaderHandle.svg"))); minHandlePos = mm2px(Vec(4.5f, -0.8f)); maxHandlePos = mm2px(Vec(34.5, -0.8f)); horizontal = true; @@ -132,9 +122,9 @@ struct Crossfader : app::SvgSlider { struct BefacoSwitchHorizontal : app::SvgSwitch { BefacoSwitchHorizontal() { - addFrame(APP->window->loadSvg(asset::plugin(pluginInstance, "res/BefacoSwitchHoriz_0.svg"))); - addFrame(APP->window->loadSvg(asset::plugin(pluginInstance, "res/BefacoSwitchHoriz_1.svg"))); - addFrame(APP->window->loadSvg(asset::plugin(pluginInstance, "res/BefacoSwitchHoriz_2.svg"))); + addFrame(Svg::load(asset::plugin(pluginInstance, "res/BefacoSwitchHoriz_0.svg"))); + addFrame(Svg::load(asset::plugin(pluginInstance, "res/BefacoSwitchHoriz_1.svg"))); + addFrame(Svg::load(asset::plugin(pluginInstance, "res/BefacoSwitchHoriz_2.svg"))); } };