Refine editor shell asset contract
This commit is contained in:
@@ -199,6 +199,9 @@ int Application::Run(HINSTANCE hInstance, int nCmdShow) {
|
||||
bool Application::Initialize(HINSTANCE hInstance, int nCmdShow) {
|
||||
m_hInstance = hInstance;
|
||||
m_shellAssetDefinition = BuildDefaultEditorShellAsset(ResolveRepoRootPath());
|
||||
m_structuredShell = BuildStructuredEditorShellBinding(m_shellAssetDefinition);
|
||||
m_shellServices = BuildStructuredEditorShellServices(m_structuredShell);
|
||||
m_screenAsset = m_structuredShell.screenAsset;
|
||||
|
||||
WNDCLASSEXW windowClass = {};
|
||||
windowClass.cbSize = sizeof(windowClass);
|
||||
@@ -397,14 +400,11 @@ void Application::QueueWindowFocusEvent(UIInputEventType type) {
|
||||
|
||||
bool Application::LoadStructuredScreen(const char* triggerReason) {
|
||||
(void)triggerReason;
|
||||
m_screenAsset = {};
|
||||
m_screenAsset.screenId = m_shellAssetDefinition.screenId;
|
||||
m_screenAsset.documentPath = m_shellAssetDefinition.documentPath.string();
|
||||
m_screenAsset.themePath = m_shellAssetDefinition.themePath.string();
|
||||
|
||||
m_screenAsset = m_structuredShell.screenAsset;
|
||||
const bool loaded = m_screenPlayer.Load(m_screenAsset);
|
||||
const EditorShellAssetValidationResult shellAssetValidation =
|
||||
ValidateEditorShellAsset(m_shellAssetDefinition);
|
||||
const EditorShellAssetValidationResult& shellAssetValidation =
|
||||
m_structuredShell.assetValidation;
|
||||
const auto shortcutValidation = m_structuredShell.shortcutManager.ValidateConfiguration();
|
||||
m_useStructuredScreen = loaded;
|
||||
m_runtimeStatus = loaded ? "XCUI Editor Shell" : "Editor Shell | Load Error";
|
||||
m_runtimeError.clear();
|
||||
@@ -416,6 +416,11 @@ bool Application::LoadStructuredScreen(const char* triggerReason) {
|
||||
m_runtimeError,
|
||||
"Editor shell asset invalid: " + shellAssetValidation.message);
|
||||
}
|
||||
if (!shortcutValidation.IsValid()) {
|
||||
AppendErrorMessage(
|
||||
m_runtimeError,
|
||||
"Structured shell shortcut manager invalid: " + shortcutValidation.message);
|
||||
}
|
||||
RebuildTrackedFileStates();
|
||||
return loaded;
|
||||
}
|
||||
|
||||
@@ -19,6 +19,19 @@ Widgets::UIEditorStatusBarSegment BuildDefaultShellModeSegment() {
|
||||
return segment;
|
||||
}
|
||||
|
||||
Widgets::UIEditorStatusBarSegment BuildDefaultActivePanelSegment(
|
||||
const UIEditorWorkspaceModel& workspace) {
|
||||
Widgets::UIEditorStatusBarSegment segment = {};
|
||||
segment.segmentId = "active-panel";
|
||||
segment.label = workspace.activePanelId.empty() ? std::string("(none)") : workspace.activePanelId;
|
||||
segment.slot = Widgets::UIEditorStatusBarSlot::Trailing;
|
||||
segment.tone = Widgets::UIEditorStatusBarTextTone::Muted;
|
||||
segment.interactive = false;
|
||||
segment.showSeparator = false;
|
||||
segment.desiredWidth = 144.0f;
|
||||
return segment;
|
||||
}
|
||||
|
||||
EditorShellAssetValidationResult MakeValidationError(
|
||||
EditorShellAssetValidationCode code,
|
||||
std::string message) {
|
||||
@@ -124,9 +137,13 @@ UIEditorWorkspacePanelPresentationModel BuildShellPresentation(
|
||||
}
|
||||
|
||||
UIEditorShellInteractionDefinition BuildDefaultShellDefinition(
|
||||
const UIEditorPanelRegistry& panelRegistry) {
|
||||
const UIEditorPanelRegistry& panelRegistry,
|
||||
const UIEditorWorkspaceModel& workspace) {
|
||||
UIEditorShellInteractionDefinition definition = {};
|
||||
definition.statusSegments = { BuildDefaultShellModeSegment() };
|
||||
definition.statusSegments = {
|
||||
BuildDefaultShellModeSegment(),
|
||||
BuildDefaultActivePanelSegment(workspace)
|
||||
};
|
||||
definition.workspacePresentations.reserve(panelRegistry.panels.size());
|
||||
for (const UIEditorPanelDescriptor& descriptor : panelRegistry.panels) {
|
||||
definition.workspacePresentations.push_back(BuildShellPresentation(descriptor));
|
||||
@@ -144,7 +161,7 @@ EditorShellAsset BuildDefaultEditorShellAsset(const std::filesystem::path& repoR
|
||||
asset.panelRegistry = BuildDefaultEditorShellPanelRegistry();
|
||||
asset.workspace = BuildDefaultEditorShellWorkspaceModel();
|
||||
asset.workspaceSession = BuildDefaultUIEditorWorkspaceSession(asset.panelRegistry, asset.workspace);
|
||||
asset.shellDefinition = BuildDefaultShellDefinition(asset.panelRegistry);
|
||||
asset.shellDefinition = BuildDefaultShellDefinition(asset.panelRegistry, asset.workspace);
|
||||
return asset;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user