2026-04-25 22:11:47 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
2026-04-26 16:27:13 +08:00
|
|
|
#include <XCEditor/Windowing/System/EditorWindowSynchronizationPlan.h>
|
2026-04-26 16:01:07 +08:00
|
|
|
#include <XCEditor/Workspace/UIEditorWorkspaceController.h>
|
2026-04-26 12:23:16 +08:00
|
|
|
#include <XCEditor/Workspace/UIEditorWindowWorkspaceController.h>
|
2026-04-25 22:11:47 +08:00
|
|
|
|
2026-04-26 12:23:16 +08:00
|
|
|
#include <memory>
|
2026-04-25 22:11:47 +08:00
|
|
|
#include <string>
|
|
|
|
|
#include <string_view>
|
2026-04-26 16:27:13 +08:00
|
|
|
#include <vector>
|
2026-04-25 22:11:47 +08:00
|
|
|
|
2026-04-26 12:23:16 +08:00
|
|
|
namespace XCEngine::UI::Editor {
|
|
|
|
|
|
|
|
|
|
class EditorWindowWorkspaceStore;
|
2026-04-25 22:11:47 +08:00
|
|
|
|
|
|
|
|
class EditorWindowSystem final {
|
|
|
|
|
public:
|
|
|
|
|
explicit EditorWindowSystem(UIEditorPanelRegistry panelRegistry);
|
2026-04-26 12:23:16 +08:00
|
|
|
~EditorWindowSystem();
|
|
|
|
|
|
|
|
|
|
EditorWindowSystem(const EditorWindowSystem&) = delete;
|
|
|
|
|
EditorWindowSystem& operator=(const EditorWindowSystem&) = delete;
|
|
|
|
|
EditorWindowSystem(EditorWindowSystem&&) = delete;
|
|
|
|
|
EditorWindowSystem& operator=(EditorWindowSystem&&) = delete;
|
2026-04-25 22:11:47 +08:00
|
|
|
|
|
|
|
|
const UIEditorPanelRegistry& GetPanelRegistry() const;
|
|
|
|
|
|
|
|
|
|
bool BootstrapPrimaryWindow(
|
|
|
|
|
std::string_view primaryWindowId,
|
2026-04-26 13:44:19 +08:00
|
|
|
const UIEditorWindowWorkspaceState& primaryWindowState,
|
2026-04-25 22:11:47 +08:00
|
|
|
std::string& outError);
|
|
|
|
|
|
|
|
|
|
bool ValidateWindowSet(
|
|
|
|
|
const UIEditorWindowWorkspaceSet& windowSet,
|
|
|
|
|
std::string& outError) const;
|
|
|
|
|
bool IsPrimaryWindowId(std::string_view windowId) const;
|
|
|
|
|
|
|
|
|
|
const UIEditorWindowWorkspaceSet& GetWindowSet() const;
|
2026-04-26 11:17:57 +08:00
|
|
|
const UIEditorWindowWorkspaceState* FindWindowState(std::string_view windowId) const;
|
2026-04-26 16:01:07 +08:00
|
|
|
bool TryBuildLiveWindowWorkspaceController(
|
|
|
|
|
std::string_view windowId,
|
|
|
|
|
UIEditorWorkspaceController& outController);
|
2026-04-25 22:11:47 +08:00
|
|
|
UIEditorWindowWorkspaceController BuildWorkspaceMutationController() const;
|
2026-04-26 00:19:58 +08:00
|
|
|
EditorWindowSynchronizationPlan BuildPlanForWindowSet(
|
|
|
|
|
const UIEditorWindowWorkspaceSet& targetWindowSet,
|
|
|
|
|
const std::vector<EditorWindowHostSnapshot>& hostWindows,
|
|
|
|
|
std::wstring_view primaryWindowTitle,
|
|
|
|
|
std::string_view preferredNewWindowId,
|
|
|
|
|
const EditorWindowSynchronizationPlacement& preferredPlacement,
|
|
|
|
|
std::string& outError) const;
|
|
|
|
|
EditorWindowSynchronizationPlan BuildPlanForDestroyedWindow(
|
|
|
|
|
std::string_view windowId,
|
|
|
|
|
const std::vector<EditorWindowHostSnapshot>& hostWindows,
|
|
|
|
|
std::wstring_view primaryWindowTitle,
|
|
|
|
|
std::string& outError) const;
|
|
|
|
|
EditorWindowSynchronizationPlan BuildSynchronizationPlan(
|
|
|
|
|
const EditorWindowSynchronizationPlannerInput& input,
|
|
|
|
|
std::string& outError) const;
|
|
|
|
|
bool CommitSynchronizationPlan(
|
|
|
|
|
const EditorWindowSynchronizationPlan& plan,
|
|
|
|
|
std::string& outError);
|
2026-04-25 22:11:47 +08:00
|
|
|
|
|
|
|
|
UIEditorWindowWorkspaceOperationResult EvaluateDetachPanelToNewWindow(
|
|
|
|
|
std::string_view sourceWindowId,
|
|
|
|
|
std::string_view sourceNodeId,
|
|
|
|
|
std::string_view panelId,
|
|
|
|
|
UIEditorWindowWorkspaceController& outController) const;
|
|
|
|
|
|
|
|
|
|
private:
|
2026-04-26 00:19:58 +08:00
|
|
|
static bool RemoveWindowStateFromSet(
|
|
|
|
|
UIEditorWindowWorkspaceSet& windowSet,
|
|
|
|
|
std::string_view windowId);
|
|
|
|
|
|
2026-04-26 12:23:16 +08:00
|
|
|
std::unique_ptr<EditorWindowWorkspaceStore> m_workspaceStore = {};
|
2026-04-25 22:11:47 +08:00
|
|
|
};
|
|
|
|
|
|
2026-04-26 12:23:16 +08:00
|
|
|
} // namespace XCEngine::UI::Editor
|