chore: checkpoint current workspace changes

This commit is contained in:
2026-04-11 22:14:02 +08:00
parent 3e55f8c204
commit 8848cfd958
227 changed files with 34027 additions and 6711 deletions

View File

@@ -376,12 +376,13 @@ int Application::Run(HINSTANCE hInstance, int nCmdShow) {
bool Application::Initialize(HINSTANCE hInstance, int nCmdShow) {
m_hInstance = hInstance;
EnableDpiAwareness();
const std::filesystem::path repoRoot = ResolveRepoRootPath();
const std::filesystem::path logRoot =
GetExecutableDirectory() / "logs";
InitializeUIEditorRuntimeTrace(logRoot);
SetUnhandledExceptionFilter(&Application::HandleUnhandledException);
LogRuntimeTrace("app", "initialize begin");
m_shellAsset = BuildProductShellAsset(ResolveRepoRootPath());
m_shellAsset = BuildProductShellAsset(repoRoot);
m_shellValidation = ValidateEditorShellAsset(m_shellAsset);
m_validationMessage = m_shellValidation.message;
if (!m_shellValidation.IsValid()) {
@@ -399,7 +400,6 @@ bool Application::Initialize(HINSTANCE hInstance, int nCmdShow) {
m_shellServices.commandDispatcher = &m_shortcutManager.GetCommandDispatcher();
m_shellServices.shortcutManager = &m_shortcutManager;
m_shellServices.textMeasurer = &m_renderer;
m_projectPanel.Initialize(ResolveRepoRootPath());
m_lastStatus = "Ready";
m_lastMessage = "Old editor shell baseline loaded.";
LogRuntimeTrace("app", "workspace initialized: " + DescribeWorkspaceState());
@@ -446,7 +446,15 @@ bool Application::Initialize(HINSTANCE hInstance, int nCmdShow) {
LogRuntimeTrace("app", "renderer initialization failed");
return false;
}
m_builtInIcons.Initialize(m_renderer, repoRoot);
if (!m_builtInIcons.GetLastError().empty()) {
LogRuntimeTrace("icons", m_builtInIcons.GetLastError());
}
m_hierarchyPanel.SetBuiltInIcons(&m_builtInIcons);
m_projectPanel.SetBuiltInIcons(&m_builtInIcons);
m_hierarchyPanel.Initialize();
m_projectPanel.SetTextMeasurer(&m_renderer);
m_projectPanel.Initialize(repoRoot);
ShowWindow(m_hwnd, nCmdShow);
UpdateWindow(m_hwnd);
@@ -468,6 +476,7 @@ void Application::Shutdown() {
}
m_autoScreenshot.Shutdown();
m_builtInIcons.Shutdown();
m_renderer.Shutdown();
if (m_hwnd != nullptr && IsWindow(m_hwnd)) {
@@ -549,6 +558,11 @@ void Application::RenderFrame() {
}
ApplyHostCaptureRequests(m_shellFrame.result);
UpdateLastStatus(m_shellFrame.result);
m_hierarchyPanel.Update(
m_shellFrame.workspaceInteractionFrame.composeFrame.contentHostFrame,
hostedContentEvents,
!m_shellFrame.result.workspaceInputSuppressed,
m_workspaceController.GetWorkspace().activePanelId == "hierarchy");
m_projectPanel.Update(
m_shellFrame.workspaceInteractionFrame.composeFrame.contentHostFrame,
hostedContentEvents,
@@ -565,6 +579,7 @@ void Application::RenderFrame() {
m_shellInteractionState.composeState,
palette.shellPalette,
metrics.shellMetrics);
m_hierarchyPanel.Append(drawList);
m_projectPanel.Append(drawList);
AppendShellPopups(drawList, m_shellFrame, palette, metrics);
} else {
@@ -599,6 +614,22 @@ float Application::PixelsToDips(float pixels) const {
return dpiScale > 0.0f ? pixels / dpiScale : pixels;
}
bool Application::IsPointerInsideClientArea() const {
if (m_hwnd == nullptr || !IsWindow(m_hwnd)) {
return false;
}
POINT screenPoint = {};
if (!GetCursorPos(&screenPoint)) {
return false;
}
const LPARAM pointParam = MAKELPARAM(
static_cast<SHORT>(screenPoint.x),
static_cast<SHORT>(screenPoint.y));
return SendMessageW(m_hwnd, WM_NCHITTEST, 0, pointParam) == HTCLIENT;
}
LPCWSTR Application::ResolveCurrentCursorResource() const {
switch (m_projectPanel.GetCursorKind()) {
case App::ProductProjectPanel::CursorKind::ResizeEW:
@@ -621,6 +652,10 @@ LPCWSTR Application::ResolveCurrentCursorResource() const {
}
bool Application::ApplyCurrentCursor() const {
if (!HasInteractiveCaptureState() && !IsPointerInsideClientArea()) {
return false;
}
const HCURSOR cursor = LoadCursorW(nullptr, ResolveCurrentCursorResource());
if (cursor == nullptr) {
return false;