Browse Source

Interpret blank ParamQuantity/PortInfo name as "#id".

tags/v2.0.0
Andrew Belt 5 years ago
parent
commit
804dc4daf2
6 changed files with 39 additions and 20 deletions
  1. +3
    -12
      include/engine/Module.hpp
  2. +1
    -0
      include/engine/ParamQuantity.hpp
  3. +5
    -6
      include/engine/PortInfo.hpp
  4. +3
    -2
      src/app/ParamWidget.cpp
  5. +6
    -0
      src/engine/ParamQuantity.cpp
  6. +21
    -0
      src/engine/PortInfo.cpp

+ 3
- 12
include/engine/Module.hpp View File

@@ -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;
}



+ 1
- 0
include/engine/ParamQuantity.hpp View File

@@ -66,6 +66,7 @@ struct ParamQuantity : Quantity {
int getDisplayPrecision() override;
std::string getLabel() override;
std::string getUnit() override;
virtual std::string getDescription();
};




+ 5
- 6
include/engine/PortInfo.hpp View File

@@ -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();
};




+ 3
- 2
src/app/ParamWidget.cpp View File

@@ -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();


+ 6
- 0
src/engine/ParamQuantity.cpp View File

@@ -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

+ 21
- 0
src/engine/PortInfo.cpp View File

@@ -0,0 +1,21 @@
#include <engine/PortInfo.hpp>
#include <string.hpp>


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

Loading…
Cancel
Save