| 31 | PortWidget* portWidget; |
| 32 | |
| 33 | void step() override { |
| 34 | if (portWidget->module) { |
| 35 | engine::Port* port = portWidget->getPort(); |
| 36 | engine::PortInfo* portInfo = portWidget->getPortInfo(); |
| 37 | // Label |
| 38 | text = portInfo->getFullName(); |
| 39 | // Description |
| 40 | std::string description = portInfo->getDescription(); |
| 41 | if (description != "") { |
| 42 | text += "\n"; |
| 43 | text += description; |
| 44 | } |
| 45 | // Voltage, number of channels |
| 46 | int channels = port->getChannels(); |
| 47 | for (int i = 0; i < channels; i++) { |
| 48 | float v = port->getVoltage(i); |
| 49 | // Add newline or comma |
| 50 | text += "\n"; |
| 51 | if (channels > 1) |
| 52 | text += string::f("%d: ", i + 1); |
| 53 | text += string::f("% .3fV", math::normalizeZero(v)); |
| 54 | } |
| 55 | // From/To |
| 56 | std::vector<CableWidget*> cables = APP->scene->rack->getCompleteCablesOnPort(portWidget); |
| 57 | for (auto it = cables.rbegin(); it != cables.rend(); it++) { |
| 58 | CableWidget* cable = *it; |
| 59 | PortWidget* otherPw = (portWidget->type == engine::Port::INPUT) ? cable->outputPort : cable->inputPort; |
| 60 | if (!otherPw) |
| 61 | continue; |
| 62 | text += "\n"; |
| 63 | if (portWidget->type == engine::Port::INPUT) |
| 64 | text += string::translate("PortWidget.from"); |
| 65 | else |
| 66 | text += string::translate("PortWidget.to"); |
| 67 | text += otherPw->module->model->getFullName(); |
| 68 | text += ": "; |
| 69 | text += otherPw->getPortInfo()->getName(); |
| 70 | text += " "; |
| 71 | text += (otherPw->type == engine::Port::INPUT) ? string::translate("PortWidget.input") : string::translate("PortWidget.output"); |
| 72 | } |
| 73 | } |
| 74 | Tooltip::step(); |
| 75 | // Position at bottom-right of parameter |
| 76 | box.pos = portWidget->getAbsoluteOffset(portWidget->box.size).round(); |
| 77 | // Fit inside parent (copied from Tooltip.cpp) |
| 78 | assert(parent); |
| 79 | box = box.nudge(parent->box.zeroPos()); |
| 80 | } |
| 81 | }; |
| 82 | |
| 83 |
nothing calls this directly
no test coverage detected