Refactor editor window synchronization flow
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEditor/Workspace/UIEditorWindowWorkspaceModel.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
namespace XCEngine::UI::Editor::App {
|
||||
|
||||
struct EditorWindowHostSnapshot {
|
||||
std::string windowId = {};
|
||||
bool workspaceWindow = false;
|
||||
bool utilityWindow = false;
|
||||
bool primary = false;
|
||||
bool running = false;
|
||||
bool destroyed = false;
|
||||
bool hasNativeWindow = false;
|
||||
bool hasWorkspaceProjection = false;
|
||||
UIEditorWindowWorkspaceState workspaceState = {};
|
||||
std::wstring title = {};
|
||||
};
|
||||
|
||||
struct EditorWindowSynchronizationPlacement {
|
||||
bool enabled = false;
|
||||
int initialX = 0;
|
||||
int initialY = 0;
|
||||
int initialWidth = 0;
|
||||
int initialHeight = 0;
|
||||
};
|
||||
|
||||
struct EditorWindowSynchronizationUpdate {
|
||||
UIEditorWindowWorkspaceState windowState = {};
|
||||
bool primary = false;
|
||||
std::wstring title = {};
|
||||
};
|
||||
|
||||
struct EditorWindowSynchronizationCreate {
|
||||
UIEditorWindowWorkspaceState windowState = {};
|
||||
bool primary = false;
|
||||
std::wstring title = {};
|
||||
EditorWindowSynchronizationPlacement placement = {};
|
||||
};
|
||||
|
||||
struct EditorWindowSynchronizationClose {
|
||||
std::string windowId = {};
|
||||
};
|
||||
|
||||
enum class EditorWindowSynchronizationActionKind : std::uint8_t {
|
||||
CreateWorkspaceWindow = 0,
|
||||
UpdateWorkspaceWindow,
|
||||
CloseWorkspaceWindow,
|
||||
};
|
||||
|
||||
struct EditorWindowSynchronizationAction {
|
||||
EditorWindowSynchronizationActionKind kind =
|
||||
EditorWindowSynchronizationActionKind::UpdateWorkspaceWindow;
|
||||
EditorWindowSynchronizationCreate create = {};
|
||||
EditorWindowSynchronizationUpdate update = {};
|
||||
EditorWindowSynchronizationClose close = {};
|
||||
};
|
||||
|
||||
struct EditorWindowSynchronizationPlan {
|
||||
bool valid = false;
|
||||
std::string errorMessage = {};
|
||||
UIEditorWindowWorkspaceSet targetWindowSet = {};
|
||||
std::vector<EditorWindowSynchronizationAction> actions = {};
|
||||
|
||||
[[nodiscard]] bool HasActions() const {
|
||||
return !actions.empty();
|
||||
}
|
||||
};
|
||||
|
||||
struct EditorWindowSynchronizationPlannerInput {
|
||||
const UIEditorPanelRegistry* panelRegistry = nullptr;
|
||||
const UIEditorWindowWorkspaceSet* targetWindowSet = nullptr;
|
||||
std::wstring_view primaryWindowTitle = {};
|
||||
std::string_view preferredNewWindowId = {};
|
||||
EditorWindowSynchronizationPlacement preferredPlacement = {};
|
||||
std::vector<EditorWindowHostSnapshot> hostWindows = {};
|
||||
};
|
||||
|
||||
} // namespace XCEngine::UI::Editor::App
|
||||
Reference in New Issue
Block a user