From aec36751a24cac6ec22695ae0d0569c88f81d33f Mon Sep 17 00:00:00 2001 From: Tomas Pecholt Date: Sun, 30 Jul 2023 13:58:05 +0700 Subject: [PATCH] fixes --- src/cppgen.cpp | 2 +- src/ui_class_wizard.cpp | 2 ++ src/ui_new_field.cpp | 6 ++++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/cppgen.cpp b/src/cppgen.cpp index 0231719..de6ab13 100644 --- a/src/cppgen.cpp +++ b/src/cppgen.cpp @@ -213,7 +213,7 @@ CppGen::ExportH(std::ostream& fout, std::istream& fprev, TopWindow::Kind kind) out << INDENT << INDENT << var.type << " " << var.name; if (var.init != "") out << " = " << var.init; - out << ";\n\n"; + out << ";\n"; } out << INDENT << "};\n"; } diff --git a/src/ui_class_wizard.cpp b/src/ui_class_wizard.cpp index 0cb684c..920e7ac 100644 --- a/src/ui_class_wizard.cpp +++ b/src/ui_class_wizard.cpp @@ -233,6 +233,7 @@ void ClassWizard::Draw() { newFieldPopup.codeGen = codeGen; newFieldPopup.mode = NewFieldPopup::NewField; + newFieldPopup.scope = stypeIdx ? stypes[stypeIdx] : ""; newFieldPopup.varType = ""; newFieldPopup.OpenPopup([this] { Refresh(); @@ -249,6 +250,7 @@ void ClassWizard::Draw() { newFieldPopup.codeGen = codeGen; newFieldPopup.mode = NewFieldPopup::RenameField; + newFieldPopup.scope = stypeIdx ? stypes[stypeIdx] : ""; newFieldPopup.varOldName = fields[selRow].name; newFieldPopup.OpenPopup([this] { root->RenameFieldVars(newFieldPopup.varOldName, newFieldPopup.varName); diff --git a/src/ui_new_field.cpp b/src/ui_new_field.cpp index 90d2887..ac3179e 100644 --- a/src/ui_new_field.cpp +++ b/src/ui_new_field.cpp @@ -72,6 +72,8 @@ void NewFieldPopup::Draw() { ImGui::Text("Field type:"); ImGui::BeginDisabled(varTypeDisabled); + if (ImGui::IsWindowAppearing() && varType == "") + ImGui::SetKeyboardFocusHere(); if (ImGui::InputText("##varType", &varType, ImGuiInputTextFlags_CharsNoBlank)) change = true; ImGui::EndDisabled(); @@ -79,7 +81,7 @@ void NewFieldPopup::Draw() ImGui::Spacing(); ImGui::Text(mode == RenameWindow ? "New name:" : "Field name:"); - if (ImGui::IsWindowAppearing()) + if (ImGui::IsWindowAppearing() && varType != "") ImGui::SetKeyboardFocusHere(); if (ImGui::InputText("##varName", &varName, ImGuiInputTextFlags_CharsNoBlank)) change = true; @@ -191,7 +193,7 @@ void NewFieldPopup::CheckVarName() clr = IM_COL32(255, 0, 0, 255); } } - else if (mode == RenameField || mode == NewStruct || mode == NewEvent) + else if (mode == NewStruct || mode == NewEvent) { std::string type = mode == NewStruct ? "struct" : varType; if (!cpp::is_id(varName)) {