From 947170198fa5d89e4c736d11eb63d0c3c499f656 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Thu, 28 Oct 2021 05:41:11 -0400 Subject: [PATCH] Add port name to PortCableItem in port context menu. --- src/app/PortWidget.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/app/PortWidget.cpp b/src/app/PortWidget.cpp index 1ebc7de0..12abb379 100644 --- a/src/app/PortWidget.cpp +++ b/src/app/PortWidget.cpp @@ -180,6 +180,8 @@ void PortWidget::createContextMenu() { else { } + menu->addChild(new ui::MenuSeparator); + // Create cable items bool createCableDisabled = (type == engine::Port::INPUT) && topCw; for (NVGcolor color : settings::cableColors) { @@ -194,9 +196,13 @@ void PortWidget::createContextMenu() { if (!cws.empty()) { menu->addChild(new ui::MenuSeparator); - for (CableWidget* cw : cws) { - PortCableItem* item = createMenuItem(" XXXX", "Click+drag"); - item->color = nvgRGBf(1, 0, 0); + for (auto it = cws.rbegin(); it != cws.rend(); it++) { + CableWidget* cw = *it; + PortWidget* pw = (type == engine::Port::INPUT) ? cw->outputPort : cw->inputPort; + engine::PortInfo* portInfo = pw->getPortInfo(); + + PortCableItem* item = createMenuItem(" " + portInfo->module->model->name + ": " + portInfo->getName()); + item->color = cw->color; menu->addChild(item); } }