mirror of
https://github.com/NohamR/Reclass.git
synced 2026-05-10 19:59:21 +00:00
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 <combuter@users.noreply.github.com>
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user