diff --git a/src/app/editor/code/assembly_editor.cc b/src/app/editor/code/assembly_editor.cc index 63ced8bf..622bf057 100644 --- a/src/app/editor/code/assembly_editor.cc +++ b/src/app/editor/code/assembly_editor.cc @@ -218,7 +218,8 @@ void AssemblyEditor::UpdateCodeView() { DrawToolset(); gui::VerticalSpacing(2.0f); - static gui::EditorCard file_browser_card("File Browser", ICON_MD_FOLDER); + // Create session-aware card (non-static for multi-session support) + gui::EditorCard file_browser_card(MakeCardTitle("File Browser").c_str(), ICON_MD_FOLDER); bool file_browser_open = true; if (file_browser_card.Begin(&file_browser_open)) { if (current_folder_.name != "") { @@ -246,7 +247,8 @@ void AssemblyEditor::UpdateCodeView() { continue; } - std::string card_name = files_[file_id]; + // Create session-aware card title for each file + std::string card_name = MakeCardTitle(files_[file_id]); gui::EditorCard file_card(card_name.c_str(), ICON_MD_DESCRIPTION, &open); if (file_card.Begin()) { if (ImGui::IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows)) { diff --git a/src/app/editor/dungeon/dungeon_editor_v2.cc b/src/app/editor/dungeon/dungeon_editor_v2.cc index 495eca48..a0ba5f10 100644 --- a/src/app/editor/dungeon/dungeon_editor_v2.cc +++ b/src/app/editor/dungeon/dungeon_editor_v2.cc @@ -128,14 +128,17 @@ void DungeonEditorV2::DrawLayout() { int room_id = active_rooms_[i]; bool open = true; - std::string card_name_str; - const char* card_name; + // Create session-aware card title + std::string base_name; if (room_id >= 0 && static_cast(room_id) < std::size(zelda3::kRoomNames)) { - card_name_str = absl::StrFormat("%s###RoomCard%d", zelda3::kRoomNames[room_id].data(), room_id); + base_name = absl::StrFormat("%s", zelda3::kRoomNames[room_id].data()); } else { - card_name_str = absl::StrFormat("Room %03X###RoomCard%d", room_id, room_id); + base_name = absl::StrFormat("Room %03X", room_id); } - card_name = card_name_str.c_str(); + + std::string card_name_str = absl::StrFormat("%s###RoomCard%d", + MakeCardTitle(base_name).c_str(), room_id); + const char* card_name = card_name_str.c_str(); gui::EditorCard room_card(card_name, ICON_MD_GRID_ON, &open); if (room_card.Begin()) { diff --git a/src/app/editor/editor.h b/src/app/editor/editor.h index 92d278a5..9ccaf593 100644 --- a/src/app/editor/editor.h +++ b/src/app/editor/editor.h @@ -120,6 +120,14 @@ class Editor { EditorType type_; EditorContext* context_ = nullptr; + // Helper method to create session-aware card titles for multi-session support + std::string MakeCardTitle(const std::string& base_title) const { + if (context_ && context_->session_id > 0) { + return absl::StrFormat("%s [S%zu]", base_title, context_->session_id); + } + return base_title; + } + // Helper method for ROM access with safety check template absl::StatusOr SafeRomAccess(std::function accessor, const std::string& operation = "") const { diff --git a/src/app/editor/graphics/graphics_editor.cc b/src/app/editor/graphics/graphics_editor.cc index 2b774d1a..5da87b93 100644 --- a/src/app/editor/graphics/graphics_editor.cc +++ b/src/app/editor/graphics/graphics_editor.cc @@ -51,10 +51,11 @@ absl::Status GraphicsEditor::Update() { DrawToolset(); gui::VerticalSpacing(2.0f); - static gui::EditorCard sheet_editor_card("Sheet Editor", ICON_MD_EDIT); - static gui::EditorCard sheet_browser_card("Sheet Browser", ICON_MD_VIEW_LIST); - static gui::EditorCard player_anims_card("Player Animations", ICON_MD_PERSON); - static gui::EditorCard prototype_card("Prototype Viewer", ICON_MD_CONSTRUCTION); + // Create session-aware cards (non-static for multi-session support) + gui::EditorCard sheet_editor_card(MakeCardTitle("Sheet Editor").c_str(), ICON_MD_EDIT); + gui::EditorCard sheet_browser_card(MakeCardTitle("Sheet Browser").c_str(), ICON_MD_VIEW_LIST); + gui::EditorCard player_anims_card(MakeCardTitle("Player Animations").c_str(), ICON_MD_PERSON); + gui::EditorCard prototype_card(MakeCardTitle("Prototype Viewer").c_str(), ICON_MD_CONSTRUCTION); if (show_sheet_editor_) { if (sheet_editor_card.Begin(&show_sheet_editor_)) { diff --git a/src/app/editor/graphics/screen_editor.cc b/src/app/editor/graphics/screen_editor.cc index 51d28dd2..918fd529 100644 --- a/src/app/editor/graphics/screen_editor.cc +++ b/src/app/editor/graphics/screen_editor.cc @@ -68,11 +68,12 @@ absl::Status ScreenEditor::Update() { DrawToolset(); gui::VerticalSpacing(2.0f); - static gui::EditorCard dungeon_maps_card("Dungeon Maps", ICON_MD_MAP); - static gui::EditorCard inventory_menu_card("Inventory Menu", ICON_MD_INVENTORY); - static gui::EditorCard overworld_map_card("Overworld Map", ICON_MD_PUBLIC); - static gui::EditorCard title_screen_card("Title Screen", ICON_MD_TITLE); - static gui::EditorCard naming_screen_card("Naming Screen", ICON_MD_EDIT_ATTRIBUTES); + // Create session-aware cards (non-static for multi-session support) + gui::EditorCard dungeon_maps_card(MakeCardTitle("Dungeon Maps").c_str(), ICON_MD_MAP); + gui::EditorCard inventory_menu_card(MakeCardTitle("Inventory Menu").c_str(), ICON_MD_INVENTORY); + gui::EditorCard overworld_map_card(MakeCardTitle("Overworld Map").c_str(), ICON_MD_PUBLIC); + gui::EditorCard title_screen_card(MakeCardTitle("Title Screen").c_str(), ICON_MD_TITLE); + gui::EditorCard naming_screen_card(MakeCardTitle("Naming Screen").c_str(), ICON_MD_EDIT_ATTRIBUTES); if (show_dungeon_maps_) { if (dungeon_maps_card.Begin(&show_dungeon_maps_)) { diff --git a/src/app/editor/overworld/overworld_editor.cc b/src/app/editor/overworld/overworld_editor.cc index c1679f65..f920005e 100644 --- a/src/app/editor/overworld/overworld_editor.cc +++ b/src/app/editor/overworld/overworld_editor.cc @@ -124,18 +124,19 @@ absl::Status OverworldEditor::Update() { DrawToolset(); gui::VerticalSpacing(2.0f); - // Initialize cards on first run - static gui::EditorCard tile16_card("Tile16 Selector", ICON_MD_GRID_3X3); - static gui::EditorCard tile8_card("Tile8 Selector", ICON_MD_GRID_4X4); - static gui::EditorCard area_gfx_card("Area Graphics", ICON_MD_IMAGE); - static gui::EditorCard scratch_card("Scratch Space", ICON_MD_BRUSH); - static gui::EditorCard tile16_editor_card("Tile16 Editor", ICON_MD_GRID_ON); - static gui::EditorCard gfx_groups_card("Graphics Groups", ICON_MD_COLLECTIONS); - static gui::EditorCard usage_stats_card("Usage Statistics", ICON_MD_ANALYTICS); - static gui::EditorCard v3_settings_card("v3 Settings", ICON_MD_TUNE); - static bool cards_initialized = false; + // Create session-aware cards (non-static for multi-session support) + gui::EditorCard tile16_card(MakeCardTitle("Tile16 Selector").c_str(), ICON_MD_GRID_3X3); + gui::EditorCard tile8_card(MakeCardTitle("Tile8 Selector").c_str(), ICON_MD_GRID_4X4); + gui::EditorCard area_gfx_card(MakeCardTitle("Area Graphics").c_str(), ICON_MD_IMAGE); + gui::EditorCard scratch_card(MakeCardTitle("Scratch Space").c_str(), ICON_MD_BRUSH); + gui::EditorCard tile16_editor_card(MakeCardTitle("Tile16 Editor").c_str(), ICON_MD_GRID_ON); + gui::EditorCard gfx_groups_card(MakeCardTitle("Graphics Groups").c_str(), ICON_MD_COLLECTIONS); + gui::EditorCard usage_stats_card(MakeCardTitle("Usage Statistics").c_str(), ICON_MD_ANALYTICS); + gui::EditorCard v3_settings_card(MakeCardTitle("v3 Settings").c_str(), ICON_MD_TUNE); - if (!cards_initialized) { + // Configure card positions (these settings persist via imgui.ini) + static bool cards_configured = false; + if (!cards_configured) { // Position cards for optimal workflow tile16_card.SetDefaultSize(300, 600); tile16_card.SetPosition(gui::EditorCard::Position::Right); @@ -161,7 +162,7 @@ absl::Status OverworldEditor::Update() { v3_settings_card.SetDefaultSize(500, 600); v3_settings_card.SetPosition(gui::EditorCard::Position::Floating); - cards_initialized = true; + cards_configured = true; } // Main canvas (full width when cards are docked) diff --git a/src/app/editor/sprite/sprite_editor.cc b/src/app/editor/sprite/sprite_editor.cc index 0a83c5ac..b15f0604 100644 --- a/src/app/editor/sprite/sprite_editor.cc +++ b/src/app/editor/sprite/sprite_editor.cc @@ -40,8 +40,9 @@ absl::Status SpriteEditor::Update() { DrawToolset(); gui::VerticalSpacing(2.0f); - static gui::EditorCard vanilla_card("Vanilla Sprites", ICON_MD_PEST_CONTROL_RODENT); - static gui::EditorCard custom_card("Custom Sprites", ICON_MD_ADD_MODERATOR); + // Create session-aware cards (non-static for multi-session support) + gui::EditorCard vanilla_card(MakeCardTitle("Vanilla Sprites").c_str(), ICON_MD_PEST_CONTROL_RODENT); + gui::EditorCard custom_card(MakeCardTitle("Custom Sprites").c_str(), ICON_MD_ADD_MODERATOR); if (show_vanilla_editor_) { if (vanilla_card.Begin(&show_vanilla_editor_)) {