MCPcopy Create free account
hub / github.com/IChooseYou/Reclass / showTypePopup

Method showTypePopup

src/controller.cpp:1565–1727  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1563}
1564
1565void RcxController::showTypePopup(RcxEditor* editor, TypePopupMode mode,
1566 int nodeIdx, QPoint globalPos) {
1567 const Node* node = nullptr;
1568 if (nodeIdx >= 0 && nodeIdx < m_doc->tree.nodes.size())
1569 node = &m_doc->tree.nodes[nodeIdx];
1570
1571 // ── Build entry list based on mode ──
1572 QVector<TypeEntry> entries;
1573 TypeEntry currentEntry;
1574 bool hasCurrent = false;
1575
1576 auto addPrimitives = [&](bool enabled, bool excludeStructArrayPad) {
1577 for (const auto& m : kKindMeta) {
1578 if (m.kind == NodeKind::Padding) continue;
1579 if (excludeStructArrayPad &&
1580 (m.kind == NodeKind::Struct || m.kind == NodeKind::Array))
1581 continue;
1582 TypeEntry e;
1583 e.entryKind = TypeEntry::Primitive;
1584 e.primitiveKind = m.kind;
1585 e.displayName = QString::fromLatin1(m.typeName);
1586 e.enabled = enabled;
1587 entries.append(e);
1588 }
1589 };
1590
1591 auto addComposites = [&](const std::function<bool(const Node&, const TypeEntry&)>& isCurrent) {
1592 for (const auto& n : m_doc->tree.nodes) {
1593 if (n.parentId != 0 || n.kind != NodeKind::Struct) continue;
1594 TypeEntry e;
1595 e.entryKind = TypeEntry::Composite;
1596 e.structId = n.id;
1597 e.displayName = n.structTypeName.isEmpty() ? n.name : n.structTypeName;
1598 e.classKeyword = n.resolvedClassKeyword();
1599 entries.append(e);
1600 if (!hasCurrent && node && isCurrent(*node, e)) {
1601 currentEntry = e;
1602 hasCurrent = true;
1603 }
1604 }
1605 };
1606
1607 switch (mode) {
1608 case TypePopupMode::Root:
1609 addPrimitives(/*enabled=*/false, /*excludeStructArrayPad=*/false);
1610 addComposites([&](const Node&, const TypeEntry& e) {
1611 return e.structId == m_viewRootId;
1612 });
1613 break;
1614
1615 case TypePopupMode::FieldType:
1616 addPrimitives(/*enabled=*/true, /*excludeStructArrayPad=*/false);
1617 if (node) {
1618 // Mark current primitive
1619 for (auto& e : entries) {
1620 if (e.entryKind == TypeEntry::Primitive && e.primitiveKind == node->kind) {
1621 currentEntry = e;
1622 hasCurrent = true;

Callers

nothing calls this directly

Calls 11

sizeForKindFunction · 0.85
resolvedClassKeywordMethod · 0.80
scintillaMethod · 0.80
setModeMethod · 0.80
setCurrentNodeSizeMethod · 0.80
setTitleMethod · 0.80
setTypesMethod · 0.80
reserveIdMethod · 0.80
popupMethod · 0.80
sizeMethod · 0.45
setFontMethod · 0.45

Tested by

no test coverage detected