| 187 | } |
| 188 | |
| 189 | void RcxController::connectEditor(RcxEditor* editor) { |
| 190 | connect(editor, &RcxEditor::marginClicked, |
| 191 | this, [this, editor](int margin, int line, Qt::KeyboardModifiers mods) { |
| 192 | handleMarginClick(editor, margin, line, mods); |
| 193 | }); |
| 194 | connect(editor, &RcxEditor::contextMenuRequested, |
| 195 | this, [this, editor](int line, int nodeIdx, int subLine, QPoint globalPos) { |
| 196 | showContextMenu(editor, line, nodeIdx, subLine, globalPos); |
| 197 | }); |
| 198 | connect(editor, &RcxEditor::nodeClicked, |
| 199 | this, [this, editor](int line, uint64_t nodeId, Qt::KeyboardModifiers mods) { |
| 200 | handleNodeClick(editor, line, nodeId, mods); |
| 201 | }); |
| 202 | |
| 203 | // Type selector popup (command row chevron) |
| 204 | connect(editor, &RcxEditor::typeSelectorRequested, |
| 205 | this, [this, editor]() { |
| 206 | showTypePopup(editor, TypePopupMode::Root, -1, QPoint()); |
| 207 | }); |
| 208 | |
| 209 | // Type picker popup (array element type / pointer target) |
| 210 | connect(editor, &RcxEditor::typePickerRequested, |
| 211 | this, [this, editor](EditTarget target, int nodeIdx, QPoint globalPos) { |
| 212 | TypePopupMode mode = TypePopupMode::FieldType; |
| 213 | if (target == EditTarget::ArrayElementType) |
| 214 | mode = TypePopupMode::ArrayElement; |
| 215 | else if (target == EditTarget::PointerTarget) |
| 216 | mode = TypePopupMode::PointerTarget; |
| 217 | showTypePopup(editor, mode, nodeIdx, globalPos); |
| 218 | }); |
| 219 | |
| 220 | // Inline editing signals |
| 221 | connect(editor, &RcxEditor::inlineEditCommitted, |
| 222 | this, [this](int nodeIdx, int subLine, EditTarget target, const QString& text) { |
| 223 | // CommandRow BaseAddress/Source/RootClass edit has nodeIdx=-1 |
| 224 | if (nodeIdx < 0 && target != EditTarget::BaseAddress && target != EditTarget::Source |
| 225 | && target != EditTarget::RootClassType && target != EditTarget::RootClassName) { refresh(); return; } |
| 226 | switch (target) { |
| 227 | case EditTarget::Name: { |
| 228 | if (text.isEmpty()) break; |
| 229 | const Node& node = m_doc->tree.nodes[nodeIdx]; |
| 230 | // ASCII edit on Hex/Padding nodes |
| 231 | if (isHexPreview(node.kind)) { |
| 232 | setNodeValue(nodeIdx, subLine, text, /*isAscii=*/true); |
| 233 | } else { |
| 234 | renameNode(nodeIdx, text); |
| 235 | } |
| 236 | break; |
| 237 | } |
| 238 | case EditTarget::Type: { |
| 239 | // Check for array type syntax: "type[count]" e.g. "int32_t[10]" |
| 240 | int bracketPos = text.indexOf('['); |
| 241 | if (bracketPos > 0 && text.endsWith(']')) { |
| 242 | QString elemTypeName = text.left(bracketPos).trimmed(); |
| 243 | QString countStr = text.mid(bracketPos + 1, text.size() - bracketPos - 2); |
| 244 | bool countOk; |
| 245 | int newCount = countStr.toInt(&countOk); |
| 246 | if (countOk && newCount > 0) { |
nothing calls this directly
no test coverage detected