diff --git a/include/app/CableContainer.hpp b/include/app/CableContainer.hpp index a629cc51..c726c52f 100644 --- a/include/app/CableContainer.hpp +++ b/include/app/CableContainer.hpp @@ -24,8 +24,10 @@ struct CableContainer : TransparentWidget { /** Takes ownership of `w` and adds it as a child if it isn't already */ void setIncompleteCable(CableWidget *w); CableWidget *releaseIncompleteCable(); - /** Returns the most recently added cable connected to the given Port, i.e. the top of the stack */ + /** Returns the most recently added complete cable connected to the given Port, i.e. the top of the stack */ CableWidget *getTopCable(PortWidget *port); + CableWidget *getCable(int cableId); + json_t *toJson(); void fromJson(json_t *rootJ, const std::map &moduleWidgets); void draw(NVGcontext *vg) override; diff --git a/include/app/CableWidget.hpp b/include/app/CableWidget.hpp index 9418f1c5..6b7b0ed0 100644 --- a/include/app/CableWidget.hpp +++ b/include/app/CableWidget.hpp @@ -21,8 +21,8 @@ struct CableWidget : OpaqueWidget { CableWidget(); ~CableWidget(); bool isComplete(); - void setOutputPort(PortWidget *outputPort); - void setInputPort(PortWidget *inputPort); + void setOutput(PortWidget *outputPort); + void setInput(PortWidget *inputPort); math::Vec getOutputPos(); math::Vec getInputPos(); json_t *toJson(); diff --git a/include/app/ModuleWidget.hpp b/include/app/ModuleWidget.hpp index be8185ce..c0e88678 100644 --- a/include/app/ModuleWidget.hpp +++ b/include/app/ModuleWidget.hpp @@ -18,8 +18,8 @@ struct ModuleWidget : OpaqueWidget { Widget *panel = NULL; std::vector params; - std::vector inputs; std::vector outputs; + std::vector inputs; /** For RackWidget dragging */ math::Vec dragPos; math::Vec oldPos; @@ -44,12 +44,15 @@ struct ModuleWidget : OpaqueWidget { Transfers ownership */ void setModule(Module *module); + void setPanel(std::shared_ptr svg); /** Convenience functions for adding special widgets (calls addChild()) */ - void addInput(PortWidget *input); - void addOutput(PortWidget *output); void addParam(ParamWidget *param); - void setPanel(std::shared_ptr svg); + void addOutput(PortWidget *output); + void addInput(PortWidget *input); + ParamWidget *getParam(int paramId); + PortWidget *getOutput(int outputId); + PortWidget *getInput(int inputId); /** Overriding these is deprecated. Use Module::dataToJson() and dataFromJson() instead diff --git a/include/engine/Module.hpp b/include/engine/Module.hpp index d8755396..4f639b9b 100644 --- a/include/engine/Module.hpp +++ b/include/engine/Module.hpp @@ -15,8 +15,8 @@ namespace rack { struct Module { int id = 0; std::vector params; - std::vector