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

Classes | |
| struct | SessionSnapshot |
Public Member Functions | |
| LayoutManager ()=default | |
| ~LayoutManager ()=default | |
| void | SetWindowManager (WorkspaceWindowManager *manager) |
| Set the window manager for window title lookups. | |
| WorkspaceWindowManager * | window_manager () const |
| Get the window 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, bool persist=true) |
| Save the current layout with a custom name. | |
| void | LoadLayout (const std::string &name) |
| Load a saved layout by name. | |
| void | CaptureTemporarySessionLayout (size_t session_id) |
| Capture the current workspace as a temporary session layout. | |
| bool | RestoreTemporarySessionLayout (size_t session_id, bool clear_after_restore=false) |
| Restore the temporary session layout if one has been captured. | |
| bool | HasTemporarySessionLayout () const |
| Whether a temporary session layout is available. | |
| void | ClearTemporarySessionLayout () |
| Clear temporary session layout snapshot state. | |
| bool | SaveNamedSnapshot (const std::string &name, size_t session_id) |
| Capture the current workspace under a named, session-scoped slot. | |
| bool | RestoreNamedSnapshot (const std::string &name, size_t session_id, bool remove_after_restore=false) |
| Restore a named snapshot by name. | |
| bool | DeleteNamedSnapshot (const std::string &name) |
| Delete a named snapshot. Returns true if an entry was removed. | |
| std::vector< std::string > | ListNamedSnapshots (size_t session_id) const |
| List all named snapshots for the given session. | |
| bool | HasNamedSnapshot (const std::string &name) const |
| Whether a named snapshot with the given name exists. | |
| bool | DeleteLayout (const std::string &name) |
| Delete a saved layout by name. | |
| bool | ApplyBuiltInProfile (const std::string &profile_id, size_t session_id, EditorType editor_type, LayoutProfile *out_profile=nullptr) |
| Apply a built-in layout profile by profile ID. | |
| std::vector< std::string > | GetSavedLayoutNames () const |
| Get list of all saved layout names. | |
| bool | HasLayout (const std::string &name) const |
| Check if a layout exists. | |
| void | LoadLayoutsFromDisk () |
| Load layouts for the active scope (global + optional project) | |
| void | SetProjectLayoutKey (const std::string &key) |
| Set the active project layout key (enables project scope) | |
| void | UseGlobalLayouts () |
| Clear project scope and return to global layouts only. | |
| LayoutScope | GetActiveScope () const |
| Get the active layout scope. | |
| 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. | |
Static Public Member Functions | |
| static std::vector< LayoutProfile > | GetBuiltInProfiles () |
| Get built-in layout profiles. | |
Private Member Functions | |
| void | BuildLayoutFromPreset (EditorType type, ImGuiID dockspace_id) |
| void | LoadLayoutsFromDiskInternal (LayoutScope scope, bool merge) |
| void | SaveLayoutsToDisk (LayoutScope scope) const |
| 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_ |
| WorkspaceWindowManager * | window_manager_ = nullptr |
| LayoutType | current_layout_type_ = LayoutType::kDefault |
| bool | rebuild_requested_ = false |
| ImGuiID | last_dockspace_id_ = 0 |
| EditorType | current_editor_type_ = EditorType::kUnknown |
| std::unordered_map< std::string, std::unordered_map< std::string, bool > > | saved_layouts_ |
| bool | has_temp_session_layout_ = false |
| size_t | temp_session_id_ = 0 |
| std::unordered_map< std::string, bool > | temp_session_visibility_ |
| std::unordered_map< std::string, bool > | temp_session_pinned_ |
| std::string | temp_session_imgui_layout_ |
| std::unordered_map< std::string, SessionSnapshot > | named_snapshots_ |
| std::unordered_map< std::string, std::string > | saved_imgui_layouts_ |
| std::unordered_map< std::string, std::unordered_map< std::string, bool > > | saved_pinned_layouts_ |
| std::unordered_map< std::string, LayoutScope > | layout_scopes_ |
| std::string | project_layout_key_ |
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 68 of file layout_manager.h.
|
default |
|
default |
|
inline |
Set the window manager for window title lookups.
| manager | Pointer to the WorkspaceWindowManager |
Definition at line 77 of file layout_manager.h.
References window_manager_.
|
inline |
Get the window manager.
Definition at line 85 of file layout_manager.h.
References window_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 167 of file layout_manager.cc.
References BuildLayoutFromPreset(), current_editor_type_, yaze::gui::DockSpaceRenderer::GetLastDockspaceSize(), IsLayoutInitialized(), last_dockspace_id_, LOG_INFO, MarkLayoutInitialized(), and window_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 212 of file layout_manager.cc.
References BuildLayoutFromPreset(), current_editor_type_, yaze::gui::DockSpaceRenderer::GetLastDockspaceSize(), last_dockspace_id_, layouts_initialized_, LOG_ERROR, LOG_INFO, MarkLayoutInitialized(), and window_manager_.
Referenced by yaze::editor::LayoutCoordinator::ProcessLayoutRebuild(), and yaze::editor::LayoutCoordinator::ResetWorkspaceLayout().

| void yaze::editor::LayoutManager::SaveCurrentLayout | ( | const std::string & | name, |
| bool | persist = true ) |
Save the current layout with a custom name.
| name | The name to save the layout under |
| persist | Whether to write the layout to disk |
Definition at line 711 of file layout_manager.cc.
References LOG_INFO, and LOG_WARN.
Referenced by yaze::editor::WorkspaceManager::SaveWorkspaceLayout(), and yaze::editor::WorkspaceManager::SaveWorkspacePreset().
| 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 746 of file layout_manager.cc.
References LOG_INFO, and LOG_WARN.
Referenced by yaze::editor::WorkspaceManager::LoadWorkspaceLayout(), and yaze::editor::WorkspaceManager::LoadWorkspacePreset().
| void yaze::editor::LayoutManager::CaptureTemporarySessionLayout | ( | size_t | session_id | ) |
Capture the current workspace as a temporary session layout.
Temporary layouts are held in memory only and are never persisted to disk.
Definition at line 781 of file layout_manager.cc.
References LOG_INFO.
| bool yaze::editor::LayoutManager::RestoreTemporarySessionLayout | ( | size_t | session_id, |
| bool | clear_after_restore = false ) |
Restore the temporary session layout if one has been captured.
Definition at line 806 of file layout_manager.cc.
|
inline |
Whether a temporary session layout is available.
Definition at line 134 of file layout_manager.h.
References has_temp_session_layout_.
| void yaze::editor::LayoutManager::ClearTemporarySessionLayout | ( | ) |
Clear temporary session layout snapshot state.
Definition at line 837 of file layout_manager.cc.
| bool yaze::editor::LayoutManager::SaveNamedSnapshot | ( | const std::string & | name, |
| size_t | session_id ) |
Capture the current workspace under a named, session-scoped slot.
Named snapshots are held in memory only (never persisted) and identified by the caller-supplied name. Names are used as the stable lookup key; duplicate saves overwrite the existing entry.
Definition at line 845 of file layout_manager.cc.
References yaze::editor::LayoutManager::SessionSnapshot::imgui_layout, LOG_INFO, yaze::editor::LayoutManager::SessionSnapshot::pinned, yaze::editor::LayoutManager::SessionSnapshot::session_id, and yaze::editor::LayoutManager::SessionSnapshot::visibility.
| bool yaze::editor::LayoutManager::RestoreNamedSnapshot | ( | const std::string & | name, |
| size_t | session_id, | ||
| bool | remove_after_restore = false ) |
Restore a named snapshot by name.
Definition at line 865 of file layout_manager.cc.
References yaze::editor::LayoutManager::SessionSnapshot::imgui_layout, yaze::editor::LayoutManager::SessionSnapshot::pinned, yaze::editor::LayoutManager::SessionSnapshot::session_id, and yaze::editor::LayoutManager::SessionSnapshot::visibility.
| bool yaze::editor::LayoutManager::DeleteNamedSnapshot | ( | const std::string & | name | ) |
Delete a named snapshot. Returns true if an entry was removed.
Definition at line 892 of file layout_manager.cc.
| std::vector< std::string > yaze::editor::LayoutManager::ListNamedSnapshots | ( | size_t | session_id | ) | const |
List all named snapshots for the given session.
Definition at line 901 of file layout_manager.cc.
| bool yaze::editor::LayoutManager::HasNamedSnapshot | ( | const std::string & | name | ) | const |
Whether a named snapshot with the given name exists.
Definition at line 914 of file layout_manager.cc.
| bool yaze::editor::LayoutManager::DeleteLayout | ( | const std::string & | name | ) |
Delete a saved layout by name.
| name | The name of the layout to delete |
Definition at line 918 of file layout_manager.cc.
|
static |
Get built-in layout profiles.
Definition at line 943 of file layout_manager.cc.
| bool yaze::editor::LayoutManager::ApplyBuiltInProfile | ( | const std::string & | profile_id, |
| size_t | session_id, | ||
| EditorType | editor_type, | ||
| LayoutProfile * | out_profile = nullptr ) |
Apply a built-in layout profile by profile ID.
| profile_id | Stable profile id from GetBuiltInProfiles() |
| session_id | Active session id |
| editor_type | Current editor type (for context-sensitive profiles) |
| out_profile | Optional resolved profile metadata |
Definition at line 968 of file layout_manager.cc.
References yaze::editor::PanelLayoutPreset::default_visible_panels, LOG_INFO, LOG_WARN, and yaze::editor::LayoutProfile::preset_name.
| std::vector< std::string > yaze::editor::LayoutManager::GetSavedLayoutNames | ( | ) | const |
Get list of all saved layout names.
Definition at line 1024 of file layout_manager.cc.
| bool yaze::editor::LayoutManager::HasLayout | ( | const std::string & | name | ) | const |
Check if a layout exists.
| name | The layout name to check |
Definition at line 1033 of file layout_manager.cc.
Referenced by yaze::editor::WorkspaceManager::LoadWorkspaceLayout(), and yaze::editor::WorkspaceManager::LoadWorkspacePreset().
| void yaze::editor::LayoutManager::LoadLayoutsFromDisk | ( | ) |
Load layouts for the active scope (global + optional project)
Definition at line 1037 of file layout_manager.cc.
| void yaze::editor::LayoutManager::SetProjectLayoutKey | ( | const std::string & | key | ) |
Set the active project layout key (enables project scope)
| key | Stable project storage key (sanitized) |
Definition at line 1049 of file layout_manager.cc.
| void yaze::editor::LayoutManager::UseGlobalLayouts | ( | ) |
Clear project scope and return to global layouts only.
Definition at line 1058 of file layout_manager.cc.
| LayoutScope yaze::editor::LayoutManager::GetActiveScope | ( | ) | const |
Get the active layout scope.
Definition at line 1063 of file layout_manager.cc.
| 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 1187 of file layout_manager.cc.
References LOG_INFO.
Referenced by yaze::editor::LayoutCoordinator::ResetCurrentEditorLayout(), and yaze::editor::WorkspaceManager::ResetWorkspaceLayout().
| 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 1193 of file layout_manager.cc.
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 1198 of file layout_manager.cc.
References LOG_INFO.
Referenced by InitializeEditorLayout(), and RebuildLayout().
| void yaze::editor::LayoutManager::ClearInitializationFlags | ( | ) |
Clear all initialization flags (for testing)
Definition at line 1204 of file layout_manager.cc.
References LOG_INFO.
Referenced by yaze::editor::LayoutCoordinator::ResetWorkspaceLayout(), and yaze::editor::WorkspaceManager::ResetWorkspaceLayout().
|
inline |
Set the current layout type for rebuild.
| type | The layout type to set |
Definition at line 257 of file layout_manager.h.
References current_layout_type_.
Referenced by yaze::editor::LayoutOrchestrator::ApplyDockLayout().
|
inline |
Get the current layout type.
Definition at line 262 of file layout_manager.h.
References current_layout_type_.
|
inline |
Request a layout rebuild on next frame.
Definition at line 267 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(), yaze::editor::LayoutCoordinator::ResetWorkspaceLayout(), and yaze::editor::WorkspaceManager::ResetWorkspaceLayout().
|
inline |
Check if rebuild was requested.
Definition at line 272 of file layout_manager.h.
References rebuild_requested_.
Referenced by yaze::editor::LayoutCoordinator::ProcessLayoutRebuild().
|
inline |
Clear rebuild request flag.
Definition at line 277 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 1209 of file layout_manager.cc.
|
private |
Definition at line 554 of file layout_manager.cc.
References LOG_WARN.
Referenced by InitializeEditorLayout(), and RebuildLayout().
|
private |
Definition at line 1068 of file layout_manager.cc.
References yaze::Json::contains(), yaze::Json::is_object(), yaze::Json::items(), LOG_INFO, and LOG_WARN.

|
private |
Definition at line 1131 of file layout_manager.cc.
References yaze::Json::dump(), yaze::util::PlatformPaths::EnsureDirectoryExists(), LOG_WARN, and yaze::Json::object().

|
private |
Definition at line 677 of file layout_manager.cc.
|
private |
Definition at line 680 of file layout_manager.cc.
|
private |
Definition at line 683 of file layout_manager.cc.
|
private |
Definition at line 686 of file layout_manager.cc.
|
private |
Definition at line 689 of file layout_manager.cc.
|
private |
Definition at line 692 of file layout_manager.cc.
|
private |
Definition at line 695 of file layout_manager.cc.
|
private |
Definition at line 698 of file layout_manager.cc.
|
private |
Definition at line 701 of file layout_manager.cc.
|
private |
Definition at line 704 of file layout_manager.cc.
|
private |
Definition at line 707 of file layout_manager.cc.
|
private |
Definition at line 307 of file layout_manager.h.
Referenced by RebuildLayout().
|
private |
Definition at line 310 of file layout_manager.h.
Referenced by InitializeEditorLayout(), RebuildLayout(), SetWindowManager(), and window_manager().
|
private |
Definition at line 313 of file layout_manager.h.
Referenced by GetLayoutType(), and SetLayoutType().
|
private |
Definition at line 316 of file layout_manager.h.
Referenced by ClearRebuildRequest(), IsRebuildRequested(), and RequestRebuild().
|
private |
Definition at line 319 of file layout_manager.h.
Referenced by InitializeEditorLayout(), and RebuildLayout().
|
private |
Definition at line 322 of file layout_manager.h.
Referenced by InitializeEditorLayout(), and RebuildLayout().
|
private |
Definition at line 326 of file layout_manager.h.
|
private |
Definition at line 329 of file layout_manager.h.
Referenced by HasTemporarySessionLayout().
|
private |
Definition at line 330 of file layout_manager.h.
|
private |
Definition at line 331 of file layout_manager.h.
|
private |
Definition at line 332 of file layout_manager.h.
|
private |
Definition at line 333 of file layout_manager.h.
|
private |
Definition at line 343 of file layout_manager.h.
|
private |
Definition at line 346 of file layout_manager.h.
|
private |
Definition at line 350 of file layout_manager.h.
|
private |
Definition at line 353 of file layout_manager.h.
|
private |
Definition at line 356 of file layout_manager.h.