refactor(new_editor): continue architecture closeout

This commit is contained in:
2026-04-15 22:47:42 +08:00
parent a458f2838c
commit dde03c5241
225 changed files with 4214 additions and 5196 deletions

View File

@@ -1,44 +1,23 @@
#include "Platform/Win32/EditorWindowManager.h"
#include "Platform/Win32/WindowManager/Internal.h"
#include "State/EditorContext.h"
#include "Platform/Win32/EditorWindow.h"
namespace XCEngine::UI::Editor::App {
#include <XCEditor/Workspace/UIEditorWindowWorkspaceController.h>
void EditorWindowManager::ProcessPendingDetachRequests() {
if (m_globalTabDragSession.active) {
return;
}
std::vector<EditorWindow*> windowsToProcess = {};
for (const std::unique_ptr<EditorWindow>& window : m_windows) {
if (window != nullptr && window->GetHwnd() != nullptr) {
windowsToProcess.push_back(window.get());
}
}
for (EditorWindow* window : windowsToProcess) {
if (window != nullptr) {
TryProcessDetachRequest(*window);
}
}
}
bool EditorWindowManager::TryProcessDetachRequest(EditorWindow& sourceWindow) {
const std::optional<EditorWindowPendingDetachRequest> pending =
sourceWindow.ConsumeDetachRequest();
if (!pending.has_value()) {
return false;
}
namespace XCEngine::UI::Editor::App::Internal {
bool EditorWindowWorkspaceCoordinator::TryProcessDetachRequest(
EditorWindow& sourceWindow,
const EditorWindowPanelTransferRequest& request) {
const std::string sourceWindowId(sourceWindow.GetWindowId());
UIEditorWindowWorkspaceController windowWorkspaceController =
BuildLiveWindowWorkspaceController(sourceWindowId);
const UIEditorWindowWorkspaceOperationResult result =
windowWorkspaceController.DetachPanelToNewWindow(
sourceWindowId,
pending->nodeId,
pending->panelId);
request.nodeId,
request.panelId);
if (result.status != UIEditorWindowWorkspaceOperationStatus::Changed) {
LogRuntimeTrace("detach", "detach request rejected: " + result.message);
return false;
@@ -47,12 +26,12 @@ bool EditorWindowManager::TryProcessDetachRequest(EditorWindow& sourceWindow) {
if (!SynchronizeWindowsFromController(
windowWorkspaceController,
result.targetWindowId,
pending->screenPoint)) {
request.screenPoint)) {
LogRuntimeTrace("detach", "failed to synchronize detached window state");
return false;
}
if (EditorWindow* detachedWindow = FindWindow(result.targetWindowId);
if (EditorWindow* detachedWindow = m_hostRuntime.FindWindow(result.targetWindowId);
detachedWindow != nullptr &&
detachedWindow->GetHwnd() != nullptr) {
SetForegroundWindow(detachedWindow->GetHwnd());
@@ -60,9 +39,9 @@ bool EditorWindowManager::TryProcessDetachRequest(EditorWindow& sourceWindow) {
LogRuntimeTrace(
"detach",
"detached panel '" + pending->panelId + "' from window '" + sourceWindowId +
"detached panel '" + request.panelId + "' from window '" + sourceWindowId +
"' to window '" + result.targetWindowId + "'");
return true;
}
} // namespace XCEngine::UI::Editor::App
} // namespace XCEngine::UI::Editor::App::Internal