2026-04-15 22:47:42 +08:00
|
|
|
#include "Platform/Win32/WindowManager/Internal.h"
|
2026-04-15 08:24:06 +08:00
|
|
|
|
|
|
|
|
#include "State/EditorContext.h"
|
2026-04-15 19:30:58 +08:00
|
|
|
#include "Platform/Win32/EditorWindow.h"
|
2026-04-15 08:24:06 +08:00
|
|
|
|
2026-04-15 22:47:42 +08:00
|
|
|
#include <XCEditor/Workspace/UIEditorWindowWorkspaceController.h>
|
|
|
|
|
#include <XCEditor/Workspace/UIEditorWorkspaceController.h>
|
2026-04-15 08:24:06 +08:00
|
|
|
|
2026-04-15 22:47:42 +08:00
|
|
|
namespace XCEngine::UI::Editor::App::Internal {
|
|
|
|
|
|
|
|
|
|
UIEditorWindowWorkspaceSet EditorWindowWorkspaceCoordinator::BuildWindowWorkspaceSet(
|
2026-04-15 08:24:06 +08:00
|
|
|
std::string_view activeWindowId) const {
|
|
|
|
|
UIEditorWindowWorkspaceSet windowSet = {};
|
2026-04-15 22:47:42 +08:00
|
|
|
if (const EditorWindow* primaryWindow = m_hostRuntime.FindPrimaryWindow();
|
2026-04-15 08:24:06 +08:00
|
|
|
primaryWindow != nullptr) {
|
|
|
|
|
windowSet.primaryWindowId = std::string(primaryWindow->GetWindowId());
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-15 22:47:42 +08:00
|
|
|
for (const std::unique_ptr<EditorWindow>& window : m_hostRuntime.GetWindows()) {
|
2026-04-15 08:24:06 +08:00
|
|
|
if (window == nullptr || window->GetHwnd() == nullptr) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UIEditorWindowWorkspaceState entry = {};
|
|
|
|
|
entry.windowId = std::string(window->GetWindowId());
|
|
|
|
|
entry.workspace = window->GetWorkspaceController().GetWorkspace();
|
|
|
|
|
entry.session = window->GetWorkspaceController().GetSession();
|
|
|
|
|
windowSet.windows.push_back(std::move(entry));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
windowSet.activeWindowId =
|
2026-04-15 22:47:42 +08:00
|
|
|
!activeWindowId.empty() && m_hostRuntime.FindWindow(activeWindowId) != nullptr
|
2026-04-15 08:24:06 +08:00
|
|
|
? std::string(activeWindowId)
|
|
|
|
|
: windowSet.primaryWindowId;
|
|
|
|
|
|
|
|
|
|
return windowSet;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UIEditorWindowWorkspaceController
|
2026-04-15 22:47:42 +08:00
|
|
|
EditorWindowWorkspaceCoordinator::BuildLiveWindowWorkspaceController(
|
2026-04-15 08:24:06 +08:00
|
|
|
std::string_view activeWindowId) const {
|
|
|
|
|
return UIEditorWindowWorkspaceController(
|
2026-04-15 22:47:42 +08:00
|
|
|
m_hostRuntime.GetEditorContext().GetShellAsset().panelRegistry,
|
2026-04-15 08:24:06 +08:00
|
|
|
BuildWindowWorkspaceSet(activeWindowId));
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-15 22:47:42 +08:00
|
|
|
UIEditorWorkspaceController EditorWindowWorkspaceCoordinator::BuildWorkspaceControllerForWindow(
|
2026-04-15 08:24:06 +08:00
|
|
|
const UIEditorWindowWorkspaceState& windowState) const {
|
|
|
|
|
return UIEditorWorkspaceController(
|
2026-04-15 22:47:42 +08:00
|
|
|
m_hostRuntime.GetEditorContext().GetShellAsset().panelRegistry,
|
2026-04-15 08:24:06 +08:00
|
|
|
windowState.workspace,
|
|
|
|
|
windowState.session);
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-15 22:47:42 +08:00
|
|
|
} // namespace XCEngine::UI::Editor::App::Internal
|