Files
XCEngine/new_editor/app/State/EditorContext.h

65 lines
2.3 KiB
C++

#pragma once
#include "Composition/EditorHostCommandBridge.h"
#include "State/EditorSession.h"
#include "Composition/EditorShellAssetBuilder.h"
#include <XCEditor/Foundation/UIEditorShortcutManager.h>
#include <XCEditor/Shell/UIEditorShellAsset.h>
#include <XCEditor/Shell/UIEditorShellInteraction.h>
#include <XCEditor/Workspace/UIEditorWorkspaceController.h>
#include <filesystem>
#include <functional>
#include <string>
#include <string_view>
namespace XCEngine::UI::Editor::App {
class EditorContext {
public:
bool Initialize(const std::filesystem::path& repoRoot);
void AttachTextMeasurer(const UIEditorTextMeasurer& textMeasurer);
void SetExitRequestHandler(std::function<void()> handler);
void SyncSessionFromWorkspace(const UIEditorWorkspaceController& workspaceController);
bool IsValid() const;
const std::string& GetValidationMessage() const;
const EditorShellAsset& GetShellAsset() const;
const EditorSession& GetSession() const;
void SetSelection(EditorSelectionState selection);
void ClearSelection();
UIEditorWorkspaceController BuildWorkspaceController() const;
const UIEditorShellInteractionServices& GetShellServices() const;
UIEditorShellInteractionDefinition BuildShellDefinition(
const UIEditorWorkspaceController& workspaceController,
std::string_view captureText,
EditorShellVariant variant = EditorShellVariant::Primary) const;
void SetReadyStatus();
void SetStatus(std::string status, std::string message);
void UpdateStatusFromShellResult(
const UIEditorWorkspaceController& workspaceController,
const UIEditorShellInteractionResult& result);
std::string DescribeWorkspaceState(
const UIEditorWorkspaceController& workspaceController,
const UIEditorShellInteractionState& interactionState) const;
private:
void AppendConsoleEntry(std::string channel, std::string message);
EditorShellAsset m_shellAsset = {};
EditorShellAssetValidationResult m_shellValidation = {};
UIEditorShortcutManager m_shortcutManager = {};
UIEditorShellInteractionServices m_shellServices = {};
EditorSession m_session = {};
EditorHostCommandBridge m_hostCommandBridge = {};
std::string m_lastStatus = {};
std::string m_lastMessage = {};
};
} // namespace XCEngine::UI::Editor::App