mirror of
https://github.com/NohamR/Reclass.git
synced 2026-05-10 19:59:21 +00:00
feat: enum editing UI, protect enums from struct ops, New Class opens two tabs
- New Class creates two Unnamed tabs, selects the first - New Enum creates 5 placeholder members (Member0-4) - Right-click enum member: Add Member Above/Below, Remove Member - Right-click enum header: Add Member, Rename, Delete only - Enum nodes fully protected from struct operations (no Add Child, Insert, Convert)
This commit is contained in:
23
src/main.cpp
23
src/main.cpp
@@ -1920,6 +1920,26 @@ void MainWindow::setupDockTabBars() {
|
||||
|
||||
// Build a minimal empty struct for new documents
|
||||
static void buildEmptyStruct(NodeTree& tree, const QString& classKeyword = QString()) {
|
||||
// ── Enum: bare node with empty enumMembers, no hex children ──
|
||||
if (classKeyword == QStringLiteral("enum")) {
|
||||
Node root;
|
||||
root.kind = NodeKind::Struct;
|
||||
root.name = "Unnamed";
|
||||
root.structTypeName = "Unnamed";
|
||||
root.classKeyword = classKeyword;
|
||||
root.parentId = 0;
|
||||
root.offset = 0;
|
||||
root.enumMembers = {
|
||||
{QStringLiteral("Member0"), 0},
|
||||
{QStringLiteral("Member1"), 1},
|
||||
{QStringLiteral("Member2"), 2},
|
||||
{QStringLiteral("Member3"), 3},
|
||||
{QStringLiteral("Member4"), 4},
|
||||
};
|
||||
tree.addNode(root);
|
||||
return;
|
||||
}
|
||||
|
||||
Node root;
|
||||
root.kind = NodeKind::Struct;
|
||||
root.name = "instance";
|
||||
@@ -1988,7 +2008,10 @@ MainWindow::~MainWindow() {
|
||||
}
|
||||
|
||||
void MainWindow::newClass() {
|
||||
auto* first = project_new(QStringLiteral("class"));
|
||||
project_new(QStringLiteral("class"));
|
||||
// Select the first tab
|
||||
if (first) first->raise();
|
||||
}
|
||||
|
||||
void MainWindow::newStruct() {
|
||||
|
||||
Reference in New Issue
Block a user