Manages ImGui DockBuilder layouts for each editor type. More...
#include <layout_manager.h>

Public Member Functions | |
| LayoutManager ()=default | |
| ~LayoutManager ()=default | |
| void | SetPanelManager (PanelManager *manager) |
| Set the panel manager for window title lookups. | |
| PanelManager * | panel_manager () const |
| Get the panel manager. | |
| void | InitializeEditorLayout (EditorType type, ImGuiID dockspace_id) |
| Initialize the default layout for a specific editor type. | |
| void | RebuildLayout (EditorType type, ImGuiID dockspace_id) |
| Force rebuild of layout for a specific editor type. | |
| void | SaveCurrentLayout (const std::string &name) |
| Save the current layout with a custom name. | |
| void | LoadLayout (const std::string &name) |
| Load a saved layout by name. | |
| void | ResetToDefaultLayout (EditorType type) |
| Reset the layout for an editor to its default. | |
| bool | IsLayoutInitialized (EditorType type) const |
| Check if a layout has been initialized for an editor. | |
| void | MarkLayoutInitialized (EditorType type) |
| Mark a layout as initialized. | |
| void | ClearInitializationFlags () |
| Clear all initialization flags (for testing) | |
| void | SetLayoutType (LayoutType type) |
| Set the current layout type for rebuild. | |
| LayoutType | GetLayoutType () const |
| Get the current layout type. | |
| void | RequestRebuild () |
| Request a layout rebuild on next frame. | |
| bool | IsRebuildRequested () const |
| Check if rebuild was requested. | |
| void | ClearRebuildRequest () |
| Clear rebuild request flag. | |
| std::string | GetWindowTitle (const std::string &card_id) const |
| Get window title for a card ID from registry. | |
Private Member Functions | |
| void | BuildLayoutFromPreset (EditorType type, ImGuiID dockspace_id) |
| void | BuildOverworldLayout (ImGuiID dockspace_id) |
| void | BuildDungeonLayout (ImGuiID dockspace_id) |
| void | BuildGraphicsLayout (ImGuiID dockspace_id) |
| void | BuildPaletteLayout (ImGuiID dockspace_id) |
| void | BuildScreenLayout (ImGuiID dockspace_id) |
| void | BuildMusicLayout (ImGuiID dockspace_id) |
| void | BuildSpriteLayout (ImGuiID dockspace_id) |
| void | BuildMessageLayout (ImGuiID dockspace_id) |
| void | BuildAssemblyLayout (ImGuiID dockspace_id) |
| void | BuildSettingsLayout (ImGuiID dockspace_id) |
| void | BuildEmulatorLayout (ImGuiID dockspace_id) |
Private Attributes | |
| std::unordered_map< EditorType, bool > | layouts_initialized_ |
| PanelManager * | panel_manager_ = nullptr |
| LayoutType | current_layout_type_ = LayoutType::kDefault |
| bool | rebuild_requested_ = false |
| ImGuiID | last_dockspace_id_ = 0 |
| EditorType | current_editor_type_ = EditorType::kUnknown |
Manages ImGui DockBuilder layouts for each editor type.
Provides professional default layouts using ImGui's DockBuilder API, similar to VSCode's workspace layouts. Each editor type has a custom layout optimized for its workflow.
Features:
Definition at line 50 of file layout_manager.h.
|
default |
|
default |
|
inline |
Set the panel manager for window title lookups.
| registry | Pointer to the PanelManager |
Definition at line 59 of file layout_manager.h.
References panel_manager_.
|
inline |
Get the panel manager.
Definition at line 67 of file layout_manager.h.
References panel_manager_.
| void yaze::editor::LayoutManager::InitializeEditorLayout | ( | EditorType | type, |
| ImGuiID | dockspace_id ) |
Initialize the default layout for a specific editor type.
| type | The editor type to initialize |
| dockspace_id | The ImGui dockspace ID to build the layout in |
Definition at line 29 of file layout_manager.cc.
References BuildLayoutFromPreset(), current_editor_type_, IsLayoutInitialized(), last_dockspace_id_, LOG_INFO, MarkLayoutInitialized(), and panel_manager_.
Referenced by yaze::editor::EditorActivator::HandleNonEditorClassSwitch(), and yaze::editor::EditorActivator::InitializeEditorLayout().

| void yaze::editor::LayoutManager::RebuildLayout | ( | EditorType | type, |
| ImGuiID | dockspace_id ) |
Force rebuild of layout for a specific editor type.
| type | The editor type to rebuild |
| dockspace_id | The ImGui dockspace ID to build the layout in |
This method rebuilds the layout even if it was already initialized. Useful for resetting layouts to their default state.
Definition at line 64 of file layout_manager.cc.
References BuildLayoutFromPreset(), current_editor_type_, last_dockspace_id_, layouts_initialized_, LOG_ERROR, LOG_INFO, MarkLayoutInitialized(), and panel_manager_.
Referenced by yaze::editor::LayoutCoordinator::ProcessLayoutRebuild(), and yaze::editor::LayoutCoordinator::ResetWorkspaceLayout().

| void yaze::editor::LayoutManager::SaveCurrentLayout | ( | const std::string & | name | ) |
Save the current layout with a custom name.
| name | The name to save the layout under |
Definition at line 298 of file layout_manager.cc.
References LOG_INFO.
| void yaze::editor::LayoutManager::LoadLayout | ( | const std::string & | name | ) |
Load a saved layout by name.
| name | The name of the layout to load |
Definition at line 304 of file layout_manager.cc.
References LOG_INFO.
| void yaze::editor::LayoutManager::ResetToDefaultLayout | ( | EditorType | type | ) |
Reset the layout for an editor to its default.
| type | The editor type to reset |
Definition at line 310 of file layout_manager.cc.
References layouts_initialized_, and LOG_INFO.
Referenced by yaze::editor::LayoutCoordinator::ResetCurrentEditorLayout().
| bool yaze::editor::LayoutManager::IsLayoutInitialized | ( | EditorType | type | ) | const |
Check if a layout has been initialized for an editor.
| type | The editor type to check |
Definition at line 316 of file layout_manager.cc.
References layouts_initialized_.
Referenced by yaze::editor::EditorActivator::ActivatePanelBasedEditor(), yaze::editor::EditorActivator::HandleNonEditorClassSwitch(), yaze::editor::LayoutCoordinator::InitializeEditorLayout(), yaze::editor::EditorActivator::InitializeEditorLayout(), and InitializeEditorLayout().
| void yaze::editor::LayoutManager::MarkLayoutInitialized | ( | EditorType | type | ) |
Mark a layout as initialized.
| type | The editor type to mark |
Definition at line 321 of file layout_manager.cc.
References layouts_initialized_, and LOG_INFO.
Referenced by InitializeEditorLayout(), and RebuildLayout().
| void yaze::editor::LayoutManager::ClearInitializationFlags | ( | ) |
Clear all initialization flags (for testing)
Definition at line 327 of file layout_manager.cc.
References layouts_initialized_, and LOG_INFO.
Referenced by yaze::editor::LayoutCoordinator::ResetWorkspaceLayout().
|
inline |
Set the current layout type for rebuild.
| type | The layout type to set |
Definition at line 126 of file layout_manager.h.
References current_layout_type_.
Referenced by yaze::editor::LayoutOrchestrator::ApplyDockLayout().
|
inline |
Get the current layout type.
Definition at line 131 of file layout_manager.h.
References current_layout_type_.
|
inline |
Request a layout rebuild on next frame.
Definition at line 136 of file layout_manager.h.
References rebuild_requested_.
Referenced by yaze::editor::LayoutOrchestrator::ApplyDockLayout(), yaze::editor::LayoutCoordinator::ApplyLayoutPreset(), yaze::editor::LayoutOrchestrator::RequestLayoutRebuild(), yaze::editor::LayoutCoordinator::ResetCurrentEditorLayout(), and yaze::editor::LayoutCoordinator::ResetWorkspaceLayout().
|
inline |
Check if rebuild was requested.
Definition at line 141 of file layout_manager.h.
References rebuild_requested_.
Referenced by yaze::editor::LayoutCoordinator::ProcessLayoutRebuild().
|
inline |
Clear rebuild request flag.
Definition at line 146 of file layout_manager.h.
References rebuild_requested_.
Referenced by yaze::editor::LayoutCoordinator::ProcessLayoutRebuild().
| std::string yaze::editor::LayoutManager::GetWindowTitle | ( | const std::string & | card_id | ) | const |
Get window title for a card ID from registry.
| card_id | The card ID to look up |
Definition at line 332 of file layout_manager.cc.
References yaze::editor::PanelManager::GetActiveSessionId(), yaze::editor::PanelManager::GetPanelDescriptor(), yaze::editor::PanelDescriptor::GetWindowTitle(), and panel_manager_.

|
private |
Definition at line 214 of file layout_manager.cc.
References yaze::editor::Bottom, yaze::editor::Center, yaze::editor::PanelManager::GetActiveSessionId(), yaze::editor::LayoutPresets::GetDefaultPreset(), yaze::editor::PanelManager::GetPanelDescriptor(), yaze::editor::PanelDescriptor::GetWindowTitle(), yaze::editor::Left, yaze::editor::LeftBottom, yaze::editor::LeftTop, LOG_WARN, panel_manager_, yaze::editor::Right, yaze::editor::RightBottom, yaze::editor::RightTop, and yaze::editor::Top.
Referenced by BuildAssemblyLayout(), BuildDungeonLayout(), BuildEmulatorLayout(), BuildGraphicsLayout(), BuildMessageLayout(), BuildMusicLayout(), BuildOverworldLayout(), BuildPaletteLayout(), BuildScreenLayout(), BuildSettingsLayout(), BuildSpriteLayout(), InitializeEditorLayout(), and RebuildLayout().

|
private |
Definition at line 286 of file layout_manager.cc.
References BuildLayoutFromPreset(), and yaze::editor::kOverworld.

|
private |
Definition at line 287 of file layout_manager.cc.
References BuildLayoutFromPreset(), and yaze::editor::kDungeon.

|
private |
Definition at line 288 of file layout_manager.cc.
References BuildLayoutFromPreset(), and yaze::editor::kGraphics.

|
private |
Definition at line 289 of file layout_manager.cc.
References BuildLayoutFromPreset(), and yaze::editor::kPalette.

|
private |
Definition at line 290 of file layout_manager.cc.
References BuildLayoutFromPreset(), and yaze::editor::kScreen.

|
private |
Definition at line 291 of file layout_manager.cc.
References BuildLayoutFromPreset(), and yaze::editor::kMusic.

|
private |
Definition at line 292 of file layout_manager.cc.
References BuildLayoutFromPreset(), and yaze::editor::kSprite.

|
private |
Definition at line 293 of file layout_manager.cc.
References BuildLayoutFromPreset(), and yaze::editor::kMessage.

|
private |
Definition at line 294 of file layout_manager.cc.
References BuildLayoutFromPreset(), and yaze::editor::kAssembly.

|
private |
Definition at line 295 of file layout_manager.cc.
References BuildLayoutFromPreset(), and yaze::editor::kSettings.

|
private |
Definition at line 296 of file layout_manager.cc.
References BuildLayoutFromPreset(), and yaze::editor::kEmulator.

|
private |
Definition at line 173 of file layout_manager.h.
Referenced by ClearInitializationFlags(), IsLayoutInitialized(), MarkLayoutInitialized(), RebuildLayout(), and ResetToDefaultLayout().
|
private |
Definition at line 176 of file layout_manager.h.
Referenced by BuildLayoutFromPreset(), GetWindowTitle(), InitializeEditorLayout(), panel_manager(), RebuildLayout(), and SetPanelManager().
|
private |
Definition at line 179 of file layout_manager.h.
Referenced by GetLayoutType(), and SetLayoutType().
|
private |
Definition at line 182 of file layout_manager.h.
Referenced by ClearRebuildRequest(), IsRebuildRequested(), and RequestRebuild().
|
private |
Definition at line 185 of file layout_manager.h.
Referenced by InitializeEditorLayout(), and RebuildLayout().
|
private |
Definition at line 188 of file layout_manager.h.
Referenced by InitializeEditorLayout(), and RebuildLayout().