From 9cbae49cb01ab173ccfc445c5360ef0d8de0414b Mon Sep 17 00:00:00 2001 From: scawful Date: Thu, 21 Aug 2025 19:00:12 -0400 Subject: [PATCH] housekeeping --- src/app/editor/overworld/entity.cc | 10 ++++++++-- src/app/editor/overworld/entity.h | 23 ++++++++++++----------- src/app/gui/modules/text_editor.cc | 2 -- src/app/rom.h | 1 - src/util/macro.h | 2 +- 5 files changed, 21 insertions(+), 17 deletions(-) diff --git a/src/app/editor/overworld/entity.cc b/src/app/editor/overworld/entity.cc index 843be091..57205e14 100644 --- a/src/app/editor/overworld/entity.cc +++ b/src/app/editor/overworld/entity.cc @@ -393,8 +393,8 @@ void DrawSpriteTable(std::function onSpriteSelect) { if (ImGui::BeginTable("##sprites", 2, ImGuiTableFlags_Sortable | ImGuiTableFlags_Resizable)) { ImGui::TableSetupColumn("ID", ImGuiTableColumnFlags_DefaultSort, 0.0f, - MyItemColumnID_ID); - ImGui::TableSetupColumn("Name", 0, 0.0f, MyItemColumnID_Name); + SpriteItemColumnID_ID); + ImGui::TableSetupColumn("Name", 0, 0.0f, SpriteItemColumnID_Name); ImGui::TableHeadersRow(); // Handle sorting @@ -441,6 +441,12 @@ void DrawSpriteInserterPopup() { } SameLine(); + if (Button(ICON_MD_DELETE)) { + new_sprite_id = -1; + ImGui::CloseCurrentPopup(); + } + SameLine(); + if (Button(ICON_MD_CANCEL)) { ImGui::CloseCurrentPopup(); } diff --git a/src/app/editor/overworld/entity.h b/src/app/editor/overworld/entity.h index 43980f30..e1b7027d 100644 --- a/src/app/editor/overworld/entity.h +++ b/src/app/editor/overworld/entity.h @@ -1,13 +1,12 @@ #ifndef YAZE_APP_EDITOR_OVERWORLD_ENTITY_H #define YAZE_APP_EDITOR_OVERWORLD_ENTITY_H -#include "imgui/imgui.h" - #include "app/zelda3/common.h" +#include "app/zelda3/overworld/overworld_entrance.h" #include "app/zelda3/overworld/overworld_exit.h" #include "app/zelda3/overworld/overworld_item.h" -#include "app/zelda3/overworld/overworld_entrance.h" #include "app/zelda3/sprite/sprite.h" +#include "imgui/imgui.h" namespace yaze { namespace editor { @@ -34,12 +33,14 @@ void DrawItemInsertPopup(); bool DrawItemEditorPopup(zelda3::OverworldItem &item); -enum MyItemColumnID { - MyItemColumnID_ID, - MyItemColumnID_Name, - MyItemColumnID_Action, - MyItemColumnID_Quantity, - MyItemColumnID_Description +/** + * @brief Column IDs for the sprite table. + * + */ +enum SpriteItemColumnID { + SpriteItemColumnID_ID, + SpriteItemColumnID_Name, + SpriteItemColumnID_Description }; struct SpriteItem { @@ -62,10 +63,10 @@ struct SpriteItem { &s_current_sort_specs->Specs[n]; int delta = 0; switch (sort_spec->ColumnUserID) { - case MyItemColumnID_ID: + case SpriteItemColumnID_ID: delta = (a.id - b.id); break; - case MyItemColumnID_Name: + case SpriteItemColumnID_Name: delta = strcmp(a.name + 2, b.name + 2); break; } diff --git a/src/app/gui/modules/text_editor.cc b/src/app/gui/modules/text_editor.cc index c6b95778..e94dd34f 100644 --- a/src/app/gui/modules/text_editor.cc +++ b/src/app/gui/modules/text_editor.cc @@ -1066,7 +1066,6 @@ void TextEditor::Render(const char* aTitle, const ImVec2& aSize, bool aBorder) { if (mHandleKeyboardInputs) { HandleKeyboardInputs(); - ImGui::PushAllowKeyboardFocus(true); } if (mHandleMouseInputs) HandleMouseInputs(); @@ -1074,7 +1073,6 @@ void TextEditor::Render(const char* aTitle, const ImVec2& aSize, bool aBorder) { ColorizeInternal(); Render(); - if (mHandleKeyboardInputs) ImGui::PopAllowKeyboardFocus(); if (!mIgnoreImGuiChild) ImGui::EndChild(); diff --git a/src/app/rom.h b/src/app/rom.h index c917d59a..a9c4a10e 100644 --- a/src/app/rom.h +++ b/src/app/rom.h @@ -9,7 +9,6 @@ #include #include #include -#include #include #include #include diff --git a/src/util/macro.h b/src/util/macro.h index 6c6cf0f5..f2b1a808 100644 --- a/src/util/macro.h +++ b/src/util/macro.h @@ -20,7 +20,7 @@ } #define HOVER_HINT(string) \ - if (ImGui::IsItemHovered()) ImGui::SetTooltip(string); + if (ImGui::IsItemHovered()) ImGui::SetTooltip(string) #define PRINT_IF_ERROR(expression) \ { \