Browse Source

Change Port's createInput and createOutput to create

tags/v0.6.0
Andrew Belt 7 years ago
parent
commit
6a8d2f5a4d
5 changed files with 13 additions and 22 deletions
  1. +2
    -11
      include/app.hpp
  2. +2
    -2
      include/rack.hpp
  3. +4
    -4
      src/core/AudioInterface.cpp
  4. +1
    -1
      src/core/MidiToCV.cpp
  5. +4
    -4
      src/core/Notes.cpp

+ 2
- 11
include/app.hpp View File

@@ -398,18 +398,9 @@ struct Port : OpaqueWidget {
void onDragLeave(EventDragEnter &e) override; void onDragLeave(EventDragEnter &e) override;


template <typename T = Port> template <typename T = Port>
static T *createInput(Vec pos, Module *module, int portId) {
static T *create(Vec pos, PortType type, Module *module, int portId) {
T *o = Widget::create<T>(pos); T *o = Widget::create<T>(pos);
o->type = INPUT;
o->module = module;
o->portId = portId;
return o;
}

template <typename T = Port>
static T *createOutput(Vec pos, Module *module, int portId) {
T *o = Widget::create<T>(pos);
o->type = OUTPUT;
o->type = type;
o->module = module; o->module = module;
o->portId = portId; o->portId = portId;
return o; return o;


+ 2
- 2
include/rack.hpp View File

@@ -53,7 +53,7 @@ DEPRECATED TParamWidget *createParam(Vec pos, Module *module, int paramId, float
return param; return param;
} }


/** Deprecated, use Port::createInput<TPort>() instead */
/** Deprecated, use Port::create<TPort>(..., Port::INPUT, ...) instead */
template <class TPort> template <class TPort>
DEPRECATED TPort *createInput(Vec pos, Module *module, int inputId) { DEPRECATED TPort *createInput(Vec pos, Module *module, int inputId) {
TPort *port = new TPort(); TPort *port = new TPort();
@@ -64,7 +64,7 @@ DEPRECATED TPort *createInput(Vec pos, Module *module, int inputId) {
return port; return port;
} }


/** Deprecated, use Port::createInput<TPort>() instead */
/** Deprecated, use Port::create<TPort>(..., Port::OUTPUT, ...) instead */
template <class TPort> template <class TPort>
DEPRECATED TPort *createOutput(Vec pos, Module *module, int outputId) { DEPRECATED TPort *createOutput(Vec pos, Module *module, int outputId) {
TPort *port = new TPort(); TPort *port = new TPort();


+ 4
- 4
src/core/AudioInterface.cpp View File

@@ -241,7 +241,7 @@ AudioInterfaceWidget::AudioInterfaceWidget() {
yPos += 5; yPos += 5;
xPos = 10; xPos = 10;
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
addInput(Port::createInput<PJ3410Port>(Vec(xPos, yPos), module, AudioInterface::AUDIO_INPUT + i));
addInput(Port::create<PJ3410Port>(Vec(xPos, yPos), Port::INPUT, module, AudioInterface::AUDIO_INPUT + i));
Label *label = new Label(); Label *label = new Label();
label->box.pos = Vec(xPos + 4, yPos + 28); label->box.pos = Vec(xPos + 4, yPos + 28);
label->text = stringf("%d", i + 1); label->text = stringf("%d", i + 1);
@@ -254,7 +254,7 @@ AudioInterfaceWidget::AudioInterfaceWidget() {
yPos += 5; yPos += 5;
xPos = 10; xPos = 10;
for (int i = 4; i < 8; i++) { for (int i = 4; i < 8; i++) {
addInput(Port::createInput<PJ3410Port>(Vec(xPos, yPos), module, AudioInterface::AUDIO_INPUT + i));
addInput(Port::create<PJ3410Port>(Vec(xPos, yPos), Port::INPUT, module, AudioInterface::AUDIO_INPUT + i));
Label *label = new Label(); Label *label = new Label();
label->box.pos = Vec(xPos + 4, yPos + 28); label->box.pos = Vec(xPos + 4, yPos + 28);
label->text = stringf("%d", i + 1); label->text = stringf("%d", i + 1);
@@ -275,7 +275,7 @@ AudioInterfaceWidget::AudioInterfaceWidget() {
yPos += 5; yPos += 5;
xPos = 10; xPos = 10;
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
Port *port = Port::createOutput<PJ3410Port>(Vec(xPos, yPos), module, AudioInterface::AUDIO_OUTPUT + i);
Port *port = Port::create<PJ3410Port>(Vec(xPos, yPos), Port::OUTPUT, module, AudioInterface::AUDIO_OUTPUT + i);
addOutput(port); addOutput(port);
Label *label = new Label(); Label *label = new Label();
label->box.pos = Vec(xPos + 4, yPos + 28); label->box.pos = Vec(xPos + 4, yPos + 28);
@@ -289,7 +289,7 @@ AudioInterfaceWidget::AudioInterfaceWidget() {
yPos += 5; yPos += 5;
xPos = 10; xPos = 10;
for (int i = 4; i < 8; i++) { for (int i = 4; i < 8; i++) {
addOutput(Port::createOutput<PJ3410Port>(Vec(xPos, yPos), module, AudioInterface::AUDIO_OUTPUT + i));
addOutput(Port::create<PJ3410Port>(Vec(xPos, yPos), Port::OUTPUT, module, AudioInterface::AUDIO_OUTPUT + i));
Label *label = new Label(); Label *label = new Label();
label->box.pos = Vec(xPos + 4, yPos + 28); label->box.pos = Vec(xPos + 4, yPos + 28);
label->text = stringf("%d", i + 1); label->text = stringf("%d", i + 1);


+ 1
- 1
src/core/MidiToCV.cpp View File

@@ -269,7 +269,7 @@ MidiToCVWidget::MidiToCVWidget() {
label->text = labels[i]; label->text = labels[i];
addChild(label); addChild(label);


addOutput(Port::createOutput<PJ3410Port>(Vec(15 * 6, yPos - 5), module, i));
addOutput(Port::create<PJ3410Port>(Vec(15 * 6, yPos - 5), Port::OUTPUT, module, i));


yPos += yGap + margin; yPos += yGap + margin;
} }


+ 4
- 4
src/core/Notes.cpp View File

@@ -13,10 +13,10 @@ NotesWidget::NotesWidget() {
addChild(panel); addChild(panel);
} }


addChild(createScrew<ScrewSilver>(Vec(15, 0)));
addChild(createScrew<ScrewSilver>(Vec(15, 365)));
addChild(createScrew<ScrewSilver>(Vec(box.size.x - 30, 0)));
addChild(createScrew<ScrewSilver>(Vec(box.size.x - 30, 365)));
addChild(Widget::create<ScrewSilver>(Vec(15, 0)));
addChild(Widget::create<ScrewSilver>(Vec(15, 365)));
addChild(Widget::create<ScrewSilver>(Vec(box.size.x - 30, 0)));
addChild(Widget::create<ScrewSilver>(Vec(box.size.x - 30, 365)));


textField = new TextField(); textField = new TextField();
textField->box.pos = Vec(15, 15); textField->box.pos = Vec(15, 15);


Loading…
Cancel
Save