Files
XCEngine/new_editor/app/Composition/EditorShellAssetBuilder.cpp

56 lines
2.2 KiB
C++
Raw Normal View History

#include "EditorShellAssetBuilder.h"
2026-04-10 16:40:11 +08:00
#include "Composition/EditorShellAssetBuilderSupport.h"
2026-04-10 16:40:11 +08:00
namespace XCEngine::UI::Editor::App {
using namespace CompositionSupport;
2026-04-10 16:40:11 +08:00
EditorShellAsset BuildEditorShellAsset(const std::filesystem::path& repoRoot) {
2026-04-10 16:40:11 +08:00
EditorShellAsset asset = {};
asset.screenId = "editor.shell";
2026-04-10 16:40:11 +08:00
asset.captureRootPath = (repoRoot / "new_editor/captures").lexically_normal();
asset.panelRegistry = BuildEditorPanelRegistry();
asset.workspace = BuildEditorWorkspaceModel();
2026-04-10 16:40:11 +08:00
asset.workspaceSession =
BuildDefaultUIEditorWorkspaceSession(asset.panelRegistry, asset.workspace);
asset.shellDefinition = BuildBaseEditorShellDefinition();
asset.shortcutAsset.commandRegistry = BuildEditorCommandRegistry();
asset.shortcutAsset.bindings = BuildEditorShortcutBindings();
2026-04-10 16:40:11 +08:00
return asset;
}
UIEditorShellInteractionDefinition BuildEditorShellInteractionDefinition(
2026-04-10 16:40:11 +08:00
const EditorShellAsset& asset,
const UIEditorWorkspaceController& controller,
std::string_view statusText,
std::string_view captureText,
EditorShellVariant variant) {
2026-04-10 16:40:11 +08:00
UIEditorShellInteractionDefinition definition = asset.shellDefinition;
if (variant == EditorShellVariant::DetachedWindow) {
definition.menuModel = {};
definition.toolbarButtons.clear();
definition.statusSegments.clear();
}
2026-04-10 16:40:11 +08:00
const std::string activeTitle =
ResolveEditorPanelTitle(asset.panelRegistry, controller.GetWorkspace().activePanelId);
2026-04-10 16:40:11 +08:00
const std::string resolvedStatus =
statusText.empty() ? std::string("Shell ready") : std::string(statusText);
const std::string resolvedCapture =
captureText.empty() ? std::string("F12 -> Screenshot") : std::string(captureText);
for (Widgets::UIEditorStatusBarSegment& segment : definition.statusSegments) {
2026-04-10 16:40:11 +08:00
if (segment.segmentId == "editor-status") {
segment.label = resolvedStatus;
} else if (segment.segmentId == "capture") {
segment.label = resolvedCapture;
} else if (segment.segmentId == "active-panel") {
segment.label = activeTitle;
}
}
return definition;
}
} // namespace XCEngine::UI::Editor::App