refactor(editor): isolate windowing from composition runtime

This commit is contained in:
2026-04-27 23:45:24 +08:00
parent 603d003684
commit 6b488d5eac
34 changed files with 418 additions and 193 deletions

View File

@@ -4,11 +4,10 @@
#include "EditorShellHostedPanelCoordinator.h"
#include "EditorShellInteractionEngine.h"
#include "EditorShellSessionCoordinator.h"
#include "EditorShellVariant.h"
#include "Windowing/EditorWorkspaceShellRuntime.h"
#include "WorkspacePanels/EditorWorkspacePanelRuntime.h"
#include "Assets/BuiltInIcons.h"
#include "Viewport/ViewportHostService.h"
#include "WorkspaceEventSync.h"
#include <XCEditor/Shell/UIEditorShellInteraction.h>
#include <XCEditor/Docking/UIEditorDockHostTransfer.h>
@@ -19,15 +18,10 @@
#include <XCEngine/UI/DrawData.h>
#include <filesystem>
#include <memory>
#include <string_view>
#include <vector>
namespace XCEngine::UI::Editor::App {
class EditorContext;
} // namespace XCEngine::UI::Editor::App
namespace XCEngine::UI::Editor::Rendering::Host {
class UiTextureHost;
@@ -49,7 +43,7 @@ class RenderContext;
namespace XCEngine::UI::Editor::App {
class EditorShellRuntime {
class EditorShellRuntime final : public EditorWorkspaceShellRuntime {
public:
EditorShellRuntime() = default;
explicit EditorShellRuntime(EditorWorkspacePanelRuntimeSet workspacePanels);
@@ -58,15 +52,15 @@ public:
const std::filesystem::path& repoRoot,
Rendering::Host::UiTextureHost& textureHost,
Host::EditorHostResourceService& resourceService,
UIEditorTextMeasurer& textMeasurer);
void Shutdown();
void ResetInteractionState();
void AttachViewportWindowRenderer(Rendering::Host::ViewportRenderHost& renderer);
void DetachViewportWindowRenderer();
void SetViewportSurfacePresentationEnabled(bool enabled);
UIEditorTextMeasurer& textMeasurer) override;
void Shutdown() override;
void ResetInteractionState() override;
void AttachViewportWindowRenderer(Rendering::Host::ViewportRenderHost& renderer) override;
void DetachViewportWindowRenderer() override;
void SetViewportSurfacePresentationEnabled(bool enabled) override;
void Update(
EditorContext& context,
EditorFrameServices& frameServices,
UIEditorWorkspaceController& workspaceController,
const ::XCEngine::UI::UIRect& bounds,
const std::vector<::XCEngine::UI::UIInputEvent>& inputEvents,
@@ -74,31 +68,31 @@ public:
EditorShellVariant shellVariant = EditorShellVariant::Primary,
bool useDetachedTitleBarTabStrip = false,
float detachedTitleBarTabHeight = 0.0f,
float detachedWindowChromeHeight = 0.0f);
float detachedWindowChromeHeight = 0.0f) override;
void RenderRequestedViewports(
const ::XCEngine::Rendering::RenderContext& renderContext);
void Append(::XCEngine::UI::UIDrawData& drawData) const;
const ::XCEngine::Rendering::RenderContext& renderContext) override;
void Append(::XCEngine::UI::UIDrawData& drawData) const override;
const UIEditorShellInteractionFrame& GetShellFrame() const;
const UIEditorShellInteractionState& GetShellInteractionState() const;
const std::vector<WorkspaceTraceEntry>& GetTraceEntries() const;
const UIEditorShellInteractionFrame& GetShellFrame() const override;
const UIEditorShellInteractionState& GetShellInteractionState() const override;
const std::vector<WorkspaceTraceEntry>& GetTraceEntries() const override;
const std::string& GetBuiltInIconError() const;
void SetExternalDockHostDropPreview(
const Widgets::UIEditorDockHostDropPreviewState& preview);
void ClearExternalDockHostDropPreview();
const Widgets::UIEditorDockHostDropPreviewState& preview) override;
void ClearExternalDockHostDropPreview() override;
EditorWorkspacePanelCursorKind GetHostedContentCursorKind() const;
Widgets::UIEditorDockHostCursorKind GetDockCursorKind() const;
EditorWorkspacePanelCursorKind GetHostedContentCursorKind() const override;
Widgets::UIEditorDockHostCursorKind GetDockCursorKind() const override;
bool TryResolveDockTabDragHotspot(
std::string_view nodeId,
std::string_view panelId,
const ::XCEngine::UI::UIPoint& point,
::XCEngine::UI::UIPoint& outHotspot) const;
::XCEngine::UI::UIPoint& outHotspot) const override;
UIEditorDockHostTabDropTarget ResolveDockTabDropTarget(
const ::XCEngine::UI::UIPoint& point) const;
bool HasHostedContentCapture() const;
bool HasShellInteractiveCapture() const;
bool HasInteractiveCapture() const;
const ::XCEngine::UI::UIPoint& point) const override;
bool HasHostedContentCapture() const override;
bool HasShellInteractiveCapture() const override;
bool HasInteractiveCapture() const override;
private:
ViewportHostService m_viewportHostService = {};
@@ -115,6 +109,9 @@ private:
EditorShellSessionCoordinator m_sessionCoordinator = {};
};
std::unique_ptr<EditorWorkspaceShellRuntime> CreateEditorWorkspaceShellRuntime(
EditorWorkspacePanelRuntimeSet workspacePanels);
} // namespace XCEngine::UI::Editor::App