From 02a5542f38aeda0415f8a933df922aa0bbc7314f Mon Sep 17 00:00:00 2001 From: sysadmin Date: Sat, 7 Feb 2026 10:12:27 -0700 Subject: [PATCH] Add quick-convert suggestions in right-click menu for Hex nodes - Hex64: offers Change to uint64_t and uint32_t - Hex32: offers Change to uint32_t - Hex16: offers Change to int16_t - Items appear at top of context menu with separator below Co-Authored-By: combuter --- src/controller.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/controller.cpp b/src/controller.cpp index a53e85d..6a8894c 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -934,6 +934,34 @@ void RcxController::showContextMenu(RcxEditor* editor, int line, int nodeIdx, uint64_t nodeId = node.id; uint64_t parentId = node.parentId; + // Quick-convert suggestions for Hex nodes + bool addedQuickConvert = false; + if (node.kind == NodeKind::Hex64) { + menu.addAction(icon("symbol-numeric.svg"), "Change to uint64_t", [this, nodeId]() { + int ni = m_doc->tree.indexOfId(nodeId); + if (ni >= 0) changeNodeKind(ni, NodeKind::UInt64); + }); + menu.addAction(icon("symbol-numeric.svg"), "Change to uint32_t", [this, nodeId]() { + int ni = m_doc->tree.indexOfId(nodeId); + if (ni >= 0) changeNodeKind(ni, NodeKind::UInt32); + }); + addedQuickConvert = true; + } else if (node.kind == NodeKind::Hex32) { + menu.addAction(icon("symbol-numeric.svg"), "Change to uint32_t", [this, nodeId]() { + int ni = m_doc->tree.indexOfId(nodeId); + if (ni >= 0) changeNodeKind(ni, NodeKind::UInt32); + }); + addedQuickConvert = true; + } else if (node.kind == NodeKind::Hex16) { + menu.addAction(icon("symbol-numeric.svg"), "Change to int16_t", [this, nodeId]() { + int ni = m_doc->tree.indexOfId(nodeId); + if (ni >= 0) changeNodeKind(ni, NodeKind::Int16); + }); + addedQuickConvert = true; + } + if (addedQuickConvert) + menu.addSeparator(); + bool isEditable = node.kind != NodeKind::Struct && node.kind != NodeKind::Array && node.kind != NodeKind::Padding && node.kind != NodeKind::Mat4x4 && m_doc->provider->isWritable();