docs(xceditor): deepen foundation api pages

This commit is contained in:
2026-04-10 17:43:30 +08:00
parent 00cf3850d5
commit 89bbad2786
5 changed files with 193 additions and 98 deletions

View File

@@ -2,39 +2,49 @@
**命名空间**: `XCEngine::UI::Editor`
**类型**: `submodule`
**类型**: `module`
**描述**: 编辑器基础设施子模块,覆盖命令注册、命令派发、快捷键管理以及主题度量解析入口。
**描述**: `XCEditor` 的基础协议层,覆盖命令注册、命令派发、快捷键管理以及主题度量解析入口。
## 概
## 概
`Foundation` 负责把 shell 壳层的静态配置转换成运行时可执行的命令与快捷键系统。按当前头文件分工:
`Foundation` 解决的是“shell 和控件真正运行前,需要先有一套什么样的 editor 级基础协议”。
按当前代码,职责主要分成四块:
- `UIEditorCommandRegistry.h`
- 声明命令描述、workspace 命令描述注册表校验规则
- 定义 editor 命令描述、workspace 命令描述以及注册表校验规则
- `UIEditorCommandDispatcher.h`
-命令 id 分发到 workspace controller 或 host command handler
- `commandId` 解析为 workspace command 或 host command,并执行 preview / dispatch。
- `UIEditorShortcutManager.h`
- `UIShortcutRegistry` 之上管理绑定、校验冲突并执行调度
- 复用 `XCEngine::UI::UIShortcutRegistry` 完成快捷键绑定、冲突校验与调度
- `UIEditorTheme.h`
- 汇总 Collections / Fields / Shell 各控件的 metrics palette 解析入口
- `Collections / Fields / Shell` 汇总默认 metrics / palette 解析入口
`new_editor/app/Application.cpp` 当前会构造 `UIEditorWorkspaceController`,再通过 `BuildEditorShellShortcutManager(...)` 接入这一层
这层不直接渲染 widget也不直接拥有 workspace 状态;它更像 `XCEditor` 的“命令 + 输入 + 主题”底座
## 当前调用链
- `new_editor/src/Shell/UIEditorShellAsset.cpp` 会从 shell asset 构造命令注册表和快捷键管理器。
- `new_editor/src/Shell/UIEditorMenuModel.cpp` 通过命令注册表、命令派发器和快捷键管理器生成 menu item 的启用态与 shortcut 文案。
- 多组 `tests/UI/Editor/unit/**``tests/UI/Editor/integration/**` 当前直接把这层当作 editor shell 的最小可验证基础设施。
## 公开头文件
- `UIEditorCommandDispatcher.h`
- `UIEditorCommandRegistry.h`
- `UIEditorShortcutManager.h`
- `UIEditorTheme.h`
- [UIEditorCommandRegistry](UIEditorCommandRegistry/UIEditorCommandRegistry.md) - editor 命令描述与注册表校验规则。
- [UIEditorCommandDispatcher](UIEditorCommandDispatcher/UIEditorCommandDispatcher.md) - `commandId -> workspace/host dispatch` 入口。
- [UIEditorShortcutManager](UIEditorShortcutManager/UIEditorShortcutManager.md) - editor 快捷键绑定、校验和调度入口。
- [UIEditorTheme](UIEditorTheme/UIEditorTheme.md) - 默认 metrics / palette 解析入口。
## 当前实现边界
- 当前这里只建立目录索引页,具体头文件页仍需后续补齐
- 该模块不直接渲染 UI而是为 `Shell` 与各控件模块提供命令、快捷键、主题和度量解析能力
- 该模块不直接渲染 UI而是为 `Shell``Collections``Fields` 提供命令、快捷键和主题基础能力
- 当前主题解析函数统一返回静态默认值,还没有引入动态主题切换或 style 覆盖链
- host command 仍然通过 `UIEditorHostCommandHandler` 抽象对外,不把宿主实现细节泄漏回 public header。
## 相关文档
- [XCEditor](../XCEditor.md)
- [Shell](../Shell/Shell.md)
- [Widgets](../Widgets/Widgets.md)
- [Collections](../Collections/Collections.md)
- [Fields](../Fields/Fields.md)