diff --git a/include/app.hpp b/include/app.hpp index 47ca2dda..0f122e44 100644 --- a/include/app.hpp +++ b/include/app.hpp @@ -398,18 +398,9 @@ struct Port : OpaqueWidget { void onDragLeave(EventDragEnter &e) override; template - static T *createInput(Vec pos, Module *module, int portId) { + static T *create(Vec pos, PortType type, Module *module, int portId) { T *o = Widget::create(pos); - o->type = INPUT; - o->module = module; - o->portId = portId; - return o; - } - - template - static T *createOutput(Vec pos, Module *module, int portId) { - T *o = Widget::create(pos); - o->type = OUTPUT; + o->type = type; o->module = module; o->portId = portId; return o; diff --git a/include/rack.hpp b/include/rack.hpp index 4364f9fc..404f4f7f 100644 --- a/include/rack.hpp +++ b/include/rack.hpp @@ -53,7 +53,7 @@ DEPRECATED TParamWidget *createParam(Vec pos, Module *module, int paramId, float return param; } -/** Deprecated, use Port::createInput() instead */ +/** Deprecated, use Port::create(..., Port::INPUT, ...) instead */ template DEPRECATED TPort *createInput(Vec pos, Module *module, int inputId) { TPort *port = new TPort(); @@ -64,7 +64,7 @@ DEPRECATED TPort *createInput(Vec pos, Module *module, int inputId) { return port; } -/** Deprecated, use Port::createInput() instead */ +/** Deprecated, use Port::create(..., Port::OUTPUT, ...) instead */ template DEPRECATED TPort *createOutput(Vec pos, Module *module, int outputId) { TPort *port = new TPort(); diff --git a/src/core/AudioInterface.cpp b/src/core/AudioInterface.cpp index e986caeb..64c55d60 100644 --- a/src/core/AudioInterface.cpp +++ b/src/core/AudioInterface.cpp @@ -241,7 +241,7 @@ AudioInterfaceWidget::AudioInterfaceWidget() { yPos += 5; xPos = 10; for (int i = 0; i < 4; i++) { - addInput(Port::createInput(Vec(xPos, yPos), module, AudioInterface::AUDIO_INPUT + i)); + addInput(Port::create(Vec(xPos, yPos), Port::INPUT, module, AudioInterface::AUDIO_INPUT + i)); Label *label = new Label(); label->box.pos = Vec(xPos + 4, yPos + 28); label->text = stringf("%d", i + 1); @@ -254,7 +254,7 @@ AudioInterfaceWidget::AudioInterfaceWidget() { yPos += 5; xPos = 10; for (int i = 4; i < 8; i++) { - addInput(Port::createInput(Vec(xPos, yPos), module, AudioInterface::AUDIO_INPUT + i)); + addInput(Port::create(Vec(xPos, yPos), Port::INPUT, module, AudioInterface::AUDIO_INPUT + i)); Label *label = new Label(); label->box.pos = Vec(xPos + 4, yPos + 28); label->text = stringf("%d", i + 1); @@ -275,7 +275,7 @@ AudioInterfaceWidget::AudioInterfaceWidget() { yPos += 5; xPos = 10; for (int i = 0; i < 4; i++) { - Port *port = Port::createOutput(Vec(xPos, yPos), module, AudioInterface::AUDIO_OUTPUT + i); + Port *port = Port::create(Vec(xPos, yPos), Port::OUTPUT, module, AudioInterface::AUDIO_OUTPUT + i); addOutput(port); Label *label = new Label(); label->box.pos = Vec(xPos + 4, yPos + 28); @@ -289,7 +289,7 @@ AudioInterfaceWidget::AudioInterfaceWidget() { yPos += 5; xPos = 10; for (int i = 4; i < 8; i++) { - addOutput(Port::createOutput(Vec(xPos, yPos), module, AudioInterface::AUDIO_OUTPUT + i)); + addOutput(Port::create(Vec(xPos, yPos), Port::OUTPUT, module, AudioInterface::AUDIO_OUTPUT + i)); Label *label = new Label(); label->box.pos = Vec(xPos + 4, yPos + 28); label->text = stringf("%d", i + 1); diff --git a/src/core/MidiToCV.cpp b/src/core/MidiToCV.cpp index c236fc7e..fa50d974 100644 --- a/src/core/MidiToCV.cpp +++ b/src/core/MidiToCV.cpp @@ -269,7 +269,7 @@ MidiToCVWidget::MidiToCVWidget() { label->text = labels[i]; addChild(label); - addOutput(Port::createOutput(Vec(15 * 6, yPos - 5), module, i)); + addOutput(Port::create(Vec(15 * 6, yPos - 5), Port::OUTPUT, module, i)); yPos += yGap + margin; } diff --git a/src/core/Notes.cpp b/src/core/Notes.cpp index 3395176f..e207bf2d 100644 --- a/src/core/Notes.cpp +++ b/src/core/Notes.cpp @@ -13,10 +13,10 @@ NotesWidget::NotesWidget() { addChild(panel); } - addChild(createScrew(Vec(15, 0))); - addChild(createScrew(Vec(15, 365))); - addChild(createScrew(Vec(box.size.x - 30, 0))); - addChild(createScrew(Vec(box.size.x - 30, 365))); + addChild(Widget::create(Vec(15, 0))); + addChild(Widget::create(Vec(15, 365))); + addChild(Widget::create(Vec(box.size.x - 30, 0))); + addChild(Widget::create(Vec(box.size.x - 30, 365))); textField = new TextField(); textField->box.pos = Vec(15, 15);