Refactor editor windowing boundaries
This commit is contained in:
@@ -3,8 +3,9 @@
|
||||
#include "Composition/EditorContext.h"
|
||||
#include "Composition/EditorShellRuntime.h"
|
||||
#include "Composition/EditorShellVariant.h"
|
||||
#include "Platform/Win32/Windowing/EditorWindowSupport.h"
|
||||
#include "Windowing/EditorWindowShared.h"
|
||||
|
||||
#include <XCEditor/Foundation/UIEditorRuntimeTrace.h>
|
||||
#include <XCEditor/Workspace/UIEditorWorkspaceController.h>
|
||||
#include <XCEngine/UI/DrawData.h>
|
||||
|
||||
@@ -12,7 +13,6 @@
|
||||
|
||||
namespace XCEngine::UI::Editor::App {
|
||||
|
||||
using namespace EditorWindowSupport;
|
||||
using ::XCEngine::UI::UIDrawData;
|
||||
using ::XCEngine::UI::UIDrawList;
|
||||
using ::XCEngine::UI::UIInputEvent;
|
||||
@@ -22,7 +22,7 @@ using ::XCEngine::UI::UIPoint;
|
||||
namespace {
|
||||
|
||||
bool IsVerboseRuntimeTraceEnabled() {
|
||||
static const bool s_enabled = ResolveVerboseRuntimeTraceEnabled();
|
||||
static const bool s_enabled = IsEditorWindowVerboseRuntimeTraceEnabled();
|
||||
return s_enabled;
|
||||
}
|
||||
|
||||
@@ -51,6 +51,7 @@ EditorWindowFrameTransferRequests EditorWindowFrameOrchestrator::UpdateAndAppend
|
||||
EditorShellRuntime& shellRuntime,
|
||||
const ::XCEngine::UI::UIRect& workspaceBounds,
|
||||
const std::vector<UIInputEvent>& frameEvents,
|
||||
const std::optional<EditorWindowScreenPoint>& cursorScreenPoint,
|
||||
std::string_view captureStatusText,
|
||||
bool primary,
|
||||
bool globalTabDragActive,
|
||||
@@ -78,22 +79,25 @@ EditorWindowFrameTransferRequests EditorWindowFrameOrchestrator::UpdateAndAppend
|
||||
|
||||
LogFrameInteractionTrace(workspaceController, frameEvents, shellFrame);
|
||||
EditorWindowFrameTransferRequests transferRequests =
|
||||
BuildShellTransferRequests(globalTabDragActive, dockHostInteractionState, shellFrame);
|
||||
POINT screenPoint = {};
|
||||
BuildShellTransferRequests(
|
||||
globalTabDragActive,
|
||||
cursorScreenPoint,
|
||||
dockHostInteractionState,
|
||||
shellFrame);
|
||||
if (const std::optional<EditorUtilityWindowKind> requestedKind =
|
||||
editorContext.ConsumeOpenUtilityWindowRequest();
|
||||
requestedKind.has_value()) {
|
||||
transferRequests.utility.openUtilityWindow = EditorWindowOpenUtilityWindowRequest{
|
||||
.kind = *requestedKind,
|
||||
.useCursorPlacement = GetCursorPos(&screenPoint) != FALSE,
|
||||
.useCursorPlacement = cursorScreenPoint.has_value(),
|
||||
};
|
||||
if (transferRequests.utility.openUtilityWindow->useCursorPlacement) {
|
||||
transferRequests.utility.openUtilityWindow->screenPoint = screenPoint;
|
||||
transferRequests.utility.openUtilityWindow->screenPoint = *cursorScreenPoint;
|
||||
}
|
||||
}
|
||||
|
||||
for (const WorkspaceTraceEntry& entry : shellRuntime.GetTraceEntries()) {
|
||||
LogRuntimeTrace(entry.channel, entry.message);
|
||||
AppendUIEditorRuntimeTrace(entry.channel, entry.message);
|
||||
}
|
||||
|
||||
shellRuntime.Append(drawData);
|
||||
@@ -146,7 +150,7 @@ void EditorWindowFrameOrchestrator::LogInputTrace(
|
||||
return;
|
||||
}
|
||||
|
||||
LogRuntimeTrace(
|
||||
AppendUIEditorRuntimeTrace(
|
||||
"input",
|
||||
DescribeInputEvents(frameEvents) + " | " +
|
||||
editorContext.DescribeWorkspaceState(
|
||||
@@ -178,33 +182,34 @@ void EditorWindowFrameOrchestrator::LogFrameInteractionTrace(
|
||||
<< workspaceController.GetWorkspace().activePanelId
|
||||
<< " message="
|
||||
<< shellFrame.result.workspaceResult.dockHostResult.layoutResult.message;
|
||||
LogRuntimeTrace("frame", frameTrace.str());
|
||||
AppendUIEditorRuntimeTrace("frame", frameTrace.str());
|
||||
}
|
||||
|
||||
EditorWindowFrameTransferRequests EditorWindowFrameOrchestrator::BuildShellTransferRequests(
|
||||
bool globalTabDragActive,
|
||||
const std::optional<EditorWindowScreenPoint>& cursorScreenPoint,
|
||||
const UIEditorDockHostInteractionState& dockHostInteractionState,
|
||||
const UIEditorShellInteractionFrame& shellFrame) const {
|
||||
EditorWindowFrameTransferRequests transferRequests = {};
|
||||
POINT screenPoint = {};
|
||||
const bool hasScreenPoint = GetCursorPos(&screenPoint) != FALSE;
|
||||
if (!cursorScreenPoint.has_value()) {
|
||||
return transferRequests;
|
||||
}
|
||||
|
||||
if (!globalTabDragActive &&
|
||||
!dockHostInteractionState.activeTabDragNodeId.empty() &&
|
||||
!dockHostInteractionState.activeTabDragPanelId.empty() &&
|
||||
hasScreenPoint) {
|
||||
!dockHostInteractionState.activeTabDragPanelId.empty()) {
|
||||
transferRequests.workspace.beginGlobalTabDrag = EditorWindowPanelTransferRequest{
|
||||
dockHostInteractionState.activeTabDragNodeId,
|
||||
dockHostInteractionState.activeTabDragPanelId,
|
||||
screenPoint,
|
||||
*cursorScreenPoint,
|
||||
};
|
||||
}
|
||||
|
||||
if (shellFrame.result.workspaceResult.dockHostResult.detachRequested && hasScreenPoint) {
|
||||
if (shellFrame.result.workspaceResult.dockHostResult.detachRequested) {
|
||||
transferRequests.workspace.detachPanel = EditorWindowPanelTransferRequest{
|
||||
shellFrame.result.workspaceResult.dockHostResult.detachedNodeId,
|
||||
shellFrame.result.workspaceResult.dockHostResult.detachedPanelId,
|
||||
screenPoint,
|
||||
*cursorScreenPoint,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user