commit d07168790de97b337c9dbc154fa8858ceeb50eb5
parent 55296fdf8dbfd9de4fca135e25236b155ddbd36e
Author: Adam M <aemalone@gmail.com>
Date: Wed, 31 Jul 2019 23:47:28 -0500
Merge branch 'master' into folypace
Diffstat:
2 files changed, 6 insertions(+), 86 deletions(-)
diff --git a/plugin.json b/plugin.json
@@ -1,6 +1,6 @@
{
"slug": "computerscare",
- "version": "1.0.2",
+ "version": "1.0.3",
"name": "computerscare",
"brand": "computerscare",
"author": "computerscare",
diff --git a/src/ComputerscareILoveCookies.cpp b/src/ComputerscareILoveCookies.cpp
@@ -24,63 +24,6 @@ const int numInputs = numInputRows * numInputColumns;
const std::vector<NVGcolor> outlineColorMap = {COLOR_COMPUTERSCARE_RED, COLOR_COMPUTERSCARE_YELLOW, COLOR_COMPUTERSCARE_BLUE};
-/*class MyTextFieldCookie : public LedDisplayTextField {
-
-public:
- int fontSize = LG_FONT_SIZE;
- int rowIndex = 0;
- bool inError = false;
- MyTextFieldCookie() : LedDisplayTextField() {}
- void setModule(ComputerscareILoveCookies* _module) {
- module = _module;
- }
- virtual void onTextChange() override;
- int getTextPosition(Vec mousePos) override {
- bndSetFont(font->handle);
- int textPos = bndIconLabelTextPosition(gVg, textOffset.x, textOffset.y,
- box.size.x - 2 * textOffset.x, box.size.y - 2 * textOffset.y,
- -1, fontSize, text.c_str(), mousePos.x, mousePos.y);
- bndSetFont(gGuiFont->handle);
- return textPos;
- }
- void draw(const DrawArgs &args) override {
- nvgScissor(args.vg, 0, 0, box.size.x, box.size.y);
-
- // Background
- nvgFontSize(args.vg, fontSize);
- nvgBeginPath(args.vg);
- nvgRoundedRect(args.vg, 0, 0, box.size.x, box.size.y, 5.0);
- if (inError) {
- nvgFillColor(args.vg, COLOR_COMPUTERSCARE_PINK);
- }
- else {
- 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 = min(cursor, selection);
- int end = (this == gFocusedWidget) ? max(cursor, selection) : -1;
- //bndTextField(args.vg,textOffset.x,textOffset.y+2, box.size.x, box.size.y, -1, 0, 0, const char *text, int cbegin, int cend);
- bndIconLabelCaret(args.vg, textOffset.x, textOffset.y - 3,
- box.size.x - 2 * textOffset.x, box.size.y - 2 * textOffset.y,
- -1, color, fontSize, text.c_str(), highlightColor, begin, end);
-
- bndSetFont(gGuiFont->handle);
- }
-
- nvgResetScissor(args.vg);
- };
-
-private:
- ComputerscareILoveCookies* module;
-};*/
-
struct ComputerscareILoveCookies : Module {
enum ParamIds {
KNOB_PARAM,
@@ -145,6 +88,9 @@ struct ComputerscareILoveCookies : Module {
checkIfShouldChange(i);
resetOneOfThem(i);
}
+ for (int k = 0; k < numKnobs; k++) {
+ configParam( KNOB_PARAM + k, 0.f, 10.f, 0.0f, string::f("knob %c",knoblookup[k]), " volts");
+ }
}
void process(const ProcessArgs &args) override;
@@ -160,7 +106,7 @@ struct ComputerscareILoveCookies : Module {
float prev = params[KNOB_PARAM + i].getValue();
if (random::uniform() < 0.7) {
float rv = (10 * random::uniform() + 2 * prev) / 3;
- params[KNOB_PARAM+i].setValue(rv);
+ params[KNOB_PARAM + i].setValue(rv);
}
}
@@ -190,11 +136,6 @@ struct ComputerscareILoveCookies : Module {
setNextAbsoluteSequence(i);
}
}
- /*void checkLength(int index) {
- std::string value = textFields[index]->text;
- int length = value.length();
- textFields[index]->fontSize = length > 17 ? (length > 30 ? SM_FONT_SIZE : MED_FONT_SIZE) : LG_FONT_SIZE;
- }*/
void setNextAbsoluteSequence(int index) {
newABSQueue[index] = AbsoluteSequence(currentFormula[index], knobandinputlookup);
shouldChange[index] = true;
@@ -414,21 +355,6 @@ struct CookiesTF2 : ComputerscareTextField
}
ComputerscareTextField::draw(args);
}
- /*void MyTextFieldCookie::onTextChange() {
- module->checkLength(this->rowIndex);
- std::string value = module->textFields[this->rowIndex]->text;
- AbsoluteSequence abs = AbsoluteSequence(value,knobandinputlookup);
- if((!abs.inError) && matchParens(value)) {
- module->setNextAbsoluteSequence(this->rowIndex);
- module->updateDisplayBlink(this->rowIndex);
- module->textFields[this->rowIndex]->inError=false;
- }
- else {
- module->textFields[this->rowIndex]->inError=true;
- }
- }*/
- //void draw(const DrawArgs &args) override;
- //int getTextPosition(math::Vec mousePos) override;
};
struct CookiesSmallDisplay : SmallLetterDisplay
@@ -472,11 +398,8 @@ struct CookiesCurrentStepDisplay : SmallLetterDisplay
};
void draw(const DrawArgs &args)
{
- //this->setNumDivisionsString();
if (module)
{
- //this->currentWorkingStepDisplays[i]->value = this->newABS[i].getWorkingStepDisplay();
-
value = module->newABS[index].getWorkingStepDisplay();
SmallLetterDisplay::draw(args);
@@ -587,7 +510,6 @@ struct ComputerscareILoveCookiesWidget : ModuleWidget {
textField->module = module;
addChild(textField);
cookiesTextFields[i] = textField;
- //module->textFields[i] = textField;
//active/total steps display
cookiesSmallDisplay = new CookiesSmallDisplay(i);
@@ -609,8 +531,6 @@ struct ComputerscareILoveCookiesWidget : ModuleWidget {
addChild(currentWorkingStepDisplay);
currentWorkingStepDisplays[i] = currentWorkingStepDisplay;
- // module->currentWorkingStepDisplays[i] = currentWorkingStepDisplay;
-
addParam(createParam<ComputerscareInvisibleButton>(mm2px(Vec(21 + xStart, verticalStart - 9.9 + verticalSpacing * i)), module, ComputerscareILoveCookies::INDIVIDUAL_RESET_PARAM + i));
}
cookies = module;
@@ -651,7 +571,7 @@ struct ComputerscareILoveCookiesWidget : ModuleWidget {
for (int i = 0; i < numFields; i++) {
json_t *sequenceJ = json_array_get(seqJLegacy, i);
if (sequenceJ)
- val = json_string_value(sequenceJ);
+ val = json_string_value(sequenceJ);
cookiesTextFields[i]->text = val;
cookies->currentFormula[i] = val;
}