From b7bf11001ff686afb930ec0fd89057012326e510 Mon Sep 17 00:00:00 2001 From: ssdfasd <2156608475@qq.com> Date: Sun, 26 Apr 2026 12:23:16 +0800 Subject: [PATCH] refactor(editor/windowing): promote core into XCUIEditorLib --- editor/AGENTS.md | 10 ++++--- editor/CMakeLists.txt | 12 +++++--- editor/app/Bootstrap/Application.cpp | 4 +-- editor/app/Bootstrap/Application.h | 5 ++-- .../Platform/Win32/Windowing/EditorWindow.h | 1 - .../Windowing/EditorWindowHostRuntime.cpp | 3 +- .../Win32/Windowing/EditorWindowHostRuntime.h | 5 +++- .../Content/EditorWindowContentController.h | 2 +- .../Content/EditorWindowContentFactory.cpp | 3 +- .../Content/EditorWindowContentFactory.h | 2 +- ...EditorWorkspaceWindowContentController.cpp | 5 ++-- .../EditorWorkspaceWindowContentController.h | 6 ++-- .../EditorWindowWorkspaceCoordinator.cpp | 4 +-- .../EditorWindowWorkspaceCoordinator.h | 9 ++++-- editor/app/Windowing/EditorWindowManager.h | 2 +- .../Frame/EditorWindowTransferRequests.h | 9 +----- .../Host/EditorWindowHostInterfaces.h | 2 +- .../EditorWindowPresentationPolicy.h | 7 ++--- .../EditorWindowSynchronizationPlan.h | 12 ++++++-- .../XCEditor/Windowing}/EditorWindowSystem.h | 21 +++++++++----- .../EditorWorkspaceWindowProjection.h | 4 +-- .../EditorWindowPresentationPolicy.cpp | 6 ++-- .../EditorWindowSynchronizationPlanner.cpp | 10 +++---- .../EditorWindowSynchronizationPlanner.h | 6 ++-- .../Windowing}/EditorWindowSystem.cpp | 29 ++++++++++--------- .../Windowing}/EditorWindowWorkspaceStore.cpp | 6 ++-- .../Windowing}/EditorWindowWorkspaceStore.h | 5 ++-- tests/UI/Editor/unit/CMakeLists.txt | 7 ----- ..._editor_window_synchronization_planner.cpp | 19 ++++++------ 29 files changed, 116 insertions(+), 100 deletions(-) rename editor/{app/Windowing/System => include/XCEditor/Windowing}/EditorWindowPresentationPolicy.h (85%) rename editor/{app/Windowing/System => include/XCEditor/Windowing}/EditorWindowSynchronizationPlan.h (90%) rename editor/{app/Windowing/System => include/XCEditor/Windowing}/EditorWindowSystem.h (83%) rename editor/{app => include/XCEditor}/Windowing/EditorWorkspaceWindowProjection.h (82%) rename editor/{app/Windowing/System => src/Windowing}/EditorWindowPresentationPolicy.cpp (94%) rename editor/{app/Windowing/System => src/Windowing}/EditorWindowSynchronizationPlanner.cpp (95%) rename editor/{app/Windowing/System => src/Windowing}/EditorWindowSynchronizationPlanner.h (57%) rename editor/{app/Windowing/System => src/Windowing}/EditorWindowSystem.cpp (91%) rename editor/{app/Composition => src/Windowing}/EditorWindowWorkspaceStore.cpp (88%) rename editor/{app/Composition => src/Windowing}/EditorWindowWorkspaceStore.h (90%) diff --git a/editor/AGENTS.md b/editor/AGENTS.md index 55d68a07..47a4cbea 100644 --- a/editor/AGENTS.md +++ b/editor/AGENTS.md @@ -8,8 +8,9 @@ The editor is a two-layer system. - The build shape of `editor/` is `XCUIEditorLib <- XCUIEditorApp`. - `editor/src/**` and `editor/include/XCEditor/**` belong to the framework layer. - `editor/app/**` belongs to the app layer and is compiled directly into `XCUIEditorApp`. -- `app/Windowing`, `app/Platform/Win32`, `app/Rendering`, `app/Composition`, and similar directories are internal partitions inside the app layer. -- Types for multi-window editor authority, Win32 hosting, utility windows, and editor-only rendering stay in `editor/app/**`. +- Platform-neutral windowing authority, planner, projection, and synchronization code now live in `editor/src/Windowing` and `editor/include/XCEditor/Windowing`. +- `app/Windowing` now owns app-side content controllers, coordinators, and frame transfer seams; `app/Platform/Win32` remains the concrete host. +- Win32 hosting, utility windows, and editor-only rendering stay in `editor/app/**`. - `editor/include/XCEditor/**` exposes framework-level APIs only. Architecture shorthand for this repo: @@ -19,7 +20,7 @@ XCUIEditorLib <- XCUIEditorApp ``` -When describing the current architecture, refer to `windowing`, `platform`, `rendering`, and `host` as app-internal partitions unless the build graph itself changes. +When describing the current architecture, treat `XCEditor/Windowing` as framework code and `app/Windowing` / `app/Platform/Win32` as the app-side orchestration and host layers. 这份文档面向在 `editor/` 下工作的 coding agent / 开发者。它描述当前 editor 的真实工程边界、窗口架构和修改约束,不是产品说明。 @@ -307,7 +308,8 @@ Application::Run - `editor/app/Windowing/Content/EditorWindowContentController.h` - `editor/app/Windowing/Content/EditorWorkspaceWindowContentController.*` - `editor/app/Windowing/Frame/EditorWindowFrameOrchestrator.*` -- `editor/app/Windowing/System/EditorWindowSystem.*` +- `editor/include/XCEditor/Windowing/EditorWindowSystem.h` +- `editor/src/Windowing/EditorWindowSystem.cpp` - `editor/app/Platform/Win32/Windowing/EditorWindow.*` - `editor/app/Platform/Win32/Windowing/EditorWindowHostRuntime.*` - `editor/app/Platform/Win32/Windowing/EditorWindowWorkspaceCoordinator.*` diff --git a/editor/CMakeLists.txt b/editor/CMakeLists.txt index 63f162f9..2619374d 100644 --- a/editor/CMakeLists.txt +++ b/editor/CMakeLists.txt @@ -136,6 +136,13 @@ set(XCUI_EDITOR_WIDGET_SUPPORT_SOURCES src/Widgets/UIEditorFieldRowLayout.cpp ) +set(XCUI_EDITOR_WINDOWING_SOURCES + src/Windowing/EditorWindowPresentationPolicy.cpp + src/Windowing/EditorWindowSynchronizationPlanner.cpp + src/Windowing/EditorWindowSystem.cpp + src/Windowing/EditorWindowWorkspaceStore.cpp +) + set(XCUI_EDITOR_SHARED_SOURCES ${XCUI_EDITOR_FOUNDATION_SOURCES} ${XCUI_EDITOR_FIELD_SOURCES} @@ -147,6 +154,7 @@ set(XCUI_EDITOR_SHARED_SOURCES ${XCUI_EDITOR_VIEWPORT_SOURCES} ${XCUI_EDITOR_WORKSPACE_SOURCES} ${XCUI_EDITOR_WIDGET_SUPPORT_SOURCES} + ${XCUI_EDITOR_WINDOWING_SOURCES} ) add_library(XCUIEditorLib STATIC @@ -259,7 +267,6 @@ if(XCENGINE_BUILD_XCUI_EDITOR_APP) ) set(XCUI_EDITOR_APP_WINDOWING_SOURCES - app/Composition/EditorWindowWorkspaceStore.cpp app/Windowing/EditorWindowManager.cpp app/Windowing/Coordinator/EditorWindowLifecycleCoordinator.cpp app/Windowing/Coordinator/EditorUtilityWindowCoordinator.cpp @@ -268,9 +275,6 @@ if(XCENGINE_BUILD_XCUI_EDITOR_APP) app/Windowing/Content/EditorUtilityWindowContentController.cpp app/Windowing/Content/EditorWorkspaceWindowContentController.cpp app/Windowing/Frame/EditorWindowFrameOrchestrator.cpp - app/Windowing/System/EditorWindowPresentationPolicy.cpp - app/Windowing/System/EditorWindowSynchronizationPlanner.cpp - app/Windowing/System/EditorWindowSystem.cpp ) set(XCUI_EDITOR_APP_PLATFORM_SOURCES diff --git a/editor/app/Bootstrap/Application.cpp b/editor/app/Bootstrap/Application.cpp index b0b09bbf..ed758413 100644 --- a/editor/app/Bootstrap/Application.cpp +++ b/editor/app/Bootstrap/Application.cpp @@ -3,12 +3,12 @@ #include "System/SystemInteractionService.h" #include "Composition/EditorContext.h" #include "Windowing/EditorWindowManager.h" -#include "Windowing/System/EditorWindowSystem.h" #include "Platform/Win32/System/Win32SystemInteractionHost.h" #include "Support/EnvironmentFlags.h" #include "Support/ExecutablePath.h" #include +#include #include #include @@ -116,7 +116,7 @@ bool Application::Initialize(HINSTANCE hInstance, int nCmdShow) { m_systemInteractionHost = std::make_unique(); m_editorContext->SetSystemInteractionHost(m_systemInteractionHost.get()); - m_windowSystem = std::make_unique( + m_windowSystem = std::make_unique( m_editorContext->GetShellAsset().panelRegistry); App::EditorWindowHostConfig hostConfig = {}; diff --git a/editor/app/Bootstrap/Application.h b/editor/app/Bootstrap/Application.h index 6c874852..ebb61e81 100644 --- a/editor/app/Bootstrap/Application.h +++ b/editor/app/Bootstrap/Application.h @@ -11,9 +11,10 @@ #include namespace XCEngine::UI::Editor { +class EditorWindowSystem; + namespace App { class EditorContext; -class EditorWindowSystem; class EditorWindowManager; } @@ -51,7 +52,7 @@ private: std::chrono::steady_clock::time_point m_smokeTestStartTime = {}; std::chrono::milliseconds m_smokeTestDuration = std::chrono::milliseconds::zero(); std::unique_ptr m_editorContext = {}; - std::unique_ptr m_windowSystem = {}; + std::unique_ptr m_windowSystem = {}; std::unique_ptr m_windowManager = {}; std::unique_ptr m_systemInteractionHost = {}; int m_smokeTestFrameLimit = 0; diff --git a/editor/app/Platform/Win32/Windowing/EditorWindow.h b/editor/app/Platform/Win32/Windowing/EditorWindow.h index 0821a1f0..55242ad9 100644 --- a/editor/app/Platform/Win32/Windowing/EditorWindow.h +++ b/editor/app/Platform/Win32/Windowing/EditorWindow.h @@ -62,7 +62,6 @@ class EditorWindowMessageDispatcher; class EditorWindowRuntimeController; class EditorWindowWorkspaceCoordinator; class EditorWindowSession; -struct EditorWorkspaceWindowProjection; class EditorWindow final : public EditorHostWindow { public: diff --git a/editor/app/Platform/Win32/Windowing/EditorWindowHostRuntime.cpp b/editor/app/Platform/Win32/Windowing/EditorWindowHostRuntime.cpp index 0d516cd3..51dabe83 100644 --- a/editor/app/Platform/Win32/Windowing/EditorWindowHostRuntime.cpp +++ b/editor/app/Platform/Win32/Windowing/EditorWindowHostRuntime.cpp @@ -11,11 +11,10 @@ #include "Windowing/Coordinator/EditorUtilityWindowCoordinator.h" #include "Windowing/Coordinator/EditorWindowLifecycleCoordinator.h" #include "Windowing/Coordinator/EditorWindowWorkspaceCoordinator.h" -#include "Windowing/System/EditorWindowSystem.h" #include - #include +#include #include #include diff --git a/editor/app/Platform/Win32/Windowing/EditorWindowHostRuntime.h b/editor/app/Platform/Win32/Windowing/EditorWindowHostRuntime.h index dc800111..63e63d6c 100644 --- a/editor/app/Platform/Win32/Windowing/EditorWindowHostRuntime.h +++ b/editor/app/Platform/Win32/Windowing/EditorWindowHostRuntime.h @@ -11,6 +11,10 @@ #include #include +namespace XCEngine::UI::Editor { +class EditorWindowSystem; +} + namespace XCEngine::UI::Editor::App { class EditorContext; @@ -18,7 +22,6 @@ class EditorWindow; class EditorWindowContentController; class EditorWindowContentFactory; class EditorWindowLifecycleCoordinator; -class EditorWindowSystem; class EditorUtilityWindowCoordinator; class EditorWindowWorkspaceCoordinator; struct EditorUtilityWindowDescriptor; diff --git a/editor/app/Windowing/Content/EditorWindowContentController.h b/editor/app/Windowing/Content/EditorWindowContentController.h index 4b616a31..4b7916a7 100644 --- a/editor/app/Windowing/Content/EditorWindowContentController.h +++ b/editor/app/Windowing/Content/EditorWindowContentController.h @@ -1,10 +1,10 @@ #pragma once -#include "Windowing/EditorWorkspaceWindowProjection.h" #include "Windowing/Frame/EditorWindowTransferRequests.h" #include #include +#include #include #include diff --git a/editor/app/Windowing/Content/EditorWindowContentFactory.cpp b/editor/app/Windowing/Content/EditorWindowContentFactory.cpp index 2c6d3b9b..efdbbd88 100644 --- a/editor/app/Windowing/Content/EditorWindowContentFactory.cpp +++ b/editor/app/Windowing/Content/EditorWindowContentFactory.cpp @@ -2,7 +2,8 @@ #include "Windowing/Content/EditorUtilityWindowContentController.h" #include "Windowing/Content/EditorWorkspaceWindowContentController.h" -#include "Windowing/System/EditorWindowSystem.h" + +#include #include diff --git a/editor/app/Windowing/Content/EditorWindowContentFactory.h b/editor/app/Windowing/Content/EditorWindowContentFactory.h index 7eeb94f4..2f9ce9ce 100644 --- a/editor/app/Windowing/Content/EditorWindowContentFactory.h +++ b/editor/app/Windowing/Content/EditorWindowContentFactory.h @@ -5,6 +5,7 @@ namespace XCEngine::UI::Editor { +class EditorWindowSystem; class UIEditorWorkspaceController; } // namespace XCEngine::UI::Editor @@ -12,7 +13,6 @@ class UIEditorWorkspaceController; namespace XCEngine::UI::Editor::App { class EditorWindowContentController; -class EditorWindowSystem; struct EditorUtilityWindowDescriptor; class EditorWindowContentFactory { diff --git a/editor/app/Windowing/Content/EditorWorkspaceWindowContentController.cpp b/editor/app/Windowing/Content/EditorWorkspaceWindowContentController.cpp index 002f668d..c045023b 100644 --- a/editor/app/Windowing/Content/EditorWorkspaceWindowContentController.cpp +++ b/editor/app/Windowing/Content/EditorWorkspaceWindowContentController.cpp @@ -1,9 +1,8 @@ #include "Windowing/Content/EditorWorkspaceWindowContentController.h" -#include "Windowing/System/EditorWindowPresentationPolicy.h" -#include "Windowing/System/EditorWindowSystem.h" - #include +#include +#include #include #include diff --git a/editor/app/Windowing/Content/EditorWorkspaceWindowContentController.h b/editor/app/Windowing/Content/EditorWorkspaceWindowContentController.h index 1075174c..d90b13b1 100644 --- a/editor/app/Windowing/Content/EditorWorkspaceWindowContentController.h +++ b/editor/app/Windowing/Content/EditorWorkspaceWindowContentController.h @@ -8,9 +8,11 @@ #include -namespace XCEngine::UI::Editor::App { - +namespace XCEngine::UI::Editor { class EditorWindowSystem; +} + +namespace XCEngine::UI::Editor::App { class EditorWorkspaceWindowContentController final : public EditorWindowContentController diff --git a/editor/app/Windowing/Coordinator/EditorWindowWorkspaceCoordinator.cpp b/editor/app/Windowing/Coordinator/EditorWindowWorkspaceCoordinator.cpp index 2abef12b..1c6855e1 100644 --- a/editor/app/Windowing/Coordinator/EditorWindowWorkspaceCoordinator.cpp +++ b/editor/app/Windowing/Coordinator/EditorWindowWorkspaceCoordinator.cpp @@ -2,10 +2,10 @@ #include "Windowing/Content/EditorWindowContentController.h" #include "Windowing/Coordinator/EditorWindowLifecycleCoordinator.h" -#include "Windowing/System/EditorWindowPresentationPolicy.h" -#include "Windowing/System/EditorWindowSystem.h" #include +#include +#include #include #include #include diff --git a/editor/app/Windowing/Coordinator/EditorWindowWorkspaceCoordinator.h b/editor/app/Windowing/Coordinator/EditorWindowWorkspaceCoordinator.h index 27e57078..58143130 100644 --- a/editor/app/Windowing/Coordinator/EditorWindowWorkspaceCoordinator.h +++ b/editor/app/Windowing/Coordinator/EditorWindowWorkspaceCoordinator.h @@ -4,11 +4,11 @@ #define NOMINMAX #endif -#include "Windowing/EditorWorkspaceWindowProjection.h" #include "Windowing/Frame/EditorWindowTransferRequests.h" #include "Windowing/Host/EditorWindowHostInterfaces.h" -#include "Windowing/System/EditorWindowSynchronizationPlan.h" +#include +#include #include #include #include @@ -17,10 +17,13 @@ #include #include +namespace XCEngine::UI::Editor { +class EditorWindowSystem; +} + namespace XCEngine::UI::Editor::App { class EditorWindowLifecycleCoordinator; -class EditorWindowSystem; class EditorWindowWorkspaceCoordinator final { public: diff --git a/editor/app/Windowing/EditorWindowManager.h b/editor/app/Windowing/EditorWindowManager.h index 856c14f4..77b8ac9d 100644 --- a/editor/app/Windowing/EditorWindowManager.h +++ b/editor/app/Windowing/EditorWindowManager.h @@ -20,6 +20,7 @@ namespace XCEngine::UI::Editor { class UIEditorWorkspaceController; class UIEditorWindowWorkspaceController; +class EditorWindowSystem; struct UIEditorWindowWorkspaceSet; struct UIEditorWindowWorkspaceState; @@ -29,7 +30,6 @@ struct UIEditorWindowWorkspaceState; namespace XCEngine::UI::Editor::App { class EditorContext; -class EditorWindowSystem; class EditorWindowContentController; class EditorWindowContentFactory; class EditorWindowHostRuntime; diff --git a/editor/app/Windowing/Frame/EditorWindowTransferRequests.h b/editor/app/Windowing/Frame/EditorWindowTransferRequests.h index 2c807743..46afa5e0 100644 --- a/editor/app/Windowing/Frame/EditorWindowTransferRequests.h +++ b/editor/app/Windowing/Frame/EditorWindowTransferRequests.h @@ -7,6 +7,7 @@ #include "Windowing/EditorWindowShared.h" #include "UtilityWindows/EditorUtilityWindowKind.h" +#include #include #include @@ -24,14 +25,6 @@ struct EditorWindowPanelTransferRequest { } }; -struct EditorWindowWorkspaceMutationRequest { - XCEngine::UI::Editor::UIEditorWindowWorkspaceState windowState = {}; - - bool IsValid() const { - return !windowState.windowId.empty(); - } -}; - struct EditorWindowOpenUtilityWindowRequest { EditorUtilityWindowKind kind = EditorUtilityWindowKind::None; EditorWindowScreenPoint screenPoint = {}; diff --git a/editor/app/Windowing/Host/EditorWindowHostInterfaces.h b/editor/app/Windowing/Host/EditorWindowHostInterfaces.h index a1a54f43..5121c006 100644 --- a/editor/app/Windowing/Host/EditorWindowHostInterfaces.h +++ b/editor/app/Windowing/Host/EditorWindowHostInterfaces.h @@ -1,11 +1,11 @@ #pragma once #include "Windowing/EditorWindowShared.h" -#include "Windowing/EditorWorkspaceWindowProjection.h" #include "Windowing/Host/EditorWindowHostTypes.h" #include "Windowing/Host/EditorWindowPointerCapture.h" #include "Windowing/Host/EditorWindowTypes.h" +#include #include #include diff --git a/editor/app/Windowing/System/EditorWindowPresentationPolicy.h b/editor/include/XCEditor/Windowing/EditorWindowPresentationPolicy.h similarity index 85% rename from editor/app/Windowing/System/EditorWindowPresentationPolicy.h rename to editor/include/XCEditor/Windowing/EditorWindowPresentationPolicy.h index a0d0b275..415ad4c7 100644 --- a/editor/app/Windowing/System/EditorWindowPresentationPolicy.h +++ b/editor/include/XCEditor/Windowing/EditorWindowPresentationPolicy.h @@ -1,14 +1,13 @@ #pragma once -#include "Windowing/EditorWorkspaceWindowProjection.h" - +#include #include #include #include #include -namespace XCEngine::UI::Editor::App { +namespace XCEngine::UI::Editor { UIEditorWorkspaceController BuildWorkspaceControllerForWindowState( const UIEditorPanelRegistry& panelRegistry, @@ -26,4 +25,4 @@ std::wstring ResolveEditorWindowPresentationTitle( const UIEditorWindowWorkspaceState& windowState, bool primary); -} // namespace XCEngine::UI::Editor::App +} // namespace XCEngine::UI::Editor diff --git a/editor/app/Windowing/System/EditorWindowSynchronizationPlan.h b/editor/include/XCEditor/Windowing/EditorWindowSynchronizationPlan.h similarity index 90% rename from editor/app/Windowing/System/EditorWindowSynchronizationPlan.h rename to editor/include/XCEditor/Windowing/EditorWindowSynchronizationPlan.h index 3b82aa8b..d35f7745 100644 --- a/editor/app/Windowing/System/EditorWindowSynchronizationPlan.h +++ b/editor/include/XCEditor/Windowing/EditorWindowSynchronizationPlan.h @@ -7,7 +7,15 @@ #include #include -namespace XCEngine::UI::Editor::App { +namespace XCEngine::UI::Editor { + +struct EditorWindowWorkspaceMutationRequest { + UIEditorWindowWorkspaceState windowState = {}; + + bool IsValid() const { + return !windowState.windowId.empty(); + } +}; struct EditorWindowHostSnapshot { std::string windowId = {}; @@ -81,4 +89,4 @@ struct EditorWindowSynchronizationPlannerInput { std::vector hostWindows = {}; }; -} // namespace XCEngine::UI::Editor::App +} // namespace XCEngine::UI::Editor diff --git a/editor/app/Windowing/System/EditorWindowSystem.h b/editor/include/XCEditor/Windowing/EditorWindowSystem.h similarity index 83% rename from editor/app/Windowing/System/EditorWindowSystem.h rename to editor/include/XCEditor/Windowing/EditorWindowSystem.h index fe9475f3..09f1d8a7 100644 --- a/editor/app/Windowing/System/EditorWindowSystem.h +++ b/editor/include/XCEditor/Windowing/EditorWindowSystem.h @@ -1,19 +1,26 @@ #pragma once -#include "Composition/EditorWindowWorkspaceStore.h" -#include "Windowing/Frame/EditorWindowTransferRequests.h" -#include "Windowing/System/EditorWindowSynchronizationPlan.h" - +#include +#include #include +#include #include #include -namespace XCEngine::UI::Editor::App { +namespace XCEngine::UI::Editor { + +class EditorWindowWorkspaceStore; class EditorWindowSystem final { public: explicit EditorWindowSystem(UIEditorPanelRegistry panelRegistry); + ~EditorWindowSystem(); + + EditorWindowSystem(const EditorWindowSystem&) = delete; + EditorWindowSystem& operator=(const EditorWindowSystem&) = delete; + EditorWindowSystem(EditorWindowSystem&&) = delete; + EditorWindowSystem& operator=(EditorWindowSystem&&) = delete; const UIEditorPanelRegistry& GetPanelRegistry() const; @@ -75,7 +82,7 @@ private: UIEditorWindowWorkspaceSet& windowSet, std::string_view windowId); - EditorWindowWorkspaceStore m_workspaceStore; + std::unique_ptr m_workspaceStore = {}; }; -} // namespace XCEngine::UI::Editor::App +} // namespace XCEngine::UI::Editor diff --git a/editor/app/Windowing/EditorWorkspaceWindowProjection.h b/editor/include/XCEditor/Windowing/EditorWorkspaceWindowProjection.h similarity index 82% rename from editor/app/Windowing/EditorWorkspaceWindowProjection.h rename to editor/include/XCEditor/Windowing/EditorWorkspaceWindowProjection.h index 0f9ce22c..518807ce 100644 --- a/editor/app/Windowing/EditorWorkspaceWindowProjection.h +++ b/editor/include/XCEditor/Windowing/EditorWorkspaceWindowProjection.h @@ -4,7 +4,7 @@ #include -namespace XCEngine::UI::Editor::App { +namespace XCEngine::UI::Editor { struct EditorWorkspaceWindowProjection { ::XCEngine::UI::UISize minimumOuterSize = ::XCEngine::UI::UISize(640.0f, 360.0f); @@ -14,4 +14,4 @@ struct EditorWorkspaceWindowProjection { std::wstring windowTitle = {}; }; -} // namespace XCEngine::UI::Editor::App +} // namespace XCEngine::UI::Editor diff --git a/editor/app/Windowing/System/EditorWindowPresentationPolicy.cpp b/editor/src/Windowing/EditorWindowPresentationPolicy.cpp similarity index 94% rename from editor/app/Windowing/System/EditorWindowPresentationPolicy.cpp rename to editor/src/Windowing/EditorWindowPresentationPolicy.cpp index fb04dabe..43201ef8 100644 --- a/editor/app/Windowing/System/EditorWindowPresentationPolicy.cpp +++ b/editor/src/Windowing/EditorWindowPresentationPolicy.cpp @@ -1,8 +1,8 @@ -#include "Windowing/System/EditorWindowPresentationPolicy.h" +#include #include -namespace XCEngine::UI::Editor::App { +namespace XCEngine::UI::Editor { namespace { @@ -66,4 +66,4 @@ std::wstring ResolveEditorWindowPresentationTitle( return std::wstring(decoratedTitle.begin(), decoratedTitle.end()); } -} // namespace XCEngine::UI::Editor::App +} // namespace XCEngine::UI::Editor diff --git a/editor/app/Windowing/System/EditorWindowSynchronizationPlanner.cpp b/editor/src/Windowing/EditorWindowSynchronizationPlanner.cpp similarity index 95% rename from editor/app/Windowing/System/EditorWindowSynchronizationPlanner.cpp rename to editor/src/Windowing/EditorWindowSynchronizationPlanner.cpp index 7898c477..48df68b1 100644 --- a/editor/app/Windowing/System/EditorWindowSynchronizationPlanner.cpp +++ b/editor/src/Windowing/EditorWindowSynchronizationPlanner.cpp @@ -1,12 +1,12 @@ -#include "Windowing/System/EditorWindowSynchronizationPlanner.h" - -#include "Windowing/System/EditorWindowPresentationPolicy.h" +#include "Windowing/EditorWindowSynchronizationPlanner.h" +#include #include #include +#include -namespace XCEngine::UI::Editor::App { +namespace XCEngine::UI::Editor { namespace { @@ -140,4 +140,4 @@ EditorWindowSynchronizationPlan EditorWindowSynchronizationPlanner::Build( return plan; } -} // namespace XCEngine::UI::Editor::App +} // namespace XCEngine::UI::Editor diff --git a/editor/app/Windowing/System/EditorWindowSynchronizationPlanner.h b/editor/src/Windowing/EditorWindowSynchronizationPlanner.h similarity index 57% rename from editor/app/Windowing/System/EditorWindowSynchronizationPlanner.h rename to editor/src/Windowing/EditorWindowSynchronizationPlanner.h index 9489d308..77695384 100644 --- a/editor/app/Windowing/System/EditorWindowSynchronizationPlanner.h +++ b/editor/src/Windowing/EditorWindowSynchronizationPlanner.h @@ -1,8 +1,8 @@ #pragma once -#include "Windowing/System/EditorWindowSynchronizationPlan.h" +#include -namespace XCEngine::UI::Editor::App { +namespace XCEngine::UI::Editor { class EditorWindowSynchronizationPlanner final { public: @@ -10,4 +10,4 @@ public: const EditorWindowSynchronizationPlannerInput& input); }; -} // namespace XCEngine::UI::Editor::App +} // namespace XCEngine::UI::Editor diff --git a/editor/app/Windowing/System/EditorWindowSystem.cpp b/editor/src/Windowing/EditorWindowSystem.cpp similarity index 91% rename from editor/app/Windowing/System/EditorWindowSystem.cpp rename to editor/src/Windowing/EditorWindowSystem.cpp index e6ed6332..6ce13ea6 100644 --- a/editor/app/Windowing/System/EditorWindowSystem.cpp +++ b/editor/src/Windowing/EditorWindowSystem.cpp @@ -1,19 +1,22 @@ -#include "Windowing/System/EditorWindowSystem.h" +#include -#include "Windowing/System/EditorWindowSynchronizationPlanner.h" +#include "Windowing/EditorWindowSynchronizationPlanner.h" +#include "Windowing/EditorWindowWorkspaceStore.h" #include #include #include -namespace XCEngine::UI::Editor::App { +namespace XCEngine::UI::Editor { EditorWindowSystem::EditorWindowSystem(UIEditorPanelRegistry panelRegistry) - : m_workspaceStore(std::move(panelRegistry)) {} + : m_workspaceStore(std::make_unique(std::move(panelRegistry))) {} + +EditorWindowSystem::~EditorWindowSystem() = default; const UIEditorPanelRegistry& EditorWindowSystem::GetPanelRegistry() const { - return m_workspaceStore.GetPanelRegistry(); + return m_workspaceStore->GetPanelRegistry(); } bool EditorWindowSystem::BootstrapPrimaryWindow( @@ -33,21 +36,21 @@ bool EditorWindowSystem::BootstrapPrimaryWindow( primaryWindowState.session = workspaceController.GetSession(); windowSet.windows.push_back(std::move(primaryWindowState)); - return m_workspaceStore.TrySetWindowSet(std::move(windowSet), outError); + return m_workspaceStore->TrySetWindowSet(std::move(windowSet), outError); } bool EditorWindowSystem::ValidateWindowSet( const UIEditorWindowWorkspaceSet& windowSet, std::string& outError) const { - return m_workspaceStore.ValidateWindowSet(windowSet, outError); + return m_workspaceStore->ValidateWindowSet(windowSet, outError); } bool EditorWindowSystem::IsPrimaryWindowId(std::string_view windowId) const { - return m_workspaceStore.IsPrimaryWindowId(windowId); + return m_workspaceStore->IsPrimaryWindowId(windowId); } const UIEditorWindowWorkspaceSet& EditorWindowSystem::GetWindowSet() const { - return m_workspaceStore.GetWindowSet(); + return m_workspaceStore->GetWindowSet(); } const UIEditorWindowWorkspaceState* EditorWindowSystem::FindWindowState( @@ -80,7 +83,7 @@ bool EditorWindowSystem::CommitLiveWindowMutation( existingState->workspace = workspaceController.GetWorkspace(); existingState->session = workspaceController.GetSession(); - return m_workspaceStore.TrySetWindowSet(std::move(nextWindowSet), outError); + return m_workspaceStore->TrySetWindowSet(std::move(nextWindowSet), outError); } EditorWindowSynchronizationPlan EditorWindowSystem::BuildPlanForWindowSet( @@ -233,12 +236,12 @@ bool EditorWindowSystem::CommitSynchronizationPlan( } if (plan.targetWindowSet.windows.empty()) { - m_workspaceStore.ClearWindowSet(); + m_workspaceStore->ClearWindowSet(); outError.clear(); return true; } - return m_workspaceStore.TrySetWindowSet(plan.targetWindowSet, outError); + return m_workspaceStore->TrySetWindowSet(plan.targetWindowSet, outError); } UIEditorWindowWorkspaceOperationResult EditorWindowSystem::EvaluateDetachPanelToNewWindow( @@ -283,4 +286,4 @@ bool EditorWindowSystem::RemoveWindowStateFromSet( return true; } -} // namespace XCEngine::UI::Editor::App +} // namespace XCEngine::UI::Editor diff --git a/editor/app/Composition/EditorWindowWorkspaceStore.cpp b/editor/src/Windowing/EditorWindowWorkspaceStore.cpp similarity index 88% rename from editor/app/Composition/EditorWindowWorkspaceStore.cpp rename to editor/src/Windowing/EditorWindowWorkspaceStore.cpp index 701b2a16..bad32ec2 100644 --- a/editor/app/Composition/EditorWindowWorkspaceStore.cpp +++ b/editor/src/Windowing/EditorWindowWorkspaceStore.cpp @@ -1,9 +1,9 @@ -#include "Composition/EditorWindowWorkspaceStore.h" +#include "Windowing/EditorWindowWorkspaceStore.h" #include #include -namespace XCEngine::UI::Editor::App { +namespace XCEngine::UI::Editor { EditorWindowWorkspaceStore::EditorWindowWorkspaceStore(UIEditorPanelRegistry panelRegistry) : m_panelRegistry(std::move(panelRegistry)) {} @@ -38,4 +38,4 @@ bool EditorWindowWorkspaceStore::IsPrimaryWindowId(std::string_view windowId) co return !windowId.empty() && m_windowSet.primaryWindowId == windowId; } -} // namespace XCEngine::UI::Editor::App +} // namespace XCEngine::UI::Editor diff --git a/editor/app/Composition/EditorWindowWorkspaceStore.h b/editor/src/Windowing/EditorWindowWorkspaceStore.h similarity index 90% rename from editor/app/Composition/EditorWindowWorkspaceStore.h rename to editor/src/Windowing/EditorWindowWorkspaceStore.h index c08cae57..09c380b6 100644 --- a/editor/app/Composition/EditorWindowWorkspaceStore.h +++ b/editor/src/Windowing/EditorWindowWorkspaceStore.h @@ -3,8 +3,9 @@ #include #include +#include -namespace XCEngine::UI::Editor::App { +namespace XCEngine::UI::Editor { class EditorWindowWorkspaceStore final { public: @@ -33,4 +34,4 @@ private: UIEditorWindowWorkspaceSet m_windowSet = {}; }; -} // namespace XCEngine::UI::Editor::App +} // namespace XCEngine::UI::Editor diff --git a/tests/UI/Editor/unit/CMakeLists.txt b/tests/UI/Editor/unit/CMakeLists.txt index 84470230..284bc0ac 100644 --- a/tests/UI/Editor/unit/CMakeLists.txt +++ b/tests/UI/Editor/unit/CMakeLists.txt @@ -108,13 +108,6 @@ target_link_libraries(editor_windowing_phase1_tests GTest::gtest_main ) -target_sources(editor_windowing_phase1_tests PRIVATE - ${CMAKE_SOURCE_DIR}/editor/app/Composition/EditorWindowWorkspaceStore.cpp - ${CMAKE_SOURCE_DIR}/editor/app/Windowing/System/EditorWindowPresentationPolicy.cpp - ${CMAKE_SOURCE_DIR}/editor/app/Windowing/System/EditorWindowSynchronizationPlanner.cpp - ${CMAKE_SOURCE_DIR}/editor/app/Windowing/System/EditorWindowSystem.cpp -) - target_include_directories(editor_windowing_phase1_tests PRIVATE ${CMAKE_SOURCE_DIR}/editor/app diff --git a/tests/UI/Editor/unit/test_editor_window_synchronization_planner.cpp b/tests/UI/Editor/unit/test_editor_window_synchronization_planner.cpp index 6ef353da..b8ac4613 100644 --- a/tests/UI/Editor/unit/test_editor_window_synchronization_planner.cpp +++ b/tests/UI/Editor/unit/test_editor_window_synchronization_planner.cpp @@ -1,9 +1,8 @@ #include -#include "Windowing/Frame/EditorWindowTransferRequests.h" -#include "Windowing/System/EditorWindowPresentationPolicy.h" -#include "Windowing/System/EditorWindowSystem.h" - +#include +#include +#include #include #include #include @@ -11,17 +10,17 @@ namespace { -using XCEngine::UI::Editor::App::EditorWindowHostSnapshot; -using XCEngine::UI::Editor::App::EditorWindowSynchronizationActionKind; -using XCEngine::UI::Editor::App::EditorWindowSynchronizationPlannerInput; -using XCEngine::UI::Editor::App::EditorWindowSystem; -using XCEngine::UI::Editor::App::EditorWindowWorkspaceMutationRequest; -using XCEngine::UI::Editor::App::BuildEditorWorkspaceWindowProjection; using XCEngine::UI::Editor::BuildDefaultUIEditorWorkspaceController; +using XCEngine::UI::Editor::BuildEditorWorkspaceWindowProjection; using XCEngine::UI::Editor::BuildUIEditorWorkspacePanel; using XCEngine::UI::Editor::BuildUIEditorWorkspaceSingleTabStack; using XCEngine::UI::Editor::BuildUIEditorWorkspaceSplit; using XCEngine::UI::Editor::BuildUIEditorWorkspaceTabStack; +using XCEngine::UI::Editor::EditorWindowHostSnapshot; +using XCEngine::UI::Editor::EditorWindowSynchronizationActionKind; +using XCEngine::UI::Editor::EditorWindowSynchronizationPlannerInput; +using XCEngine::UI::Editor::EditorWindowSystem; +using XCEngine::UI::Editor::EditorWindowWorkspaceMutationRequest; using XCEngine::UI::Editor::FindUIEditorWindowWorkspaceState; using XCEngine::UI::Editor::UIEditorWorkspaceCommand; using XCEngine::UI::Editor::UIEditorWorkspaceCommandKind;