Refactor editor command state contracts into core

This commit is contained in:
2026-04-28 01:57:06 +08:00
parent cadababab5
commit 946c19f876
35 changed files with 65 additions and 66 deletions

View File

@@ -37,9 +37,9 @@ The app layer has a good directory vocabulary but enforcement is still
incomplete:
- `XCEditorCore` now limits its public app include surface to
`editor/app/Core`, `editor/app/Commands`, `editor/app/State`, and
`editor/app/Host/Interfaces`, and app/core sources now include through
explicit module roots instead of a private `editor/app` compatibility root.
`editor/app/Core` and `editor/app/Host/Interfaces`, and app/core sources now
include through explicit module roots instead of a private `editor/app`
compatibility root.
Concrete host code has converged under `editor/app/Host/Win32` and
`editor/app/Host/D3D12`.
- Native editor resources now cross the app-core boundary through a neutral
@@ -78,6 +78,10 @@ Completed boundary cuts:
utility-window runtime contracts accept this service view instead of
`EditorContext`, so concrete feature panels no longer depend on
`Composition/EditorContext.h`.
- Command routing and shared state contracts now live under
`editor/app/Core/Commands` and `editor/app/Core/State`. `XCEditorCore`,
`XCEditor`, and app-facing tests expose those contracts through the single
`editor/app/Core` include surface instead of separate command/state roots.
- Win32 now hands render startup a neutral
`Rendering::Host::EditorWindowRenderRuntimeSurface` value, and D3D12 no
longer includes `Platform/Win32/**` editor surface headers to obtain `HWND`.
@@ -304,12 +308,10 @@ add_library(XCEditorCore STATIC ...)
Initial contents:
- `app/Core/**`
- `app/Commands/**`
- `app/Composition/**`
- `app/Features/**`
- `app/Project/**` or `app/Services/Project/**`
- `app/Scene/**` or `app/Services/Scene/**`
- `app/State/**`
- `app/Core/UtilityWindows/**`
- `app/Core/Windowing/**`
- `app/Windowing/**` core files that do not require Win32 or D3D12
@@ -516,8 +518,8 @@ Completed cuts:
- Neutral host-facing contracts now live under `app/Host/Interfaces/`.
- `EditorWindowTransferRequests`, window screen geometry, and title-bar chrome
metrics now live under `app/Core/Windowing/`.
- `XCEditorCore` now exposes only `app/Core`, `app/Commands`, `app/State`, and
`app/Host/Interfaces` through its public usage requirements, and both
- `XCEditorCore` now exposes only `app/Core` and `app/Host/Interfaces`
through its public usage requirements, and both
`XCEditorCore` and `XCEditor` enumerate explicit module roots instead of
using `editor/app` as a compatibility include directory.
- Concrete Win32 and D3D12 host implementations now live under

View File

@@ -32,8 +32,7 @@ change.
include root or concrete Win32/D3D12 host dependencies.
- `XCEditorCore` does not publish the whole `editor/app` root as a usage
include directory. Its public app include surface is limited to shared
contracts under `app/Core`, `app/Commands`, `app/State`, and
`app/Host/Interfaces`.
contracts under `app/Core` and `app/Host/Interfaces`.
- `XCEditorCore` also does not consume the whole `editor/app` root privately.
Its implementation include paths enumerate concrete app module roots such as
`app/Composition`, `app/Features`, `app/Windowing`, `app/Rendering`,
@@ -68,7 +67,8 @@ change.
`Application`.
- `app/Core/` contains app-level contracts and shared app model definitions
that are not owned by a concrete feature or composition implementation.
Current examples are panel IDs, shared window type contracts, host window
Current examples are command routing contracts, editor session/selection
state contracts, panel IDs, shared window type contracts, host window
geometry/metrics, frame transfer requests, the panel-facing service view,
the windowing-facing frame-services/shell-runtime contracts,
scene-viewport request contracts, workspace-panel runtime interface, and
@@ -98,8 +98,9 @@ change.
panel factory. Shared utility-window contracts and descriptors live under
`app/Core/UtilityWindows` so windowing can resolve utility window shape
without constructing concrete feature panels.
- `app/Services/Project/`, `app/Scene/`, and `app/State/` hold application
services that panels should use instead of owning global state themselves.
- `app/Services/Project/` and `app/Scene/` hold application services that
panels should use instead of owning global state themselves. Shared app
state contracts live under `app/Core/State`.
`ProjectBrowserModel` and `EditorProjectRuntime` live under
`app/Services/Project`; project panels adapt those service models into
widget-specific tree/list presentation data.
@@ -347,8 +348,8 @@ inside pure shell/widget code.
`XCENGINE_BUILD_XCUI_EDITOR_APP` as the switch for the concrete executable
host.
- `XCEditorCore` does not use `editor/app` as a private implementation include
root. Its public usage requirements expose only `app/Core`, `app/Commands`,
`app/State`, `app/Host/Interfaces`, `include`, and engine headers;
root. Its public usage requirements expose only `app/Core`,
`app/Host/Interfaces`, `include`, and engine headers;
implementation files use explicit module roots instead of the app-wide
compatibility root.
- App-facing unit tests follow the same rule. `editor_app_core_tests` uses
@@ -498,6 +499,10 @@ ownership rule.
`app/Core/Panels/EditorPanelServices.h`. Workspace-panel and utility-window
runtime contracts no longer expose `EditorContext`, and concrete feature
panels no longer include `Composition/EditorContext.h`.
- Command and shared state contracts now live under `app/Core/Commands` and
`app/Core/State`. `XCEditorCore`, `XCEditor`, and app-facing tests no longer
expose `app/Commands` or `app/State` include roots; includes use
`Commands/...` and `State/...` through the single `app/Core` surface.
- Project service ownership moved out of `app/Features`: `ProjectBrowserModel`
and `EditorProjectRuntime` now live under `app/Services/Project`, and the
Project panel owns the widget-tree projection instead of making the service

View File

@@ -219,13 +219,13 @@ if(XCENGINE_BUILD_XCUI_EDITOR_CORE)
)
set(XCUI_EDITOR_APP_STATE_SOURCES
app/State/EditorColorPickerToolState.cpp
app/State/EditorUtilityWindowRequestState.cpp
app/State/EditorSession.cpp
app/Core/State/EditorColorPickerToolState.cpp
app/Core/State/EditorUtilityWindowRequestState.cpp
app/Core/State/EditorSession.cpp
)
set(XCUI_EDITOR_APP_COMMAND_SOURCES
app/Commands/EditorHostCommandBridge.cpp
app/Core/Commands/EditorHostCommandBridge.cpp
)
set(XCUI_EDITOR_APP_COMPOSITION_SOURCES
@@ -304,8 +304,6 @@ if(XCENGINE_BUILD_XCUI_EDITOR_CORE)
target_include_directories(XCEditorCore
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/app/Core
${CMAKE_CURRENT_SOURCE_DIR}/app/Commands
${CMAKE_CURRENT_SOURCE_DIR}/app/State
${CMAKE_CURRENT_SOURCE_DIR}/app/Host/Interfaces
${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/engine/include
@@ -363,7 +361,6 @@ if(XCENGINE_BUILD_XCUI_EDITOR_APP)
target_include_directories(XCEditor PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/app/Bootstrap
${CMAKE_CURRENT_SOURCE_DIR}/app/Commands
${CMAKE_CURRENT_SOURCE_DIR}/app/Composition
${CMAKE_CURRENT_SOURCE_DIR}/app/Core
${CMAKE_CURRENT_SOURCE_DIR}/app/Features
@@ -373,7 +370,6 @@ if(XCENGINE_BUILD_XCUI_EDITOR_APP)
${CMAKE_CURRENT_SOURCE_DIR}/app/Rendering
${CMAKE_CURRENT_SOURCE_DIR}/app/Scene
${CMAKE_CURRENT_SOURCE_DIR}/app/Services
${CMAKE_CURRENT_SOURCE_DIR}/app/State
${CMAKE_CURRENT_SOURCE_DIR}/app/Support
${CMAKE_CURRENT_SOURCE_DIR}/app/Windowing
${CMAKE_CURRENT_SOURCE_DIR}/include

View File

@@ -6,12 +6,12 @@
#include "Project/EditorProjectRuntime.h"
#include "UtilityWindows/EditorUtilityWindowRuntime.h"
#include "EditorHostCommandBridge.h"
#include "EditorColorPickerToolState.h"
#include "EditorCommandFocusService.h"
#include "EditorSelectionService.h"
#include "EditorSession.h"
#include "EditorUtilityWindowRequestState.h"
#include "Commands/EditorHostCommandBridge.h"
#include "State/EditorColorPickerToolState.h"
#include "State/EditorCommandFocusService.h"
#include "State/EditorSelectionService.h"
#include "State/EditorSession.h"
#include "State/EditorUtilityWindowRequestState.h"
#include <XCEditor/Foundation/UIEditorShortcutManager.h>
#include <XCEditor/Shell/UIEditorShellAsset.h>
#include <XCEditor/Shell/UIEditorShellInteraction.h>

View File

@@ -1,4 +1,4 @@
#include "EditorHostCommandBridge.h"
#include "Commands/EditorHostCommandBridge.h"
#include <string>
#include <utility>

View File

@@ -1,8 +1,8 @@
#pragma once
#include "EditorEditCommandRoute.h"
#include "EditorCommandFocusService.h"
#include "EditorSession.h"
#include "Commands/EditorEditCommandRoute.h"
#include "State/EditorCommandFocusService.h"
#include "State/EditorSession.h"
#include <XCEditor/Foundation/UIEditorCommandDispatcher.h>

View File

@@ -1,4 +1,4 @@
#include "EditorColorPickerToolState.h"
#include "State/EditorColorPickerToolState.h"
#include <algorithm>

View File

@@ -1,6 +1,6 @@
#pragma once
#include "EditorSession.h"
#include "State/EditorSession.h"
#include <XCEngine/UI/Types.h>

View File

@@ -1,7 +1,7 @@
#pragma once
#include "EditorSelectionStamp.h"
#include "EditorSession.h"
#include "State/EditorSelectionStamp.h"
#include "State/EditorSession.h"
#include <filesystem>
#include <string>

View File

@@ -1,4 +1,4 @@
#include "EditorSession.h"
#include "State/EditorSession.h"
#include "Panels/EditorPanelIds.h"

View File

@@ -1,4 +1,4 @@
#include "EditorUtilityWindowRequestState.h"
#include "State/EditorUtilityWindowRequestState.h"
namespace XCEngine::UI::Editor::App {

View File

@@ -1,7 +1,7 @@
#pragma once
#include "EditorEditCommandRoute.h"
#include "EditorSession.h"
#include "Commands/EditorEditCommandRoute.h"
#include "State/EditorSession.h"
#include "Panels/EditorPanelServices.h"
#include <XCEditor/Foundation/UIEditorTextMeasurement.h>

View File

@@ -1,7 +1,7 @@
#include "ColorPickerPanel.h"
#include "Panels/EditorPanelServices.h"
#include "EditorColorPickerToolState.h"
#include "State/EditorColorPickerToolState.h"
#include <XCEditor/Fields/UIEditorFieldStyle.h>
#include <XCEditor/Foundation/UIEditorPanelInputFilter.h>

View File

@@ -1,6 +1,6 @@
#pragma once
#include "EditorSession.h"
#include "State/EditorSession.h"
#include <XCEditor/Panels/UIEditorHostedPanelDispatch.h>

View File

@@ -3,7 +3,7 @@
#include <XCEditor/Foundation/UIEditorPanelInputFilter.h>
#include <XCEditor/Foundation/UIEditorTheme.h>
#include "EditorSceneRuntime.h"
#include "EditorCommandFocusService.h"
#include "State/EditorCommandFocusService.h"
#include <XCEditor/Fields/UIEditorFieldStyle.h>
#include <XCEditor/Fields/UIEditorTextField.h>
#include <utility>

View File

@@ -2,7 +2,7 @@
#include "HierarchyModel.h"
#include "EditorEditCommandRoute.h"
#include "Commands/EditorEditCommandRoute.h"
#include <XCEditor/Foundation/UIEditorTextMeasurement.h>
#include <XCEditor/Collections/UIEditorFilterableTreeHost.h>
#include <XCEditor/Collections/UIEditorTreeDragDrop.h>

View File

@@ -2,7 +2,7 @@
#include "Panels/EditorPanelServices.h"
#include "UtilityWindows/EditorUtilityWindowRuntime.h"
#include "EditorColorPickerToolState.h"
#include "State/EditorColorPickerToolState.h"
#include <XCEditor/Collections/UIEditorScrollView.h>
#include <XCEditor/Fields/UIEditorFieldStyle.h>
#include <XCEditor/Foundation/UIEditorPanelInputFilter.h>
@@ -12,7 +12,7 @@
#include "Inspector/Components/InspectorComponentEditorRegistry.h"
#include "EditorSceneRuntime.h"
#include "Project/EditorProjectRuntime.h"
#include "EditorCommandFocusService.h"
#include "State/EditorCommandFocusService.h"
#include <algorithm>
#include <cmath>

View File

@@ -3,7 +3,7 @@
#include "Inspector/InspectorPresentationModel.h"
#include "Inspector/InspectorSubject.h"
#include "EditorEditCommandRoute.h"
#include "Commands/EditorEditCommandRoute.h"
#include <XCEditor/Foundation/UIEditorTextMeasurement.h>
#include <XCEditor/Collections/UIEditorScrollViewInteraction.h>
#include <XCEditor/Fields/UIEditorPropertyGridInteraction.h>

View File

@@ -1,6 +1,6 @@
#pragma once
#include "EditorSession.h"
#include "State/EditorSession.h"
#include <cstdint>
#include <string>

View File

@@ -8,7 +8,7 @@
#include <string_view>
#include "SystemInteractionService.h"
#include "Project/EditorProjectRuntime.h"
#include "EditorCommandFocusService.h"
#include "State/EditorCommandFocusService.h"
#include <XCEditor/Fields/UIEditorFieldStyle.h>
#include <XCEditor/Foundation/UIEditorPanelInputFilter.h>
#include <XCEditor/Fields/UIEditorTextField.h>

View File

@@ -3,7 +3,7 @@
#include "Project/EditorProjectRuntime.h"
#include "Project/ProjectBrowserModel.h"
#include "EditorEditCommandRoute.h"
#include "Commands/EditorEditCommandRoute.h"
#include <XCEditor/Collections/UIEditorFilterableTreeHost.h>
#include <XCEditor/Collections/UIEditorGridDragDrop.h>
#include <XCEditor/Collections/UIEditorInlineRenameSession.h>

View File

@@ -1,6 +1,6 @@
#pragma once
#include "EditorEditCommandRoute.h"
#include "Commands/EditorEditCommandRoute.h"
#include <string>

View File

@@ -2,7 +2,7 @@
#include "Viewport/ViewportObjectPickerService.h"
#include "EditorSceneRuntime.h"
#include "EditorCommandFocusService.h"
#include "State/EditorCommandFocusService.h"
#include "Panels/EditorPanelIds.h"
#include <XCEditor/Viewport/UIEditorViewportInputBridge.h>

View File

@@ -5,7 +5,7 @@
#include "Viewport/SceneViewportResourcePaths.h"
#include "Viewport/ViewportHostService.h"
#include "EditorSceneRuntime.h"
#include "EditorCommandFocusService.h"
#include "State/EditorCommandFocusService.h"
namespace XCEngine::UI::Editor::App {

View File

@@ -3,7 +3,7 @@
#include "EditorSceneBridge.h"
#include "SceneViewportCameraController.h"
#include "SceneToolState.h"
#include "EditorSelectionService.h"
#include "State/EditorSelectionService.h"
#include "Scene/SceneViewportRenderRequest.h"
#include <memory>

View File

@@ -2,8 +2,8 @@
#include "Project/ProjectBrowserModel.h"
#include "EditorSelectionService.h"
#include "EditorSession.h"
#include "State/EditorSelectionService.h"
#include "State/EditorSession.h"
#include <XCEngine/UI/Types.h>

View File

@@ -128,14 +128,12 @@ if(TARGET XCEditorCore)
target_include_directories(editor_app_core_tests
PRIVATE
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/app/Commands
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/app/Composition
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/app/Core
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/app/Features
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/app/Host/Interfaces
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/app/Scene
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/app/Services
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/app/State
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/app/Support
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/include
${CMAKE_SOURCE_DIR}/engine/include
@@ -172,7 +170,6 @@ if(TARGET XCEditorCore)
target_include_directories(editor_app_feature_tests
PRIVATE
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/app/Commands
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/app/Composition
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/app/Core
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/app/Features
@@ -180,7 +177,6 @@ if(TARGET XCEditorCore)
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/app/Rendering
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/app/Scene
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/app/Services
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/app/State
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/app/Support
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/include
${CMAKE_SOURCE_DIR}/engine/include

View File

@@ -1,10 +1,10 @@
#include <gtest/gtest.h>
#include "Panels/EditorPanelIds.h"
#include "EditorEditCommandRoute.h"
#include "EditorHostCommandBridge.h"
#include "EditorCommandFocusService.h"
#include "EditorSession.h"
#include "Commands/EditorEditCommandRoute.h"
#include "Commands/EditorHostCommandBridge.h"
#include "State/EditorCommandFocusService.h"
#include "State/EditorSession.h"
namespace {

View File

@@ -1,5 +1,5 @@
#include "Project/EditorProjectRuntime.h"
#include "EditorSelectionService.h"
#include "State/EditorSelectionService.h"
#include <gtest/gtest.h>

View File

@@ -5,7 +5,7 @@
#include "Viewport/ViewportHostService.h"
#include "Viewport/ViewportRenderTargets.h"
#include "Viewport/ViewportRenderTargetUtils.h"
#include "EditorSelectionService.h"
#include "State/EditorSelectionService.h"
#include "Panels/EditorPanelIds.h"
#include <XCEditor/Viewport/UIEditorViewportInputBridge.h>