yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
layout_coordinator.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_LAYOUT_LAYOUT_COORDINATOR_H_
2#define YAZE_APP_EDITOR_LAYOUT_LAYOUT_COORDINATOR_H_
3
4#include <atomic>
5#include <functional>
6#include <memory>
7#include <string>
8
9#include "app/editor/editor.h"
13#include "imgui/imgui.h"
14
15namespace yaze {
16namespace editor {
17
18// Forward declarations
19class WorkspaceWindowManager;
20class UICoordinator;
21class ToastManager;
22class StatusBar;
23
38 public:
40 float left_offset = 0.0f;
41 float right_offset = 0.0f;
42 bool side_panels_overlay = false;
43 };
44
57
58 LayoutCoordinator() = default;
59 ~LayoutCoordinator() = default;
60
65 void Initialize(const Dependencies& deps);
66
67 // ==========================================================================
68 // Layout Offset Calculations
69 // ==========================================================================
70
75 float GetLeftLayoutOffset() const;
76
81 float GetRightLayoutOffset() const;
82
84 float viewport_width, float activity_bar_width,
85 float left_side_panel_width, float right_sidebar_width,
86 float right_sidebar_budget_width = -1.0f,
87 float min_canvas_width = 640.0f);
88
93 float GetBottomLayoutOffset() const;
94
95 // ==========================================================================
96 // Layout Operations
97 // ==========================================================================
98
106
112 void ApplyLayoutPreset(const std::string& preset_name, size_t session_id);
113
119 void ResetCurrentEditorLayout(EditorType editor_type, size_t session_id);
120 static std::string DefaultLayoutBackupName(EditorType type);
121 bool HasPreviousEditorLayout(EditorType type) const;
123
124 // ==========================================================================
125 // Layout Rebuild Handling
126 // ==========================================================================
127
137 void ProcessLayoutRebuild(EditorType current_editor_type,
138 bool is_emulator_visible);
139
148
156 void QueueDeferredAction(std::function<void()> action);
157
164
169 return pending_deferred_actions_.load(std::memory_order_relaxed);
170 }
171
172 // ==========================================================================
173 // Accessors
174 // ==========================================================================
175
178
179 bool IsInitialized() const { return layout_manager_ != nullptr; }
180
181 private:
182 WorkspaceChromeBudget GetWorkspaceChromeBudget() const;
183
184 // Dependencies (injected)
191
192 // Deferred action queue
193 std::vector<std::function<void()>> deferred_actions_;
194 std::atomic<int> pending_deferred_actions_{0};
195};
196
197} // namespace editor
198} // namespace yaze
199
200#endif // YAZE_APP_EDITOR_LAYOUT_LAYOUT_COORDINATOR_H_
Facade class that coordinates all layout-related operations.
bool RestorePreviousEditorLayout(EditorType type)
std::vector< std::function< void()> > deferred_actions_
void QueueDeferredAction(std::function< void()> action)
Queue an action to be executed on the next frame.
static std::string DefaultLayoutBackupName(EditorType type)
void ProcessDeferredActions()
Process all queued deferred actions.
WorkspaceChromeBudget GetWorkspaceChromeBudget() const
float GetBottomLayoutOffset() const
Get the bottom margin needed for status bar.
static WorkspaceChromeBudget ResolveWorkspaceChromeBudget(float viewport_width, float activity_bar_width, float left_side_panel_width, float right_sidebar_width, float right_sidebar_budget_width=-1.0f, float min_canvas_width=640.0f)
bool HasPreviousEditorLayout(EditorType type) const
void ResetWorkspaceLayout()
Reset the workspace layout to defaults.
void ProcessLayoutRebuild(EditorType current_editor_type, bool is_emulator_visible)
Process pending layout rebuild requests.
RightDrawerManager * right_drawer_manager_
WorkspaceWindowManager * window_manager_
std::atomic< int > pending_deferred_actions_
void InitializeEditorLayout(EditorType type)
Initialize layout for an editor type on first activation.
float GetRightLayoutOffset() const
Get the right margin needed for drawers.
void ResetCurrentEditorLayout(EditorType editor_type, size_t session_id)
Reset current editor layout to its default configuration.
int PendingDeferredActionCount() const
Approximate pending deferred layout actions for sync diagnostics.
void ApplyLayoutPreset(const std::string &preset_name, size_t session_id)
Apply a named layout preset.
void Initialize(const Dependencies &deps)
Initialize with all dependencies.
const LayoutManager * layout_manager() const
float GetLeftLayoutOffset() const
Get the left margin needed for sidebar (Activity Bar + Side Panel)
Manages ImGui DockBuilder layouts for each editor type.
Manages right-side sliding drawers for agent chat, proposals, settings.
A session-aware status bar displayed at the bottom of the application.
Definition status_bar.h:57
Handles all UI drawing operations and state management.
Central registry for all editor cards with session awareness and dependency injection.
All dependencies required by LayoutCoordinator.