2026-04-15 08:24:06 +08:00
|
|
|
#include "EditorShellAssetBuilder.h"
|
2026-04-10 16:40:11 +08:00
|
|
|
|
2026-04-15 08:24:06 +08:00
|
|
|
#include "Composition/EditorShellAssetBuilderSupport.h"
|
2026-04-10 16:40:11 +08:00
|
|
|
|
|
|
|
|
namespace XCEngine::UI::Editor::App {
|
|
|
|
|
|
2026-04-15 08:24:06 +08:00
|
|
|
using namespace CompositionSupport;
|
2026-04-10 16:40:11 +08:00
|
|
|
|
2026-04-15 08:24:06 +08:00
|
|
|
EditorShellAsset BuildEditorShellAsset(const std::filesystem::path& repoRoot) {
|
2026-04-10 16:40:11 +08:00
|
|
|
EditorShellAsset asset = {};
|
2026-04-15 08:24:06 +08:00
|
|
|
asset.screenId = "editor.shell";
|
2026-04-10 16:40:11 +08:00
|
|
|
asset.captureRootPath = (repoRoot / "new_editor/captures").lexically_normal();
|
2026-04-15 08:24:06 +08:00
|
|
|
asset.panelRegistry = BuildEditorPanelRegistry();
|
|
|
|
|
asset.workspace = BuildEditorWorkspaceModel();
|
2026-04-10 16:40:11 +08:00
|
|
|
asset.workspaceSession =
|
|
|
|
|
BuildDefaultUIEditorWorkspaceSession(asset.panelRegistry, asset.workspace);
|
2026-04-15 08:24:06 +08:00
|
|
|
asset.shellDefinition = BuildBaseEditorShellDefinition();
|
|
|
|
|
asset.shortcutAsset.commandRegistry = BuildEditorCommandRegistry();
|
|
|
|
|
asset.shortcutAsset.bindings = BuildEditorShortcutBindings();
|
2026-04-10 16:40:11 +08:00
|
|
|
return asset;
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-15 08:24:06 +08:00
|
|
|
UIEditorShellInteractionDefinition BuildEditorShellInteractionDefinition(
|
2026-04-10 16:40:11 +08:00
|
|
|
const EditorShellAsset& asset,
|
|
|
|
|
const UIEditorWorkspaceController& controller,
|
|
|
|
|
std::string_view statusText,
|
2026-04-14 16:19:23 +08:00
|
|
|
std::string_view captureText,
|
2026-04-15 08:24:06 +08:00
|
|
|
EditorShellVariant variant) {
|
2026-04-10 16:40:11 +08:00
|
|
|
UIEditorShellInteractionDefinition definition = asset.shellDefinition;
|
2026-04-15 08:24:06 +08:00
|
|
|
if (variant == EditorShellVariant::DetachedWindow) {
|
2026-04-14 16:19:23 +08:00
|
|
|
definition.menuModel = {};
|
|
|
|
|
definition.toolbarButtons.clear();
|
|
|
|
|
definition.statusSegments.clear();
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-10 16:40:11 +08:00
|
|
|
const std::string activeTitle =
|
2026-04-15 08:24:06 +08:00
|
|
|
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);
|
|
|
|
|
|
2026-04-15 08:24:06 +08:00
|
|
|
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
|