refactor(new_editor): extract window content boundary

This commit is contained in:
2026-04-22 20:32:56 +08:00
parent 6efbaf450e
commit e251b77d0d
19 changed files with 1223 additions and 234 deletions

View File

@@ -4,7 +4,7 @@
#define NOMINMAX
#endif
#include "Composition/EditorShellRuntime.h"
#include "Platform/Win32/EditorWindowContentController.h"
#include "Platform/Win32/EditorWindowScreenshotController.h"
#include <Rendering/D3D12/D3D12UiRenderer.h>
@@ -13,35 +13,23 @@
#include <Rendering/D3D12/D3D12WindowRenderLoop.h>
#include <Rendering/D3D12/D3D12WindowRenderer.h>
#include <XCEditor/Workspace/UIEditorWorkspaceController.h>
#include <XCEngine/UI/DrawData.h>
#include <XCEngine/UI/Types.h>
#include <windows.h>
#include <chrono>
#include <filesystem>
#include <memory>
#include <string>
namespace XCEngine::UI::Editor {
struct UIEditorShellInteractionFrame;
struct UIEditorShellInteractionState;
namespace Widgets {
struct UIEditorDockHostDropPreviewState;
}
} // namespace XCEngine::UI::Editor
namespace XCEngine::UI::Editor::App {
class EditorContext;
class EditorWindowRuntimeController final {
public:
explicit EditorWindowRuntimeController(UIEditorWorkspaceController workspaceController);
explicit EditorWindowRuntimeController(
std::unique_ptr<EditorWindowContentController> contentController);
~EditorWindowRuntimeController();
EditorWindowRuntimeController(const EditorWindowRuntimeController&) = delete;
@@ -51,18 +39,35 @@ public:
bool IsReady() const;
const UIEditorWorkspaceController* TryGetWorkspaceController() const;
UIEditorWorkspaceController* TryGetMutableWorkspaceController();
const UIEditorWorkspaceController& GetWorkspaceController() const;
UIEditorWorkspaceController& GetMutableWorkspaceController();
void ReplaceWorkspaceController(UIEditorWorkspaceController workspaceController);
const EditorShellRuntime& GetShellRuntime() const;
EditorShellRuntime& GetShellRuntime();
const UIEditorShellInteractionFrame& GetShellFrame() const;
const UIEditorShellInteractionState& GetShellInteractionState() const;
void SetExternalDockHostDropPreview(
const Widgets::UIEditorDockHostDropPreviewState& preview);
void ClearExternalDockHostDropPreview();
bool TryResolveDockTabDragHotspot(
std::string_view nodeId,
std::string_view panelId,
const ::XCEngine::UI::UIPoint& point,
::XCEngine::UI::UIPoint& outHotspot) const;
UIEditorDockHostTabDropTarget ResolveDockTabDropTarget(
const ::XCEngine::UI::UIPoint& point) const;
bool HasHostedContentCapture() const;
bool HasShellInteractiveCapture() const;
bool HasInteractiveCapture() const;
EditorWindowContentCursorKind GetHostedContentCursorKind() const;
EditorWindowContentCursorKind GetDockCursorKind() const;
::XCEngine::UI::UISize ResolveMinimumOuterSize() const;
bool ShouldUseDetachedTitleBarTabStrip() const;
std::string ResolveTabStripTitleText(std::string_view fallbackTitle) const;
std::string ResolveDetachedWindowTitleText(
std::string_view fallbackWindowTitle) const;
void SetDpiScale(float dpiScale);
::XCEngine::UI::Editor::UIEditorTextMeasurer& GetTextMeasurer();
@@ -82,6 +87,11 @@ public:
Host::D3D12WindowRenderLoopFrameContext BeginFrame();
Host::D3D12WindowRenderLoopPresentResult Present(
const ::XCEngine::UI::UIDrawData& drawData);
EditorWindowFrameTransferRequests UpdateAndAppend(
const EditorWindowContentFrameContext& context,
::XCEngine::UI::UIDrawData& drawData);
void RenderRequestedViewports(
const ::XCEngine::Rendering::RenderContext& renderContext);
void RequestManualScreenshot(std::string reason);
std::string BuildCaptureStatusText() const;
@@ -99,8 +109,7 @@ private:
Host::D3D12WindowRenderLoop m_windowRenderLoop = {};
EditorWindowScreenshotController m_screenshotController = {};
::XCEngine::UI::UITextureHandle m_titleBarLogoIcon = {};
UIEditorWorkspaceController m_workspaceController = {};
EditorShellRuntime m_shellRuntime = {};
std::unique_ptr<EditorWindowContentController> m_contentController = {};
std::chrono::steady_clock::time_point m_lastFrameTime = {};
bool m_hasLastFrameTime = false;
float m_smoothedDeltaTimeSeconds = 0.0f;