1#ifndef YAZE_APP_EDITOR_LAYOUT_LAYOUT_MANAGER_H_
2#define YAZE_APP_EDITOR_LAYOUT_LAYOUT_MANAGER_H_
5#include <unordered_map>
8#include "absl/status/status.h"
9#include "absl/status/statusor.h"
12#include "imgui/imgui.h"
18class WorkspaceWindowManager;
133 bool clear_after_restore =
false);
158 bool remove_after_restore =
false);
210 bool HasLayout(
const std::string& name)
const;
321 ImGuiID dockspace_id);
419 ImGuiID dockspace_id)
const;
480 std::unordered_map<std::string, std::unordered_map<std::string, bool>>
495 std::unordered_map<std::string, bool>
pinned;
504 std::unordered_map<std::string, std::unordered_map<std::string, bool>>
Manages ImGui DockBuilder layouts for each editor type.
void SetLayoutType(LayoutType type)
Set the current layout type for rebuild.
void LoadLayout(const std::string &name)
Load a saved layout by name.
std::string GetWindowTitle(const std::string &card_id) const
Get window title for a card ID from registry.
EditorType current_editor_type_
bool RestoreNamedSnapshot(const std::string &name, size_t session_id, bool remove_after_restore=false)
Restore a named snapshot by name.
void BuildScreenLayout(ImGuiID dockspace_id)
ImGuiID last_dockspace_id_
void BuildPaletteLayout(ImGuiID dockspace_id)
WorkspaceWindowManager * window_manager() const
Get the window manager.
WorkspaceWindowManager * window_manager_
void BuildDungeonLayout(ImGuiID dockspace_id)
void CaptureTemporarySessionLayout(size_t session_id)
Capture the current workspace as a temporary session layout.
void SetProjectLayoutKey(const std::string &key)
Set the active project layout key (enables project scope)
bool DeleteNamedSnapshot(const std::string &name)
Delete a named snapshot. Returns true if an entry was removed.
bool SaveNamedSnapshot(const std::string &name, size_t session_id)
Capture the current workspace under a named, session-scoped slot.
std::unordered_map< std::string, std::unordered_map< std::string, bool > > saved_layouts_
void SaveLayoutsToDisk(LayoutScope scope) const
void BuildGraphicsLayout(ImGuiID dockspace_id)
bool startup_reapply_pending_protection_
absl::Status ApplyDockTree(const layout_designer::DockTree &tree, ImGuiID dockspace_id)
Apply a DockTree to the given dockspace.
void RebuildLayout(EditorType type, ImGuiID dockspace_id)
Force rebuild of layout for a specific editor type.
std::unordered_map< std::string, SessionSnapshot > named_snapshots_
void BuildEmulatorLayout(ImGuiID dockspace_id)
bool startup_layout_consumed_
void LoadLayoutsFromDisk()
Load layouts for the active scope (global + optional project)
void UseGlobalLayouts()
Clear project scope and return to global layouts only.
void BuildAssemblyLayout(ImGuiID dockspace_id)
void ClearInitializationFlags()
Clear all initialization flags (for testing)
LayoutType current_layout_type_
bool HasTemporarySessionLayout() const
Whether a temporary session layout is available.
bool startup_reapply_pending_protection_for_test() const
void BuildMessageLayout(ImGuiID dockspace_id)
void set_current_editor_type_for_test(EditorType type)
bool DeleteLayout(const std::string &name)
Delete a saved layout by name.
bool HasNamedSnapshot(const std::string &name) const
Whether a named snapshot with the given name exists.
absl::StatusOr< layout_designer::DockTree > CaptureDockTree(ImGuiID dockspace_id) const
Capture the current docking state into a DockTree.
std::unordered_map< std::string, std::string > saved_imgui_layouts_
void reset_startup_layout_consumed_for_test()
Test-only: reset the one-shot startup-reapply guard so a single test fixture can drive MaybeReapplySt...
std::vector< std::string > GetSavedLayoutNames() const
Get list of all saved layout names.
std::unordered_map< EditorType, bool > layouts_initialized_
void LoadLayoutsFromDiskInternal(LayoutScope scope, bool merge)
bool IsLayoutInitialized(EditorType type) const
Check if a layout has been initialized for an editor.
LayoutType GetLayoutType() const
Get the current layout type.
bool RestoreTemporarySessionLayout(size_t session_id, bool clear_after_restore=false)
Restore the temporary session layout if one has been captured.
void BuildSettingsLayout(ImGuiID dockspace_id)
std::string temp_session_imgui_layout_
std::unordered_map< std::string, std::unordered_map< std::string, bool > > saved_pinned_layouts_
void ResetToDefaultLayout(EditorType type)
Reset the layout for an editor to its default.
void SetMainDockspaceId(ImGuiID id)
Record the ImGui ID of the main dockspace from its authoring scope.
LayoutScope GetActiveScope() const
Get the active layout scope.
void BuildOverworldLayout(ImGuiID dockspace_id)
void ClearRebuildRequest()
Clear rebuild request flag.
ImGuiID main_dockspace_id_
void ClearTemporarySessionLayout()
Clear temporary session layout snapshot state.
void MarkLayoutInitialized(EditorType type)
Mark a layout as initialized.
void SaveCurrentLayout(const std::string &name, bool persist=true)
Save the current layout with a custom name.
void RequestRebuild()
Request a layout rebuild on next frame.
void SetWindowManager(WorkspaceWindowManager *manager)
Set the window manager for window title lookups.
static std::vector< LayoutProfile > GetBuiltInProfiles()
Get built-in layout profiles.
void InitializeEditorLayout(EditorType type, ImGuiID dockspace_id)
Initialize the default layout for a specific editor type.
bool IsRebuildRequested() const
Check if rebuild was requested.
bool HasLayout(const std::string &name) const
Check if a layout exists.
std::unordered_map< std::string, LayoutScope > layout_scopes_
void BuildLayoutFromPreset(EditorType type, ImGuiID dockspace_id)
void BuildSpriteLayout(ImGuiID dockspace_id)
bool startup_layout_consumed_for_test() const
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 > ListNamedSnapshots(size_t session_id) const
List all named snapshots for the given session.
std::unordered_map< std::string, bool > temp_session_pinned_
void BuildMusicLayout(ImGuiID dockspace_id)
std::string project_layout_key_
absl::Status MaybeReapplyStartupLayout(UserSettings *settings)
One-shot startup hook that re-applies the user's last applied named layout, if any.
bool has_temp_session_layout_
ImGuiID GetMainDockspaceId() const
Get the cached main dockspace ID.
std::unordered_map< std::string, bool > temp_session_visibility_
Manages user preferences and settings persistence.
Central registry for all editor cards with session awareness and dependency injection.
LayoutScope
Storage scope for saved layouts.
LayoutType
Predefined layout types for different editor workflows.
std::unordered_map< std::string, bool > visibility
std::unordered_map< std::string, bool > pinned
Built-in workflow-oriented layout profiles.