refactor(editor): remove EditorCardManager references from various editors
- Eliminated the inclusion of EditorCardManager from multiple editor header files, streamlining dependencies and reducing coupling. - Updated comments in PaletteEditor to reflect the transition to EditorCardRegistry for card management. Benefits: - Enhances modularity by decoupling editor components from the centralized card manager. - Improves maintainability and clarity in the codebase by aligning with the new card management approach.
This commit is contained in:
@@ -8,7 +8,6 @@
|
||||
#include "app/editor/editor.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"
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#include "dungeon_object_selector.h"
|
||||
#include "dungeon_room_loader.h"
|
||||
#include "object_editor_card.h"
|
||||
#include "app/gui/app/editor_card_manager.h"
|
||||
#include "zelda3/dungeon/room.h"
|
||||
#include "zelda3/dungeon/room_entrance.h"
|
||||
#include "app/gui/app/editor_layout.h"
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "app/editor/editor.h"
|
||||
#include "app/editor/palette/palette_editor.h"
|
||||
#include "app/gfx/core/bitmap.h"
|
||||
#include "app/gui/app/editor_card_manager.h"
|
||||
#include "app/gfx/types/snes_tile.h"
|
||||
#include "app/gui/canvas/canvas.h"
|
||||
#include "app/gui/app/editor_layout.h"
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "app/editor/editor.h"
|
||||
#include "app/gfx/core/bitmap.h"
|
||||
#include "app/gfx/types/snes_palette.h"
|
||||
#include "app/gui/app/editor_card_manager.h"
|
||||
#include "app/gfx/render/tilemap.h"
|
||||
#include "app/gui/canvas/canvas.h"
|
||||
#include "app/rom.h"
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include "app/editor/editor.h"
|
||||
#include "app/editor/message/message_data.h"
|
||||
#include "app/editor/message/message_preview.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/canvas.h"
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include "app/editor/code/assembly_editor.h"
|
||||
#include "app/editor/editor.h"
|
||||
#include "app/emu/audio/apu.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"
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "app/editor/editor.h"
|
||||
#include "app/editor/graphics/gfx_group_editor.h"
|
||||
#include "app/editor/palette/palette_editor.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"
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "app/gfx/debug/performance/performance_profiler.h"
|
||||
#include "app/gfx/types/snes_palette.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"
|
||||
@@ -185,7 +184,7 @@ absl::Status DisplayPalette(gfx::SnesPalette& palette, bool loaded) {
|
||||
}
|
||||
|
||||
void PaletteEditor::Initialize() {
|
||||
// Register all cards with EditorCardManager (done once during initialization)
|
||||
// Register all cards with EditorCardRegistry (done once during initialization)
|
||||
if (!dependencies_.card_registry) return;
|
||||
auto* card_registry = dependencies_.card_registry;
|
||||
|
||||
@@ -751,9 +750,8 @@ absl::Status PaletteEditor::ResetColorToOriginal(
|
||||
// ============================================================================
|
||||
|
||||
void PaletteEditor::DrawToolset() {
|
||||
// Draw VSCode-style sidebar using EditorCardManager
|
||||
// auto& card_manager = gui::EditorCardManager::Get();
|
||||
// card_manager.DrawSidebar("Palette");
|
||||
// Sidebar is drawn by EditorCardRegistry in EditorManager
|
||||
// Cards registered in Initialize() appear in the sidebar automatically
|
||||
}
|
||||
|
||||
void PaletteEditor::DrawControlPanel() {
|
||||
@@ -936,10 +934,9 @@ void PaletteEditor::DrawControlPanel() {
|
||||
"%s Palette Card Manager", ICON_MD_PALETTE);
|
||||
ImGui::Separator();
|
||||
|
||||
// Use EditorCardManager to draw the menu
|
||||
if (!dependencies_.card_registry) return;
|
||||
auto* card_registry = dependencies_.card_registry;
|
||||
// View menu section now handled by EditorCardRegistry in EditorManager
|
||||
if (!dependencies_.card_registry) return;
|
||||
auto* card_registry = dependencies_.card_registry;
|
||||
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include "absl/status/status.h"
|
||||
#include "app/gfx/types/snes_color.h"
|
||||
#include "app/gfx/types/snes_palette.h"
|
||||
#include "app/gui/app/editor_card_manager.h"
|
||||
#include "app/rom.h"
|
||||
#include "imgui/imgui.h"
|
||||
|
||||
@@ -61,7 +60,7 @@ struct PaletteGroupMetadata {
|
||||
* - Modified state tracking with visual indicators
|
||||
* - Save/discard workflow
|
||||
* - Common toolbar and color picker UI
|
||||
* - EditorCardManager integration
|
||||
* - EditorCardRegistry integration
|
||||
*
|
||||
* Derived classes implement specific grid layouts and palette access.
|
||||
*/
|
||||
@@ -260,9 +259,6 @@ class PaletteGroupCard {
|
||||
bool auto_save_enabled_ = false; // Auto-save to ROM on every change
|
||||
bool show_snes_format_ = true; // Show SNES $xxxx format in info
|
||||
bool show_hex_format_ = true; // Show #xxxxxx hex in info
|
||||
|
||||
// Card registration
|
||||
gui::CardRegistration card_registration_;
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include "app/editor/editor.h"
|
||||
#include "app/editor/sprite/zsprite.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"
|
||||
|
||||
|
||||
@@ -104,8 +104,6 @@ void UICoordinator::DrawAllUI() {
|
||||
// Note: Theme styling is applied by ThemeManager, not here
|
||||
// This is called from EditorManager::Update() - don't call menu bar stuff here
|
||||
|
||||
LOG_INFO("UICoordinator", "DrawAllUI() called");
|
||||
|
||||
// Draw UI windows and dialogs
|
||||
// Session dialogs are drawn by SessionCoordinator separately to avoid duplication
|
||||
DrawCommandPalette(); // Ctrl+Shift+P
|
||||
@@ -114,8 +112,6 @@ void UICoordinator::DrawAllUI() {
|
||||
DrawWelcomeScreen(); // Welcome screen
|
||||
DrawProjectHelp(); // Project help
|
||||
DrawWindowManagementUI(); // Window management
|
||||
|
||||
LOG_INFO("UICoordinator", "DrawAllUI() complete");
|
||||
}
|
||||
|
||||
void UICoordinator::DrawMenuBarExtras() {
|
||||
@@ -291,26 +287,20 @@ void UICoordinator::DrawWelcomeScreen() {
|
||||
return;
|
||||
}
|
||||
|
||||
LOG_INFO("UICoordinator", "Drawing welcome screen (rom_loaded=%s)",
|
||||
rom_is_loaded ? "true" : "false");
|
||||
|
||||
// Reset first show flag to override ImGui ini state
|
||||
// This ensures the window appears even if imgui.ini has it hidden
|
||||
welcome_screen_->ResetFirstShow();
|
||||
|
||||
// Update recent projects before showing
|
||||
welcome_screen_->RefreshRecentProjects();
|
||||
|
||||
// Show the welcome screen (it manages its own ImGui window)
|
||||
// Show the welcome screen window
|
||||
bool is_open = true;
|
||||
bool action_taken = welcome_screen_->Show(&is_open);
|
||||
welcome_screen_->Show(&is_open);
|
||||
|
||||
// If user closed the window via X button, mark as manually closed
|
||||
// If user closed it via X button, respect that
|
||||
if (!is_open) {
|
||||
welcome_screen_manually_closed_ = true;
|
||||
show_welcome_screen_ = false;
|
||||
welcome_screen_->MarkManuallyClosed();
|
||||
LOG_INFO("UICoordinator", "Welcome screen manually closed by user (X button)");
|
||||
welcome_screen_manually_closed_ = true;
|
||||
}
|
||||
|
||||
// If an action was taken (ROM loaded, project opened), the welcome screen will auto-hide
|
||||
@@ -533,8 +523,6 @@ void UICoordinator::DrawTestingUI() {
|
||||
void UICoordinator::DrawCommandPalette() {
|
||||
if (!show_command_palette_) return;
|
||||
|
||||
LOG_INFO("UICoordinator", "DrawCommandPalette() - rendering command palette");
|
||||
|
||||
using namespace ImGui;
|
||||
auto& theme = gui::ThemeManager::Get().GetCurrentTheme();
|
||||
|
||||
|
||||
@@ -92,10 +92,7 @@ class UICoordinator {
|
||||
void HideCurrentEditorCards();
|
||||
void ToggleCardSidebar() { show_card_sidebar_ = !show_card_sidebar_; }
|
||||
void ShowGlobalSearch() { show_global_search_ = true; }
|
||||
void ShowCommandPalette() {
|
||||
LOG_INFO("UICoordinator", "ShowCommandPalette() called - setting flag to true");
|
||||
show_command_palette_ = true;
|
||||
}
|
||||
void ShowCommandPalette() { show_command_palette_ = true; }
|
||||
void ShowCardBrowser() { show_card_browser_ = true; }
|
||||
|
||||
// Window visibility management
|
||||
|
||||
Reference in New Issue
Block a user