2.4 KiB
2.4 KiB
Foundation
命名空间: XCEngine::UI::Editor
类型: module
描述: XCEditor 的基础协议层,覆盖命令注册、命令派发、快捷键管理以及主题度量解析入口。
概览
Foundation 解决的是“shell 和控件真正运行前,需要先有一套什么样的 editor 级基础协议”。
按当前代码,职责主要分成四块:
UIEditorCommandRegistry.h- 定义 editor 命令描述、workspace 命令描述以及注册表校验规则。
UIEditorCommandDispatcher.h- 把
commandId解析为 workspace command 或 host command,并执行 preview / dispatch。
- 把
UIEditorShortcutManager.h- 复用
XCEngine::UI::UIShortcutRegistry完成快捷键绑定、冲突校验与调度。
- 复用
UIEditorTheme.h- 为
Collections / Fields / Shell汇总默认 metrics / palette 解析入口。
- 为
这层不直接渲染 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 的最小可验证基础设施。
公开头文件
- UIEditorCommandRegistry - editor 命令描述与注册表校验规则。
- UIEditorCommandDispatcher -
commandId -> workspace/host dispatch入口。 - UIEditorShortcutManager - editor 快捷键绑定、校验和调度入口。
- UIEditorTheme - 默认 metrics / palette 解析入口。
当前实现边界
- 该模块不直接渲染 UI,而是为
Shell、Collections和Fields提供命令、快捷键和主题基础能力。 - 当前主题解析函数统一返回静态默认值,还没有引入动态主题切换或 style 覆盖链。
- host command 仍然通过
UIEditorHostCommandHandler抽象对外,不把宿主实现细节泄漏回 public header。