refactor(new_editor): tighten app dependency boundaries

This commit is contained in:
2026-04-19 02:48:41 +08:00
parent 7429f22fb1
commit c59cd83c38
86 changed files with 1754 additions and 1077 deletions

View File

@@ -1,5 +1,6 @@
#include "Platform/Win32/EditorWindow.h"
#include "Platform/Win32/EditorWindowConstants.h"
#include "Platform/Win32/EditorWindowInternalState.h"
#include "Platform/Win32/EditorWindowStyle.h"
#include <XCEditor/Foundation/UIEditorTheme.h>
@@ -100,17 +101,18 @@ UIRect BuildDetachedTitleLogoRect(const Host::BorderlessWindowChromeLayout& layo
} // namespace
bool EditorWindow::ShouldUseDetachedTitleBarTabStrip() const {
return !m_window.primary && HasSingleVisibleRootTab(m_composition.workspaceController);
return !m_state->window.primary &&
HasSingleVisibleRootTab(m_state->composition.workspaceController);
}
Host::BorderlessWindowChromeHitTarget EditorWindow::HitTestBorderlessWindowChrome(
LPARAM lParam) const {
if (!IsBorderlessWindowEnabled() || m_window.hwnd == nullptr) {
if (!IsBorderlessWindowEnabled() || m_state->window.hwnd == nullptr) {
return Host::BorderlessWindowChromeHitTarget::None;
}
RECT clientRect = {};
if (!GetClientRect(m_window.hwnd, &clientRect)) {
if (!GetClientRect(m_state->window.hwnd, &clientRect)) {
return Host::BorderlessWindowChromeHitTarget::None;
}
@@ -156,11 +158,11 @@ void EditorWindow::AppendBorderlessWindowChrome(
1.0f);
}
if (!m_window.primary) {
if (m_render.titleBarLogoIcon.IsValid()) {
if (!m_state->window.primary) {
if (m_state->render.titleBarLogoIcon.IsValid()) {
drawList.AddImage(
BuildDetachedTitleLogoRect(layout),
m_render.titleBarLogoIcon,
m_state->render.titleBarLogoIcon,
UIColor(1.0f, 1.0f, 1.0f, 1.0f));
}
} else {
@@ -168,19 +170,21 @@ void EditorWindow::AppendBorderlessWindowChrome(
const float iconY =
layout.titleBarRect.y +
(std::max)(0.0f, (layout.titleBarRect.height - kTitleBarLogoExtent) * 0.5f);
if (m_render.titleBarLogoIcon.IsValid()) {
if (m_state->render.titleBarLogoIcon.IsValid()) {
drawList.AddImage(
UIRect(iconX, iconY, kTitleBarLogoExtent, kTitleBarLogoExtent),
m_render.titleBarLogoIcon,
m_state->render.titleBarLogoIcon,
UIColor(1.0f, 1.0f, 1.0f, 1.0f));
}
const std::string& titleText =
m_window.titleText.empty() ? std::string("XCEngine Editor") : m_window.titleText;
m_state->window.titleText.empty()
? std::string("XCEngine Editor")
: m_state->window.titleText;
drawList.AddText(
UIPoint(
iconX +
(m_render.titleBarLogoIcon.IsValid()
(m_state->render.titleBarLogoIcon.IsValid()
? (kTitleBarLogoExtent + kTitleBarLogoTextGap)
: 4.0f),
layout.titleBarRect.y +
@@ -195,7 +199,7 @@ void EditorWindow::AppendBorderlessWindowChrome(
Host::AppendBorderlessWindowChrome(
drawList,
layout,
m_chrome.chromeState,
m_state->chrome.chromeState,
IsBorderlessWindowMaximized());
}