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:

Public Member Functions

 LayoutManager ()=default
 
 ~LayoutManager ()=default
 
void SetPanelManager (PanelManager *manager)
 Set the panel manager for window title lookups.
 
PanelManagerpanel_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_
 
PanelManagerpanel_manager_ = nullptr
 
LayoutType current_layout_type_ = LayoutType::kDefault
 
bool rebuild_requested_ = false
 
ImGuiID last_dockspace_id_ = 0
 
EditorType current_editor_type_ = EditorType::kUnknown
 

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 50 of file layout_manager.h.

Constructor & Destructor Documentation

◆ LayoutManager()

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

◆ ~LayoutManager()

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

Member Function Documentation

◆ SetPanelManager()

void yaze::editor::LayoutManager::SetPanelManager ( PanelManager * manager)
inline

Set the panel manager for window title lookups.

Parameters
registryPointer to the PanelManager

Definition at line 59 of file layout_manager.h.

References panel_manager_.

◆ panel_manager()

PanelManager * yaze::editor::LayoutManager::panel_manager ( ) const
inline

Get the panel manager.

Returns
Pointer to the PanelManager

Definition at line 67 of file layout_manager.h.

References panel_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 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().

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 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().

Here is the call graph for this function:

◆ SaveCurrentLayout()

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

Save the current layout with a custom name.

Parameters
nameThe name to save the layout under
Todo
[EditorManagerRefactor] Implement layout saving to file

Definition at line 298 of file layout_manager.cc.

References LOG_INFO.

◆ LoadLayout()

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

Load a saved layout by name.

Parameters
nameThe name of the layout to load
Todo
[EditorManagerRefactor] Implement layout loading from file

Definition at line 304 of file layout_manager.cc.

References LOG_INFO.

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

References layouts_initialized_, and LOG_INFO.

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

◆ 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 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().

◆ MarkLayoutInitialized()

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

Mark a layout as initialized.

Parameters
typeThe editor type to mark

Definition at line 321 of file layout_manager.cc.

References layouts_initialized_, and LOG_INFO.

Referenced by InitializeEditorLayout(), and RebuildLayout().

◆ ClearInitializationFlags()

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().

◆ 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 126 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 131 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 141 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 146 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 332 of file layout_manager.cc.

References yaze::editor::PanelManager::GetActiveSessionId(), yaze::editor::PanelManager::GetPanelDescriptor(), yaze::editor::PanelDescriptor::GetWindowTitle(), and panel_manager_.

Here is the call graph for this function:

◆ BuildLayoutFromPreset()

◆ BuildOverworldLayout()

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

Definition at line 286 of file layout_manager.cc.

References BuildLayoutFromPreset(), and yaze::editor::kOverworld.

Here is the call graph for this function:

◆ BuildDungeonLayout()

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

Definition at line 287 of file layout_manager.cc.

References BuildLayoutFromPreset(), and yaze::editor::kDungeon.

Here is the call graph for this function:

◆ BuildGraphicsLayout()

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

Definition at line 288 of file layout_manager.cc.

References BuildLayoutFromPreset(), and yaze::editor::kGraphics.

Here is the call graph for this function:

◆ BuildPaletteLayout()

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

Definition at line 289 of file layout_manager.cc.

References BuildLayoutFromPreset(), and yaze::editor::kPalette.

Here is the call graph for this function:

◆ BuildScreenLayout()

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

Definition at line 290 of file layout_manager.cc.

References BuildLayoutFromPreset(), and yaze::editor::kScreen.

Here is the call graph for this function:

◆ BuildMusicLayout()

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

Definition at line 291 of file layout_manager.cc.

References BuildLayoutFromPreset(), and yaze::editor::kMusic.

Here is the call graph for this function:

◆ BuildSpriteLayout()

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

Definition at line 292 of file layout_manager.cc.

References BuildLayoutFromPreset(), and yaze::editor::kSprite.

Here is the call graph for this function:

◆ BuildMessageLayout()

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

Definition at line 293 of file layout_manager.cc.

References BuildLayoutFromPreset(), and yaze::editor::kMessage.

Here is the call graph for this function:

◆ BuildAssemblyLayout()

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

Definition at line 294 of file layout_manager.cc.

References BuildLayoutFromPreset(), and yaze::editor::kAssembly.

Here is the call graph for this function:

◆ BuildSettingsLayout()

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

Definition at line 295 of file layout_manager.cc.

References BuildLayoutFromPreset(), and yaze::editor::kSettings.

Here is the call graph for this function:

◆ BuildEmulatorLayout()

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

Definition at line 296 of file layout_manager.cc.

References BuildLayoutFromPreset(), and yaze::editor::kEmulator.

Here is the call graph for this function:

Member Data Documentation

◆ layouts_initialized_

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

◆ panel_manager_

PanelManager* yaze::editor::LayoutManager::panel_manager_ = nullptr
private

◆ current_layout_type_

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

Definition at line 179 of file layout_manager.h.

Referenced by GetLayoutType(), and SetLayoutType().

◆ rebuild_requested_

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

Definition at line 182 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 185 of file layout_manager.h.

Referenced by InitializeEditorLayout(), and RebuildLayout().

◆ current_editor_type_

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

Definition at line 188 of file layout_manager.h.

Referenced by InitializeEditorLayout(), and RebuildLayout().


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