Internalize editor shell asset definition contract

This commit is contained in:
2026-04-07 12:38:23 +08:00
parent d14fa6be07
commit 49e9b63a2d
5 changed files with 337 additions and 10 deletions

View File

@@ -10,6 +10,10 @@
#include "Core/EditorShellAsset.h"
#include <XCEditor/Core/UIEditorShellInteraction.h>
#include <XCEditor/Core/UIEditorShortcutManager.h>
#include <XCEditor/Core/UIEditorWorkspaceController.h>
#include <XCEngine/UI/Runtime/UIScreenDocumentHost.h>
#include <XCEngine/UI/Runtime/UIScreenPlayer.h>
@@ -24,6 +28,46 @@
namespace XCEngine::UI::Editor {
struct StructuredEditorShellBinding {
::XCEngine::UI::Runtime::UIScreenAsset screenAsset = {};
UIEditorWorkspaceController workspaceController = {};
UIEditorShellInteractionDefinition shellDefinition = {};
UIEditorShortcutManager shortcutManager = {};
EditorShellAssetValidationResult assetValidation = {};
[[nodiscard]] bool IsValid() const {
return assetValidation.IsValid();
}
};
inline UIEditorShortcutManager BuildStructuredEditorShortcutManager(
const EditorShellAsset& asset) {
(void)asset;
return UIEditorShortcutManager(UIEditorCommandRegistry{});
}
inline StructuredEditorShellBinding BuildStructuredEditorShellBinding(
const EditorShellAsset& asset) {
StructuredEditorShellBinding binding = {};
binding.screenAsset.screenId = asset.screenId;
binding.screenAsset.documentPath = asset.documentPath.string();
binding.screenAsset.themePath = asset.themePath.string();
binding.workspaceController =
UIEditorWorkspaceController(asset.panelRegistry, asset.workspace, asset.workspaceSession);
binding.shellDefinition = asset.shellDefinition;
binding.shortcutManager = BuildStructuredEditorShortcutManager(asset);
binding.assetValidation = ValidateEditorShellAsset(asset);
return binding;
}
inline UIEditorShellInteractionServices BuildStructuredEditorShellServices(
const StructuredEditorShellBinding& binding) {
UIEditorShellInteractionServices services = {};
services.commandDispatcher = &binding.shortcutManager.GetCommandDispatcher();
services.shortcutManager = &binding.shortcutManager;
return services;
}
class Application {
public:
Application();
@@ -65,6 +109,8 @@ private:
::XCEngine::UI::Runtime::UIScreenPlayer m_screenPlayer;
::XCEngine::UI::Runtime::UIScreenAsset m_screenAsset = {};
EditorShellAsset m_shellAssetDefinition = {};
StructuredEditorShellBinding m_structuredShell = {};
UIEditorShellInteractionServices m_shellServices = {};
std::vector<TrackedFileState> m_trackedFiles = {};
std::chrono::steady_clock::time_point m_startTime = {};
std::chrono::steady_clock::time_point m_lastFrameTime = {};