diff --git a/include/engine/Module.hpp b/include/engine/Module.hpp index 90888848..f17111ac 100644 --- a/include/engine/Module.hpp +++ b/include/engine/Module.hpp @@ -110,10 +110,7 @@ struct Module { q->minValue = minValue; q->maxValue = maxValue; q->defaultValue = defaultValue; - if (name == "") - q->name = string::f("#%d", paramId + 1); - else - q->name = name; + q->name = name; q->unit = unit; q->displayBase = displayBase; q->displayMultiplier = displayMultiplier; @@ -131,10 +128,7 @@ struct Module { p->module = this; p->type = Port::INPUT; p->portId = portId; - if (name == "") - p->name = string::f("#%d", portId + 1); - else - p->name = name; + p->name = name; inputInfos[portId] = p; } @@ -148,10 +142,7 @@ struct Module { p->module = this; p->type = Port::OUTPUT; p->portId = portId; - if (name == "") - p->name = string::f("#%d", portId + 1); - else - p->name = name; + p->name = name; outputInfos[portId] = p; } diff --git a/include/engine/ParamQuantity.hpp b/include/engine/ParamQuantity.hpp index 662737b0..041256cc 100644 --- a/include/engine/ParamQuantity.hpp +++ b/include/engine/ParamQuantity.hpp @@ -66,6 +66,7 @@ struct ParamQuantity : Quantity { int getDisplayPrecision() override; std::string getLabel() override; std::string getUnit() override; + virtual std::string getDescription(); }; diff --git a/include/engine/PortInfo.hpp b/include/engine/PortInfo.hpp index 872c0196..daf21fc4 100644 --- a/include/engine/PortInfo.hpp +++ b/include/engine/PortInfo.hpp @@ -7,6 +7,9 @@ namespace rack { namespace engine { +struct Module; + + struct PortInfo { Module* module = NULL; Port::Type type; @@ -24,12 +27,8 @@ struct PortInfo { std::string description; virtual ~PortInfo() {} - virtual std::string getName() { - return name; - } - virtual std::string getDescription() { - return description; - } + virtual std::string getName(); + virtual std::string getDescription(); }; diff --git a/src/app/ParamWidget.cpp b/src/app/ParamWidget.cpp index c8e640ef..df812680 100644 --- a/src/app/ParamWidget.cpp +++ b/src/app/ParamWidget.cpp @@ -69,9 +69,10 @@ struct ParamTooltip : ui::Tooltip { // Quantity string text = pq->getString(); // Description - if (pq->description != "") { + std::string description = pq->getDescription(); + if (description != "") { text += "\n"; - text += pq->description; + text += description; } } Tooltip::step(); diff --git a/src/engine/ParamQuantity.cpp b/src/engine/ParamQuantity.cpp index a7c5f8b3..4368cdc1 100644 --- a/src/engine/ParamQuantity.cpp +++ b/src/engine/ParamQuantity.cpp @@ -110,6 +110,8 @@ void ParamQuantity::setDisplayValueString(std::string s) { } std::string ParamQuantity::getLabel() { + if (name == "") + return string::f("#%d", paramId + 1); return name; } @@ -117,6 +119,10 @@ std::string ParamQuantity::getUnit() { return unit; } +std::string ParamQuantity::getDescription() { + return description; +} + } // namespace engine } // namespace rack diff --git a/src/engine/PortInfo.cpp b/src/engine/PortInfo.cpp new file mode 100644 index 00000000..d3df05d5 --- /dev/null +++ b/src/engine/PortInfo.cpp @@ -0,0 +1,21 @@ +#include +#include + + +namespace rack { +namespace engine { + + +std::string PortInfo::getName() { + if (name == "") + return string::f("#%d", portId + 1); + return name; +} + +std::string PortInfo::getDescription() { + return description; +} + + +} // namespace engine +} // namespace rack