2026-04-12 01:29:00 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
2026-04-15 22:47:42 +08:00
|
|
|
#include "Composition/EditorShellVariant.h"
|
2026-04-19 00:03:25 +08:00
|
|
|
#include "Project/EditorProjectRuntime.h"
|
2026-04-18 00:45:14 +08:00
|
|
|
#include "Scene/EditorSceneRuntime.h"
|
2026-04-12 01:49:08 +08:00
|
|
|
|
2026-04-19 02:48:41 +08:00
|
|
|
#include "Commands/EditorHostCommandBridge.h"
|
|
|
|
|
#include "State/EditorSession.h"
|
2026-04-12 01:29:00 +08:00
|
|
|
#include <XCEditor/Foundation/UIEditorShortcutManager.h>
|
|
|
|
|
#include <XCEditor/Shell/UIEditorShellAsset.h>
|
|
|
|
|
#include <XCEditor/Shell/UIEditorShellInteraction.h>
|
2026-04-15 08:24:06 +08:00
|
|
|
#include <XCEditor/Workspace/UIEditorWorkspaceController.h>
|
2026-04-12 01:29:00 +08:00
|
|
|
|
|
|
|
|
#include <filesystem>
|
2026-04-12 01:49:08 +08:00
|
|
|
#include <functional>
|
2026-04-12 01:29:00 +08:00
|
|
|
#include <string>
|
|
|
|
|
#include <string_view>
|
|
|
|
|
|
|
|
|
|
namespace XCEngine::UI::Editor::App {
|
|
|
|
|
|
2026-04-15 19:30:58 +08:00
|
|
|
class EditorEditCommandRoute;
|
|
|
|
|
|
2026-04-15 08:24:06 +08:00
|
|
|
class EditorContext {
|
2026-04-12 01:29:00 +08:00
|
|
|
public:
|
2026-04-12 01:49:08 +08:00
|
|
|
bool Initialize(const std::filesystem::path& repoRoot);
|
2026-04-12 01:29:00 +08:00
|
|
|
void AttachTextMeasurer(const UIEditorTextMeasurer& textMeasurer);
|
2026-04-15 19:30:58 +08:00
|
|
|
void BindEditCommandRoutes(
|
|
|
|
|
EditorEditCommandRoute* hierarchyRoute,
|
2026-04-19 00:03:25 +08:00
|
|
|
EditorEditCommandRoute* projectRoute,
|
|
|
|
|
EditorEditCommandRoute* sceneRoute,
|
|
|
|
|
EditorEditCommandRoute* inspectorRoute = nullptr);
|
2026-04-12 01:49:08 +08:00
|
|
|
void SetExitRequestHandler(std::function<void()> handler);
|
2026-04-14 15:07:52 +08:00
|
|
|
void SyncSessionFromWorkspace(const UIEditorWorkspaceController& workspaceController);
|
2026-04-12 01:29:00 +08:00
|
|
|
|
|
|
|
|
bool IsValid() const;
|
|
|
|
|
const std::string& GetValidationMessage() const;
|
|
|
|
|
const EditorShellAsset& GetShellAsset() const;
|
2026-04-15 08:24:06 +08:00
|
|
|
const EditorSession& GetSession() const;
|
2026-04-19 00:03:25 +08:00
|
|
|
EditorProjectRuntime& GetProjectRuntime();
|
|
|
|
|
const EditorProjectRuntime& GetProjectRuntime() const;
|
2026-04-18 00:45:14 +08:00
|
|
|
EditorSceneRuntime& GetSceneRuntime();
|
|
|
|
|
const EditorSceneRuntime& GetSceneRuntime() const;
|
2026-04-15 08:24:06 +08:00
|
|
|
void SetSelection(EditorSelectionState selection);
|
2026-04-12 11:12:27 +08:00
|
|
|
void ClearSelection();
|
2026-04-19 00:03:25 +08:00
|
|
|
void SyncSessionFromProjectRuntime();
|
2026-04-12 01:29:00 +08:00
|
|
|
|
2026-04-14 15:07:52 +08:00
|
|
|
UIEditorWorkspaceController BuildWorkspaceController() const;
|
2026-04-12 01:29:00 +08:00
|
|
|
const UIEditorShellInteractionServices& GetShellServices() const;
|
|
|
|
|
|
|
|
|
|
UIEditorShellInteractionDefinition BuildShellDefinition(
|
2026-04-14 15:07:52 +08:00
|
|
|
const UIEditorWorkspaceController& workspaceController,
|
2026-04-14 16:19:23 +08:00
|
|
|
std::string_view captureText,
|
2026-04-15 08:24:06 +08:00
|
|
|
EditorShellVariant variant = EditorShellVariant::Primary) const;
|
2026-04-12 01:29:00 +08:00
|
|
|
|
|
|
|
|
void SetReadyStatus();
|
|
|
|
|
void SetStatus(std::string status, std::string message);
|
2026-04-14 15:07:52 +08:00
|
|
|
void UpdateStatusFromShellResult(
|
|
|
|
|
const UIEditorWorkspaceController& workspaceController,
|
|
|
|
|
const UIEditorShellInteractionResult& result);
|
2026-04-12 01:29:00 +08:00
|
|
|
std::string DescribeWorkspaceState(
|
2026-04-14 15:07:52 +08:00
|
|
|
const UIEditorWorkspaceController& workspaceController,
|
2026-04-12 01:29:00 +08:00
|
|
|
const UIEditorShellInteractionState& interactionState) const;
|
|
|
|
|
|
|
|
|
|
private:
|
2026-04-12 11:12:27 +08:00
|
|
|
void AppendConsoleEntry(std::string channel, std::string message);
|
|
|
|
|
|
2026-04-12 01:29:00 +08:00
|
|
|
EditorShellAsset m_shellAsset = {};
|
|
|
|
|
EditorShellAssetValidationResult m_shellValidation = {};
|
|
|
|
|
UIEditorShortcutManager m_shortcutManager = {};
|
|
|
|
|
UIEditorShellInteractionServices m_shellServices = {};
|
2026-04-15 08:24:06 +08:00
|
|
|
EditorSession m_session = {};
|
2026-04-19 00:03:25 +08:00
|
|
|
EditorProjectRuntime m_projectRuntime = {};
|
2026-04-18 00:45:14 +08:00
|
|
|
EditorSceneRuntime m_sceneRuntime = {};
|
2026-04-15 08:24:06 +08:00
|
|
|
EditorHostCommandBridge m_hostCommandBridge = {};
|
2026-04-12 01:29:00 +08:00
|
|
|
std::string m_lastStatus = {};
|
|
|
|
|
std::string m_lastMessage = {};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace XCEngine::UI::Editor::App
|
2026-04-15 08:24:06 +08:00
|
|
|
|