From 58f3213c625d0421d3919cd555454df5564765ea Mon Sep 17 00:00:00 2001 From: scawful Date: Mon, 13 Oct 2025 10:21:03 -0400 Subject: [PATCH] refactor(gui): reorganize GUI includes and introduce new components - Updated include paths for various GUI-related headers to improve organization and clarity. - Introduced new components for better modularity, including PaletteEditorWidget and EditorCardManager. - Refactored existing code to utilize the new components, ensuring consistency across the GUI subsystem. Benefits: - Enhances maintainability and readability of the GUI code. - Facilitates future enhancements and optimizations within the GUI subsystem. --- src/app/core/controller.cc | 6 +- src/app/core/project.cc | 2 +- .../core/service/canvas_automation_service.h | 2 +- .../core/service/widget_discovery_service.h | 2 +- src/app/core/window.cc | 2 +- .../editor/agent/agent_chat_history_popup.cc | 4 +- src/app/editor/agent/agent_chat_widget.cc | 2 +- src/app/editor/agent/agent_chat_widget.h | 2 +- src/app/editor/agent/agent_editor.cc | 2 +- src/app/editor/agent/agent_editor.h | 2 +- src/app/editor/agent/agent_ui_theme.cc | 4 +- src/app/editor/agent/agent_ui_theme.h | 4 +- src/app/editor/code/assembly_editor.cc | 6 +- src/app/editor/code/assembly_editor.h | 10 +- src/app/editor/code/memory_editor.cc | 4 +- src/app/editor/code/memory_editor.h | 4 +- src/app/editor/code/project_file_editor.cc | 2 +- src/app/editor/code/project_file_editor.h | 2 +- .../editor/dungeon/dungeon_canvas_viewer.cc | 2 +- .../editor/dungeon/dungeon_canvas_viewer.h | 2 +- src/app/editor/dungeon/dungeon_editor_v2.cc | 4 +- src/app/editor/dungeon/dungeon_editor_v2.h | 4 +- .../dungeon/dungeon_object_interaction.h | 2 +- .../editor/dungeon/dungeon_object_selector.cc | 4 +- .../editor/dungeon/dungeon_object_selector.h | 2 +- .../editor/dungeon/dungeon_room_selector.cc | 2 +- src/app/editor/dungeon/dungeon_toolset.cc | 2 +- src/app/editor/dungeon/object_editor_card.cc | 4 +- src/app/editor/dungeon/object_editor_card.h | 4 +- src/app/editor/editor_manager.cc | 12 +- src/app/editor/graphics/gfx_group_editor.cc | 6 +- src/app/editor/graphics/gfx_group_editor.h | 2 +- src/app/editor/graphics/graphics_editor.cc | 14 +- src/app/editor/graphics/graphics_editor.h | 8 +- src/app/editor/graphics/screen_editor.cc | 10 +- src/app/editor/graphics/screen_editor.h | 6 +- src/app/editor/message/message_editor.cc | 8 +- src/app/editor/message/message_editor.h | 8 +- src/app/editor/music/music_editor.cc | 4 +- src/app/editor/music/music_editor.h | 4 +- src/app/editor/overworld/entity.cc | 6 +- src/app/editor/overworld/map_properties.cc | 8 +- src/app/editor/overworld/map_properties.h | 2 +- src/app/editor/overworld/overworld_editor.cc | 10 +- src/app/editor/overworld/overworld_editor.h | 6 +- .../overworld/overworld_entity_renderer.cc | 2 +- .../overworld/overworld_entity_renderer.h | 2 +- src/app/editor/overworld/scratch_space.cc | 8 +- src/app/editor/overworld/tile16_editor.cc | 6 +- src/app/editor/overworld/tile16_editor.h | 4 +- src/app/editor/palette/palette_editor.cc | 8 +- src/app/editor/palette/palette_group_card.cc | 8 +- src/app/editor/palette/palette_group_card.h | 2 +- src/app/editor/palette/palette_utility.cc | 2 +- src/app/editor/palette/palette_utility.h | 2 +- src/app/editor/sprite/sprite_editor.cc | 6 +- src/app/editor/sprite/sprite_editor.h | 6 +- src/app/editor/system/command_manager.cc | 2 +- src/app/editor/system/popup_manager.cc | 4 +- src/app/editor/system/proposal_drawer.cc | 2 +- src/app/editor/system/settings_editor.cc | 8 +- src/app/editor/system/shortcut_manager.cc | 2 +- src/app/editor/system/user_settings.cc | 2 +- src/app/editor/ui/editor_selection_dialog.cc | 4 +- src/app/editor/ui/menu_builder.h | 4 +- src/app/editor/ui/welcome_screen.cc | 4 +- src/app/editor/ui/workspace_manager.cc | 2 +- src/app/emu/debug/disassembly_viewer.cc | 2 +- src/app/emu/debug/disassembly_viewer.h | 4 +- src/app/emu/emulator.cc | 8 +- src/app/emu/emulator.h | 2 +- src/app/emu/ui/debugger_ui.cc | 8 +- src/app/emu/ui/emulator_ui.cc | 6 +- src/app/emu/ui/input_handler.cc | 5 +- .../gui/{widgets => app}/agent_chat_widget.cc | 2 +- .../gui/{widgets => app}/agent_chat_widget.h | 0 src/app/gui/{ => app}/background_renderer.cc | 4 +- src/app/gui/{ => app}/background_renderer.h | 6 +- .../{widgets => app}/collaboration_panel.cc | 2 +- .../{widgets => app}/collaboration_panel.h | 0 src/app/gui/{ => app}/editor_card_manager.cc | 4 +- src/app/gui/{ => app}/editor_card_manager.h | 0 src/app/gui/{ => app}/editor_layout.cc | 12 +- src/app/gui/{ => app}/editor_layout.h | 0 src/app/gui/{ => app}/feature_flags_menu.h | 0 .../widget_auto_register.cc | 2 +- .../widget_auto_register.h | 8 +- .../widget_id_registry.cc | 2 +- .../widget_id_registry.h | 6 +- .../widget_measurement.cc | 2 +- .../widget_measurement.h | 0 .../widget_state_capture.cc | 2 +- .../widget_state_capture.h | 0 src/app/gui/canvas/bpp_format_ui.cc | 2 +- src/app/gui/{ => canvas}/canvas.cc | 8 +- src/app/gui/{ => canvas}/canvas.h | 8 +- src/app/gui/canvas/canvas_automation_api.cc | 2 +- src/app/gui/canvas/canvas_context_menu.cc | 9 +- src/app/gui/canvas/canvas_context_menu.h | 6 +- src/app/gui/canvas/canvas_modals.cc | 12 +- src/app/gui/{ => core}/color.cc | 0 src/app/gui/{ => core}/color.h | 0 src/app/gui/{ => core}/icons.h | 0 src/app/gui/{ => core}/input.cc | 0 src/app/gui/{ => core}/input.h | 0 src/app/gui/{ => core}/layout_helpers.cc | 10 +- src/app/gui/{ => core}/layout_helpers.h | 5 +- src/app/gui/{ => core}/style.cc | 10 +- src/app/gui/{ => core}/style.h | 4 +- src/app/gui/{ => core}/theme_manager.cc | 5 +- src/app/gui/{ => core}/theme_manager.h | 2 +- src/app/gui/{ => core}/ui_helpers.cc | 9 +- src/app/gui/{ => core}/ui_helpers.h | 0 src/app/gui/gui_library.cmake | 161 +++-- .../gui/{modules => widgets}/asset_browser.cc | 0 .../gui/{modules => widgets}/asset_browser.h | 0 .../dungeon_object_emulator_preview.cc | 2 +- src/app/gui/widgets/palette_editor_widget.cc | 582 ++++++++++++++---- src/app/gui/widgets/palette_editor_widget.h | 72 ++- src/app/gui/widgets/palette_widget.cc | 462 -------------- src/app/gui/widgets/palette_widget.h | 99 --- .../gui/{modules => widgets}/text_editor.cc | 0 .../gui/{modules => widgets}/text_editor.h | 0 src/app/gui/{ => widgets}/themed_widgets.cc | 4 +- src/app/gui/{ => widgets}/themed_widgets.h | 6 +- src/app/gui/widgets/tile_selector_widget.h | 2 +- src/app/platform/font_loader.cc | 2 +- src/app/platform/font_loader.mm | 2 +- src/app/test/e2e_test_suite.h | 2 +- src/app/test/emulator_test_suite.h | 2 +- src/app/test/rom_dependent_test_suite.h | 2 +- src/app/test/test_manager.cc | 4 +- src/app/test/zscustomoverworld_test_suite.h | 2 +- src/zelda3/screen/inventory.h | 3 +- .../editor/editor_integration_test.cc | 2 +- test/test_editor.cc | 2 +- test/unit/gui/canvas_automation_api_test.cc | 2 +- test/unit/gui/canvas_coordinate_sync_test.cc | 2 +- test/unit/gui/tile_selector_widget_test.cc | 2 +- 139 files changed, 890 insertions(+), 1006 deletions(-) rename src/app/gui/{widgets => app}/agent_chat_widget.cc (99%) rename src/app/gui/{widgets => app}/agent_chat_widget.h (100%) rename src/app/gui/{ => app}/background_renderer.cc (99%) rename src/app/gui/{ => app}/background_renderer.h (97%) rename src/app/gui/{widgets => app}/collaboration_panel.cc (99%) rename src/app/gui/{widgets => app}/collaboration_panel.h (100%) rename src/app/gui/{ => app}/editor_card_manager.cc (99%) rename src/app/gui/{ => app}/editor_card_manager.h (100%) rename src/app/gui/{ => app}/editor_layout.cc (98%) rename src/app/gui/{ => app}/editor_layout.h (100%) rename src/app/gui/{ => app}/feature_flags_menu.h (100%) rename src/app/gui/{widgets => automation}/widget_auto_register.cc (97%) rename src/app/gui/{widgets => automation}/widget_auto_register.h (97%) rename src/app/gui/{widgets => automation}/widget_id_registry.cc (99%) rename src/app/gui/{widgets => automation}/widget_id_registry.h (97%) rename src/app/gui/{widgets => automation}/widget_measurement.cc (98%) rename src/app/gui/{widgets => automation}/widget_measurement.h (100%) rename src/app/gui/{widgets => automation}/widget_state_capture.cc (99%) rename src/app/gui/{widgets => automation}/widget_state_capture.h (100%) rename src/app/gui/{ => canvas}/canvas.cc (99%) rename src/app/gui/{ => canvas}/canvas.h (99%) rename src/app/gui/{ => core}/color.cc (100%) rename src/app/gui/{ => core}/color.h (100%) rename src/app/gui/{ => core}/icons.h (100%) rename src/app/gui/{ => core}/input.cc (100%) rename src/app/gui/{ => core}/input.h (100%) rename src/app/gui/{ => core}/layout_helpers.cc (97%) rename src/app/gui/{ => core}/layout_helpers.h (96%) rename src/app/gui/{ => core}/style.cc (97%) rename src/app/gui/{ => core}/style.h (95%) rename src/app/gui/{ => core}/theme_manager.cc (99%) rename src/app/gui/{ => core}/theme_manager.h (99%) rename src/app/gui/{ => core}/ui_helpers.cc (98%) rename src/app/gui/{ => core}/ui_helpers.h (100%) rename src/app/gui/{modules => widgets}/asset_browser.cc (100%) rename src/app/gui/{modules => widgets}/asset_browser.h (100%) delete mode 100644 src/app/gui/widgets/palette_widget.cc delete mode 100644 src/app/gui/widgets/palette_widget.h rename src/app/gui/{modules => widgets}/text_editor.cc (100%) rename src/app/gui/{modules => widgets}/text_editor.h (100%) rename src/app/gui/{ => widgets}/themed_widgets.cc (99%) rename src/app/gui/{ => widgets}/themed_widgets.h (98%) diff --git a/src/app/core/controller.cc b/src/app/core/controller.cc index cfe41dd5..5a5c39e4 100644 --- a/src/app/core/controller.cc +++ b/src/app/core/controller.cc @@ -8,11 +8,11 @@ #include "app/core/timing.h" #include "app/core/window.h" #include "app/editor/editor_manager.h" -#include "app/gui/background_renderer.h" +#include "app/gui/app/background_renderer.h" #include "app/gfx/resource/arena.h" // Add include for Arena #include "app/gfx/backend/sdl2_renderer.h" // Add include for new renderer -#include "app/gui/theme_manager.h" -#include "app/gui/widgets/widget_id_registry.h" +#include "app/gui/core/theme_manager.h" +#include "app/gui/automation/widget_id_registry.h" #include "imgui/backends/imgui_impl_sdl2.h" #include "imgui/backends/imgui_impl_sdlrenderer2.h" #include "imgui/imgui.h" diff --git a/src/app/core/project.cc b/src/app/core/project.cc index d603fb9c..7a4978f5 100644 --- a/src/app/core/project.cc +++ b/src/app/core/project.cc @@ -11,7 +11,7 @@ #include "absl/strings/str_split.h" #include "util/file_util.h" #include "util/platform_paths.h" -#include "app/gui/icons.h" +#include "app/gui/core/icons.h" #include "util/log.h" #include "zelda3/zelda3_labels.h" #include "imgui/imgui.h" diff --git a/src/app/core/service/canvas_automation_service.h b/src/app/core/service/canvas_automation_service.h index 540ea568..de8ad9fd 100644 --- a/src/app/core/service/canvas_automation_service.h +++ b/src/app/core/service/canvas_automation_service.h @@ -9,7 +9,7 @@ #include #include "absl/status/status.h" -#include "app/gui/canvas.h" +#include "app/gui/canvas/canvas.h" // Forward declarations namespace grpc { diff --git a/src/app/core/service/widget_discovery_service.h b/src/app/core/service/widget_discovery_service.h index ca0d03e1..cfbab682 100644 --- a/src/app/core/service/widget_discovery_service.h +++ b/src/app/core/service/widget_discovery_service.h @@ -16,7 +16,7 @@ #pragma pop_macro("DWORD") #pragma pop_macro("ERROR") #endif // _WIN32 -#include "app/gui/widgets/widget_id_registry.h" +#include "app/gui/automation/widget_id_registry.h" #if defined(YAZE_ENABLE_IMGUI_TEST_ENGINE) && YAZE_ENABLE_IMGUI_TEST_ENGINE #include "imgui_test_engine/imgui_te_context.h" diff --git a/src/app/core/window.cc b/src/app/core/window.cc index 81598397..8ce9c968 100644 --- a/src/app/core/window.cc +++ b/src/app/core/window.cc @@ -8,7 +8,7 @@ #include "util/sdl_deleter.h" #include "util/log.h" #include "app/gfx/resource/arena.h" -#include "app/gui/style.h" +#include "app/gui/core/style.h" #include "imgui/backends/imgui_impl_sdl2.h" #include "imgui/backends/imgui_impl_sdlrenderer2.h" #include "imgui/imgui.h" diff --git a/src/app/editor/agent/agent_chat_history_popup.cc b/src/app/editor/agent/agent_chat_history_popup.cc index 5212b6a2..14adc823 100644 --- a/src/app/editor/agent/agent_chat_history_popup.cc +++ b/src/app/editor/agent/agent_chat_history_popup.cc @@ -6,8 +6,8 @@ #include "absl/time/time.h" #include "app/editor/agent/agent_ui_theme.h" #include "app/editor/system/toast_manager.h" -#include "app/gui/icons.h" -#include "app/gui/style.h" +#include "app/gui/core/icons.h" +#include "app/gui/core/style.h" #include "imgui/imgui.h" #include "imgui/misc/cpp/imgui_stdlib.h" diff --git a/src/app/editor/agent/agent_chat_widget.cc b/src/app/editor/agent/agent_chat_widget.cc index b1c29a73..f7b0120a 100644 --- a/src/app/editor/agent/agent_chat_widget.cc +++ b/src/app/editor/agent/agent_chat_widget.cc @@ -24,7 +24,7 @@ #include "app/editor/agent/agent_chat_history_popup.h" #include "app/editor/system/proposal_drawer.h" #include "app/editor/system/toast_manager.h" -#include "app/gui/icons.h" +#include "app/gui/core/icons.h" #include "app/rom.h" #include "imgui/imgui.h" #include "util/file_util.h" diff --git a/src/app/editor/agent/agent_chat_widget.h b/src/app/editor/agent/agent_chat_widget.h index 23097f86..d925b755 100644 --- a/src/app/editor/agent/agent_chat_widget.h +++ b/src/app/editor/agent/agent_chat_widget.h @@ -10,7 +10,7 @@ #include "absl/status/status.h" #include "absl/status/statusor.h" #include "absl/time/time.h" -#include "app/gui/modules/text_editor.h" +#include "app/gui/widgets/text_editor.h" #include "cli/service/agent/conversational_agent_service.h" #include "cli/service/agent/advanced_routing.h" #include "cli/service/agent/agent_pretraining.h" diff --git a/src/app/editor/agent/agent_editor.cc b/src/app/editor/agent/agent_editor.cc index 7b1212fb..b7605e59 100644 --- a/src/app/editor/agent/agent_editor.cc +++ b/src/app/editor/agent/agent_editor.cc @@ -12,7 +12,7 @@ #include "app/editor/agent/agent_collaboration_coordinator.h" #include "app/editor/system/proposal_drawer.h" #include "app/editor/system/toast_manager.h" -#include "app/gui/icons.h" +#include "app/gui/core/icons.h" #include "app/rom.h" #include "util/file_util.h" #include "util/platform_paths.h" diff --git a/src/app/editor/agent/agent_editor.h b/src/app/editor/agent/agent_editor.h index 185c435e..386031a3 100644 --- a/src/app/editor/agent/agent_editor.h +++ b/src/app/editor/agent/agent_editor.h @@ -10,7 +10,7 @@ #include "absl/status/status.h" #include "absl/status/statusor.h" #include "app/editor/editor.h" -#include "app/gui/modules/text_editor.h" +#include "app/gui/widgets/text_editor.h" #include "cli/service/agent/conversational_agent_service.h" namespace yaze { diff --git a/src/app/editor/agent/agent_ui_theme.cc b/src/app/editor/agent/agent_ui_theme.cc index 0001a379..cea54125 100644 --- a/src/app/editor/agent/agent_ui_theme.cc +++ b/src/app/editor/agent/agent_ui_theme.cc @@ -1,7 +1,7 @@ #include "app/editor/agent/agent_ui_theme.h" -#include "app/gui/theme_manager.h" -#include "app/gui/color.h" +#include "app/gui/core/theme_manager.h" +#include "app/gui/core/color.h" #include "imgui/imgui.h" namespace yaze { diff --git a/src/app/editor/agent/agent_ui_theme.h b/src/app/editor/agent/agent_ui_theme.h index 36a46c84..aec824c7 100644 --- a/src/app/editor/agent/agent_ui_theme.h +++ b/src/app/editor/agent/agent_ui_theme.h @@ -2,8 +2,8 @@ #define YAZE_APP_EDITOR_AGENT_AGENT_UI_THEME_H #include "imgui/imgui.h" -#include "app/gui/theme_manager.h" -#include "app/gui/color.h" +#include "app/gui/core/theme_manager.h" +#include "app/gui/core/color.h" namespace yaze { namespace editor { diff --git a/src/app/editor/code/assembly_editor.cc b/src/app/editor/code/assembly_editor.cc index 2140e689..25d455c3 100644 --- a/src/app/editor/code/assembly_editor.cc +++ b/src/app/editor/code/assembly_editor.cc @@ -7,9 +7,9 @@ #include "absl/strings/str_cat.h" #include "absl/strings/match.h" #include "util/file_util.h" -#include "app/gui/icons.h" -#include "app/gui/ui_helpers.h" -#include "app/gui/modules/text_editor.h" +#include "app/gui/core/icons.h" +#include "app/gui/core/ui_helpers.h" +#include "app/gui/widgets/text_editor.h" namespace yaze::editor { diff --git a/src/app/editor/code/assembly_editor.h b/src/app/editor/code/assembly_editor.h index 69aca081..810d073f 100644 --- a/src/app/editor/code/assembly_editor.h +++ b/src/app/editor/code/assembly_editor.h @@ -2,12 +2,14 @@ #define YAZE_APP_EDITOR_ASSEMBLY_EDITOR_H #include +#include +#include "absl/container/flat_hash_map.h" #include "app/editor/editor.h" -#include "app/gui/modules/text_editor.h" -#include "app/gui/editor_layout.h" -#include "app/gui/editor_card_manager.h" -#include "app/gui/style.h" +#include "app/gui/widgets/text_editor.h" +#include "app/gui/app/editor_layout.h" +#include "app/gui/app/editor_card_manager.h" +#include "app/gui/core/style.h" #include "app/rom.h" namespace yaze { diff --git a/src/app/editor/code/memory_editor.cc b/src/app/editor/code/memory_editor.cc index 4361886f..d43e9285 100644 --- a/src/app/editor/code/memory_editor.cc +++ b/src/app/editor/code/memory_editor.cc @@ -1,8 +1,8 @@ #include "app/editor/code/memory_editor.h" #include "absl/strings/str_format.h" -#include "app/gui/icons.h" -#include "app/gui/style.h" +#include "app/gui/core/icons.h" +#include "app/gui/core/style.h" #include "imgui/imgui.h" namespace yaze { diff --git a/src/app/editor/code/memory_editor.h b/src/app/editor/code/memory_editor.h index a717ffa8..1062953a 100644 --- a/src/app/editor/code/memory_editor.h +++ b/src/app/editor/code/memory_editor.h @@ -2,7 +2,9 @@ #define YAZE_APP_EDITOR_CODE_MEMORY_EDITOR_H #include "util/file_util.h" -#include "app/gui/input.h" +#include "absl/container/flat_hash_map.h" +#include "app/editor/editor.h" +#include "app/gui/core/input.h" #include "app/rom.h" #include "app/snes.h" #include "imgui/imgui.h" diff --git a/src/app/editor/code/project_file_editor.cc b/src/app/editor/code/project_file_editor.cc index 55b10039..971d2478 100644 --- a/src/app/editor/code/project_file_editor.cc +++ b/src/app/editor/code/project_file_editor.cc @@ -8,7 +8,7 @@ #include "absl/strings/str_split.h" #include "util/file_util.h" #include "app/editor/system/toast_manager.h" -#include "app/gui/icons.h" +#include "app/gui/core/icons.h" #include "imgui/imgui.h" namespace yaze { diff --git a/src/app/editor/code/project_file_editor.h b/src/app/editor/code/project_file_editor.h index 21b53929..640aa63d 100644 --- a/src/app/editor/code/project_file_editor.h +++ b/src/app/editor/code/project_file_editor.h @@ -5,7 +5,7 @@ #include "absl/status/status.h" #include "app/core/project.h" -#include "app/gui/modules/text_editor.h" +#include "app/gui/widgets/text_editor.h" namespace yaze { namespace editor { diff --git a/src/app/editor/dungeon/dungeon_canvas_viewer.cc b/src/app/editor/dungeon/dungeon_canvas_viewer.cc index afb85e19..3cfce463 100644 --- a/src/app/editor/dungeon/dungeon_canvas_viewer.cc +++ b/src/app/editor/dungeon/dungeon_canvas_viewer.cc @@ -3,7 +3,7 @@ #include "absl/strings/str_format.h" #include "app/gfx/resource/arena.h" #include "app/gfx/types/snes_palette.h" -#include "app/gui/input.h" +#include "app/gui/core/input.h" #include "app/rom.h" #include "zelda3/dungeon/room.h" #include "zelda3/sprite/sprite.h" diff --git a/src/app/editor/dungeon/dungeon_canvas_viewer.h b/src/app/editor/dungeon/dungeon_canvas_viewer.h index 104b2733..e8f5ec8e 100644 --- a/src/app/editor/dungeon/dungeon_canvas_viewer.h +++ b/src/app/editor/dungeon/dungeon_canvas_viewer.h @@ -3,7 +3,7 @@ #include -#include "app/gui/canvas.h" +#include "app/gui/canvas/canvas.h" #include "app/rom.h" #include "zelda3/dungeon/room.h" #include "app/gfx/types/snes_palette.h" diff --git a/src/app/editor/dungeon/dungeon_editor_v2.cc b/src/app/editor/dungeon/dungeon_editor_v2.cc index a5310f59..82302112 100644 --- a/src/app/editor/dungeon/dungeon_editor_v2.cc +++ b/src/app/editor/dungeon/dungeon_editor_v2.cc @@ -8,8 +8,8 @@ #include "app/gfx/util/palette_manager.h" #include "app/gfx/types/snes_palette.h" #include "zelda3/dungeon/room.h" -#include "app/gui/icons.h" -#include "app/gui/input.h" +#include "app/gui/core/icons.h" +#include "app/gui/core/input.h" #include "imgui/imgui.h" #include "util/log.h" diff --git a/src/app/editor/dungeon/dungeon_editor_v2.h b/src/app/editor/dungeon/dungeon_editor_v2.h index fdf5fd12..3d493585 100644 --- a/src/app/editor/dungeon/dungeon_editor_v2.h +++ b/src/app/editor/dungeon/dungeon_editor_v2.h @@ -14,10 +14,10 @@ #include "dungeon_object_selector.h" #include "dungeon_room_loader.h" #include "object_editor_card.h" -#include "app/gui/editor_card_manager.h" +#include "app/gui/app/editor_card_manager.h" #include "zelda3/dungeon/room.h" #include "zelda3/dungeon/room_entrance.h" -#include "app/gui/editor_layout.h" +#include "app/gui/app/editor_layout.h" #include "app/gui/widgets/dungeon_object_emulator_preview.h" #include "app/gui/widgets/palette_editor_widget.h" #include "imgui/imgui.h" diff --git a/src/app/editor/dungeon/dungeon_object_interaction.h b/src/app/editor/dungeon/dungeon_object_interaction.h index ead248ce..abfed03e 100644 --- a/src/app/editor/dungeon/dungeon_object_interaction.h +++ b/src/app/editor/dungeon/dungeon_object_interaction.h @@ -5,7 +5,7 @@ #include #include "imgui/imgui.h" -#include "app/gui/canvas.h" +#include "app/gui/canvas/canvas.h" #include "zelda3/dungeon/room.h" #include "zelda3/dungeon/room_object.h" diff --git a/src/app/editor/dungeon/dungeon_object_selector.cc b/src/app/editor/dungeon/dungeon_object_selector.cc index df90acca..078eedab 100644 --- a/src/app/editor/dungeon/dungeon_object_selector.cc +++ b/src/app/editor/dungeon/dungeon_object_selector.cc @@ -7,8 +7,8 @@ #include "app/core/window.h" #include "app/gfx/resource/arena.h" #include "app/gfx/types/snes_palette.h" -#include "app/gui/canvas.h" -#include "app/gui/modules/asset_browser.h" +#include "app/gui/canvas/canvas.h" +#include "app/gui/widgets/asset_browser.h" #include "app/rom.h" #include "zelda3/dungeon/room.h" #include "zelda3/dungeon/dungeon_editor_system.h" diff --git a/src/app/editor/dungeon/dungeon_object_selector.h b/src/app/editor/dungeon/dungeon_object_selector.h index b86f5e01..11fb9b71 100644 --- a/src/app/editor/dungeon/dungeon_object_selector.h +++ b/src/app/editor/dungeon/dungeon_object_selector.h @@ -1,7 +1,7 @@ #ifndef YAZE_APP_EDITOR_DUNGEON_DUNGEON_OBJECT_SELECTOR_H #define YAZE_APP_EDITOR_DUNGEON_DUNGEON_OBJECT_SELECTOR_H -#include "app/gui/canvas.h" +#include "app/gui/canvas/canvas.h" #include "app/rom.h" // object_renderer.h removed - using ObjectDrawer for production rendering #include "zelda3/dungeon/dungeon_object_editor.h" diff --git a/src/app/editor/dungeon/dungeon_room_selector.cc b/src/app/editor/dungeon/dungeon_room_selector.cc index 8dcfa581..b08043d8 100644 --- a/src/app/editor/dungeon/dungeon_room_selector.cc +++ b/src/app/editor/dungeon/dungeon_room_selector.cc @@ -1,6 +1,6 @@ #include "dungeon_room_selector.h" -#include "app/gui/input.h" +#include "app/gui/core/input.h" #include "zelda3/dungeon/room.h" #include "zelda3/dungeon/room_entrance.h" #include "imgui/imgui.h" diff --git a/src/app/editor/dungeon/dungeon_toolset.cc b/src/app/editor/dungeon/dungeon_toolset.cc index 15b9b52a..da5cbf96 100644 --- a/src/app/editor/dungeon/dungeon_toolset.cc +++ b/src/app/editor/dungeon/dungeon_toolset.cc @@ -3,7 +3,7 @@ #include #include -#include "app/gui/icons.h" +#include "app/gui/core/icons.h" #include "imgui/imgui.h" namespace yaze::editor { diff --git a/src/app/editor/dungeon/object_editor_card.cc b/src/app/editor/dungeon/object_editor_card.cc index c963e184..ef734ac2 100644 --- a/src/app/editor/dungeon/object_editor_card.cc +++ b/src/app/editor/dungeon/object_editor_card.cc @@ -2,8 +2,8 @@ #include "absl/strings/str_format.h" #include "app/gfx/backend/irenderer.h" -#include "app/gui/icons.h" -#include "app/gui/ui_helpers.h" +#include "app/gui/core/icons.h" +#include "app/gui/core/ui_helpers.h" #include "imgui/imgui.h" namespace yaze::editor { diff --git a/src/app/editor/dungeon/object_editor_card.h b/src/app/editor/dungeon/object_editor_card.h index 23ae006a..f403016e 100644 --- a/src/app/editor/dungeon/object_editor_card.h +++ b/src/app/editor/dungeon/object_editor_card.h @@ -6,9 +6,9 @@ #include "app/editor/dungeon/dungeon_canvas_viewer.h" #include "app/gfx/backend/irenderer.h" -#include "app/gui/canvas.h" +#include "app/gui/canvas/canvas.h" #include "app/editor/dungeon/dungeon_object_selector.h" -#include "app/gui/editor_layout.h" +#include "app/gui/app/editor_layout.h" #include "app/gui/widgets/dungeon_object_emulator_preview.h" #include "app/rom.h" #include "zelda3/dungeon/room_object.h" diff --git a/src/app/editor/editor_manager.cc b/src/app/editor/editor_manager.cc index c66ed31b..86be55a2 100644 --- a/src/app/editor/editor_manager.cc +++ b/src/app/editor/editor_manager.cc @@ -13,7 +13,7 @@ #include "app/core/features.h" #include "app/core/timing.h" #include "util/file_util.h" -#include "app/gui/widgets/widget_id_registry.h" +#include "app/gui/automation/widget_id_registry.h" #include "imgui/imgui.h" #include "util/log.h" #include "util/platform_paths.h" @@ -30,11 +30,11 @@ #include "app/emu/emulator.h" #include "app/gfx/resource/arena.h" #include "app/gfx/debug/performance/performance_profiler.h" -#include "app/gui/background_renderer.h" -#include "app/gui/icons.h" -#include "app/gui/input.h" -#include "app/gui/style.h" -#include "app/gui/theme_manager.h" +#include "app/gui/app/background_renderer.h" +#include "app/gui/core/icons.h" +#include "app/gui/core/input.h" +#include "app/gui/core/style.h" +#include "app/gui/core/theme_manager.h" #include "app/rom.h" #include "app/test/test_manager.h" #include "zelda3/overworld/overworld_map.h" diff --git a/src/app/editor/graphics/gfx_group_editor.cc b/src/app/editor/graphics/gfx_group_editor.cc index a5300f18..aa0dd5e5 100644 --- a/src/app/editor/graphics/gfx_group_editor.cc +++ b/src/app/editor/graphics/gfx_group_editor.cc @@ -4,9 +4,9 @@ #include "absl/strings/str_cat.h" #include "app/gfx/resource/arena.h" #include "app/gfx/types/snes_palette.h" -#include "app/gui/canvas.h" -#include "app/gui/color.h" -#include "app/gui/input.h" +#include "app/gui/canvas/canvas.h" +#include "app/gui/core/color.h" +#include "app/gui/core/input.h" #include "app/rom.h" #include "imgui/imgui.h" diff --git a/src/app/editor/graphics/gfx_group_editor.h b/src/app/editor/graphics/gfx_group_editor.h index 26223d35..dc666971 100644 --- a/src/app/editor/graphics/gfx_group_editor.h +++ b/src/app/editor/graphics/gfx_group_editor.h @@ -3,7 +3,7 @@ #include "absl/status/status.h" #include "app/gfx/types/snes_palette.h" -#include "app/gui/canvas.h" +#include "app/gui/canvas/canvas.h" #include "app/rom.h" namespace yaze { diff --git a/src/app/editor/graphics/graphics_editor.cc b/src/app/editor/graphics/graphics_editor.cc index ef571cb3..6a0ed8eb 100644 --- a/src/app/editor/graphics/graphics_editor.cc +++ b/src/app/editor/graphics/graphics_editor.cc @@ -5,7 +5,7 @@ #include "absl/status/status.h" #include "absl/status/statusor.h" #include "absl/strings/str_cat.h" -#include "app/gui/ui_helpers.h" +#include "app/gui/core/ui_helpers.h" #include "util/file_util.h" #include "app/core/window.h" #include "app/gfx/resource/arena.h" @@ -14,12 +14,12 @@ #include "app/gfx/util/scad_format.h" #include "app/gfx/types/snes_palette.h" #include "app/gfx/types/snes_tile.h" -#include "app/gui/canvas.h" -#include "app/gui/color.h" -#include "app/gui/icons.h" -#include "app/gui/input.h" -#include "app/gui/modules/asset_browser.h" -#include "app/gui/style.h" +#include "app/gui/canvas/canvas.h" +#include "app/gui/core/color.h" +#include "app/gui/core/icons.h" +#include "app/gui/core/input.h" +#include "app/gui/widgets/asset_browser.h" +#include "app/gui/core/style.h" #include "app/rom.h" #include "app/gfx/debug/performance/performance_profiler.h" #include "imgui/imgui.h" diff --git a/src/app/editor/graphics/graphics_editor.h b/src/app/editor/graphics/graphics_editor.h index 4b45984c..e1496384 100644 --- a/src/app/editor/graphics/graphics_editor.h +++ b/src/app/editor/graphics/graphics_editor.h @@ -7,11 +7,11 @@ #include "app/editor/editor.h" #include "app/editor/palette/palette_editor.h" #include "app/gfx/core/bitmap.h" -#include "app/gui/editor_card_manager.h" +#include "app/gui/app/editor_card_manager.h" #include "app/gfx/types/snes_tile.h" -#include "app/gui/canvas.h" -#include "app/gui/editor_layout.h" -#include "app/gui/modules/asset_browser.h" +#include "app/gui/canvas/canvas.h" +#include "app/gui/app/editor_layout.h" +#include "app/gui/widgets/asset_browser.h" #include "app/rom.h" #include "zelda3/overworld/overworld.h" #include "imgui/imgui.h" diff --git a/src/app/editor/graphics/screen_editor.cc b/src/app/editor/graphics/screen_editor.cc index 380ec3de..3c7eb32e 100644 --- a/src/app/editor/graphics/screen_editor.cc +++ b/src/app/editor/graphics/screen_editor.cc @@ -13,11 +13,11 @@ #include "app/gfx/core/bitmap.h" #include "app/gfx/debug/performance/performance_profiler.h" #include "app/gfx/types/snes_tile.h" -#include "app/gui/canvas.h" -#include "app/gui/color.h" -#include "app/gui/icons.h" -#include "app/gui/input.h" -#include "app/gui/ui_helpers.h" +#include "app/gui/canvas/canvas.h" +#include "app/gui/core/color.h" +#include "app/gui/core/icons.h" +#include "app/gui/core/input.h" +#include "app/gui/core/ui_helpers.h" #include "imgui/imgui.h" #include "util/hex.h" #include "util/macro.h" diff --git a/src/app/editor/graphics/screen_editor.h b/src/app/editor/graphics/screen_editor.h index 2d0db707..2dfedf52 100644 --- a/src/app/editor/graphics/screen_editor.h +++ b/src/app/editor/graphics/screen_editor.h @@ -7,13 +7,13 @@ #include "app/editor/editor.h" #include "app/gfx/core/bitmap.h" #include "app/gfx/types/snes_palette.h" -#include "app/gui/editor_card_manager.h" +#include "app/gui/app/editor_card_manager.h" #include "app/gfx/render/tilemap.h" -#include "app/gui/canvas.h" +#include "app/gui/canvas/canvas.h" #include "app/rom.h" #include "zelda3/screen/dungeon_map.h" #include "zelda3/screen/inventory.h" -#include "app/gui/editor_layout.h" +#include "app/gui/app/editor_layout.h" #include "imgui/imgui.h" namespace yaze { diff --git a/src/app/editor/message/message_editor.cc b/src/app/editor/message/message_editor.cc index 6d846557..01cb233e 100644 --- a/src/app/editor/message/message_editor.cc +++ b/src/app/editor/message/message_editor.cc @@ -12,11 +12,11 @@ #include "app/gfx/core/bitmap.h" #include "app/gfx/types/snes_palette.h" #include "app/gfx/types/snes_tile.h" -#include "app/gui/canvas.h" -#include "app/gui/style.h" -#include "app/gui/icons.h" +#include "app/gui/canvas/canvas.h" +#include "app/gui/core/style.h" +#include "app/gui/core/icons.h" #include "app/rom.h" -#include "app/gui/input.h" +#include "app/gui/core/input.h" #include "imgui.h" #include "imgui/misc/cpp/imgui_stdlib.h" #include "util/hex.h" diff --git a/src/app/editor/message/message_editor.h b/src/app/editor/message/message_editor.h index 01355b32..0ef0f43e 100644 --- a/src/app/editor/message/message_editor.h +++ b/src/app/editor/message/message_editor.h @@ -9,11 +9,11 @@ #include "app/editor/editor.h" #include "app/editor/message/message_data.h" #include "app/editor/message/message_preview.h" -#include "app/gui/editor_card_manager.h" -#include "app/gui/editor_layout.h" +#include "app/gui/app/editor_card_manager.h" +#include "app/gui/app/editor_layout.h" #include "app/gfx/core/bitmap.h" -#include "app/gui/canvas.h" -#include "app/gui/style.h" +#include "app/gui/canvas/canvas.h" +#include "app/gui/core/style.h" #include "app/rom.h" namespace yaze { diff --git a/src/app/editor/music/music_editor.cc b/src/app/editor/music/music_editor.cc index da3124d9..adab8a2b 100644 --- a/src/app/editor/music/music_editor.cc +++ b/src/app/editor/music/music_editor.cc @@ -4,8 +4,8 @@ #include "app/gfx/debug/performance/performance_profiler.h" #include "app/editor/code/assembly_editor.h" #include "app/emu/emulator.h" -#include "app/gui/icons.h" -#include "app/gui/input.h" +#include "app/gui/core/icons.h" +#include "app/gui/core/input.h" #include "imgui/imgui.h" #include "util/log.h" diff --git a/src/app/editor/music/music_editor.h b/src/app/editor/music/music_editor.h index a054aea8..87578497 100644 --- a/src/app/editor/music/music_editor.h +++ b/src/app/editor/music/music_editor.h @@ -4,8 +4,8 @@ #include "app/editor/code/assembly_editor.h" #include "app/editor/editor.h" #include "app/emu/audio/apu.h" -#include "app/gui/editor_card_manager.h" -#include "app/gui/editor_layout.h" +#include "app/gui/app/editor_card_manager.h" +#include "app/gui/app/editor_layout.h" #include "app/rom.h" #include "zelda3/music/tracker.h" #include "imgui/imgui.h" diff --git a/src/app/editor/overworld/entity.cc b/src/app/editor/overworld/entity.cc index 9f1d4e52..1bb93c35 100644 --- a/src/app/editor/overworld/entity.cc +++ b/src/app/editor/overworld/entity.cc @@ -1,8 +1,8 @@ #include "app/editor/overworld/entity.h" -#include "app/gui/icons.h" -#include "app/gui/input.h" -#include "app/gui/style.h" +#include "app/gui/core/icons.h" +#include "app/gui/core/input.h" +#include "app/gui/core/style.h" #include "util/hex.h" namespace yaze { diff --git a/src/app/editor/overworld/map_properties.cc b/src/app/editor/overworld/map_properties.cc index c5770f15..1a502a7a 100644 --- a/src/app/editor/overworld/map_properties.cc +++ b/src/app/editor/overworld/map_properties.cc @@ -3,10 +3,10 @@ #include "app/gfx/debug/performance/performance_profiler.h" #include "app/editor/overworld/overworld_editor.h" #include "app/editor/overworld/ui_constants.h" -#include "app/gui/canvas.h" -#include "app/gui/color.h" -#include "app/gui/icons.h" -#include "app/gui/input.h" +#include "app/gui/canvas/canvas.h" +#include "app/gui/core/color.h" +#include "app/gui/core/icons.h" +#include "app/gui/core/input.h" #include "zelda3/overworld/overworld_map.h" #include "imgui/imgui.h" diff --git a/src/app/editor/overworld/map_properties.h b/src/app/editor/overworld/map_properties.h index 1e4b4387..7fba9d65 100644 --- a/src/app/editor/overworld/map_properties.h +++ b/src/app/editor/overworld/map_properties.h @@ -5,7 +5,7 @@ #include "zelda3/overworld/overworld.h" #include "app/rom.h" -#include "app/gui/canvas.h" +#include "app/gui/canvas/canvas.h" // Forward declaration namespace yaze { diff --git a/src/app/editor/overworld/overworld_editor.cc b/src/app/editor/overworld/overworld_editor.cc index d42e22f3..75f5de89 100644 --- a/src/app/editor/overworld/overworld_editor.cc +++ b/src/app/editor/overworld/overworld_editor.cc @@ -24,12 +24,12 @@ #include "app/gfx/debug/performance/performance_profiler.h" #include "app/gfx/types/snes_palette.h" #include "app/gfx/render/tilemap.h" -#include "app/gui/canvas.h" +#include "app/gui/canvas/canvas.h" #include "app/gui/canvas/canvas_automation_api.h" -#include "app/gui/editor_layout.h" -#include "app/gui/icons.h" -#include "app/gui/style.h" -#include "app/gui/ui_helpers.h" +#include "app/gui/app/editor_layout.h" +#include "app/gui/core/icons.h" +#include "app/gui/core/style.h" +#include "app/gui/core/ui_helpers.h" #include "app/rom.h" #include "zelda3/common.h" #include "zelda3/overworld/overworld.h" diff --git a/src/app/editor/overworld/overworld_editor.h b/src/app/editor/overworld/overworld_editor.h index dbb8f423..5eddfdc8 100644 --- a/src/app/editor/overworld/overworld_editor.h +++ b/src/app/editor/overworld/overworld_editor.h @@ -5,16 +5,16 @@ #include "app/editor/editor.h" #include "app/editor/graphics/gfx_group_editor.h" #include "app/editor/palette/palette_editor.h" -#include "app/gui/editor_card_manager.h" +#include "app/gui/app/editor_card_manager.h" #include "app/editor/overworld/tile16_editor.h" #include "app/editor/overworld/map_properties.h" #include "app/editor/overworld/overworld_entity_renderer.h" #include "app/gfx/core/bitmap.h" #include "app/gfx/types/snes_palette.h" #include "app/gfx/render/tilemap.h" -#include "app/gui/canvas.h" +#include "app/gui/canvas/canvas.h" #include "app/gui/widgets/tile_selector_widget.h" -#include "app/gui/input.h" +#include "app/gui/core/input.h" #include "app/rom.h" #include "zelda3/overworld/overworld.h" #include "imgui/imgui.h" diff --git a/src/app/editor/overworld/overworld_entity_renderer.cc b/src/app/editor/overworld/overworld_entity_renderer.cc index a009e2a3..fe3c71ea 100644 --- a/src/app/editor/overworld/overworld_entity_renderer.cc +++ b/src/app/editor/overworld/overworld_entity_renderer.cc @@ -3,7 +3,7 @@ #include "absl/strings/str_format.h" #include "app/core/features.h" #include "app/editor/overworld/entity.h" -#include "app/gui/canvas.h" +#include "app/gui/canvas/canvas.h" #include "zelda3/common.h" #include "util/hex.h" #include "imgui/imgui.h" diff --git a/src/app/editor/overworld/overworld_entity_renderer.h b/src/app/editor/overworld/overworld_entity_renderer.h index 8db44d1b..e7a79824 100644 --- a/src/app/editor/overworld/overworld_entity_renderer.h +++ b/src/app/editor/overworld/overworld_entity_renderer.h @@ -4,7 +4,7 @@ #include #include "app/gfx/core/bitmap.h" -#include "app/gui/canvas.h" +#include "app/gui/canvas/canvas.h" #include "zelda3/common.h" #include "zelda3/overworld/overworld.h" #include "imgui/imgui.h" diff --git a/src/app/editor/overworld/scratch_space.cc b/src/app/editor/overworld/scratch_space.cc index 50bc4644..82ddc563 100644 --- a/src/app/editor/overworld/scratch_space.cc +++ b/src/app/editor/overworld/scratch_space.cc @@ -21,10 +21,10 @@ #include "app/gfx/debug/performance/performance_profiler.h" #include "app/gfx/types/snes_palette.h" #include "app/gfx/render/tilemap.h" -#include "app/gui/canvas.h" -#include "app/gui/icons.h" -#include "app/gui/input.h" -#include "app/gui/style.h" +#include "app/gui/canvas/canvas.h" +#include "app/gui/core/icons.h" +#include "app/gui/core/input.h" +#include "app/gui/core/style.h" #include "app/rom.h" #include "zelda3/common.h" #include "zelda3/overworld/overworld.h" diff --git a/src/app/editor/overworld/tile16_editor.cc b/src/app/editor/overworld/tile16_editor.cc index f7fe038b..8a8355ca 100644 --- a/src/app/editor/overworld/tile16_editor.cc +++ b/src/app/editor/overworld/tile16_editor.cc @@ -8,9 +8,9 @@ #include "app/gfx/backend/irenderer.h" #include "app/gfx/debug/performance/performance_profiler.h" #include "app/gfx/types/snes_palette.h" -#include "app/gui/canvas.h" -#include "app/gui/input.h" -#include "app/gui/style.h" +#include "app/gui/canvas/canvas.h" +#include "app/gui/core/input.h" +#include "app/gui/core/style.h" #include "app/rom.h" #include "zelda3/overworld/overworld.h" #include "imgui/imgui.h" diff --git a/src/app/editor/overworld/tile16_editor.h b/src/app/editor/overworld/tile16_editor.h index 2f1c8045..ab22f10d 100644 --- a/src/app/editor/overworld/tile16_editor.h +++ b/src/app/editor/overworld/tile16_editor.h @@ -11,8 +11,8 @@ #include "app/gfx/core/bitmap.h" #include "app/gfx/types/snes_palette.h" #include "app/gfx/types/snes_tile.h" -#include "app/gui/canvas.h" -#include "app/gui/input.h" +#include "app/gui/canvas/canvas.h" +#include "app/gui/core/input.h" #include "util/log.h" #include "app/rom.h" #include "imgui/imgui.h" diff --git a/src/app/editor/palette/palette_editor.cc b/src/app/editor/palette/palette_editor.cc index 3b5d17b1..e832e223 100644 --- a/src/app/editor/palette/palette_editor.cc +++ b/src/app/editor/palette/palette_editor.cc @@ -5,10 +5,10 @@ #include "app/gfx/util/palette_manager.h" #include "app/gfx/debug/performance/performance_profiler.h" #include "app/gfx/types/snes_palette.h" -#include "app/gui/color.h" -#include "app/gui/editor_card_manager.h" -#include "app/gui/editor_layout.h" -#include "app/gui/icons.h" +#include "app/gui/core/color.h" +#include "app/gui/app/editor_card_manager.h" +#include "app/gui/app/editor_layout.h" +#include "app/gui/core/icons.h" #include "imgui/imgui.h" namespace yaze { diff --git a/src/app/editor/palette/palette_group_card.cc b/src/app/editor/palette/palette_group_card.cc index d0fbb673..c4dc88de 100644 --- a/src/app/editor/palette/palette_group_card.cc +++ b/src/app/editor/palette/palette_group_card.cc @@ -5,10 +5,10 @@ #include "absl/strings/str_format.h" #include "app/gfx/util/palette_manager.h" #include "app/gfx/types/snes_palette.h" -#include "app/gui/color.h" -#include "app/gui/icons.h" -#include "app/gui/layout_helpers.h" -#include "app/gui/themed_widgets.h" +#include "app/gui/core/color.h" +#include "app/gui/core/icons.h" +#include "app/gui/core/layout_helpers.h" +#include "app/gui/widgets/themed_widgets.h" #include "imgui/imgui.h" namespace yaze { diff --git a/src/app/editor/palette/palette_group_card.h b/src/app/editor/palette/palette_group_card.h index 10db2acf..8b644733 100644 --- a/src/app/editor/palette/palette_group_card.h +++ b/src/app/editor/palette/palette_group_card.h @@ -11,7 +11,7 @@ #include "absl/status/status.h" #include "app/gfx/types/snes_color.h" #include "app/gfx/types/snes_palette.h" -#include "app/gui/editor_card_manager.h" +#include "app/gui/app/editor_card_manager.h" #include "app/rom.h" #include "imgui/imgui.h" diff --git a/src/app/editor/palette/palette_utility.cc b/src/app/editor/palette/palette_utility.cc index 2966bf6d..07edef5b 100644 --- a/src/app/editor/palette/palette_utility.cc +++ b/src/app/editor/palette/palette_utility.cc @@ -3,7 +3,7 @@ #include "absl/strings/str_format.h" #include "app/editor/palette/palette_editor.h" #include "app/gfx/snes_palette.h" -#include "app/gui/icons.h" +#include "app/gui/core/icons.h" #include "app/rom.h" #include "imgui/imgui.h" diff --git a/src/app/editor/palette/palette_utility.h b/src/app/editor/palette/palette_utility.h index eefcac38..6f585de2 100644 --- a/src/app/editor/palette/palette_utility.h +++ b/src/app/editor/palette/palette_utility.h @@ -4,7 +4,7 @@ #include #include "app/gfx/snes_color.h" -#include "app/gui/color.h" +#include "app/gui/core/color.h" #include "imgui/imgui.h" namespace yaze { diff --git a/src/app/editor/sprite/sprite_editor.cc b/src/app/editor/sprite/sprite_editor.cc index fb225880..af82639b 100644 --- a/src/app/editor/sprite/sprite_editor.cc +++ b/src/app/editor/sprite/sprite_editor.cc @@ -1,12 +1,12 @@ #include "sprite_editor.h" #include "app/gfx/debug/performance/performance_profiler.h" -#include "app/gui/ui_helpers.h" +#include "app/gui/core/ui_helpers.h" #include "util/file_util.h" #include "app/editor/sprite/zsprite.h" #include "app/gfx/resource/arena.h" -#include "app/gui/icons.h" -#include "app/gui/input.h" +#include "app/gui/core/icons.h" +#include "app/gui/core/input.h" #include "zelda3/sprite/sprite.h" #include "util/hex.h" diff --git a/src/app/editor/sprite/sprite_editor.h b/src/app/editor/sprite/sprite_editor.h index 632726bf..07b04a5b 100644 --- a/src/app/editor/sprite/sprite_editor.h +++ b/src/app/editor/sprite/sprite_editor.h @@ -7,9 +7,9 @@ #include "absl/status/status.h" #include "app/editor/editor.h" #include "app/editor/sprite/zsprite.h" -#include "app/gui/canvas.h" -#include "app/gui/editor_card_manager.h" -#include "app/gui/editor_layout.h" +#include "app/gui/canvas/canvas.h" +#include "app/gui/app/editor_card_manager.h" +#include "app/gui/app/editor_layout.h" #include "app/rom.h" namespace yaze { diff --git a/src/app/editor/system/command_manager.cc b/src/app/editor/system/command_manager.cc index 5587752c..3a73e1d3 100644 --- a/src/app/editor/system/command_manager.cc +++ b/src/app/editor/system/command_manager.cc @@ -2,7 +2,7 @@ #include -#include "app/gui/input.h" +#include "app/gui/core/input.h" #include "imgui/imgui.h" namespace yaze { diff --git a/src/app/editor/system/popup_manager.cc b/src/app/editor/system/popup_manager.cc index b8562890..7288ab74 100644 --- a/src/app/editor/system/popup_manager.cc +++ b/src/app/editor/system/popup_manager.cc @@ -2,8 +2,8 @@ #include "absl/strings/str_format.h" #include "app/editor/editor_manager.h" -#include "app/gui/style.h" -#include "app/gui/icons.h" +#include "app/gui/core/style.h" +#include "app/gui/core/icons.h" #include "util/hex.h" #include "imgui/misc/cpp/imgui_stdlib.h" diff --git a/src/app/editor/system/proposal_drawer.cc b/src/app/editor/system/proposal_drawer.cc index cab9f372..e980d640 100644 --- a/src/app/editor/system/proposal_drawer.cc +++ b/src/app/editor/system/proposal_drawer.cc @@ -7,7 +7,7 @@ #include "absl/strings/str_format.h" #include "absl/time/time.h" #include "imgui/imgui.h" -#include "app/gui/icons.h" +#include "app/gui/core/icons.h" #include "cli/service/rom/rom_sandbox_manager.h" // Policy evaluation support (optional, only in main yaze build) diff --git a/src/app/editor/system/settings_editor.cc b/src/app/editor/system/settings_editor.cc index 2c3e57af..53ffd081 100644 --- a/src/app/editor/system/settings_editor.cc +++ b/src/app/editor/system/settings_editor.cc @@ -2,11 +2,11 @@ #include "app/editor/system/settings_editor.h" #include "absl/status/status.h" -#include "app/gui/feature_flags_menu.h" +#include "app/gui/app/feature_flags_menu.h" #include "app/gfx/debug/performance/performance_profiler.h" -#include "app/gui/style.h" -#include "app/gui/icons.h" -#include "app/gui/theme_manager.h" +#include "app/gui/core/style.h" +#include "app/gui/core/icons.h" +#include "app/gui/core/theme_manager.h" #include "imgui/imgui.h" #include "util/log.h" diff --git a/src/app/editor/system/shortcut_manager.cc b/src/app/editor/system/shortcut_manager.cc index afb8ba56..adad8091 100644 --- a/src/app/editor/system/shortcut_manager.cc +++ b/src/app/editor/system/shortcut_manager.cc @@ -3,7 +3,7 @@ #include #include -#include "app/gui/input.h" +#include "app/gui/core/input.h" #include "imgui/imgui.h" namespace yaze { diff --git a/src/app/editor/system/user_settings.cc b/src/app/editor/system/user_settings.cc index bf64b6d4..c56d3455 100644 --- a/src/app/editor/system/user_settings.cc +++ b/src/app/editor/system/user_settings.cc @@ -4,7 +4,7 @@ #include #include "absl/strings/str_format.h" -#include "app/gui/style.h" +#include "app/gui/core/style.h" #include "imgui/imgui.h" #include "util/file_util.h" #include "util/log.h" diff --git a/src/app/editor/ui/editor_selection_dialog.cc b/src/app/editor/ui/editor_selection_dialog.cc index e90424e7..c00304b3 100644 --- a/src/app/editor/ui/editor_selection_dialog.cc +++ b/src/app/editor/ui/editor_selection_dialog.cc @@ -6,8 +6,8 @@ #include "absl/strings/str_cat.h" #include "imgui/imgui.h" -#include "app/gui/icons.h" -#include "app/gui/style.h" +#include "app/gui/core/icons.h" +#include "app/gui/core/style.h" #include "util/file_util.h" namespace yaze { diff --git a/src/app/editor/ui/menu_builder.h b/src/app/editor/ui/menu_builder.h index a9141d8a..6592ad2a 100644 --- a/src/app/editor/ui/menu_builder.h +++ b/src/app/editor/ui/menu_builder.h @@ -10,7 +10,9 @@ #define IMGUI_DEFINE_MATH_OPERATORS #endif -#include "app/gui/icons.h" +#include "absl/container/flat_hash_map.h" +#include "absl/strings/string_view.h" +#include "app/gui/core/icons.h" #include "imgui/imgui.h" namespace yaze { diff --git a/src/app/editor/ui/welcome_screen.cc b/src/app/editor/ui/welcome_screen.cc index a973d810..d71778e2 100644 --- a/src/app/editor/ui/welcome_screen.cc +++ b/src/app/editor/ui/welcome_screen.cc @@ -11,8 +11,8 @@ #include "absl/time/time.h" #include "app/core/project.h" #include "app/core/timing.h" -#include "app/gui/icons.h" -#include "app/gui/theme_manager.h" +#include "app/gui/core/icons.h" +#include "app/gui/core/theme_manager.h" #include "imgui/imgui.h" #include "imgui/imgui_internal.h" #include "util/file_util.h" diff --git a/src/app/editor/ui/workspace_manager.cc b/src/app/editor/ui/workspace_manager.cc index c7181d69..c5e329e6 100644 --- a/src/app/editor/ui/workspace_manager.cc +++ b/src/app/editor/ui/workspace_manager.cc @@ -1,6 +1,6 @@ #include "app/editor/ui/workspace_manager.h" #include "app/editor/system/toast_manager.h" -#include "app/gui/editor_card_manager.h" +#include "app/gui/app/editor_card_manager.h" #include "app/rom.h" #include "absl/strings/str_format.h" #include "util/file_util.h" diff --git a/src/app/emu/debug/disassembly_viewer.cc b/src/app/emu/debug/disassembly_viewer.cc index fea92444..6c9bb6a6 100644 --- a/src/app/emu/debug/disassembly_viewer.cc +++ b/src/app/emu/debug/disassembly_viewer.cc @@ -6,7 +6,7 @@ #include #include "absl/strings/str_format.h" -#include "app/gui/style.h" +#include "app/gui/core/style.h" #include "imgui/imgui.h" namespace yaze { diff --git a/src/app/emu/debug/disassembly_viewer.h b/src/app/emu/debug/disassembly_viewer.h index 10aff6d7..23867cd1 100644 --- a/src/app/emu/debug/disassembly_viewer.h +++ b/src/app/emu/debug/disassembly_viewer.h @@ -6,9 +6,11 @@ #include #include +#include "absl/strings/str_format.h" #include "app/emu/cpu/cpu.h" #include "app/gfx/core/bitmap.h" -#include "app/gui/icons.h" +#include "app/gui/core/icons.h" +#include "app/rom.h" #include "imgui/imgui.h" namespace yaze { diff --git a/src/app/emu/emulator.cc b/src/app/emu/emulator.cc index c22784d9..d20780cf 100644 --- a/src/app/emu/emulator.cc +++ b/src/app/emu/emulator.cc @@ -15,10 +15,10 @@ namespace yaze::core { #include "app/emu/ui/debugger_ui.h" #include "app/emu/ui/emulator_ui.h" #include "app/emu/ui/input_handler.h" -#include "app/gui/color.h" -#include "app/gui/editor_layout.h" -#include "app/gui/icons.h" -#include "app/gui/theme_manager.h" +#include "app/gui/core/color.h" +#include "app/gui/app/editor_layout.h" +#include "app/gui/core/icons.h" +#include "app/gui/core/theme_manager.h" #include "imgui/imgui.h" namespace yaze { diff --git a/src/app/emu/emulator.h b/src/app/emu/emulator.h index 85e40ee1..323ae631 100644 --- a/src/app/emu/emulator.h +++ b/src/app/emu/emulator.h @@ -7,7 +7,7 @@ #include "app/emu/snes.h" #include "app/emu/audio/audio_backend.h" #include "app/emu/debug/breakpoint_manager.h" -#include "app/gui/editor_card_manager.h" +#include "app/gui/app/editor_card_manager.h" #include "app/emu/debug/disassembly_viewer.h" #include "app/emu/input/input_manager.h" #include "app/rom.h" diff --git a/src/app/emu/ui/debugger_ui.cc b/src/app/emu/ui/debugger_ui.cc index 547ed597..d0df8c5b 100644 --- a/src/app/emu/ui/debugger_ui.cc +++ b/src/app/emu/ui/debugger_ui.cc @@ -3,10 +3,10 @@ #include "absl/strings/str_format.h" #include "app/emu/emulator.h" #include "app/emu/cpu/cpu.h" -#include "app/gui/color.h" -#include "app/gui/icons.h" -#include "app/gui/input.h" -#include "app/gui/theme_manager.h" +#include "app/gui/core/color.h" +#include "app/gui/core/icons.h" +#include "app/gui/core/input.h" +#include "app/gui/core/theme_manager.h" #include "imgui/imgui.h" #include "imgui_memory_editor.h" #include "util/log.h" diff --git a/src/app/emu/ui/emulator_ui.cc b/src/app/emu/ui/emulator_ui.cc index cc39f45c..92b55bcd 100644 --- a/src/app/emu/ui/emulator_ui.cc +++ b/src/app/emu/ui/emulator_ui.cc @@ -4,9 +4,9 @@ #include "absl/strings/str_format.h" #include "app/emu/emulator.h" -#include "app/gui/color.h" -#include "app/gui/icons.h" -#include "app/gui/theme_manager.h" +#include "app/gui/core/color.h" +#include "app/gui/core/icons.h" +#include "app/gui/core/theme_manager.h" #include "imgui/imgui.h" #include "util/file_util.h" #include "util/log.h" diff --git a/src/app/emu/ui/input_handler.cc b/src/app/emu/ui/input_handler.cc index 46a74bcf..734bf739 100644 --- a/src/app/emu/ui/input_handler.cc +++ b/src/app/emu/ui/input_handler.cc @@ -1,7 +1,8 @@ #include "app/emu/ui/input_handler.h" -#include "SDL.h" -#include "app/gui/icons.h" +#include + +#include "app/gui/core/icons.h" #include "imgui/imgui.h" namespace yaze { diff --git a/src/app/gui/widgets/agent_chat_widget.cc b/src/app/gui/app/agent_chat_widget.cc similarity index 99% rename from src/app/gui/widgets/agent_chat_widget.cc rename to src/app/gui/app/agent_chat_widget.cc index 619f662f..1320e044 100644 --- a/src/app/gui/widgets/agent_chat_widget.cc +++ b/src/app/gui/app/agent_chat_widget.cc @@ -1,4 +1,4 @@ -#include "app/gui/widgets/agent_chat_widget.h" +#include "app/gui/app/agent_chat_widget.h" #include #include diff --git a/src/app/gui/widgets/agent_chat_widget.h b/src/app/gui/app/agent_chat_widget.h similarity index 100% rename from src/app/gui/widgets/agent_chat_widget.h rename to src/app/gui/app/agent_chat_widget.h diff --git a/src/app/gui/background_renderer.cc b/src/app/gui/app/background_renderer.cc similarity index 99% rename from src/app/gui/background_renderer.cc rename to src/app/gui/app/background_renderer.cc index b6147dba..c2793c1a 100644 --- a/src/app/gui/background_renderer.cc +++ b/src/app/gui/app/background_renderer.cc @@ -1,10 +1,10 @@ -#include "app/gui/background_renderer.h" +#include "app/gui/app/background_renderer.h" #include #include #include "app/core/timing.h" -#include "app/gui/theme_manager.h" +#include "app/gui/core/theme_manager.h" #include "imgui/imgui.h" #ifndef M_PI diff --git a/src/app/gui/background_renderer.h b/src/app/gui/app/background_renderer.h similarity index 97% rename from src/app/gui/background_renderer.h rename to src/app/gui/app/background_renderer.h index ee2f1fcc..5b2bda86 100644 --- a/src/app/gui/background_renderer.h +++ b/src/app/gui/app/background_renderer.h @@ -2,7 +2,11 @@ #define YAZE_APP_EDITOR_UI_BACKGROUND_RENDERER_H #include "imgui/imgui.h" -#include "app/gui/color.h" +#include +#include + +#include "app/gui/core/color.h" +#include "app/rom.h" namespace yaze { namespace gui { diff --git a/src/app/gui/widgets/collaboration_panel.cc b/src/app/gui/app/collaboration_panel.cc similarity index 99% rename from src/app/gui/widgets/collaboration_panel.cc rename to src/app/gui/app/collaboration_panel.cc index 219b69ed..e3e7e6aa 100644 --- a/src/app/gui/widgets/collaboration_panel.cc +++ b/src/app/gui/app/collaboration_panel.cc @@ -1,4 +1,4 @@ -#include "app/gui/widgets/collaboration_panel.h" +#include "app/gui/app/collaboration_panel.h" #include #include diff --git a/src/app/gui/widgets/collaboration_panel.h b/src/app/gui/app/collaboration_panel.h similarity index 100% rename from src/app/gui/widgets/collaboration_panel.h rename to src/app/gui/app/collaboration_panel.h diff --git a/src/app/gui/editor_card_manager.cc b/src/app/gui/app/editor_card_manager.cc similarity index 99% rename from src/app/gui/editor_card_manager.cc rename to src/app/gui/app/editor_card_manager.cc index 55702cc4..9c8c9c6d 100644 --- a/src/app/gui/editor_card_manager.cc +++ b/src/app/gui/app/editor_card_manager.cc @@ -4,8 +4,8 @@ #include #include "absl/strings/str_format.h" -#include "app/gui/icons.h" -#include "app/gui/theme_manager.h" +#include "app/gui/core/icons.h" +#include "app/gui/core/theme_manager.h" #include "imgui/imgui.h" namespace yaze { diff --git a/src/app/gui/editor_card_manager.h b/src/app/gui/app/editor_card_manager.h similarity index 100% rename from src/app/gui/editor_card_manager.h rename to src/app/gui/app/editor_card_manager.h diff --git a/src/app/gui/editor_layout.cc b/src/app/gui/app/editor_layout.cc similarity index 98% rename from src/app/gui/editor_layout.cc rename to src/app/gui/app/editor_layout.cc index cf6be6ce..bf4f4e91 100644 --- a/src/app/gui/editor_layout.cc +++ b/src/app/gui/app/editor_layout.cc @@ -1,13 +1,13 @@ #define IMGUI_DEFINE_MATH_OPERATORS -#include "app/gui/editor_layout.h" +#include "app/gui/app/editor_layout.h" #include "absl/strings/str_format.h" -#include "app/gui/icons.h" -#include "app/gui/input.h" -#include "app/gui/ui_helpers.h" -#include "app/gui/widgets/widget_measurement.h" -#include "app/gui/widgets/widget_id_registry.h" +#include "app/gui/core/icons.h" +#include "app/gui/core/input.h" +#include "app/gui/core/ui_helpers.h" +#include "app/gui/automation/widget_measurement.h" +#include "app/gui/automation/widget_id_registry.h" #include "imgui/imgui.h" #include "imgui/imgui_internal.h" diff --git a/src/app/gui/editor_layout.h b/src/app/gui/app/editor_layout.h similarity index 100% rename from src/app/gui/editor_layout.h rename to src/app/gui/app/editor_layout.h diff --git a/src/app/gui/feature_flags_menu.h b/src/app/gui/app/feature_flags_menu.h similarity index 100% rename from src/app/gui/feature_flags_menu.h rename to src/app/gui/app/feature_flags_menu.h diff --git a/src/app/gui/widgets/widget_auto_register.cc b/src/app/gui/automation/widget_auto_register.cc similarity index 97% rename from src/app/gui/widgets/widget_auto_register.cc rename to src/app/gui/automation/widget_auto_register.cc index d4026bdc..d1d59c61 100644 --- a/src/app/gui/widgets/widget_auto_register.cc +++ b/src/app/gui/automation/widget_auto_register.cc @@ -1,4 +1,4 @@ -#include "app/gui/widgets/widget_auto_register.h" +#include "app/gui/automation/widget_auto_register.h" #include diff --git a/src/app/gui/widgets/widget_auto_register.h b/src/app/gui/automation/widget_auto_register.h similarity index 97% rename from src/app/gui/widgets/widget_auto_register.h rename to src/app/gui/automation/widget_auto_register.h index ff632cc4..134383bf 100644 --- a/src/app/gui/widgets/widget_auto_register.h +++ b/src/app/gui/automation/widget_auto_register.h @@ -1,10 +1,10 @@ -#ifndef YAZE_APP_GUI_WIDGETS_WIDGET_AUTO_REGISTER_H_ -#define YAZE_APP_GUI_WIDGETS_WIDGET_AUTO_REGISTER_H_ +#ifndef YAZE_APP_GUI_AUTOMATION_WIDGET_AUTO_REGISTER_H_ +#define YAZE_APP_GUI_AUTOMATION_WIDGET_AUTO_REGISTER_H_ #include #include "imgui/imgui.h" -#include "app/gui/widgets/widget_id_registry.h" +#include "app/gui/automation/widget_id_registry.h" #include "absl/strings/str_cat.h" /** @@ -260,5 +260,5 @@ inline void RegisterTable(const char* table_name, const std::string& description } // namespace gui } // namespace yaze -#endif // YAZE_APP_GUI_WIDGETS_WIDGET_AUTO_REGISTER_H_ +#endif // YAZE_APP_GUI_AUTOMATION_WIDGET_AUTO_REGISTER_H_ diff --git a/src/app/gui/widgets/widget_id_registry.cc b/src/app/gui/automation/widget_id_registry.cc similarity index 99% rename from src/app/gui/widgets/widget_id_registry.cc rename to src/app/gui/automation/widget_id_registry.cc index 17845ab4..9df446a9 100644 --- a/src/app/gui/widgets/widget_id_registry.cc +++ b/src/app/gui/automation/widget_id_registry.cc @@ -1,4 +1,4 @@ -#include "app/gui/widgets/widget_id_registry.h" +#include "app/gui/automation/widget_id_registry.h" #include #include diff --git a/src/app/gui/widgets/widget_id_registry.h b/src/app/gui/automation/widget_id_registry.h similarity index 97% rename from src/app/gui/widgets/widget_id_registry.h rename to src/app/gui/automation/widget_id_registry.h index 50924a9a..2bea3d95 100644 --- a/src/app/gui/widgets/widget_id_registry.h +++ b/src/app/gui/automation/widget_id_registry.h @@ -1,5 +1,5 @@ -#ifndef YAZE_APP_GUI_WIDGETS_WIDGET_ID_REGISTRY_H_ -#define YAZE_APP_GUI_WIDGETS_WIDGET_ID_REGISTRY_H_ +#ifndef YAZE_APP_GUI_AUTOMATION_WIDGET_ID_REGISTRY_H_ +#define YAZE_APP_GUI_AUTOMATION_WIDGET_ID_REGISTRY_H_ #include #include @@ -173,4 +173,4 @@ class WidgetIdRegistry { } // namespace gui } // namespace yaze -#endif // YAZE_APP_GUI_WIDGETS_WIDGET_ID_REGISTRY_H_ +#endif // YAZE_APP_GUI_AUTOMATION_WIDGET_ID_REGISTRY_H_ diff --git a/src/app/gui/widgets/widget_measurement.cc b/src/app/gui/automation/widget_measurement.cc similarity index 98% rename from src/app/gui/widgets/widget_measurement.cc rename to src/app/gui/automation/widget_measurement.cc index 5e934ee4..4aa0c010 100644 --- a/src/app/gui/widgets/widget_measurement.cc +++ b/src/app/gui/automation/widget_measurement.cc @@ -1,4 +1,4 @@ -#include "app/gui/widgets/widget_measurement.h" +#include "app/gui/automation/widget_measurement.h" #include "absl/strings/str_format.h" #include "imgui/imgui.h" diff --git a/src/app/gui/widgets/widget_measurement.h b/src/app/gui/automation/widget_measurement.h similarity index 100% rename from src/app/gui/widgets/widget_measurement.h rename to src/app/gui/automation/widget_measurement.h diff --git a/src/app/gui/widgets/widget_state_capture.cc b/src/app/gui/automation/widget_state_capture.cc similarity index 99% rename from src/app/gui/widgets/widget_state_capture.cc rename to src/app/gui/automation/widget_state_capture.cc index cc36ef96..3f62f7b3 100644 --- a/src/app/gui/widgets/widget_state_capture.cc +++ b/src/app/gui/automation/widget_state_capture.cc @@ -1,4 +1,4 @@ -#include "app/gui/widgets/widget_state_capture.h" +#include "app/gui/automation/widget_state_capture.h" #include "absl/strings/str_format.h" #if defined(YAZE_ENABLE_IMGUI_TEST_ENGINE) && YAZE_ENABLE_IMGUI_TEST_ENGINE diff --git a/src/app/gui/widgets/widget_state_capture.h b/src/app/gui/automation/widget_state_capture.h similarity index 100% rename from src/app/gui/widgets/widget_state_capture.h rename to src/app/gui/automation/widget_state_capture.h diff --git a/src/app/gui/canvas/bpp_format_ui.cc b/src/app/gui/canvas/bpp_format_ui.cc index 4b04ac6c..032c3042 100644 --- a/src/app/gui/canvas/bpp_format_ui.cc +++ b/src/app/gui/canvas/bpp_format_ui.cc @@ -5,7 +5,7 @@ #include "app/gfx/util/bpp_format_manager.h" #include "app/gfx/core/bitmap.h" -#include "app/gui/ui_helpers.h" +#include "app/gui/core/ui_helpers.h" #include "imgui/imgui.h" namespace yaze { diff --git a/src/app/gui/canvas.cc b/src/app/gui/canvas/canvas.cc similarity index 99% rename from src/app/gui/canvas.cc rename to src/app/gui/canvas/canvas.cc index 60afeed6..60507745 100644 --- a/src/app/gui/canvas.cc +++ b/src/app/gui/canvas/canvas.cc @@ -5,9 +5,9 @@ #include "app/gfx/util/bpp_format_manager.h" #include "app/gfx/core/bitmap.h" #include "app/gfx/debug/performance/performance_profiler.h" -#include "app/gui/style.h" -#include "canvas/canvas_utils.h" -#include "canvas/canvas_automation_api.h" +#include "app/gui/core/style.h" +#include "app/gui/canvas/canvas_utils.h" +#include "app/gui/canvas/canvas_automation_api.h" #include "imgui/imgui.h" namespace yaze::gui { @@ -124,7 +124,7 @@ void Canvas::InitializeDefaults() { selection_.Clear(); // Initialize palette editor - palette_editor_ = std::make_unique(); + palette_editor_ = std::make_unique(); // Initialize interaction handler interaction_handler_.Initialize(canvas_id_); diff --git a/src/app/gui/canvas.h b/src/app/gui/canvas/canvas.h similarity index 99% rename from src/app/gui/canvas.h rename to src/app/gui/canvas/canvas.h index b941f5ad..cb7eb9f6 100644 --- a/src/app/gui/canvas.h +++ b/src/app/gui/canvas/canvas.h @@ -11,10 +11,10 @@ #include "app/gfx/core/bitmap.h" #include "app/rom.h" -#include "canvas/canvas_utils.h" -#include "app/gui/widgets/palette_widget.h" +#include "app/gui/canvas/canvas_utils.h" +#include "app/gui/widgets/palette_editor_widget.h" #include "app/gfx/util/bpp_format_manager.h" -#include "canvas/bpp_format_ui.h" +#include "app/gui/canvas/bpp_format_ui.h" #include "app/gui/canvas/canvas_modals.h" #include "app/gui/canvas/canvas_context_menu.h" #include "app/gui/canvas/canvas_usage_tracker.h" @@ -411,7 +411,7 @@ class Canvas { gfx::IRenderer* renderer_ = nullptr; CanvasConfig config_; CanvasSelection selection_; - std::unique_ptr palette_editor_; + std::unique_ptr palette_editor_; // Automation API (lazy-initialized on first access) std::unique_ptr automation_api_; diff --git a/src/app/gui/canvas/canvas_automation_api.cc b/src/app/gui/canvas/canvas_automation_api.cc index dfab3362..61ff66d8 100644 --- a/src/app/gui/canvas/canvas_automation_api.cc +++ b/src/app/gui/canvas/canvas_automation_api.cc @@ -3,7 +3,7 @@ #include #include -#include "app/gui/canvas.h" +#include "app/gui/canvas/canvas.h" namespace yaze { namespace gui { diff --git a/src/app/gui/canvas/canvas_context_menu.cc b/src/app/gui/canvas/canvas_context_menu.cc index 58540be3..d907dac6 100644 --- a/src/app/gui/canvas/canvas_context_menu.cc +++ b/src/app/gui/canvas/canvas_context_menu.cc @@ -3,10 +3,11 @@ #include "app/gfx/resource/arena.h" #include "app/gfx/debug/performance/performance_profiler.h" #include "app/gfx/debug/performance/performance_dashboard.h" -#include "app/gui/widgets/palette_widget.h" -#include "app/gui/icons.h" -#include "app/gui/color.h" +#include "app/gui/widgets/palette_editor_widget.h" +#include "app/gui/core/icons.h" +#include "app/gui/core/color.h" #include "app/gui/canvas/canvas_modals.h" +#include "app/gui/widgets/palette_editor_widget.h" #include "imgui/imgui.h" namespace yaze { @@ -27,7 +28,7 @@ void CanvasContextMenu::Initialize(const std::string& canvas_id) { canvas_id_ = canvas_id; enabled_ = true; current_usage_ = CanvasUsage::kTilePainting; - palette_editor_ = std::make_unique(); + palette_editor_ = std::make_unique(); // Initialize canvas state canvas_size_ = ImVec2(0, 0); diff --git a/src/app/gui/canvas/canvas_context_menu.h b/src/app/gui/canvas/canvas_context_menu.h index 523bb1d6..96e6d7a8 100644 --- a/src/app/gui/canvas/canvas_context_menu.h +++ b/src/app/gui/canvas/canvas_context_menu.h @@ -8,7 +8,7 @@ #include "app/gfx/core/bitmap.h" #include "app/gfx/types/snes_palette.h" -#include "app/gui/icons.h" +#include "app/gui/core/icons.h" #include "app/gui/canvas/canvas_modals.h" #include "canvas_usage_tracker.h" #include "imgui/imgui.h" @@ -17,7 +17,7 @@ namespace yaze { namespace gui { // Forward declarations -class PaletteWidget; +class PaletteEditorWidget; namespace canvas { @@ -108,7 +108,7 @@ class CanvasContextMenu { bool auto_resize_ = false; ImVec2 scrolling_; - std::unique_ptr palette_editor_; + std::unique_ptr palette_editor_; uint64_t edit_palette_group_name_index_ = 0; uint64_t edit_palette_index_ = 0; uint64_t edit_palette_sub_index_ = 0; diff --git a/src/app/gui/canvas/canvas_modals.cc b/src/app/gui/canvas/canvas_modals.cc index 6191d0e5..6b15f08f 100644 --- a/src/app/gui/canvas/canvas_modals.cc +++ b/src/app/gui/canvas/canvas_modals.cc @@ -6,9 +6,9 @@ #include "app/gfx/debug/performance/performance_profiler.h" #include "app/gfx/debug/performance/performance_dashboard.h" -#include "app/gui/widgets/palette_widget.h" +#include "app/gui/widgets/palette_editor_widget.h" #include "app/gui/canvas/bpp_format_ui.h" -#include "app/gui/icons.h" +#include "app/gui/core/icons.h" #include "imgui/imgui.h" namespace yaze { @@ -422,8 +422,8 @@ void CanvasModals::RenderPaletteEditorModal(const std::string& canvas_id, ImGui::Separator(); // Use the existing PaletteWidget - static std::unique_ptr palette_editor = - std::make_unique(); + static std::unique_ptr palette_editor = + std::make_unique(); if (options.palette) { palette_editor->ShowPaletteEditor(*options.palette, modal_title); @@ -455,8 +455,8 @@ void CanvasModals::RenderColorAnalysisModal(const std::string& canvas_id, ImGui::Separator(); // Use the existing PaletteWidget for color analysis - static std::unique_ptr palette_editor = - std::make_unique(); + static std::unique_ptr palette_editor = + std::make_unique(); if (options.bitmap) { palette_editor->ShowColorAnalysis(*options.bitmap, modal_title); diff --git a/src/app/gui/color.cc b/src/app/gui/core/color.cc similarity index 100% rename from src/app/gui/color.cc rename to src/app/gui/core/color.cc diff --git a/src/app/gui/color.h b/src/app/gui/core/color.h similarity index 100% rename from src/app/gui/color.h rename to src/app/gui/core/color.h diff --git a/src/app/gui/icons.h b/src/app/gui/core/icons.h similarity index 100% rename from src/app/gui/icons.h rename to src/app/gui/core/icons.h diff --git a/src/app/gui/input.cc b/src/app/gui/core/input.cc similarity index 100% rename from src/app/gui/input.cc rename to src/app/gui/core/input.cc diff --git a/src/app/gui/input.h b/src/app/gui/core/input.h similarity index 100% rename from src/app/gui/input.h rename to src/app/gui/core/input.h diff --git a/src/app/gui/layout_helpers.cc b/src/app/gui/core/layout_helpers.cc similarity index 97% rename from src/app/gui/layout_helpers.cc rename to src/app/gui/core/layout_helpers.cc index 292ba063..78cbe1eb 100644 --- a/src/app/gui/layout_helpers.cc +++ b/src/app/gui/core/layout_helpers.cc @@ -1,9 +1,13 @@ -#include "app/gui/layout_helpers.h" +#include "app/gui/core/layout_helpers.h" +#include + +#include "absl/strings/str_format.h" +#include "app/gui/core/icons.h" #include "imgui/imgui.h" #include "imgui/imgui_internal.h" -#include "app/gui/theme_manager.h" -#include "app/gui/color.h" +#include "app/gui/core/theme_manager.h" +#include "app/gui/core/color.h" namespace yaze { namespace gui { diff --git a/src/app/gui/layout_helpers.h b/src/app/gui/core/layout_helpers.h similarity index 96% rename from src/app/gui/layout_helpers.h rename to src/app/gui/core/layout_helpers.h index d011b414..352f3259 100644 --- a/src/app/gui/layout_helpers.h +++ b/src/app/gui/core/layout_helpers.h @@ -1,8 +1,11 @@ #ifndef YAZE_APP_GUI_LAYOUT_HELPERS_H #define YAZE_APP_GUI_LAYOUT_HELPERS_H +#include + +#include "absl/strings/str_format.h" +#include "app/gui/core/theme_manager.h" #include "imgui/imgui.h" -#include "app/gui/theme_manager.h" namespace yaze { namespace gui { diff --git a/src/app/gui/style.cc b/src/app/gui/core/style.cc similarity index 97% rename from src/app/gui/style.cc rename to src/app/gui/core/style.cc index 0ad52233..c5fcd45a 100644 --- a/src/app/gui/style.cc +++ b/src/app/gui/core/style.cc @@ -1,13 +1,13 @@ -#include "style.h" +#include "app/gui/core/style.h" #include #include "util/file_util.h" -#include "app/gui/theme_manager.h" -#include "app/gui/background_renderer.h" +#include "app/gui/core/theme_manager.h" +#include "app/gui/app/background_renderer.h" #include "app/platform/font_loader.h" -#include "app/gui/color.h" -#include "app/gui/icons.h" +#include "app/gui/core/color.h" +#include "app/gui/core/icons.h" #include "imgui/imgui.h" #include "imgui/imgui_internal.h" #include "util/log.h" diff --git a/src/app/gui/style.h b/src/app/gui/core/style.h similarity index 95% rename from src/app/gui/style.h rename to src/app/gui/core/style.h index f502c746..59021043 100644 --- a/src/app/gui/style.h +++ b/src/app/gui/core/style.h @@ -7,8 +7,8 @@ #include "absl/strings/string_view.h" #include "app/gfx/core/bitmap.h" -#include "app/gui/color.h" -#include "app/gui/modules/text_editor.h" +#include "app/gui/core/color.h" +#include "app/gui/widgets/text_editor.h" #include "imgui/imgui.h" namespace yaze { diff --git a/src/app/gui/theme_manager.cc b/src/app/gui/core/theme_manager.cc similarity index 99% rename from src/app/gui/theme_manager.cc rename to src/app/gui/core/theme_manager.cc index 140f43a4..8a520e70 100644 --- a/src/app/gui/theme_manager.cc +++ b/src/app/gui/core/theme_manager.cc @@ -11,10 +11,11 @@ #include "absl/strings/str_split.h" #include "util/file_util.h" #include "util/platform_paths.h" -#include "app/gui/icons.h" -#include "app/gui/style.h" // For ColorsYaze function +#include "app/gui/core/icons.h" +#include "app/gui/core/style.h" // For ColorsYaze function #include "imgui/imgui.h" #include "util/log.h" +#include "nlohmann/json.hpp" namespace yaze { namespace gui { diff --git a/src/app/gui/theme_manager.h b/src/app/gui/core/theme_manager.h similarity index 99% rename from src/app/gui/theme_manager.h rename to src/app/gui/core/theme_manager.h index aa345a73..1b2d02e9 100644 --- a/src/app/gui/theme_manager.h +++ b/src/app/gui/core/theme_manager.h @@ -7,7 +7,7 @@ #include "absl/status/status.h" #include "absl/status/statusor.h" -#include "app/gui/color.h" +#include "app/gui/core/color.h" #include "imgui/imgui.h" namespace yaze { diff --git a/src/app/gui/ui_helpers.cc b/src/app/gui/core/ui_helpers.cc similarity index 98% rename from src/app/gui/ui_helpers.cc rename to src/app/gui/core/ui_helpers.cc index d2bb5d26..54f3c3d7 100644 --- a/src/app/gui/ui_helpers.cc +++ b/src/app/gui/core/ui_helpers.cc @@ -1,8 +1,9 @@ -#include "app/gui/ui_helpers.h" +#include "app/gui/core/ui_helpers.h" -#include "app/gui/color.h" -#include "app/gui/icons.h" -#include "app/gui/theme_manager.h" +#include "absl/strings/str_format.h" +#include "app/gui/core/icons.h" +#include "app/gui/core/color.h" +#include "app/gui/core/theme_manager.h" #include "imgui/imgui.h" #include "imgui/imgui_internal.h" diff --git a/src/app/gui/ui_helpers.h b/src/app/gui/core/ui_helpers.h similarity index 100% rename from src/app/gui/ui_helpers.h rename to src/app/gui/core/ui_helpers.h diff --git a/src/app/gui/gui_library.cmake b/src/app/gui/gui_library.cmake index 9fe37732..1eb7337a 100644 --- a/src/app/gui/gui_library.cmake +++ b/src/app/gui/gui_library.cmake @@ -1,7 +1,25 @@ -set( - YAZE_GUI_SRC - app/gui/canvas.cc +# ============================================================================== +# GUI Library Refactoring (see docs/gui-refactor.md) +# ============================================================================== +# The monolithic yaze_gui has been decomposed into smaller, layered libraries +# to improve build times and code organization. The yaze_gui target is now +# an INTERFACE library that aggregates these components for backward +# compatibility. +# ============================================================================== + +# 1. Define Source Groups for each sub-library +set(GUI_CORE_SRC + app/gui/core/color.cc + app/gui/core/input.cc + app/gui/core/layout_helpers.cc + app/gui/core/style.cc + app/gui/core/theme_manager.cc + app/gui/core/ui_helpers.cc +) + +set(CANVAS_SRC app/gui/canvas/bpp_format_ui.cc + app/gui/canvas/canvas.cc app/gui/canvas/canvas_automation_api.cc app/gui/canvas/canvas_context_menu.cc app/gui/canvas/canvas_interaction_handler.cc @@ -9,61 +27,89 @@ set( app/gui/canvas/canvas_performance_integration.cc app/gui/canvas/canvas_usage_tracker.cc app/gui/canvas/canvas_utils.cc - app/gui/color.cc - app/gui/editor_card_manager.cc - app/gui/editor_layout.cc - app/gui/input.cc - app/gui/layout_helpers.cc - app/gui/themed_widgets.cc - app/gui/modules/asset_browser.cc - app/gui/modules/text_editor.cc - app/gui/style.cc - app/gui/theme_manager.cc - app/gui/ui_helpers.cc - app/gui/background_renderer.cc # Moved from yaze_editor (used by style.cc) - app/gui/widgets/agent_chat_widget.cc - app/gui/widgets/collaboration_panel.cc +) + +set(GUI_WIDGETS_SRC + app/gui/widgets/asset_browser.cc app/gui/widgets/dungeon_object_emulator_preview.cc app/gui/widgets/palette_editor_widget.cc - app/gui/widgets/palette_widget.cc + app/gui/widgets/text_editor.cc + app/gui/widgets/themed_widgets.cc app/gui/widgets/tile_selector_widget.cc - app/gui/widgets/widget_auto_register.cc - app/gui/widgets/widget_id_registry.cc - app/gui/widgets/widget_measurement.cc - app/gui/widgets/widget_state_capture.cc - # Canvas system components ) -# ============================================================================== -# Yaze GUI Library -# ============================================================================== -# This library contains all GUI-related functionality: -# - Canvas system -# - ImGui widgets and utilities -# - Input handling -# - Theme management -# - Color utilities -# - Background rendering -# -# Dependencies: yaze_gfx, yaze_util, ImGui, SDL2 -# ============================================================================== - -add_library(yaze_gui STATIC ${YAZE_GUI_SRC}) - -target_precompile_headers(yaze_gui PRIVATE - "$<$:${CMAKE_SOURCE_DIR}/src/yaze_pch.h>" +set(GUI_AUTOMATION_SRC + app/gui/automation/widget_auto_register.cc + app/gui/automation/widget_id_registry.cc + app/gui/automation/widget_measurement.cc + app/gui/automation/widget_state_capture.cc ) -target_include_directories(yaze_gui PUBLIC - ${CMAKE_SOURCE_DIR}/src - ${CMAKE_SOURCE_DIR}/src/lib - ${CMAKE_SOURCE_DIR}/src/lib/imgui - ${CMAKE_SOURCE_DIR}/incl - ${SDL2_INCLUDE_DIR} - ${PROJECT_BINARY_DIR} +set(GUI_APP_SRC + app/gui/app/agent_chat_widget.cc + app/gui/app/background_renderer.cc + app/gui/app/collaboration_panel.cc + app/gui/app/editor_card_manager.cc + app/gui/app/editor_layout.cc ) -target_link_libraries(yaze_gui PUBLIC +# 2. Create Static Libraries and Establish Link Dependencies +add_library(yaze_gui_core STATIC ${GUI_CORE_SRC}) +add_library(yaze_canvas STATIC ${CANVAS_SRC}) +add_library(yaze_gui_widgets STATIC ${GUI_WIDGETS_SRC}) +add_library(yaze_gui_automation STATIC ${GUI_AUTOMATION_SRC}) +add_library(yaze_gui_app STATIC ${GUI_APP_SRC}) + +# Link dependencies between the new libraries +target_link_libraries(yaze_gui_core PUBLIC yaze_util ImGui nlohmann_json::nlohmann_json) +target_link_libraries(yaze_canvas PUBLIC yaze_gui_core yaze_gfx) +target_link_libraries(yaze_gui_widgets PUBLIC yaze_gui_core yaze_gfx) +target_link_libraries(yaze_gui_automation PUBLIC yaze_gui_core) +target_link_libraries(yaze_gui_app PUBLIC yaze_gui_core yaze_gui_widgets yaze_gui_automation) + +set(GUI_SUB_LIBS + yaze_gui_core + yaze_canvas + yaze_gui_widgets + yaze_gui_automation + yaze_gui_app +) + +# Apply common properties to all new sub-libraries +foreach(LIB ${GUI_SUB_LIBS}) + target_precompile_headers(${LIB} PRIVATE + "$<$:${CMAKE_SOURCE_DIR}/src/yaze_pch.h>" + ) + target_include_directories(${LIB} PUBLIC + ${CMAKE_SOURCE_DIR}/src + ${CMAKE_SOURCE_DIR}/incl + ${CMAKE_SOURCE_DIR}/src/app/gui + ${SDL2_INCLUDE_DIR} + ${PROJECT_BINARY_DIR} + ) + set_target_properties(${LIB} PROPERTIES + POSITION_INDEPENDENT_CODE ON + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" + ) + if(UNIX AND NOT APPLE) + target_compile_definitions(${LIB} PRIVATE linux stricmp=strcasecmp) + elseif(APPLE) + target_compile_definitions(${LIB} PRIVATE MACOS) + elseif(WIN32) + target_compile_definitions(${LIB} PRIVATE WINDOWS) + endif() +endforeach() + +# 3. Create Aggregate INTERFACE library +add_library(yaze_gui INTERFACE) +target_link_libraries(yaze_gui INTERFACE + yaze_gui_core + yaze_canvas + yaze_gui_widgets + yaze_gui_automation + yaze_gui_app + # Link original public dependencies so downstream targets receive them yaze_gfx yaze_util yaze_common @@ -72,19 +118,4 @@ target_link_libraries(yaze_gui PUBLIC ${SDL_TARGETS} ) -set_target_properties(yaze_gui PROPERTIES - POSITION_INDEPENDENT_CODE ON - ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" - LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" -) - -# Platform-specific compile definitions -if(UNIX AND NOT APPLE) - target_compile_definitions(yaze_gui PRIVATE linux stricmp=strcasecmp) -elseif(APPLE) - target_compile_definitions(yaze_gui PRIVATE MACOS) -elseif(WIN32) - target_compile_definitions(yaze_gui PRIVATE WINDOWS) -endif() - -message(STATUS "✓ yaze_gui library configured") +message(STATUS "✓ yaze_gui library refactored and configured") diff --git a/src/app/gui/modules/asset_browser.cc b/src/app/gui/widgets/asset_browser.cc similarity index 100% rename from src/app/gui/modules/asset_browser.cc rename to src/app/gui/widgets/asset_browser.cc diff --git a/src/app/gui/modules/asset_browser.h b/src/app/gui/widgets/asset_browser.h similarity index 100% rename from src/app/gui/modules/asset_browser.h rename to src/app/gui/widgets/asset_browser.h diff --git a/src/app/gui/widgets/dungeon_object_emulator_preview.cc b/src/app/gui/widgets/dungeon_object_emulator_preview.cc index 93deaa22..20135bfc 100644 --- a/src/app/gui/widgets/dungeon_object_emulator_preview.cc +++ b/src/app/gui/widgets/dungeon_object_emulator_preview.cc @@ -3,7 +3,7 @@ #include "zelda3/dungeon/room.h" #include "zelda3/dungeon/room_object.h" -#include "app/gui/widgets/widget_auto_register.h" +#include "app/gui/automation/widget_auto_register.h" #include "app/core/window.h" #include diff --git a/src/app/gui/widgets/palette_editor_widget.cc b/src/app/gui/widgets/palette_editor_widget.cc index 34e8d7b7..44fa79ea 100644 --- a/src/app/gui/widgets/palette_editor_widget.cc +++ b/src/app/gui/widgets/palette_editor_widget.cc @@ -1,59 +1,75 @@ -#include "palette_editor_widget.h" +#include "app/gui/widgets/palette_editor_widget.h" + +#include +#include #include "absl/strings/str_format.h" -#include "imgui/imgui.h" +#include "app/gfx/resource/arena.h" +#include "app/gui/core/color.h" +#include "util/log.h" namespace yaze { namespace gui { -void PaletteEditorWidget::Initialize(Rom* rom) { +// Merged implementation from PaletteWidget and PaletteEditorWidget + +void PaletteEditorWidget::Initialize(Rom *rom) { rom_ = rom; + rom_palettes_loaded_ = false; + if (rom_) { + LoadROMPalettes(); + } current_palette_id_ = 0; selected_color_index_ = -1; } +// --- Embedded Draw Method (from simple editor) --- void PaletteEditorWidget::Draw() { if (!rom_ || !rom_->is_loaded()) { ImGui::TextColored(ImVec4(1, 0, 0, 1), "ROM not loaded"); return; } - + ImGui::BeginGroup(); - - // Palette selector dropdown + DrawPaletteSelector(); - ImGui::Separator(); - - // Color grid display - DrawColorGrid(); - + + auto &dungeon_pal_group = rom_->mutable_palette_group()->dungeon_main; + if (current_palette_id_ >= 0 && + current_palette_id_ < (int)dungeon_pal_group.size()) { + auto palette = dungeon_pal_group[current_palette_id_]; + DrawPaletteGrid(palette, 15); + dungeon_pal_group[current_palette_id_] = palette; + } + ImGui::Separator(); - - // Color picker for selected color + if (selected_color_index_ >= 0) { DrawColorPicker(); } else { ImGui::TextDisabled("Select a color to edit"); } - + ImGui::EndGroup(); } void PaletteEditorWidget::DrawPaletteSelector() { - auto& dungeon_pal_group = rom_->mutable_palette_group()->dungeon_main; + auto &dungeon_pal_group = rom_->mutable_palette_group()->dungeon_main; int num_palettes = dungeon_pal_group.size(); - + ImGui::Text("Dungeon Palette:"); ImGui::SameLine(); - - if (ImGui::BeginCombo("##PaletteSelect", - absl::StrFormat("Palette %d", current_palette_id_).c_str())) { + + if (ImGui::BeginCombo( + "##PaletteSelect", + absl::StrFormat("Palette %d", current_palette_id_).c_str())) { for (int i = 0; i < num_palettes; i++) { bool is_selected = (current_palette_id_ == i); - if (ImGui::Selectable(absl::StrFormat("Palette %d", i).c_str(), is_selected)) { + if (ImGui::Selectable(absl::StrFormat("Palette %d", i).c_str(), + is_selected)) { current_palette_id_ = i; - selected_color_index_ = -1; // Reset color selection + selected_color_index_ = -1; } if (is_selected) { ImGui::SetItemDefaultFocus(); @@ -63,111 +79,453 @@ void PaletteEditorWidget::DrawPaletteSelector() { } } -void PaletteEditorWidget::DrawColorGrid() { - auto& dungeon_pal_group = rom_->mutable_palette_group()->dungeon_main; - - if (current_palette_id_ < 0 || current_palette_id_ >= (int)dungeon_pal_group.size()) { - ImGui::TextColored(ImVec4(1, 0, 0, 1), "Invalid palette ID"); - return; - } - - auto palette = dungeon_pal_group[current_palette_id_]; - int num_colors = palette.size(); - - ImGui::Text("Colors (%d):", num_colors); - - // Draw color grid (15 colors per row for good layout) - const int colors_per_row = 15; - const float color_button_size = 24.0f; - - for (int i = 0; i < num_colors; i++) { - ImGui::PushID(i); - - // Get color as RGB (0-255) - auto color = palette[i]; - ImVec4 col(color.rgb().x / 255.0f, - color.rgb().y / 255.0f, - color.rgb().z / 255.0f, - 1.0f); - - // Color button - bool is_selected = (i == selected_color_index_); - if (is_selected) { - ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(1, 1, 0, 1)); // Yellow border - ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 2.0f); - } - - if (ImGui::ColorButton(absl::StrFormat("##color%d", i).c_str(), col, - ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_NoPicker, - ImVec2(color_button_size, color_button_size))) { - selected_color_index_ = i; - editing_color_ = col; - } - - if (is_selected) { - ImGui::PopStyleVar(); - ImGui::PopStyleColor(); - } - - // Tooltip showing color index and SNES value - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip("Color %d\nSNES: 0x%04X\nRGB: (%d, %d, %d)", - i, color.snes(), - (int)color.rgb().x, (int)color.rgb().y, (int)color.rgb().z); - } - - // Layout: 15 per row - if ((i + 1) % colors_per_row != 0 && i < num_colors - 1) { - ImGui::SameLine(); - } - - ImGui::PopID(); - } -} - void PaletteEditorWidget::DrawColorPicker() { - ImGui::SeparatorText(absl::StrFormat("Edit Color %d", selected_color_index_).c_str()); - - auto& dungeon_pal_group = rom_->mutable_palette_group()->dungeon_main; - auto palette = dungeon_pal_group[current_palette_id_]; // Get copy, not reference + ImGui::SeparatorText( + absl::StrFormat("Edit Color %d", selected_color_index_).c_str()); + + auto &dungeon_pal_group = rom_->mutable_palette_group()->dungeon_main; + auto palette = dungeon_pal_group[current_palette_id_]; auto original_color = palette[selected_color_index_]; - - // Color picker - if (ImGui::ColorEdit3("Color", &editing_color_.x, - ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_PickerHueWheel)) { - // Convert ImGui color (0-1) to SNES color (0-31 per channel) + + if (ImGui::ColorEdit3("Color", &editing_color_.x, + ImGuiColorEditFlags_NoAlpha | + ImGuiColorEditFlags_PickerHueWheel)) { int r = static_cast(editing_color_.x * 31.0f); int g = static_cast(editing_color_.y * 31.0f); int b = static_cast(editing_color_.z * 31.0f); - - // Create SNES color (15-bit BGR555 format) uint16_t snes_color = (b << 10) | (g << 5) | r; - - // Update palette in ROM (need to write back through the group) + palette[selected_color_index_] = gfx::SnesColor(snes_color); - dungeon_pal_group[current_palette_id_] = palette; // Write back - - // Notify that palette changed + dungeon_pal_group[current_palette_id_] = palette; + if (on_palette_changed_) { on_palette_changed_(current_palette_id_); } } - - // Show RGB values - ImGui::Text("RGB (0-255): (%d, %d, %d)", - (int)(editing_color_.x * 255), - (int)(editing_color_.y * 255), - (int)(editing_color_.z * 255)); - - // Show SNES BGR555 value + + ImGui::Text("RGB (0-255): (%d, %d, %d)", (int)(editing_color_.x * 255), + (int)(editing_color_.y * 255), (int)(editing_color_.z * 255)); ImGui::Text("SNES BGR555: 0x%04X", original_color.snes()); - - // Reset button + if (ImGui::Button("Reset to Original")) { editing_color_ = ImVec4(original_color.rgb().x / 255.0f, - original_color.rgb().y / 255.0f, - original_color.rgb().z / 255.0f, - 1.0f); + original_color.rgb().y / 255.0f, + original_color.rgb().z / 255.0f, 1.0f); + } +} + +// --- Modal/Popup Methods (from feature-rich widget) --- + +void PaletteEditorWidget::ShowPaletteEditor(gfx::SnesPalette &palette, + const std::string &title) { + if (ImGui::BeginPopupModal(title.c_str(), nullptr, + ImGuiWindowFlags_AlwaysAutoResize)) { + ImGui::Text("Enhanced Palette Editor"); + ImGui::Separator(); + + DrawPaletteGrid(palette); + ImGui::Separator(); + + if (ImGui::CollapsingHeader("Palette Analysis")) { + DrawPaletteAnalysis(palette); + } + + if (ImGui::CollapsingHeader("ROM Palette Manager") && rom_) { + DrawROMPaletteSelector(); + + if (ImGui::Button("Apply ROM Palette") && !rom_palette_groups_.empty()) { + if (current_group_index_ < + static_cast(rom_palette_groups_.size())) { + palette = rom_palette_groups_[current_group_index_]; + } + } + } + + ImGui::Separator(); + + if (ImGui::Button("Save Backup")) { + SavePaletteBackup(palette); + } + ImGui::SameLine(); + if (ImGui::Button("Restore Backup")) { + RestorePaletteBackup(palette); + } + ImGui::SameLine(); + if (ImGui::Button("Close")) { + ImGui::CloseCurrentPopup(); + } + + ImGui::EndPopup(); + } +} + +void PaletteEditorWidget::ShowROMPaletteManager() { + if (!show_rom_manager_) return; + + if (ImGui::Begin("ROM Palette Manager", &show_rom_manager_)) { + if (!rom_) { + ImGui::Text("No ROM loaded"); + ImGui::End(); + return; + } + + if (!rom_palettes_loaded_) { + LoadROMPalettes(); + } + + DrawROMPaletteSelector(); + + if (current_group_index_ < static_cast(rom_palette_groups_.size())) { + ImGui::Separator(); + ImGui::Text("Preview of %s:", + palette_group_names_[current_group_index_].c_str()); + + const auto &preview_palette = rom_palette_groups_[current_group_index_]; + DrawPaletteGrid(const_cast(preview_palette)); + DrawPaletteAnalysis(preview_palette); + } + } + ImGui::End(); +} + +void PaletteEditorWidget::ShowColorAnalysis(const gfx::Bitmap &bitmap, + const std::string &title) { + if (!show_color_analysis_) return; + + if (ImGui::Begin(title.c_str(), &show_color_analysis_)) { + ImGui::Text("Bitmap Color Analysis"); + ImGui::Separator(); + + if (!bitmap.is_active()) { + ImGui::Text("Bitmap is not active"); + ImGui::End(); + return; + } + + std::map pixel_counts; + const auto &data = bitmap.vector(); + + for (uint8_t pixel : data) { + uint8_t palette_index = pixel & 0x0F; + pixel_counts[palette_index]++; + } + + ImGui::Text("Bitmap Size: %d x %d (%zu pixels)", bitmap.width(), + bitmap.height(), data.size()); + + ImGui::Separator(); + ImGui::Text("Pixel Distribution:"); + + int total_pixels = static_cast(data.size()); + for (const auto &[index, count] : pixel_counts) { + float percentage = (static_cast(count) / total_pixels) * 100.0f; + ImGui::Text("Index %d: %d pixels (%.1f%%)", index, count, percentage); + + ImGui::SameLine(); + ImGui::ProgressBar(percentage / 100.0f, ImVec2(100, 0)); + + if (index < static_cast(bitmap.palette().size())) { + ImGui::SameLine(); + auto color = bitmap.palette()[index]; + ImVec4 display_color = color.rgb(); + ImGui::ColorButton(("##color" + std::to_string(index)).c_str(), + display_color, ImGuiColorEditFlags_NoTooltip, + ImVec2(20, 20)); + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip("SNES Color: 0x%04X\nRGB: (%d, %d, %d)", + color.snes(), + static_cast(display_color.x * 255), + static_cast(display_color.y * 255), + static_cast(display_color.z * 255)); + } + } + } + } + ImGui::End(); +} + +bool PaletteEditorWidget::ApplyROMPalette(gfx::Bitmap *bitmap, int group_index, + int palette_index) { + if (!bitmap || !rom_palettes_loaded_ || group_index < 0 || + group_index >= static_cast(rom_palette_groups_.size())) { + return false; + } + + try { + const auto &selected_palette = rom_palette_groups_[group_index]; + SavePaletteBackup(bitmap->palette()); + + if (palette_index >= 0 && palette_index < 8) { + bitmap->SetPaletteWithTransparent(selected_palette, palette_index); + } else { + bitmap->SetPalette(selected_palette); + } + + gfx::Arena::Get().QueueTextureCommand( + gfx::Arena::TextureCommandType::UPDATE, bitmap); + + current_group_index_ = group_index; + current_palette_index_ = palette_index; + return true; + } catch (const std::exception &e) { + return false; + } +} + +const gfx::SnesPalette *PaletteEditorWidget::GetSelectedROMPalette() const { + if (!rom_palettes_loaded_ || current_group_index_ < 0 || + current_group_index_ >= static_cast(rom_palette_groups_.size())) { + return nullptr; + } + return &rom_palette_groups_[current_group_index_]; +} + +void PaletteEditorWidget::SavePaletteBackup(const gfx::SnesPalette &palette) { + backup_palette_ = palette; +} + +bool PaletteEditorWidget::RestorePaletteBackup(gfx::SnesPalette &palette) { + if (backup_palette_.size() == 0) { + return false; + } + palette = backup_palette_; + return true; +} + +// Unified grid drawing function +void PaletteEditorWidget::DrawPaletteGrid(gfx::SnesPalette &palette, int cols) { + for (int i = 0; i < static_cast(palette.size()); i++) { + if (i % cols != 0) ImGui::SameLine(); + + auto color = palette[i]; + ImVec4 display_color = color.rgb(); + + ImGui::PushID(i); + if (ImGui::ColorButton("##color", display_color, + ImGuiColorEditFlags_NoTooltip, ImVec2(30, 30))) { + editing_color_index_ = i; + selected_color_index_ = i; + temp_color_ = display_color; + editing_color_ = display_color; + } + + if (ImGui::BeginPopupContextItem()) { + ImGui::Text("Color %d (0x%04X)", i, color.snes()); + ImGui::Separator(); + if (ImGui::MenuItem("Edit Color")) { + editing_color_index_ = i; + selected_color_index_ = i; + temp_color_ = display_color; + editing_color_ = display_color; + } + if (ImGui::MenuItem("Reset to Black")) { + palette[i] = gfx::SnesColor(0); + } + ImGui::EndPopup(); + } + + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip("Color %d\nSNES: 0x%04X\nRGB: (%d, %d, %d)", i, + color.snes(), static_cast(display_color.x * 255), + static_cast(display_color.y * 255), + static_cast(display_color.z * 255)); + } + + ImGui::PopID(); + } + + if (editing_color_index_ >= 0) { + ImGui::OpenPopup("Edit Color"); + if (ImGui::BeginPopupModal("Edit Color", nullptr, + ImGuiWindowFlags_AlwaysAutoResize)) { + ImGui::Text("Editing Color %d", editing_color_index_); + if (ImGui::ColorEdit4("Color", &temp_color_.x, + ImGuiColorEditFlags_NoAlpha | + ImGuiColorEditFlags_DisplayRGB)) { + auto new_snes_color = gfx::SnesColor(temp_color_); + palette[editing_color_index_] = new_snes_color; + } + if (ImGui::Button("Apply")) { + editing_color_index_ = -1; + ImGui::CloseCurrentPopup(); + } + ImGui::SameLine(); + if (ImGui::Button("Cancel")) { + editing_color_index_ = -1; + ImGui::CloseCurrentPopup(); + } + ImGui::EndPopup(); + } + } +} + +void PaletteEditorWidget::DrawROMPaletteSelector() { + if (!rom_palettes_loaded_) { + LoadROMPalettes(); + } + + if (rom_palette_groups_.empty()) { + ImGui::Text("No ROM palettes available"); + return; + } + + ImGui::Text("Palette Group:"); + if (ImGui::Combo( + "##PaletteGroup", ¤t_group_index_, + [](void *data, int idx, const char **out_text) -> bool { + auto *names = static_cast *>(data); + if (idx < 0 || idx >= static_cast(names->size())) return false; + *out_text = (*names)[idx].c_str(); + return true; + }, + &palette_group_names_, + static_cast(palette_group_names_.size()))) { + } + + ImGui::Text("Palette Index:"); + ImGui::SliderInt("##PaletteIndex", ¤t_palette_index_, 0, 7, "%d"); + + if (current_group_index_ < static_cast(rom_palette_groups_.size())) { + ImGui::Text("Preview:"); + const auto &preview_palette = rom_palette_groups_[current_group_index_]; + for (int i = 0; i < 8 && i < static_cast(preview_palette.size()); + i++) { + if (i > 0) ImGui::SameLine(); + auto color = preview_palette[i]; + ImVec4 display_color = color.rgb(); + ImGui::ColorButton(("##preview" + std::to_string(i)).c_str(), + display_color, ImGuiColorEditFlags_NoTooltip, + ImVec2(20, 20)); + } + } +} + +void PaletteEditorWidget::DrawColorEditControls(gfx::SnesColor &color, + int color_index) { + ImVec4 rgba = color.rgb(); + + ImGui::PushID(color_index); + + if (ImGui::ColorEdit4("##color_edit", &rgba.x, + ImGuiColorEditFlags_NoAlpha | + ImGuiColorEditFlags_DisplayRGB)) { + color = gfx::SnesColor(rgba); + } + + ImGui::Text("SNES Color: 0x%04X", color.snes()); + + int r = (color.snes() & 0x1F); + int g = (color.snes() >> 5) & 0x1F; + int b = (color.snes() >> 10) & 0x1F; + + if (ImGui::SliderInt("Red", &r, 0, 31)) { + uint16_t new_color = (color.snes() & 0xFFE0) | (r & 0x1F); + color = gfx::SnesColor(new_color); + } + if (ImGui::SliderInt("Green", &g, 0, 31)) { + uint16_t new_color = (color.snes() & 0xFC1F) | ((g & 0x1F) << 5); + color = gfx::SnesColor(new_color); + } + if (ImGui::SliderInt("Blue", &b, 0, 31)) { + uint16_t new_color = (color.snes() & 0x83FF) | ((b & 0x1F) << 10); + color = gfx::SnesColor(new_color); + } + + ImGui::PopID(); +} + +void PaletteEditorWidget::DrawPaletteAnalysis( + const gfx::SnesPalette &palette) { + ImGui::Text("Palette Information:"); + ImGui::Text("Size: %zu colors", palette.size()); + + std::map color_frequency; + for (int i = 0; i < static_cast(palette.size()); i++) { + color_frequency[palette[i].snes()]++; + } + + ImGui::Text("Unique Colors: %zu", color_frequency.size()); + + if (color_frequency.size() < palette.size()) { + ImGui::TextColored(ImVec4(1, 1, 0, 1), "Warning: Duplicate colors detected!"); + if (ImGui::TreeNode("Duplicate Colors")) { + for (const auto &[snes_color, count] : color_frequency) { + if (count > 1) { + ImVec4 display_color = gfx::SnesColor(snes_color).rgb(); + ImGui::ColorButton(("##dup" + std::to_string(snes_color)).c_str(), + display_color, ImGuiColorEditFlags_NoTooltip, + ImVec2(16, 16)); + ImGui::SameLine(); + ImGui::Text("0x%04X appears %d times", snes_color, count); + } + } + ImGui::TreePop(); + } + } + + float total_brightness = 0.0f; + float min_brightness = 1.0f; + float max_brightness = 0.0f; + + for (int i = 0; i < static_cast(palette.size()); i++) { + ImVec4 color = palette[i].rgb(); + float brightness = (color.x + color.y + color.z) / 3.0f; + total_brightness += brightness; + min_brightness = std::min(min_brightness, brightness); + max_brightness = std::max(max_brightness, brightness); + } + + float avg_brightness = total_brightness / palette.size(); + + ImGui::Separator(); + ImGui::Text("Brightness Analysis:"); + ImGui::Text("Average: %.2f", avg_brightness); + ImGui::Text("Range: %.2f - %.2f", min_brightness, max_brightness); + + ImGui::Text("Brightness Distribution:"); + ImGui::ProgressBar(avg_brightness, ImVec2(-1, 0), "Avg"); +} + +void PaletteEditorWidget::LoadROMPalettes() { + if (!rom_ || rom_palettes_loaded_) return; + + try { + const auto &palette_groups = rom_->palette_group(); + rom_palette_groups_.clear(); + palette_group_names_.clear(); + + if (palette_groups.overworld_main.size() > 0) { + rom_palette_groups_.push_back(palette_groups.overworld_main[0]); + palette_group_names_.push_back("Overworld Main"); + } + if (palette_groups.overworld_aux.size() > 0) { + rom_palette_groups_.push_back(palette_groups.overworld_aux[0]); + palette_group_names_.push_back("Overworld Aux"); + } + if (palette_groups.overworld_animated.size() > 0) { + rom_palette_groups_.push_back(palette_groups.overworld_animated[0]); + palette_group_names_.push_back("Overworld Animated"); + } + if (palette_groups.dungeon_main.size() > 0) { + rom_palette_groups_.push_back(palette_groups.dungeon_main[0]); + palette_group_names_.push_back("Dungeon Main"); + } + if (palette_groups.global_sprites.size() > 0) { + rom_palette_groups_.push_back(palette_groups.global_sprites[0]); + palette_group_names_.push_back("Global Sprites"); + } + if (palette_groups.armors.size() > 0) { + rom_palette_groups_.push_back(palette_groups.armors[0]); + palette_group_names_.push_back("Armor"); + } + if (palette_groups.swords.size() > 0) { + rom_palette_groups_.push_back(palette_groups.swords[0]); + palette_group_names_.push_back("Swords"); + } + + rom_palettes_loaded_ = true; + } catch (const std::exception &e) { + LOG_ERROR("Enhanced Palette Editor", "Failed to load ROM palettes"); } } diff --git a/src/app/gui/widgets/palette_editor_widget.h b/src/app/gui/widgets/palette_editor_widget.h index bb87799b..b6ce2903 100644 --- a/src/app/gui/widgets/palette_editor_widget.h +++ b/src/app/gui/widgets/palette_editor_widget.h @@ -2,8 +2,10 @@ #define YAZE_APP_GUI_WIDGETS_PALETTE_EDITOR_WIDGET_H #include +#include #include +#include "app/gfx/core/bitmap.h" #include "app/gfx/types/snes_palette.h" #include "app/rom.h" #include "imgui/imgui.h" @@ -11,42 +13,72 @@ namespace yaze { namespace gui { -/** - * @brief Simple visual palette editor with color picker - * - * Displays dungeon palettes in a grid, allows editing colors, - * and notifies when palettes change so rooms can re-render. - */ class PaletteEditorWidget { public: PaletteEditorWidget() = default; - - void Initialize(Rom* rom); + + void Initialize(Rom *rom); + + // Embedded drawing function, like the old PaletteEditorWidget void Draw(); - + + // Modal dialogs from the more feature-rich PaletteWidget + void ShowPaletteEditor(gfx::SnesPalette &palette, + const std::string &title = "Palette Editor"); + void ShowROMPaletteManager(); + void ShowColorAnalysis(const gfx::Bitmap &bitmap, + const std::string &title = "Color Analysis"); + + bool ApplyROMPalette(gfx::Bitmap *bitmap, int group_index, int palette_index); + const gfx::SnesPalette *GetSelectedROMPalette() const; + void SavePaletteBackup(const gfx::SnesPalette &palette); + bool RestorePaletteBackup(gfx::SnesPalette &palette); + // Callback when palette is modified void SetOnPaletteChanged(std::function callback) { on_palette_changed_ = callback; } - + // Get/Set current editing palette - int current_palette_id() const { return current_palette_id_; } - void set_current_palette_id(int id) { current_palette_id_ = id; } - + int GetCurrentPaletteId() const { return current_palette_id_; } + void SetCurrentPaletteId(int id) { current_palette_id_ = id; } + + bool IsROMLoaded() const { return rom_ != nullptr; } + int GetCurrentGroupIndex() const { return current_group_index_; } + void DrawROMPaletteSelector(); + private: + void DrawPaletteGrid(gfx::SnesPalette &palette, int cols = 15); + void DrawColorEditControls(gfx::SnesColor &color, int color_index); + void DrawPaletteAnalysis(const gfx::SnesPalette &palette); + void LoadROMPalettes(); + + // For embedded view void DrawPaletteSelector(); - void DrawColorGrid(); void DrawColorPicker(); - - Rom* rom_ = nullptr; + + Rom *rom_ = nullptr; + std::vector rom_palette_groups_; + std::vector palette_group_names_; + gfx::SnesPalette backup_palette_; + + int current_group_index_ = 0; + int current_palette_index_ = 0; // used by ROM palette selector + bool rom_palettes_loaded_ = false; + bool show_color_analysis_ = false; + bool show_rom_manager_ = false; + + // State for embedded editor int current_palette_id_ = 0; int selected_color_index_ = -1; - + ImVec4 editing_color_{0, 0, 0, 1}; + // Callback for palette changes std::function on_palette_changed_; - - // Temp color for editing (RGB 0-1 range for ImGui) - ImVec4 editing_color_{0, 0, 0, 1}; + + // Color editing state + int editing_color_index_ = -1; + ImVec4 temp_color_ = ImVec4(0, 0, 0, 1); }; } // namespace gui diff --git a/src/app/gui/widgets/palette_widget.cc b/src/app/gui/widgets/palette_widget.cc deleted file mode 100644 index d297027b..00000000 --- a/src/app/gui/widgets/palette_widget.cc +++ /dev/null @@ -1,462 +0,0 @@ -#include "app/gui/widgets/palette_widget.h" - -#include -#include -#include "app/gfx/resource/arena.h" -#include "app/gui/color.h" -#include "util/log.h" - -namespace yaze { -namespace gui { - -void PaletteWidget::Initialize(Rom* rom) { - rom_ = rom; - rom_palettes_loaded_ = false; - if (rom_) { - LoadROMPalettes(); - } -} - -void PaletteWidget::ShowPaletteEditor(gfx::SnesPalette& palette, const std::string& title) { - if (ImGui::BeginPopupModal(title.c_str(), nullptr, ImGuiWindowFlags_AlwaysAutoResize)) { - ImGui::Text("Enhanced Palette Editor"); - ImGui::Separator(); - - // Palette grid editor - DrawPaletteGrid(palette); - - ImGui::Separator(); - - // Analysis and tools - if (ImGui::CollapsingHeader("Palette Analysis")) { - DrawPaletteAnalysis(palette); - } - - if (ImGui::CollapsingHeader("ROM Palette Manager") && rom_) { - DrawROMPaletteSelector(); - - if (ImGui::Button("Apply ROM Palette") && !rom_palette_groups_.empty()) { - if (current_group_index_ < static_cast(rom_palette_groups_.size())) { - palette = rom_palette_groups_[current_group_index_]; - } - } - } - - ImGui::Separator(); - - // Action buttons - if (ImGui::Button("Save Backup")) { - SavePaletteBackup(palette); - } - ImGui::SameLine(); - if (ImGui::Button("Restore Backup")) { - RestorePaletteBackup(palette); - } - ImGui::SameLine(); - if (ImGui::Button("Close")) { - ImGui::CloseCurrentPopup(); - } - - ImGui::EndPopup(); - } -} - -void PaletteWidget::ShowROMPaletteManager() { - if (!show_rom_manager_) return; - - if (ImGui::Begin("ROM Palette Manager", &show_rom_manager_)) { - if (!rom_) { - ImGui::Text("No ROM loaded"); - ImGui::End(); - return; - } - - if (!rom_palettes_loaded_) { - LoadROMPalettes(); - } - - DrawROMPaletteSelector(); - - if (current_group_index_ < static_cast(rom_palette_groups_.size())) { - ImGui::Separator(); - ImGui::Text("Preview of %s:", palette_group_names_[current_group_index_].c_str()); - - const auto& preview_palette = rom_palette_groups_[current_group_index_]; - DrawPaletteGrid(const_cast(preview_palette)); - - DrawPaletteAnalysis(preview_palette); - } - } - ImGui::End(); -} - -void PaletteWidget::ShowColorAnalysis(const gfx::Bitmap& bitmap, const std::string& title) { - if (!show_color_analysis_) return; - - if (ImGui::Begin(title.c_str(), &show_color_analysis_)) { - ImGui::Text("Bitmap Color Analysis"); - ImGui::Separator(); - - if (!bitmap.is_active()) { - ImGui::Text("Bitmap is not active"); - ImGui::End(); - return; - } - - // Analyze pixel distribution - std::map pixel_counts; - const auto& data = bitmap.vector(); - - for (uint8_t pixel : data) { - uint8_t palette_index = pixel & 0x0F; // 4-bit palette index - pixel_counts[palette_index]++; - } - - ImGui::Text("Bitmap Size: %d x %d (%zu pixels)", - bitmap.width(), bitmap.height(), data.size()); - - ImGui::Separator(); - ImGui::Text("Pixel Distribution:"); - - // Show distribution as bars - int total_pixels = static_cast(data.size()); - for (const auto& [index, count] : pixel_counts) { - float percentage = (static_cast(count) / total_pixels) * 100.0f; - ImGui::Text("Index %d: %d pixels (%.1f%%)", index, count, percentage); - - // Progress bar visualization - ImGui::SameLine(); - ImGui::ProgressBar(percentage / 100.0f, ImVec2(100, 0)); - - // Color swatch if palette is available - if (index < static_cast(bitmap.palette().size())) { - ImGui::SameLine(); - auto color = bitmap.palette()[index]; - ImVec4 display_color = color.rgb(); - ImGui::ColorButton(("##color" + std::to_string(index)).c_str(), - display_color, ImGuiColorEditFlags_NoTooltip, ImVec2(20, 20)); - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip("SNES Color: 0x%04X\nRGB: (%d, %d, %d)", - color.snes(), - static_cast(display_color.x * 255), - static_cast(display_color.y * 255), - static_cast(display_color.z * 255)); - } - } - } - } - ImGui::End(); -} - -bool PaletteWidget::ApplyROMPalette(gfx::Bitmap* bitmap, int group_index, int palette_index) { - if (!bitmap || !rom_palettes_loaded_ || - group_index < 0 || group_index >= static_cast(rom_palette_groups_.size())) { - return false; - } - - try { - const auto& selected_palette = rom_palette_groups_[group_index]; - - // Save current palette as backup - SavePaletteBackup(bitmap->palette()); - - // Apply new palette - if (palette_index >= 0 && palette_index < 8) { - bitmap->SetPaletteWithTransparent(selected_palette, palette_index); - } else { - bitmap->SetPalette(selected_palette); - } - - // Queue texture update via Arena's deferred system - gfx::Arena::Get().QueueTextureCommand( - gfx::Arena::TextureCommandType::UPDATE, bitmap); - - current_group_index_ = group_index; - current_palette_index_ = palette_index; - - return true; - - } catch (const std::exception& e) { - return false; - } -} - -const gfx::SnesPalette* PaletteWidget::GetSelectedROMPalette() const { - if (!rom_palettes_loaded_ || current_group_index_ < 0 || - current_group_index_ >= static_cast(rom_palette_groups_.size())) { - return nullptr; - } - - return &rom_palette_groups_[current_group_index_]; -} - -void PaletteWidget::SavePaletteBackup(const gfx::SnesPalette& palette) { - backup_palette_ = palette; -} - -bool PaletteWidget::RestorePaletteBackup(gfx::SnesPalette& palette) { - if (backup_palette_.size() == 0) { - return false; - } - - palette = backup_palette_; - return true; -} - -void PaletteWidget::DrawPaletteGrid(gfx::SnesPalette& palette, int cols) { - for (int i = 0; i < static_cast(palette.size()); i++) { - if (i % cols != 0) ImGui::SameLine(); - - auto color = palette[i]; - ImVec4 display_color = color.rgb(); - - ImGui::PushID(i); - - // Color button with editing capability - if (ImGui::ColorButton("##color", display_color, - ImGuiColorEditFlags_NoTooltip, ImVec2(30, 30))) { - editing_color_index_ = i; - temp_color_ = display_color; - } - - // Context menu for individual colors - if (ImGui::BeginPopupContextItem()) { - ImGui::Text("Color %d (0x%04X)", i, color.snes()); - ImGui::Separator(); - - if (ImGui::MenuItem("Edit Color")) { - editing_color_index_ = i; - temp_color_ = display_color; - } - - if (ImGui::MenuItem("Copy Color")) { - // Could implement color clipboard here - } - - if (ImGui::MenuItem("Reset to Black")) { - palette[i] = gfx::SnesColor(0); - } - - ImGui::EndPopup(); - } - - // Tooltip with detailed info - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip("Color %d\nSNES: 0x%04X\nRGB: (%d, %d, %d)\nClick to edit", - i, color.snes(), - static_cast(display_color.x * 255), - static_cast(display_color.y * 255), - static_cast(display_color.z * 255)); - } - - ImGui::PopID(); - } - - // Color editor popup - if (editing_color_index_ >= 0) { - ImGui::OpenPopup("Edit Color"); - - if (ImGui::BeginPopupModal("Edit Color", nullptr, ImGuiWindowFlags_AlwaysAutoResize)) { - ImGui::Text("Editing Color %d", editing_color_index_); - - if (ImGui::ColorEdit4("Color", &temp_color_.x, - ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_DisplayRGB)) { - // Update the palette color in real-time - auto new_snes_color = gfx::SnesColor(temp_color_); - palette[editing_color_index_] = new_snes_color; - } - - if (ImGui::Button("Apply")) { - editing_color_index_ = -1; - ImGui::CloseCurrentPopup(); - } - ImGui::SameLine(); - if (ImGui::Button("Cancel")) { - editing_color_index_ = -1; - ImGui::CloseCurrentPopup(); - } - - ImGui::EndPopup(); - } - } -} - -void PaletteWidget::DrawROMPaletteSelector() { - if (!rom_palettes_loaded_) { - LoadROMPalettes(); - } - - if (rom_palette_groups_.empty()) { - ImGui::Text("No ROM palettes available"); - return; - } - - // Group selector - ImGui::Text("Palette Group:"); - if (ImGui::Combo("##PaletteGroup", ¤t_group_index_, - [](void* data, int idx, const char** out_text) -> bool { - auto* names = static_cast*>(data); - if (idx < 0 || idx >= static_cast(names->size())) return false; - *out_text = (*names)[idx].c_str(); - return true; - }, &palette_group_names_, static_cast(palette_group_names_.size()))) { - // Group changed - could trigger preview update - } - - // Palette index selector - ImGui::Text("Palette Index:"); - ImGui::SliderInt("##PaletteIndex", ¤t_palette_index_, 0, 7, "%d"); - - // Quick palette preview - if (current_group_index_ < static_cast(rom_palette_groups_.size())) { - ImGui::Text("Preview:"); - const auto& preview_palette = rom_palette_groups_[current_group_index_]; - - // Show just first 8 colors in a row - for (int i = 0; i < 8 && i < static_cast(preview_palette.size()); i++) { - if (i > 0) ImGui::SameLine(); - auto color = preview_palette[i]; - ImVec4 display_color = color.rgb(); - ImGui::ColorButton(("##preview" + std::to_string(i)).c_str(), - display_color, ImGuiColorEditFlags_NoTooltip, ImVec2(20, 20)); - } - } -} - -void PaletteWidget::DrawColorEditControls(gfx::SnesColor& color, int color_index) { - ImVec4 rgba = color.rgb(); - - ImGui::PushID(color_index); - - if (ImGui::ColorEdit4("##color_edit", &rgba.x, - ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_DisplayRGB)) { - color = gfx::SnesColor(rgba); - } - - // SNES-specific controls - ImGui::Text("SNES Color: 0x%04X", color.snes()); - - // Individual RGB component sliders (0-31 for SNES) - int r = (color.snes() & 0x1F); - int g = (color.snes() >> 5) & 0x1F; - int b = (color.snes() >> 10) & 0x1F; - - if (ImGui::SliderInt("Red", &r, 0, 31)) { - uint16_t new_color = (color.snes() & 0xFFE0) | (r & 0x1F); - color = gfx::SnesColor(new_color); - } - - if (ImGui::SliderInt("Green", &g, 0, 31)) { - uint16_t new_color = (color.snes() & 0xFC1F) | ((g & 0x1F) << 5); - color = gfx::SnesColor(new_color); - } - - if (ImGui::SliderInt("Blue", &b, 0, 31)) { - uint16_t new_color = (color.snes() & 0x83FF) | ((b & 0x1F) << 10); - color = gfx::SnesColor(new_color); - } - - ImGui::PopID(); -} - -void PaletteWidget::DrawPaletteAnalysis(const gfx::SnesPalette& palette) { - ImGui::Text("Palette Information:"); - ImGui::Text("Size: %zu colors", palette.size()); - - // Color distribution analysis - std::map color_frequency; - for (int i = 0; i < static_cast(palette.size()); i++) { - color_frequency[palette[i].snes()]++; - } - - ImGui::Text("Unique Colors: %zu", color_frequency.size()); - - if (color_frequency.size() < palette.size()) { - ImGui::TextColored(ImVec4(1, 1, 0, 1), "Warning: Duplicate colors detected!"); - - if (ImGui::TreeNode("Duplicate Colors")) { - for (const auto& [snes_color, count] : color_frequency) { - if (count > 1) { - ImVec4 display_color = gfx::SnesColor(snes_color).rgb(); - ImGui::ColorButton(("##dup" + std::to_string(snes_color)).c_str(), - display_color, ImGuiColorEditFlags_NoTooltip, ImVec2(16, 16)); - ImGui::SameLine(); - ImGui::Text("0x%04X appears %d times", snes_color, count); - } - } - ImGui::TreePop(); - } - } - - // Brightness analysis - float total_brightness = 0.0f; - float min_brightness = 1.0f; - float max_brightness = 0.0f; - - for (int i = 0; i < static_cast(palette.size()); i++) { - ImVec4 color = palette[i].rgb(); - float brightness = (color.x + color.y + color.z) / 3.0f; - total_brightness += brightness; - min_brightness = std::min(min_brightness, brightness); - max_brightness = std::max(max_brightness, brightness); - } - - float avg_brightness = total_brightness / palette.size(); - - ImGui::Separator(); - ImGui::Text("Brightness Analysis:"); - ImGui::Text("Average: %.2f", avg_brightness); - ImGui::Text("Range: %.2f - %.2f", min_brightness, max_brightness); - - // Show brightness as progress bar - ImGui::Text("Brightness Distribution:"); - ImGui::ProgressBar(avg_brightness, ImVec2(-1, 0), "Avg"); -} - -void PaletteWidget::LoadROMPalettes() { - if (!rom_ || rom_palettes_loaded_) return; - - try { - const auto& palette_groups = rom_->palette_group(); - rom_palette_groups_.clear(); - palette_group_names_.clear(); - - // Load all available palette groups - if (palette_groups.overworld_main.size() > 0) { - rom_palette_groups_.push_back(palette_groups.overworld_main[0]); - palette_group_names_.push_back("Overworld Main"); - } - if (palette_groups.overworld_aux.size() > 0) { - rom_palette_groups_.push_back(palette_groups.overworld_aux[0]); - palette_group_names_.push_back("Overworld Aux"); - } - if (palette_groups.overworld_animated.size() > 0) { - rom_palette_groups_.push_back(palette_groups.overworld_animated[0]); - palette_group_names_.push_back("Overworld Animated"); - } - if (palette_groups.dungeon_main.size() > 0) { - rom_palette_groups_.push_back(palette_groups.dungeon_main[0]); - palette_group_names_.push_back("Dungeon Main"); - } - if (palette_groups.global_sprites.size() > 0) { - rom_palette_groups_.push_back(palette_groups.global_sprites[0]); - palette_group_names_.push_back("Global Sprites"); - } - if (palette_groups.armors.size() > 0) { - rom_palette_groups_.push_back(palette_groups.armors[0]); - palette_group_names_.push_back("Armor"); - } - if (palette_groups.swords.size() > 0) { - rom_palette_groups_.push_back(palette_groups.swords[0]); - palette_group_names_.push_back("Swords"); - } - - rom_palettes_loaded_ = true; - - } catch (const std::exception& e) { - LOG_ERROR("Enhanced Palette Editor", "Failed to load ROM palettes"); - } -} - -} // namespace gui -} // namespace yaze diff --git a/src/app/gui/widgets/palette_widget.h b/src/app/gui/widgets/palette_widget.h deleted file mode 100644 index 4fbbfdca..00000000 --- a/src/app/gui/widgets/palette_widget.h +++ /dev/null @@ -1,99 +0,0 @@ -#ifndef YAZE_APP_GUI_PALETTE_WIDGET_H -#define YAZE_APP_GUI_PALETTE_WIDGET_H - -#include -#include -#include "app/gfx/types/snes_palette.h" -#include "app/gfx/core/bitmap.h" -#include "app/rom.h" -#include "imgui/imgui.h" - -namespace yaze { -namespace gui { - -/** - * @brief Palette widget with ROM integration, analysis tools, and AI tool call support - * - * This widget provides comprehensive palette editing capabilities including: - * - Grid-based color editing with preview - * - ROM palette browser and manager - * - Color analysis and statistics - * - Export/import functionality - * - AI agent tool call integration for programmatic palette access - */ -class PaletteWidget { -public: - PaletteWidget() = default; - - /** - * @brief Initialize the palette editor with ROM data - */ - void Initialize(Rom* rom); - - /** - * @brief Show the main palette editor window - */ - void ShowPaletteEditor(gfx::SnesPalette& palette, const std::string& title = "Palette Editor"); - - /** - * @brief Show the ROM palette manager window - */ - void ShowROMPaletteManager(); - - /** - * @brief Show color analysis window for a bitmap - */ - void ShowColorAnalysis(const gfx::Bitmap& bitmap, const std::string& title = "Color Analysis"); - - /** - * @brief Apply a ROM palette group to a bitmap - */ - bool ApplyROMPalette(gfx::Bitmap* bitmap, int group_index, int palette_index); - - /** - * @brief Get the currently selected ROM palette - */ - const gfx::SnesPalette* GetSelectedROMPalette() const; - - /** - * @brief Save current palette as backup - */ - void SavePaletteBackup(const gfx::SnesPalette& palette); - - /** - * @brief Restore palette from backup - */ - bool RestorePaletteBackup(gfx::SnesPalette& palette); - - // Accessors - bool IsROMLoaded() const { return rom_ != nullptr; } - int GetCurrentGroupIndex() const { return current_group_index_; } - int GetCurrentPaletteIndex() const { return current_palette_index_; } - void DrawROMPaletteSelector(); - -private: - void DrawPaletteGrid(gfx::SnesPalette& palette, int cols = 8); - void DrawColorEditControls(gfx::SnesColor& color, int color_index); - void DrawPaletteAnalysis(const gfx::SnesPalette& palette); - void LoadROMPalettes(); - - Rom* rom_ = nullptr; - std::vector rom_palette_groups_; - std::vector palette_group_names_; - gfx::SnesPalette backup_palette_; - - int current_group_index_ = 0; - int current_palette_index_ = 0; - bool rom_palettes_loaded_ = false; - bool show_color_analysis_ = false; - bool show_rom_manager_ = false; - - // Color editing state - int editing_color_index_ = -1; - ImVec4 temp_color_ = ImVec4(0, 0, 0, 1); -}; - -} // namespace gui -} // namespace yaze - -#endif // YAZE_APP_GUI_WIDGETS_PALETTE_WIDGET_H diff --git a/src/app/gui/modules/text_editor.cc b/src/app/gui/widgets/text_editor.cc similarity index 100% rename from src/app/gui/modules/text_editor.cc rename to src/app/gui/widgets/text_editor.cc diff --git a/src/app/gui/modules/text_editor.h b/src/app/gui/widgets/text_editor.h similarity index 100% rename from src/app/gui/modules/text_editor.h rename to src/app/gui/widgets/text_editor.h diff --git a/src/app/gui/themed_widgets.cc b/src/app/gui/widgets/themed_widgets.cc similarity index 99% rename from src/app/gui/themed_widgets.cc rename to src/app/gui/widgets/themed_widgets.cc index f81b8563..9cae21b4 100644 --- a/src/app/gui/themed_widgets.cc +++ b/src/app/gui/widgets/themed_widgets.cc @@ -1,6 +1,6 @@ -#include "app/gui/themed_widgets.h" +#include "app/gui/widgets/themed_widgets.h" -#include "app/gui/color.h" +#include "app/gui/core/color.h" #include "app/gfx/types/snes_color.h" namespace yaze { diff --git a/src/app/gui/themed_widgets.h b/src/app/gui/widgets/themed_widgets.h similarity index 98% rename from src/app/gui/themed_widgets.h rename to src/app/gui/widgets/themed_widgets.h index e99ffafe..bebd3cab 100644 --- a/src/app/gui/themed_widgets.h +++ b/src/app/gui/widgets/themed_widgets.h @@ -1,9 +1,9 @@ #ifndef YAZE_APP_GUI_THEMED_WIDGETS_H #define YAZE_APP_GUI_THEMED_WIDGETS_H -#include "app/gui/color.h" -#include "app/gui/layout_helpers.h" -#include "app/gui/theme_manager.h" +#include "app/gui/core/color.h" +#include "app/gui/core/layout_helpers.h" +#include "app/gui/core/theme_manager.h" #include "imgui/imgui.h" namespace yaze { diff --git a/src/app/gui/widgets/tile_selector_widget.h b/src/app/gui/widgets/tile_selector_widget.h index e5be59c8..79e75517 100644 --- a/src/app/gui/widgets/tile_selector_widget.h +++ b/src/app/gui/widgets/tile_selector_widget.h @@ -4,7 +4,7 @@ #include #include "app/gfx/core/bitmap.h" -#include "app/gui/canvas.h" +#include "app/gui/canvas/canvas.h" #include "imgui/imgui.h" namespace yaze::gui { diff --git a/src/app/platform/font_loader.cc b/src/app/platform/font_loader.cc index 3d6ca4ba..eaa9b7e2 100644 --- a/src/app/platform/font_loader.cc +++ b/src/app/platform/font_loader.cc @@ -10,7 +10,7 @@ #include "absl/strings/str_cat.h" #include "absl/strings/str_format.h" #include "util/file_util.h" -#include "app/gui/icons.h" +#include "app/gui/core/icons.h" #include "imgui/imgui.h" #include "util/macro.h" diff --git a/src/app/platform/font_loader.mm b/src/app/platform/font_loader.mm index 0a4d1321..2e324ec4 100644 --- a/src/app/platform/font_loader.mm +++ b/src/app/platform/font_loader.mm @@ -3,7 +3,7 @@ #import #include -#include "app/gui/icons.h" +#include "app/gui/core/icons.h" #include "imgui/imgui.h" #if TARGET_OS_IPHONE == 1 || TARGET_IPHONE_SIMULATOR == 1 diff --git a/src/app/test/e2e_test_suite.h b/src/app/test/e2e_test_suite.h index 51035933..16751311 100644 --- a/src/app/test/e2e_test_suite.h +++ b/src/app/test/e2e_test_suite.h @@ -8,7 +8,7 @@ #include "app/test/test_manager.h" #include "app/rom.h" #include "app/transaction.h" -#include "app/gui/icons.h" +#include "app/gui/core/icons.h" namespace yaze { namespace test { diff --git a/src/app/test/emulator_test_suite.h b/src/app/test/emulator_test_suite.h index b01ddc77..32d64b1c 100644 --- a/src/app/test/emulator_test_suite.h +++ b/src/app/test/emulator_test_suite.h @@ -13,7 +13,7 @@ #include "app/emu/debug/breakpoint_manager.h" #include "app/emu/debug/watchpoint_manager.h" #include "app/emu/debug/apu_debugger.h" -#include "app/gui/icons.h" +#include "app/gui/core/icons.h" #include "util/log.h" namespace yaze { diff --git a/src/app/test/rom_dependent_test_suite.h b/src/app/test/rom_dependent_test_suite.h index 3716f2dd..9eb8b1b7 100644 --- a/src/app/test/rom_dependent_test_suite.h +++ b/src/app/test/rom_dependent_test_suite.h @@ -9,7 +9,7 @@ #include "app/rom.h" #include "zelda3/overworld/overworld.h" #include "app/editor/overworld/tile16_editor.h" -#include "app/gui/icons.h" +#include "app/gui/core/icons.h" namespace yaze { namespace test { diff --git a/src/app/test/test_manager.cc b/src/app/test/test_manager.cc index 934b6354..50c20685 100644 --- a/src/app/test/test_manager.cc +++ b/src/app/test/test_manager.cc @@ -14,11 +14,11 @@ #include "absl/time/clock.h" #include "absl/time/time.h" #include "app/core/service/screenshot_utils.h" -#include "app/gui/widgets/widget_state_capture.h" +#include "app/gui/automation/widget_state_capture.h" #include "app/core/features.h" #include "util/file_util.h" #include "app/gfx/resource/arena.h" -#include "app/gui/icons.h" +#include "app/gui/core/icons.h" #if defined(YAZE_ENABLE_IMGUI_TEST_ENGINE) && YAZE_ENABLE_IMGUI_TEST_ENGINE #include "imgui.h" #include "imgui_internal.h" diff --git a/src/app/test/zscustomoverworld_test_suite.h b/src/app/test/zscustomoverworld_test_suite.h index 8f50dd58..ddf35dc3 100644 --- a/src/app/test/zscustomoverworld_test_suite.h +++ b/src/app/test/zscustomoverworld_test_suite.h @@ -7,7 +7,7 @@ #include "absl/strings/str_format.h" #include "app/test/test_manager.h" #include "app/rom.h" -#include "app/gui/icons.h" +#include "app/gui/core/icons.h" namespace yaze { namespace test { diff --git a/src/zelda3/screen/inventory.h b/src/zelda3/screen/inventory.h index c78260d6..15264e43 100644 --- a/src/zelda3/screen/inventory.h +++ b/src/zelda3/screen/inventory.h @@ -1,10 +1,11 @@ #ifndef YAZE_APP_ZELDA3_INVENTORY_H #define YAZE_APP_ZELDA3_INVENTORY_H +#include "absl/status/status.h" #include "app/gfx/core/bitmap.h" #include "app/gfx/types/snes_palette.h" #include "app/gfx/types/snes_tile.h" -#include "app/gui/canvas.h" +#include "app/gui/canvas/canvas.h" #include "app/rom.h" namespace yaze { diff --git a/test/integration/editor/editor_integration_test.cc b/test/integration/editor/editor_integration_test.cc index 9dcbbdc5..45deab7e 100644 --- a/test/integration/editor/editor_integration_test.cc +++ b/test/integration/editor/editor_integration_test.cc @@ -5,7 +5,7 @@ #include #include "app/core/window.h" -#include "app/gui/style.h" +#include "app/gui/core/style.h" #include "imgui/backends/imgui_impl_sdl2.h" #include "imgui/backends/imgui_impl_sdlrenderer2.h" #include "imgui/imgui.h" diff --git a/test/test_editor.cc b/test/test_editor.cc index f755fd3f..2c426ec3 100644 --- a/test/test_editor.cc +++ b/test/test_editor.cc @@ -5,7 +5,7 @@ #include "app/core/controller.h" #include "app/core/window.h" #include "app/gfx/backend/sdl2_renderer.h" -#include "app/gui/style.h" +#include "app/gui/core/style.h" #include "imgui/backends/imgui_impl_sdl2.h" #include "imgui/backends/imgui_impl_sdlrenderer2.h" #include "imgui.h" diff --git a/test/unit/gui/canvas_automation_api_test.cc b/test/unit/gui/canvas_automation_api_test.cc index ea647a5c..92215bec 100644 --- a/test/unit/gui/canvas_automation_api_test.cc +++ b/test/unit/gui/canvas_automation_api_test.cc @@ -3,7 +3,7 @@ #include #include -#include "app/gui/canvas.h" +#include "app/gui/canvas/canvas.h" #include "testing.h" namespace yaze { diff --git a/test/unit/gui/canvas_coordinate_sync_test.cc b/test/unit/gui/canvas_coordinate_sync_test.cc index fef5478f..4dc21140 100644 --- a/test/unit/gui/canvas_coordinate_sync_test.cc +++ b/test/unit/gui/canvas_coordinate_sync_test.cc @@ -1,4 +1,4 @@ -#include "app/gui/canvas.h" +#include "app/gui/canvas/canvas.h" #include #include diff --git a/test/unit/gui/tile_selector_widget_test.cc b/test/unit/gui/tile_selector_widget_test.cc index 26038e5e..6dbe6403 100644 --- a/test/unit/gui/tile_selector_widget_test.cc +++ b/test/unit/gui/tile_selector_widget_test.cc @@ -4,7 +4,7 @@ #include #include "app/gfx/core/bitmap.h" -#include "app/gui/canvas.h" +#include "app/gui/canvas/canvas.h" #include "testing.h" namespace yaze {