Refactor XCUI editor module layout
This commit is contained in:
@@ -2,13 +2,13 @@
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
|
||||
#include <XCEditor/Core/UIEditorCommandDispatcher.h>
|
||||
#include <XCEditor/Core/UIEditorMenuModel.h>
|
||||
#include <XCEditor/Core/UIEditorMenuSession.h>
|
||||
#include <XCEditor/Core/UIEditorShortcutManager.h>
|
||||
#include <XCEditor/Core/UIEditorWorkspaceController.h>
|
||||
#include <XCEditor/Core/UIEditorWorkspaceModel.h>
|
||||
#include <XCEditor/Widgets/UIEditorMenuPopup.h>
|
||||
#include <XCEditor/Foundation/UIEditorCommandDispatcher.h>
|
||||
#include <XCEditor/Shell/UIEditorMenuModel.h>
|
||||
#include <XCEditor/Shell/UIEditorMenuSession.h>
|
||||
#include <XCEditor/Foundation/UIEditorShortcutManager.h>
|
||||
#include <XCEditor/Shell/UIEditorWorkspaceController.h>
|
||||
#include <XCEditor/Shell/UIEditorWorkspaceModel.h>
|
||||
#include <XCEditor/Shell/UIEditorMenuPopup.h>
|
||||
#include "Host/AutoScreenshot.h"
|
||||
#include "Host/NativeRenderer.h"
|
||||
|
||||
@@ -767,7 +767,7 @@ void ScenarioApp::ResetScenario() {
|
||||
SetCustomResult(
|
||||
"等待操作",
|
||||
"Ready",
|
||||
"右键 Context Target 打开菜单;hover `Workspace Tools` 展开子菜单;Esc / 外部点击关闭。");
|
||||
"右键 Context Target 打开菜单,hover `Workspace Tools` 展开子菜单;Esc / 点击外部关闭。");
|
||||
}
|
||||
|
||||
void ScenarioApp::OnResize(UINT width, UINT height) {
|
||||
@@ -913,7 +913,7 @@ void ScenarioApp::HandleMouseMove(float x, float y) {
|
||||
SetCustomResult(
|
||||
"Hover 收起更深层子菜单",
|
||||
"Dismissed",
|
||||
"鼠标移到普通菜单项后,更深层 child popup 已收起。closed: " +
|
||||
"鼠标移到普通菜单项后,更深层 child popup 已收起。Closed: " +
|
||||
JoinClosedPopupIds(mutation));
|
||||
dirty = true;
|
||||
}
|
||||
@@ -925,7 +925,7 @@ void ScenarioApp::HandleMouseMove(float x, float y) {
|
||||
SetCustomResult(
|
||||
"Hover popup 空白区",
|
||||
"Dismissed",
|
||||
"鼠标停留在 popup 空白区后,更深层 child popup 已回收。closed: " +
|
||||
"鼠标停留在 popup 空白区后,更深层 child popup 已回收。Closed: " +
|
||||
JoinClosedPopupIds(mutation));
|
||||
dirty = true;
|
||||
}
|
||||
@@ -952,7 +952,7 @@ void ScenarioApp::HandleLeftClick(float x, float y) {
|
||||
mutation.changed
|
||||
? "已展开 `" + hoveredItem->label +
|
||||
"` 子菜单。正常行为是 hover 也会直接展开。"
|
||||
: "子菜单已经处于打开状态。");
|
||||
: "子菜单已经处于展开状态。");
|
||||
InvalidateRect(m_hwnd, nullptr, FALSE);
|
||||
return;
|
||||
}
|
||||
@@ -983,7 +983,7 @@ void ScenarioApp::HandleLeftClick(float x, float y) {
|
||||
SetCustomResult(
|
||||
"点击 popup 空白区",
|
||||
"Dismissed",
|
||||
"点击当前 popup 空白区后,仅更深层子菜单被关闭。closed: " +
|
||||
"点击当前 popup 空白区后,仅更深层子菜单被关闭。Closed: " +
|
||||
JoinClosedPopupIds(mutation));
|
||||
ClearHoverWhenMenuClosed();
|
||||
InvalidateRect(m_hwnd, nullptr, FALSE);
|
||||
@@ -998,7 +998,7 @@ void ScenarioApp::HandleLeftClick(float x, float y) {
|
||||
"点击菜单外区域",
|
||||
mutation.changed ? "Dismissed" : "NoOp",
|
||||
mutation.changed
|
||||
? "点击外部区域后,整条菜单链已关闭。closed: " +
|
||||
? "点击外部区域后,整条菜单链已关闭。Closed: " +
|
||||
JoinClosedPopupIds(mutation)
|
||||
: "菜单链没有变化。");
|
||||
ClearHoverWhenMenuClosed();
|
||||
@@ -1015,7 +1015,7 @@ void ScenarioApp::HandleRightClick(float x, float y) {
|
||||
"右键外部区域",
|
||||
mutation.changed ? "Dismissed" : "NoOp",
|
||||
mutation.changed
|
||||
? "右键菜单外部区域后,整条菜单链已关闭。closed: " +
|
||||
? "右键菜单外部区域后,整条菜单链已关闭。Closed: " +
|
||||
JoinClosedPopupIds(mutation)
|
||||
: "菜单链没有变化。");
|
||||
ClearHoverWhenMenuClosed();
|
||||
@@ -1045,7 +1045,7 @@ void ScenarioApp::HandleKeyDown(UINT keyCode) {
|
||||
"Escape 关闭菜单",
|
||||
mutation.changed ? "Dismissed" : "NoOp",
|
||||
mutation.changed
|
||||
? "按下 Escape 后,topmost popup 已关闭。closed: " +
|
||||
? "按下 Escape 后,topmost popup 已关闭。Closed: " +
|
||||
JoinClosedPopupIds(mutation)
|
||||
: "当前没有可关闭的 popup。");
|
||||
ClearHoverWhenMenuClosed();
|
||||
@@ -1166,13 +1166,13 @@ void ScenarioApp::BuildDrawData(UIDrawData& drawData, float width, float height)
|
||||
DrawCard(
|
||||
drawList,
|
||||
m_headerRect,
|
||||
"测试功能:Editor ContextMenu 基础层",
|
||||
"这个测试验证什么功能?",
|
||||
"本场景只验证 root popup 锚点、submenu hover、outside/Esc dismiss、命令派发;不验证业务面板。");
|
||||
drawList.AddText(UIPoint(m_headerRect.x + 18.0f, m_headerRect.y + 70.0f), "1. 在左侧 Context Target 内右键,root popup 必须贴近鼠标位置打开。", kTextPrimary, 13.0f);
|
||||
drawList.AddText(UIPoint(m_headerRect.x + 18.0f, m_headerRect.y + 92.0f), "2. hover `Workspace Tools`,右侧 child popup 必须立即弹出。", kTextPrimary, 13.0f);
|
||||
drawList.AddText(UIPoint(m_headerRect.x + 18.0f, m_headerRect.y + 114.0f), "3. 点击 Show/Activate/Hide/Reset,右侧 Details visible / active / activePanel 状态必须同步变化。", kTextPrimary, 13.0f);
|
||||
drawList.AddText(UIPoint(m_headerRect.x + 18.0f, m_headerRect.y + 136.0f), "4. 点击 popup 外部区域应整条关闭;如果 child popup 已打开,Esc 先关 topmost,再关 root。", kTextPrimary, 13.0f);
|
||||
drawList.AddText(UIPoint(m_headerRect.x + 18.0f, m_headerRect.y + 158.0f), "5. F12 截图;R 直接触发 Reset Workspace,便于确认命令派发仍正常。", kTextPrimary, 13.0f);
|
||||
drawList.AddText(UIPoint(m_headerRect.x + 18.0f, m_headerRect.y + 158.0f), "5. F12 截图,R 直接触发 Reset Workspace,便于确认命令派发仍然正常。", kTextPrimary, 13.0f);
|
||||
|
||||
DrawCard(drawList, m_targetRect, "Context Target", "只在这里接受右键打开 ContextMenu。");
|
||||
DrawCard(drawList, m_stateRect, "状态摘要", "重点看 popup chain、anchor 和 Details 状态。");
|
||||
@@ -1190,22 +1190,22 @@ void ScenarioApp::BuildDrawData(UIDrawData& drawData, float width, float height)
|
||||
drawList.AddRectOutline(targetSurface, kCardBorder, 1.0f, 10.0f);
|
||||
drawList.AddText(UIPoint(targetSurface.x + 18.0f, targetSurface.y + 18.0f), "在这块区域右键打开 ContextMenu", kTextPrimary, 16.0f);
|
||||
drawList.AddText(UIPoint(targetSurface.x + 18.0f, targetSurface.y + 46.0f), "当前 anchor: " + FormatAnchorPoint(m_contextAnchorPoint, m_hasContextAnchor), kTextMuted, 12.0f);
|
||||
drawList.AddText(UIPoint(targetSurface.x + 18.0f, targetSurface.y + 68.0f), "Visible Panels: " + JoinVisiblePanelIds(workspace, session), kTextMuted, 12.0f);
|
||||
drawList.AddText(UIPoint(targetSurface.x + 18.0f, targetSurface.y + 90.0f), "Details visible: " + std::string(detailsState != nullptr && detailsState->visible ? "true" : "false"), kTextMuted, 12.0f);
|
||||
drawList.AddText(UIPoint(targetSurface.x + 18.0f, targetSurface.y + 112.0f), "Details active: " + std::string(workspace.activePanelId == "details" ? "true" : "false"), kTextMuted, 12.0f);
|
||||
drawList.AddText(UIPoint(targetSurface.x + 18.0f, targetSurface.y + 68.0f), "可见面板: " + JoinVisiblePanelIds(workspace, session), kTextMuted, 12.0f);
|
||||
drawList.AddText(UIPoint(targetSurface.x + 18.0f, targetSurface.y + 90.0f), "Details 可见: " + std::string(detailsState != nullptr && detailsState->visible ? "true" : "false"), kTextMuted, 12.0f);
|
||||
drawList.AddText(UIPoint(targetSurface.x + 18.0f, targetSurface.y + 112.0f), "Details 激活: " + std::string(workspace.activePanelId == "details" ? "true" : "false"), kTextMuted, 12.0f);
|
||||
|
||||
const UIRect stateBox(m_stateRect.x + 18.0f, m_stateRect.y + 74.0f, m_stateRect.width - 36.0f, 220.0f);
|
||||
drawList.AddFilledRect(stateBox, kIndicatorBg, 10.0f);
|
||||
drawList.AddRectOutline(stateBox, kCardBorder, 1.0f, 10.0f);
|
||||
drawList.AddText(UIPoint(stateBox.x + 14.0f, stateBox.y + 14.0f), "Open root menu", kTextMuted, 12.0f);
|
||||
drawList.AddText(UIPoint(stateBox.x + 14.0f, stateBox.y + 14.0f), "已打开 root menu", kTextMuted, 12.0f);
|
||||
drawList.AddText(UIPoint(stateBox.x + 14.0f, stateBox.y + 34.0f), m_menuSession.HasOpenMenu() ? std::string(m_menuSession.GetOpenRootMenuId()) : "(none)", kTextPrimary, 14.0f);
|
||||
drawList.AddText(UIPoint(stateBox.x + 14.0f, stateBox.y + 62.0f), "Popup chain", kTextMuted, 12.0f);
|
||||
drawList.AddText(UIPoint(stateBox.x + 14.0f, stateBox.y + 62.0f), "Popup 链", kTextMuted, 12.0f);
|
||||
drawList.AddText(UIPoint(stateBox.x + 14.0f, stateBox.y + 82.0f), JoinPopupChainIds(m_menuSession), kTextPrimary, 14.0f);
|
||||
drawList.AddText(UIPoint(stateBox.x + 14.0f, stateBox.y + 110.0f), "Submenu path", kTextMuted, 12.0f);
|
||||
drawList.AddText(UIPoint(stateBox.x + 14.0f, stateBox.y + 110.0f), "Submenu 路径", kTextMuted, 12.0f);
|
||||
drawList.AddText(UIPoint(stateBox.x + 14.0f, stateBox.y + 130.0f), JoinSubmenuPathIds(m_menuSession), kTextPrimary, 14.0f);
|
||||
drawList.AddText(UIPoint(stateBox.x + 14.0f, stateBox.y + 158.0f), "Active panel", kTextMuted, 12.0f);
|
||||
drawList.AddText(UIPoint(stateBox.x + 14.0f, stateBox.y + 158.0f), "当前激活面板", kTextMuted, 12.0f);
|
||||
drawList.AddText(UIPoint(stateBox.x + 14.0f, stateBox.y + 178.0f), workspace.activePanelId.empty() ? "(none)" : workspace.activePanelId, kTextPrimary, 14.0f);
|
||||
drawList.AddText(UIPoint(stateBox.x + 14.0f, stateBox.y + 202.0f), "Menu validation: " + std::string(menuValidation.IsValid() ? "OK" : menuValidation.message), menuValidation.IsValid() ? kSuccess : kDanger, 12.0f);
|
||||
drawList.AddText(UIPoint(stateBox.x + 14.0f, stateBox.y + 202.0f), "菜单验证: " + std::string(menuValidation.IsValid() ? "OK" : menuValidation.message), menuValidation.IsValid() ? kSuccess : kDanger, 12.0f);
|
||||
|
||||
const std::string captureSummary =
|
||||
m_autoScreenshot.HasPendingCapture()
|
||||
|
||||
Reference in New Issue
Block a user