yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::editor::LayoutManager Class Reference

Manages ImGui DockBuilder layouts for each editor type. More...

#include <layout_manager.h>

Collaboration diagram for yaze::editor::LayoutManager:

Classes

struct  SessionSnapshot
 

Public Member Functions

 LayoutManager ()=default
 
 ~LayoutManager ()=default
 
void SetWindowManager (WorkspaceWindowManager *manager)
 Set the window manager for window title lookups.
 
WorkspaceWindowManagerwindow_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.
 
absl::Status ApplyDockTree (const layout_designer::DockTree &tree, ImGuiID dockspace_id)
 Apply a DockTree to the given dockspace.
 
void SetMainDockspaceId (ImGuiID id)
 Record the ImGui ID of the main dockspace from its authoring scope.
 
ImGuiID GetMainDockspaceId () const
 Get the cached main dockspace ID.
 
void reset_startup_layout_consumed_for_test ()
 Test-only: reset the one-shot startup-reapply guard so a single test fixture can drive MaybeReapplyStartupLayout through multiple scenarios without standing up a fresh manager each time.
 
bool startup_layout_consumed_for_test () const
 
bool startup_reapply_pending_protection_for_test () const
 
void set_current_editor_type_for_test (EditorType type)
 
absl::Status MaybeReapplyStartupLayout (UserSettings *settings)
 One-shot startup hook that re-applies the user's last applied named layout, if any.
 
absl::StatusOr< layout_designer::DockTreeCaptureDockTree (ImGuiID dockspace_id) const
 Capture the current docking state into a DockTree.
 

Static Public Member Functions

static std::vector< LayoutProfileGetBuiltInProfiles ()
 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_
 
WorkspaceWindowManagerwindow_manager_ = nullptr
 
LayoutType current_layout_type_ = LayoutType::kDefault
 
bool rebuild_requested_ = false
 
ImGuiID last_dockspace_id_ = 0
 
ImGuiID main_dockspace_id_ = 0
 
bool startup_layout_consumed_ = false
 
bool startup_reapply_pending_protection_ = false
 
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, SessionSnapshotnamed_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, LayoutScopelayout_scopes_
 
std::string project_layout_key_
 

Detailed Description

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:

  • Per-editor default layouts (Overworld, Dungeon, Graphics, etc.)
  • Layout persistence and restoration
  • Workspace presets (Developer, Designer, Modder)
  • Dynamic layout initialization on first editor switch
  • Panel manager integration for window title lookups

Definition at line 72 of file layout_manager.h.

Constructor & Destructor Documentation

◆ LayoutManager()

yaze::editor::LayoutManager::LayoutManager ( )
default

◆ ~LayoutManager()

yaze::editor::LayoutManager::~LayoutManager ( )
default

Member Function Documentation

◆ SetWindowManager()

void yaze::editor::LayoutManager::SetWindowManager ( WorkspaceWindowManager * manager)
inline

Set the window manager for window title lookups.

Parameters
managerPointer to the WorkspaceWindowManager

Definition at line 81 of file layout_manager.h.

References window_manager_.

◆ window_manager()

WorkspaceWindowManager * yaze::editor::LayoutManager::window_manager ( ) const
inline

Get the window manager.

Returns
Pointer to the WorkspaceWindowManager

Definition at line 89 of file layout_manager.h.

References window_manager_.

◆ InitializeEditorLayout()

void yaze::editor::LayoutManager::InitializeEditorLayout ( EditorType type,
ImGuiID dockspace_id )

Initialize the default layout for a specific editor type.

Parameters
typeThe editor type to initialize
dockspace_idThe ImGui dockspace ID to build the layout in

Definition at line 170 of file layout_manager.cc.

References BuildLayoutFromPreset(), current_editor_type_, yaze::gui::DockSpaceRenderer::GetLastDockspaceSize(), IsLayoutInitialized(), last_dockspace_id_, LOG_INFO, MarkLayoutInitialized(), startup_reapply_pending_protection_, and window_manager_.

Referenced by yaze::editor::EditorActivator::HandleNonEditorClassSwitch(), and yaze::editor::EditorActivator::InitializeEditorLayout().

Here is the call graph for this function:

◆ RebuildLayout()

void yaze::editor::LayoutManager::RebuildLayout ( EditorType type,
ImGuiID dockspace_id )

Force rebuild of layout for a specific editor type.

Parameters
typeThe editor type to rebuild
dockspace_idThe 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 233 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().

Here is the call graph for this function:

◆ SaveCurrentLayout()

void yaze::editor::LayoutManager::SaveCurrentLayout ( const std::string & name,
bool persist = true )

Save the current layout with a custom name.

Parameters
nameThe name to save the layout under
persistWhether to write the layout to disk

Definition at line 732 of file layout_manager.cc.

References LOG_INFO, and LOG_WARN.

Referenced by yaze::editor::WorkspaceManager::SaveWorkspaceLayout(), and yaze::editor::WorkspaceManager::SaveWorkspacePreset().

◆ LoadLayout()

void yaze::editor::LayoutManager::LoadLayout ( const std::string & name)

Load a saved layout by name.

Parameters
nameThe name of the layout to load

Definition at line 767 of file layout_manager.cc.

References LOG_INFO, and LOG_WARN.

Referenced by yaze::editor::WorkspaceManager::LoadWorkspaceLayout(), and yaze::editor::WorkspaceManager::LoadWorkspacePreset().

◆ CaptureTemporarySessionLayout()

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 802 of file layout_manager.cc.

References LOG_INFO.

◆ RestoreTemporarySessionLayout()

bool yaze::editor::LayoutManager::RestoreTemporarySessionLayout ( size_t session_id,
bool clear_after_restore = false )

Restore the temporary session layout if one has been captured.

Returns
true when a captured layout was restored

Definition at line 827 of file layout_manager.cc.

References LOG_INFO, and LOG_WARN.

◆ HasTemporarySessionLayout()

bool yaze::editor::LayoutManager::HasTemporarySessionLayout ( ) const
inline

Whether a temporary session layout is available.

Definition at line 138 of file layout_manager.h.

References has_temp_session_layout_.

◆ ClearTemporarySessionLayout()

void yaze::editor::LayoutManager::ClearTemporarySessionLayout ( )

Clear temporary session layout snapshot state.

Definition at line 858 of file layout_manager.cc.

◆ SaveNamedSnapshot()

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 866 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.

◆ RestoreNamedSnapshot()

bool yaze::editor::LayoutManager::RestoreNamedSnapshot ( const std::string & name,
size_t session_id,
bool remove_after_restore = false )

◆ DeleteNamedSnapshot()

bool yaze::editor::LayoutManager::DeleteNamedSnapshot ( const std::string & name)

Delete a named snapshot. Returns true if an entry was removed.

Definition at line 913 of file layout_manager.cc.

◆ ListNamedSnapshots()

std::vector< std::string > yaze::editor::LayoutManager::ListNamedSnapshots ( size_t session_id) const

List all named snapshots for the given session.

Definition at line 922 of file layout_manager.cc.

◆ HasNamedSnapshot()

bool yaze::editor::LayoutManager::HasNamedSnapshot ( const std::string & name) const

Whether a named snapshot with the given name exists.

Definition at line 935 of file layout_manager.cc.

◆ DeleteLayout()

bool yaze::editor::LayoutManager::DeleteLayout ( const std::string & name)

Delete a saved layout by name.

Parameters
nameThe name of the layout to delete
Returns
true if layout was deleted, false if not found

Definition at line 939 of file layout_manager.cc.

References LOG_INFO, and LOG_WARN.

◆ GetBuiltInProfiles()

std::vector< LayoutProfile > yaze::editor::LayoutManager::GetBuiltInProfiles ( )
static

Get built-in layout profiles.

Definition at line 964 of file layout_manager.cc.

◆ ApplyBuiltInProfile()

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.

Parameters
profile_idStable profile id from GetBuiltInProfiles()
session_idActive session id
editor_typeCurrent editor type (for context-sensitive profiles)
out_profileOptional resolved profile metadata
Returns
true when a matching profile was applied

Definition at line 989 of file layout_manager.cc.

References yaze::editor::PanelLayoutPreset::default_visible_panels, LOG_INFO, LOG_WARN, and yaze::editor::LayoutProfile::preset_name.

◆ GetSavedLayoutNames()

std::vector< std::string > yaze::editor::LayoutManager::GetSavedLayoutNames ( ) const

Get list of all saved layout names.

Returns
Vector of layout names

Definition at line 1045 of file layout_manager.cc.

◆ HasLayout()

bool yaze::editor::LayoutManager::HasLayout ( const std::string & name) const

Check if a layout exists.

Parameters
nameThe layout name to check
Returns
true if layout exists

Definition at line 1054 of file layout_manager.cc.

Referenced by yaze::editor::WorkspaceManager::LoadWorkspaceLayout(), and yaze::editor::WorkspaceManager::LoadWorkspacePreset().

◆ LoadLayoutsFromDisk()

void yaze::editor::LayoutManager::LoadLayoutsFromDisk ( )

Load layouts for the active scope (global + optional project)

Definition at line 1058 of file layout_manager.cc.

◆ SetProjectLayoutKey()

void yaze::editor::LayoutManager::SetProjectLayoutKey ( const std::string & key)

Set the active project layout key (enables project scope)

Parameters
keyStable project storage key (sanitized)

Definition at line 1070 of file layout_manager.cc.

◆ UseGlobalLayouts()

void yaze::editor::LayoutManager::UseGlobalLayouts ( )

Clear project scope and return to global layouts only.

Definition at line 1079 of file layout_manager.cc.

◆ GetActiveScope()

LayoutScope yaze::editor::LayoutManager::GetActiveScope ( ) const

Get the active layout scope.

Definition at line 1084 of file layout_manager.cc.

◆ ResetToDefaultLayout()

void yaze::editor::LayoutManager::ResetToDefaultLayout ( EditorType type)

Reset the layout for an editor to its default.

Parameters
typeThe editor type to reset

Definition at line 1208 of file layout_manager.cc.

References LOG_INFO.

Referenced by yaze::editor::LayoutCoordinator::ResetCurrentEditorLayout(), and yaze::editor::WorkspaceManager::ResetWorkspaceLayout().

◆ IsLayoutInitialized()

bool yaze::editor::LayoutManager::IsLayoutInitialized ( EditorType type) const

Check if a layout has been initialized for an editor.

Parameters
typeThe editor type to check
Returns
True if layout is initialized

Definition at line 1214 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().

◆ MarkLayoutInitialized()

void yaze::editor::LayoutManager::MarkLayoutInitialized ( EditorType type)

Mark a layout as initialized.

Parameters
typeThe editor type to mark

Definition at line 1219 of file layout_manager.cc.

References LOG_INFO.

Referenced by InitializeEditorLayout(), and RebuildLayout().

◆ ClearInitializationFlags()

void yaze::editor::LayoutManager::ClearInitializationFlags ( )

Clear all initialization flags (for testing)

Definition at line 1225 of file layout_manager.cc.

References LOG_INFO.

Referenced by yaze::editor::LayoutCoordinator::ResetWorkspaceLayout(), and yaze::editor::WorkspaceManager::ResetWorkspaceLayout().

◆ SetLayoutType()

void yaze::editor::LayoutManager::SetLayoutType ( LayoutType type)
inline

Set the current layout type for rebuild.

Parameters
typeThe layout type to set

Definition at line 261 of file layout_manager.h.

References current_layout_type_.

Referenced by yaze::editor::LayoutOrchestrator::ApplyDockLayout().

◆ GetLayoutType()

LayoutType yaze::editor::LayoutManager::GetLayoutType ( ) const
inline

Get the current layout type.

Definition at line 266 of file layout_manager.h.

References current_layout_type_.

◆ RequestRebuild()

◆ IsRebuildRequested()

bool yaze::editor::LayoutManager::IsRebuildRequested ( ) const
inline

Check if rebuild was requested.

Definition at line 276 of file layout_manager.h.

References rebuild_requested_.

Referenced by yaze::editor::LayoutCoordinator::ProcessLayoutRebuild().

◆ ClearRebuildRequest()

void yaze::editor::LayoutManager::ClearRebuildRequest ( )
inline

Clear rebuild request flag.

Definition at line 281 of file layout_manager.h.

References rebuild_requested_.

Referenced by yaze::editor::LayoutCoordinator::ProcessLayoutRebuild().

◆ GetWindowTitle()

std::string yaze::editor::LayoutManager::GetWindowTitle ( const std::string & card_id) const

Get window title for a card ID from registry.

Parameters
card_idThe card ID to look up
Returns
Window title or empty string if not found

Definition at line 1230 of file layout_manager.cc.

◆ ApplyDockTree()

absl::Status yaze::editor::LayoutManager::ApplyDockTree ( const layout_designer::DockTree & tree,
ImGuiID dockspace_id )

Apply a DockTree to the given dockspace.

Removes and rebuilds dockspace_id from scratch, walking the tree and calling DockBuilder{SplitNode,DockWindow,Finish}.

Side effects beyond DockBuilder, added in Phase 8 review (2026-04-24):

  • Calls WorkspaceWindowManager::OpenWindow(panel_id) for every panel referenced in the tree, so the user actually sees the panels they docked rather than empty slots.
  • Marks every EditorType's layout as initialized so the lazy InitializeEditorLayout path in EditorActivator doesn't blow the custom layout away on the first panel-based editor activation. The Layout Designer's apply is an explicit "this is my workspace" — the per-editor preset must yield to it.

Panels in the tree whose panel_id is not registered against the bound WorkspaceWindowManager are skipped with a best-effort fallback that reconstructs the window title from the PanelEntry's cached icon + display_name + id.

Parameters
treeTree to apply. Must pass Validate().
dockspace_idImGui dockspace to rebuild.
Returns
FailedPrecondition when no WorkspaceWindowManager is bound; InvalidArgument when the tree fails validation; OK otherwise.

Definition at line 1390 of file layout_manager.cc.

References yaze::editor::layout_designer::DockTree::root, and yaze::editor::layout_designer::DockTree::Validate().

Referenced by yaze::editor::layout_designer::LayoutDesignerPanel::ApplyCurrentTreeToLiveDockspace(), and yaze::editor::SettingsPanel::ApplyNamedLayoutToDockspace().

Here is the call graph for this function:

◆ SetMainDockspaceId()

void yaze::editor::LayoutManager::SetMainDockspaceId ( ImGuiID id)
inline

Record the ImGui ID of the main dockspace from its authoring scope.

ImGui IDs are salted by the current window's ID stack, so ImGui::GetID("MainDockSpace") only resolves to the live dockspace when called from inside the window that hosts it (see controller.cc::Render). Panels drawn in other windows (e.g. the Layout Designer, which lives in its own PanelWindow) would hash a different ID and end up driving an orphan dock node. The controller calls this setter every frame from the correct scope; consumers read via GetMainDockspaceId().

Definition at line 336 of file layout_manager.h.

References main_dockspace_id_.

◆ GetMainDockspaceId()

ImGuiID yaze::editor::LayoutManager::GetMainDockspaceId ( ) const
inline

Get the cached main dockspace ID.

Returns
The ID cached by SetMainDockspaceId, or 0 before the first frame of the DockSpaceWindow has rendered.

Definition at line 343 of file layout_manager.h.

References main_dockspace_id_.

Referenced by yaze::editor::layout_designer::LayoutDesignerPanel::ApplyCurrentTreeToLiveDockspace(), and yaze::editor::SettingsPanel::ApplyNamedLayoutToDockspace().

◆ reset_startup_layout_consumed_for_test()

void yaze::editor::LayoutManager::reset_startup_layout_consumed_for_test ( )
inline

Test-only: reset the one-shot startup-reapply guard so a single test fixture can drive MaybeReapplyStartupLayout through multiple scenarios without standing up a fresh manager each time.

Definition at line 351 of file layout_manager.h.

References startup_layout_consumed_.

◆ startup_layout_consumed_for_test()

bool yaze::editor::LayoutManager::startup_layout_consumed_for_test ( ) const
inline

Definition at line 354 of file layout_manager.h.

References startup_layout_consumed_.

◆ startup_reapply_pending_protection_for_test()

bool yaze::editor::LayoutManager::startup_reapply_pending_protection_for_test ( ) const
inline

Definition at line 357 of file layout_manager.h.

References startup_reapply_pending_protection_.

◆ set_current_editor_type_for_test()

void yaze::editor::LayoutManager::set_current_editor_type_for_test ( EditorType type)
inline

Definition at line 360 of file layout_manager.h.

References current_editor_type_.

◆ MaybeReapplyStartupLayout()

absl::Status yaze::editor::LayoutManager::MaybeReapplyStartupLayout ( UserSettings * settings)

One-shot startup hook that re-applies the user's last applied named layout, if any.

Drives idempotently from UserSettings::last_applied_layout_name

  • named_layouts. The first frame this is called with a valid main_dockspace_id_ (i.e. after the controller has rendered at least one DockSpaceWindow), the matching layout is parsed, validated, and applied to the live dockspace; subsequent calls are no-ops.

Failure modes are absorbed (logged, internally consumed) rather than propagated, because there is no useful caller-side recovery for "the layout the user picked yesterday no longer parses": the editor falls through to whatever default layout the workspace shell already built. The Status return is for observability and tests.

Skipped paths (return OK, leave the consumed flag clear so the caller can retry next frame):

  • main_dockspace_id_ == 0 (dockspace not bound yet).

Skipped paths (return OK, set consumed):

  • settings == nullptr.
  • last_applied_layout_name is empty.

Failure paths (return error status, set consumed):

  • The named layout is missing from named_layouts.
  • Its body fails to parse / validate.
  • ApplyDockTree returns non-OK.
Parameters
settingsUserSettings to read named_layouts and last_applied_layout_name from. May be null.
Returns
OK on legitimate skip or successful apply; the underlying error otherwise.

Definition at line 1482 of file layout_manager.cc.

References yaze::editor::UserSettings::Preferences::last_applied_layout_name, yaze::util::logf(), yaze::editor::UserSettings::Preferences::named_layouts, and yaze::editor::UserSettings::prefs().

Here is the call graph for this function:

◆ CaptureDockTree()

absl::StatusOr< layout_designer::DockTree > yaze::editor::LayoutManager::CaptureDockTree ( ImGuiID dockspace_id) const

Capture the current docking state into a DockTree.

Walks ImGui's internal dock node tree rooted at dockspace_id and samples splits + leaf windows. Unknown windows (those not registered against the bound WorkspaceWindowManager) are dropped. Split ratios are recovered from measured node sizes; X-axis splits always emit SplitDirection::kLeft and Y-axis splits emit kUp (direction is lossy, since a 0.4 right-placed split is visually identical to a 0.4 left-placed split).

Parameters
dockspace_idImGui dockspace to sample.
Returns
FailedPrecondition when no WorkspaceWindowManager is bound; NotFound when no node exists at dockspace_id; the captured tree otherwise.

Definition at line 1557 of file layout_manager.cc.

References yaze::editor::layout_designer::DockTree::root.

◆ BuildLayoutFromPreset()

void yaze::editor::LayoutManager::BuildLayoutFromPreset ( EditorType type,
ImGuiID dockspace_id )
private

Definition at line 575 of file layout_manager.cc.

References LOG_WARN.

Referenced by InitializeEditorLayout(), and RebuildLayout().

◆ LoadLayoutsFromDiskInternal()

void yaze::editor::LayoutManager::LoadLayoutsFromDiskInternal ( LayoutScope scope,
bool merge )
private

Definition at line 1089 of file layout_manager.cc.

References yaze::Json::contains(), yaze::Json::is_object(), yaze::Json::items(), LOG_INFO, and LOG_WARN.

Here is the call graph for this function:

◆ SaveLayoutsToDisk()

void yaze::editor::LayoutManager::SaveLayoutsToDisk ( LayoutScope scope) const
private

Definition at line 1152 of file layout_manager.cc.

References yaze::Json::dump(), yaze::util::PlatformPaths::EnsureDirectoryExists(), LOG_WARN, and yaze::Json::object().

Here is the call graph for this function:

◆ BuildOverworldLayout()

void yaze::editor::LayoutManager::BuildOverworldLayout ( ImGuiID dockspace_id)
private

Definition at line 698 of file layout_manager.cc.

◆ BuildDungeonLayout()

void yaze::editor::LayoutManager::BuildDungeonLayout ( ImGuiID dockspace_id)
private

Definition at line 701 of file layout_manager.cc.

◆ BuildGraphicsLayout()

void yaze::editor::LayoutManager::BuildGraphicsLayout ( ImGuiID dockspace_id)
private

Definition at line 704 of file layout_manager.cc.

◆ BuildPaletteLayout()

void yaze::editor::LayoutManager::BuildPaletteLayout ( ImGuiID dockspace_id)
private

Definition at line 707 of file layout_manager.cc.

◆ BuildScreenLayout()

void yaze::editor::LayoutManager::BuildScreenLayout ( ImGuiID dockspace_id)
private

Definition at line 710 of file layout_manager.cc.

◆ BuildMusicLayout()

void yaze::editor::LayoutManager::BuildMusicLayout ( ImGuiID dockspace_id)
private

Definition at line 713 of file layout_manager.cc.

◆ BuildSpriteLayout()

void yaze::editor::LayoutManager::BuildSpriteLayout ( ImGuiID dockspace_id)
private

Definition at line 716 of file layout_manager.cc.

◆ BuildMessageLayout()

void yaze::editor::LayoutManager::BuildMessageLayout ( ImGuiID dockspace_id)
private

Definition at line 719 of file layout_manager.cc.

◆ BuildAssemblyLayout()

void yaze::editor::LayoutManager::BuildAssemblyLayout ( ImGuiID dockspace_id)
private

Definition at line 722 of file layout_manager.cc.

◆ BuildSettingsLayout()

void yaze::editor::LayoutManager::BuildSettingsLayout ( ImGuiID dockspace_id)
private

Definition at line 725 of file layout_manager.cc.

◆ BuildEmulatorLayout()

void yaze::editor::LayoutManager::BuildEmulatorLayout ( ImGuiID dockspace_id)
private

Definition at line 728 of file layout_manager.cc.

Member Data Documentation

◆ layouts_initialized_

std::unordered_map<EditorType, bool> yaze::editor::LayoutManager::layouts_initialized_
private

Definition at line 442 of file layout_manager.h.

Referenced by RebuildLayout().

◆ window_manager_

WorkspaceWindowManager* yaze::editor::LayoutManager::window_manager_ = nullptr
private

◆ current_layout_type_

LayoutType yaze::editor::LayoutManager::current_layout_type_ = LayoutType::kDefault
private

Definition at line 448 of file layout_manager.h.

Referenced by GetLayoutType(), and SetLayoutType().

◆ rebuild_requested_

bool yaze::editor::LayoutManager::rebuild_requested_ = false
private

Definition at line 451 of file layout_manager.h.

Referenced by ClearRebuildRequest(), IsRebuildRequested(), and RequestRebuild().

◆ last_dockspace_id_

ImGuiID yaze::editor::LayoutManager::last_dockspace_id_ = 0
private

Definition at line 454 of file layout_manager.h.

Referenced by InitializeEditorLayout(), and RebuildLayout().

◆ main_dockspace_id_

ImGuiID yaze::editor::LayoutManager::main_dockspace_id_ = 0
private

Definition at line 459 of file layout_manager.h.

Referenced by GetMainDockspaceId(), and SetMainDockspaceId().

◆ startup_layout_consumed_

bool yaze::editor::LayoutManager::startup_layout_consumed_ = false
private

◆ startup_reapply_pending_protection_

bool yaze::editor::LayoutManager::startup_reapply_pending_protection_ = false
private

◆ current_editor_type_

EditorType yaze::editor::LayoutManager::current_editor_type_ = EditorType::kUnknown
private

◆ saved_layouts_

std::unordered_map<std::string, std::unordered_map<std::string, bool> > yaze::editor::LayoutManager::saved_layouts_
private

Definition at line 481 of file layout_manager.h.

◆ has_temp_session_layout_

bool yaze::editor::LayoutManager::has_temp_session_layout_ = false
private

Definition at line 484 of file layout_manager.h.

Referenced by HasTemporarySessionLayout().

◆ temp_session_id_

size_t yaze::editor::LayoutManager::temp_session_id_ = 0
private

Definition at line 485 of file layout_manager.h.

◆ temp_session_visibility_

std::unordered_map<std::string, bool> yaze::editor::LayoutManager::temp_session_visibility_
private

Definition at line 486 of file layout_manager.h.

◆ temp_session_pinned_

std::unordered_map<std::string, bool> yaze::editor::LayoutManager::temp_session_pinned_
private

Definition at line 487 of file layout_manager.h.

◆ temp_session_imgui_layout_

std::string yaze::editor::LayoutManager::temp_session_imgui_layout_
private

Definition at line 488 of file layout_manager.h.

◆ named_snapshots_

std::unordered_map<std::string, SessionSnapshot> yaze::editor::LayoutManager::named_snapshots_
private

Definition at line 498 of file layout_manager.h.

◆ saved_imgui_layouts_

std::unordered_map<std::string, std::string> yaze::editor::LayoutManager::saved_imgui_layouts_
private

Definition at line 501 of file layout_manager.h.

◆ saved_pinned_layouts_

std::unordered_map<std::string, std::unordered_map<std::string, bool> > yaze::editor::LayoutManager::saved_pinned_layouts_
private

Definition at line 505 of file layout_manager.h.

◆ layout_scopes_

std::unordered_map<std::string, LayoutScope> yaze::editor::LayoutManager::layout_scopes_
private

Definition at line 508 of file layout_manager.h.

◆ project_layout_key_

std::string yaze::editor::LayoutManager::project_layout_key_
private

Definition at line 511 of file layout_manager.h.


The documentation for this class was generated from the following files: