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

Facade class that coordinates all layout-related operations. More...

#include <layout_coordinator.h>

Classes

struct  Dependencies
 All dependencies required by LayoutCoordinator. More...
 

Public Member Functions

 LayoutCoordinator ()=default
 
 ~LayoutCoordinator ()=default
 
void Initialize (const Dependencies &deps)
 Initialize with all dependencies.
 
float GetLeftLayoutOffset () const
 Get the left margin needed for sidebar (Activity Bar + Side Panel)
 
float GetRightLayoutOffset () const
 Get the right margin needed for panels.
 
float GetBottomLayoutOffset () const
 Get the bottom margin needed for status bar.
 
void ResetWorkspaceLayout ()
 Reset the workspace layout to defaults.
 
void ApplyLayoutPreset (const std::string &preset_name, size_t session_id)
 Apply a named layout preset.
 
void ResetCurrentEditorLayout (EditorType editor_type, size_t session_id)
 Reset current editor layout to its default configuration.
 
void ProcessLayoutRebuild (EditorType current_editor_type, bool is_emulator_visible)
 Process pending layout rebuild requests.
 
void InitializeEditorLayout (EditorType type)
 Initialize layout for an editor type on first activation.
 
void QueueDeferredAction (std::function< void()> action)
 Queue an action to be executed on the next frame.
 
void ProcessDeferredActions ()
 Process all queued deferred actions.
 
LayoutManagerlayout_manager ()
 
const LayoutManagerlayout_manager () const
 
bool IsInitialized () const
 

Private Attributes

LayoutManagerlayout_manager_ = nullptr
 
PanelManagerpanel_manager_ = nullptr
 
UICoordinatorui_coordinator_ = nullptr
 
ToastManagertoast_manager_ = nullptr
 
StatusBarstatus_bar_ = nullptr
 
RightPanelManagerright_panel_manager_ = nullptr
 
std::vector< std::function< void()> > deferred_actions_
 

Detailed Description

Facade class that coordinates all layout-related operations.

This class extracts layout logic from EditorManager to reduce cognitive complexity. It provides a unified interface for:

  • Layout offset calculations (for dockspace margins)
  • Layout preset application
  • Layout rebuild handling
  • Editor layout initialization

Dependencies are injected to avoid circular includes.

Definition at line 36 of file layout_coordinator.h.

Constructor & Destructor Documentation

◆ LayoutCoordinator()

yaze::editor::LayoutCoordinator::LayoutCoordinator ( )
default

◆ ~LayoutCoordinator()

yaze::editor::LayoutCoordinator::~LayoutCoordinator ( )
default

Member Function Documentation

◆ Initialize()

◆ GetLeftLayoutOffset()

◆ GetRightLayoutOffset()

float yaze::editor::LayoutCoordinator::GetRightLayoutOffset ( ) const

Get the right margin needed for panels.

Returns
Float representing pixel offset

Definition at line 56 of file layout_coordinator.cc.

References yaze::editor::RightPanelManager::GetPanelWidth(), and right_panel_manager_.

Referenced by yaze::editor::EditorManager::GetRightLayoutOffset().

Here is the call graph for this function:

◆ GetBottomLayoutOffset()

float yaze::editor::LayoutCoordinator::GetBottomLayoutOffset ( ) const

Get the bottom margin needed for status bar.

Returns
Float representing pixel offset

Definition at line 60 of file layout_coordinator.cc.

References yaze::editor::StatusBar::GetHeight(), and status_bar_.

Referenced by yaze::editor::EditorManager::GetBottomLayoutOffset().

Here is the call graph for this function:

◆ ResetWorkspaceLayout()

void yaze::editor::LayoutCoordinator::ResetWorkspaceLayout ( )

Reset the workspace layout to defaults.

Clears all layout initialization flags and requests rebuild. Uses the current editor context to determine which layout to rebuild.

Definition at line 68 of file layout_coordinator.cc.

References yaze::editor::LayoutManager::ClearInitializationFlags(), yaze::editor::UICoordinator::IsEmulatorVisible(), yaze::editor::kEmulator, layout_manager_, LOG_INFO, yaze::editor::LayoutManager::RebuildLayout(), yaze::editor::LayoutManager::RequestRebuild(), and ui_coordinator_.

Referenced by yaze::editor::EditorManager::ResetWorkspaceLayout().

Here is the call graph for this function:

◆ ApplyLayoutPreset()

◆ ResetCurrentEditorLayout()

void yaze::editor::LayoutCoordinator::ResetCurrentEditorLayout ( EditorType editor_type,
size_t session_id )

◆ ProcessLayoutRebuild()

void yaze::editor::LayoutCoordinator::ProcessLayoutRebuild ( EditorType current_editor_type,
bool is_emulator_visible )

Process pending layout rebuild requests.

Called from the main update loop. Checks if a rebuild was requested and executes it if we're in a valid ImGui frame scope.

Parameters
current_editor_typeThe currently active editor type
is_emulator_visibleWhether the emulator is currently visible

Definition at line 181 of file layout_coordinator.cc.

References yaze::editor::LayoutManager::ClearRebuildRequest(), yaze::editor::LayoutManager::IsRebuildRequested(), yaze::editor::kEmulator, yaze::editor::kUnknown, layout_manager_, LOG_INFO, and yaze::editor::LayoutManager::RebuildLayout().

Referenced by yaze::editor::EditorManager::Update().

Here is the call graph for this function:

◆ InitializeEditorLayout()

void yaze::editor::LayoutCoordinator::InitializeEditorLayout ( EditorType type)

Initialize layout for an editor type on first activation.

Parameters
typeThe editor type to initialize

This is called when switching to an editor for the first time. Uses deferred action to ensure ImGui context is valid.

Definition at line 213 of file layout_coordinator.cc.

References yaze::editor::LayoutManager::IsLayoutInitialized(), layout_manager_, and QueueDeferredAction().

Here is the call graph for this function:

◆ QueueDeferredAction()

void yaze::editor::LayoutCoordinator::QueueDeferredAction ( std::function< void()> action)

Queue an action to be executed on the next frame.

Parameters
actionThe action to queue

Used for operations that must be deferred (e.g., layout changes during menu rendering).

Definition at line 231 of file layout_coordinator.cc.

References deferred_actions_.

Referenced by InitializeEditorLayout().

◆ ProcessDeferredActions()

void yaze::editor::LayoutCoordinator::ProcessDeferredActions ( )

Process all queued deferred actions.

Should be called at the start of each frame before other updates.

Definition at line 235 of file layout_coordinator.cc.

References deferred_actions_.

Referenced by yaze::editor::EditorManager::Update().

◆ layout_manager() [1/2]

LayoutManager * yaze::editor::LayoutCoordinator::layout_manager ( )
inline

Definition at line 153 of file layout_coordinator.h.

References layout_manager_.

◆ layout_manager() [2/2]

const LayoutManager * yaze::editor::LayoutCoordinator::layout_manager ( ) const
inline

Definition at line 154 of file layout_coordinator.h.

References layout_manager_.

◆ IsInitialized()

bool yaze::editor::LayoutCoordinator::IsInitialized ( ) const
inline

Definition at line 156 of file layout_coordinator.h.

References layout_manager_.

Member Data Documentation

◆ layout_manager_

◆ panel_manager_

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

◆ ui_coordinator_

UICoordinator* yaze::editor::LayoutCoordinator::ui_coordinator_ = nullptr
private

Definition at line 162 of file layout_coordinator.h.

Referenced by GetLeftLayoutOffset(), Initialize(), and ResetWorkspaceLayout().

◆ toast_manager_

ToastManager* yaze::editor::LayoutCoordinator::toast_manager_ = nullptr
private

Definition at line 163 of file layout_coordinator.h.

Referenced by ApplyLayoutPreset(), Initialize(), and ResetCurrentEditorLayout().

◆ status_bar_

StatusBar* yaze::editor::LayoutCoordinator::status_bar_ = nullptr
private

Definition at line 164 of file layout_coordinator.h.

Referenced by GetBottomLayoutOffset(), and Initialize().

◆ right_panel_manager_

RightPanelManager* yaze::editor::LayoutCoordinator::right_panel_manager_ = nullptr
private

Definition at line 165 of file layout_coordinator.h.

Referenced by GetRightLayoutOffset(), and Initialize().

◆ deferred_actions_

std::vector<std::function<void()> > yaze::editor::LayoutCoordinator::deferred_actions_
private

Definition at line 168 of file layout_coordinator.h.

Referenced by ProcessDeferredActions(), and QueueDeferredAction().


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