Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tope99 committed Jul 30, 2023
1 parent f8ae207 commit aec3675
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/cppgen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Expand Down
2 changes: 2 additions & 0 deletions src/ui_class_wizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
Expand Down
6 changes: 4 additions & 2 deletions src/ui_new_field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,16 @@ 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();
}

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;
Expand Down Expand Up @@ -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)) {
Expand Down

0 comments on commit aec3675

Please sign in to comment.