Refactor new editor state ownership model

This commit is contained in:
2026-04-19 04:36:52 +08:00
parent 48bfde28e3
commit f45b34a03a
46 changed files with 1979 additions and 217 deletions

View File

@@ -182,14 +182,26 @@ bool EditorWindowWorkspaceCoordinator::SynchronizeWindowsFromWindowSet(
return true;
}
bool EditorWindowWorkspaceCoordinator::SynchronizeWindowsFromController(
bool EditorWindowWorkspaceCoordinator::CommitWindowWorkspaceMutation(
const UIEditorWindowWorkspaceController& windowWorkspaceController,
std::string_view preferredNewWindowId,
const POINT& preferredScreenPoint) {
return SynchronizeWindowsFromWindowSet(
windowWorkspaceController.GetWindowSet(),
preferredNewWindowId,
preferredScreenPoint);
const UIEditorWindowWorkspaceSet nextWindowSet = windowWorkspaceController.GetWindowSet();
std::string error = {};
if (!m_workspaceStore.ValidateWindowSet(nextWindowSet, error)) {
LogRuntimeTrace("window", "workspace mutation validation failed: " + error);
return false;
}
if (!SynchronizeWindowsFromWindowSet(
nextWindowSet,
preferredNewWindowId,
preferredScreenPoint)) {
return false;
}
m_workspaceStore.ReplaceWindowSet(nextWindowSet);
return true;
}
} // namespace XCEngine::UI::Editor::App::Internal