commit 551fe8c6bc940c9eddc4ea69b9ac7ef3cebf18ad
parent 4a53535cfd9e27b16ed17e57ef270b87657a50d1
Author: Adam M <aemalone@gmail.com>
Date: Wed, 13 Mar 2019 00:17:14 -0500
Peas Works with v1
Diffstat:
2 files changed, 58 insertions(+), 7 deletions(-)
diff --git a/src/Computerscare.hpp b/src/Computerscare.hpp
@@ -244,7 +244,46 @@ struct ComputerscareDotKnob : SmallKnob {
}
};
+struct ComputerscareTextField : ui::TextField {
+ std::shared_ptr<Font> font;
+ math::Vec textOffset;
+ NVGcolor color = COLOR_COMPUTERSCARE_LIGHT_GREEN;
+ ComputerscareTextField() {
+
+ font = APP->window->loadFont(asset::system("res/fonts/ShareTechMono-Regular.ttf"));
+ color = nvgRGB(0xff, 0xd7, 0x14);
+ textOffset = math::Vec(5, 5);
+}
+
+
+void draw(const DrawArgs &args) {
+ nvgScissor(args.vg, RECT_ARGS(args.clipBox));
+
+ // Background
+ nvgBeginPath(args.vg);
+ nvgRoundedRect(args.vg, 0, 0, box.size.x, box.size.y, 5.0);
+ nvgFillColor(args.vg, nvgRGB(0x00, 0x00, 0x00));
+ nvgFill(args.vg);
+
+ // Text
+ if (font->handle >= 0) {
+ bndSetFont(font->handle);
+
+ NVGcolor highlightColor = color;
+ highlightColor.a = 0.5;
+ int begin = std::min(cursor, selection);
+ int end = (this == APP->event->selectedWidget) ? std::max(cursor, selection) : -1;
+ bndIconLabelCaret(args.vg, textOffset.x, textOffset.y,
+ box.size.x - 2*textOffset.x, box.size.y - 2*textOffset.y,
+ -1, color, 18, text.c_str(), highlightColor, begin, end);
+
+ bndSetFont(APP->window->uiFont->handle);
+ }
+ nvgResetScissor(args.vg);
+}
+ //int getTextPosition(math::Vec mousePos) override;
+};
////////////////////////////////////
struct SmallLetterDisplay : Widget {
diff --git a/src/ComputerscareOhPeas.cpp b/src/ComputerscareOhPeas.cpp
@@ -2,9 +2,7 @@
#include "Computerscare.hpp"
#include "dtpulse.hpp"
-#include "dsp/digital.hpp"
-//#include "window.hpp"
-#include "dsp/filter.hpp"
+
#include <string>
#include <sstream>
@@ -320,11 +318,15 @@ struct SetQuantizationModeMenuItem : MenuItem {
MenuItem::step();
}
};
-struct PeasTF2 : LedDisplayTextField {
+struct PeasTF2 : ComputerscareTextField {
ComputerscareOhPeas *module;
+ int fontSize = 16;
+ int rowIndex=0;
+ bool inError = false;
//ComputerscareDebug *module;
+
PeasTF2() {
- LedDisplayTextField();
+ ComputerscareTextField();
};
void draw(const DrawArgs &args) override {
if(module) {
@@ -336,7 +338,7 @@ struct PeasTF2 : LedDisplayTextField {
printf("charlie %s\n",text.c_str());
}
}
- LedDisplayTextField::draw(args);
+ ComputerscareTextField::draw(args);
}
//void draw(const DrawArgs &args) override;
@@ -379,8 +381,18 @@ struct ComputerscareOhPeasWidget : ModuleWidget {
//TextField *textFieldTemp;
ComputerscareOhPeasWidget(ComputerscareOhPeas *module) {
setModule(module);
- setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/ComputerscareOhPeasPanel.svg")));
+ //setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/ComputerscareOhPeasPanel.svg")));
+ box.size = Vec(9*15, 380);
+ {
+ ComputerscareSVGPanel *panel = new ComputerscareSVGPanel();
+ panel->box.size = box.size;
+ panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance,"res/ComputerscareOhPeasPanel.svg")));
+
+ //module->panelRef = panel;
+ addChild(panel);
+
+ }
double x = 1;
double y = 7;
//double dy = 18.4;