new_editor: close editor-layer app boundary

This commit is contained in:
2026-04-22 16:24:59 +08:00
parent a805803858
commit 2c2a8b8669
25 changed files with 1036 additions and 439 deletions

View File

@@ -3,6 +3,7 @@
#include "Composition/EditorPanelIds.h"
#include <XCEditor/Foundation/UIEditorTheme.h>
#include <XCEditor/Workspace/UIEditorDetachedWindowPolicy.h>
#include <algorithm>
@@ -79,67 +80,19 @@ void ApplyViewportFramesToShellFrame(
applyToViewportFrames(shellFrame.workspaceInteractionFrame.composeFrame.viewportFrames);
}
const UIEditorPanelDescriptor* ResolveSingleVisibleToolWindowPanelDescriptor(
const UIEditorWorkspaceController& workspaceController) {
const UIEditorWorkspaceNode& root = workspaceController.GetWorkspace().root;
if (root.kind != UIEditorWorkspaceNodeKind::TabStack) {
return nullptr;
}
const UIEditorWorkspaceSession& session = workspaceController.GetSession();
const UIEditorPanelRegistry& panelRegistry = workspaceController.GetPanelRegistry();
const UIEditorPanelDescriptor* visibleDescriptor = nullptr;
std::size_t visibleCount = 0u;
for (const UIEditorWorkspaceNode& child : root.children) {
if (child.kind != UIEditorWorkspaceNodeKind::Panel) {
continue;
}
const UIEditorPanelSessionState* panelState =
FindUIEditorPanelSessionState(session, child.panel.panelId);
if (panelState == nullptr || !panelState->open || !panelState->visible) {
continue;
}
const UIEditorPanelDescriptor* descriptor =
FindUIEditorPanelDescriptor(panelRegistry, child.panel.panelId);
if (descriptor == nullptr) {
return nullptr;
}
++visibleCount;
visibleDescriptor = descriptor;
if (visibleCount > 1u) {
return nullptr;
}
}
return visibleDescriptor != nullptr && visibleDescriptor->toolWindow
? visibleDescriptor
: nullptr;
}
UIEditorShellInteractionMetrics ResolveInteractionMetrics(
const UIEditorWorkspaceController& workspaceController,
bool useDetachedTitleBarTabStrip,
float detachedTitleBarTabHeight,
float detachedWindowChromeHeight) {
UIEditorShellInteractionMetrics metrics = ResolveUIEditorShellInteractionMetrics();
if (const UIEditorPanelDescriptor* toolWindowDescriptor =
ResolveSingleVisibleToolWindowPanelDescriptor(workspaceController);
toolWindowDescriptor != nullptr) {
if (IsUIEditorDetachedWorkspaceToolWindow(workspaceController)) {
metrics.shellMetrics.dockHostMetrics.tabStripMetrics.layoutMetrics.headerHeight = 0.0f;
const float minimumContentWidth =
toolWindowDescriptor->minimumDetachedWindowSize.width > 0.0f
? toolWindowDescriptor->minimumDetachedWindowSize.width
: metrics.shellMetrics.dockHostMetrics.minimumStandalonePanelBodySize.width;
const float minimumContentHeight =
toolWindowDescriptor->minimumDetachedWindowSize.height > detachedWindowChromeHeight
? toolWindowDescriptor->minimumDetachedWindowSize.height -
detachedWindowChromeHeight
: metrics.shellMetrics.dockHostMetrics.minimumStandalonePanelBodySize.height;
metrics.shellMetrics.dockHostMetrics.minimumStandalonePanelBodySize =
::XCEngine::UI::UISize(minimumContentWidth, minimumContentHeight);
ResolveUIEditorDetachedToolWindowMinimumContentSize(
workspaceController,
metrics.shellMetrics.dockHostMetrics.minimumStandalonePanelBodySize,
detachedWindowChromeHeight);
metrics.shellMetrics.dockHostMetrics.minimumTabContentBodySize =
metrics.shellMetrics.dockHostMetrics.minimumStandalonePanelBodySize;
}