载入中...
搜索中...
未找到
EditorUndoCoordinator.cpp
浏览该文件的文档.
2
3#include "editor/EditorHost.h"
6
7namespace eve::editor {
8
10
11Result<void> EditorUndoCoordinator::focusOwner(std::string_view ownerModule) {
12 if (!host_)
13 return eve::editing::failed<void>(EditorStatus::Failed, RuleId("editor.undo.no-host"),
14 "UndoCoordinator has no host");
15 if (ownerModule.empty()) {
16 focusedOwner_.clear();
17 return eve::editing::applied<void>();
18 }
19 if (!host_->isMounted(ownerModule))
20 return eve::editing::failed<void>(EditorStatus::NotFound, RuleId("editor.undo.owner-not-mounted"),
21 "Cannot focus undo for an unmounted package: " + std::string(ownerModule));
22 focusedOwner_ = std::string(ownerModule);
23 return eve::editing::applied<void>();
24}
25
27 if (!host_ || focusedOwner_.empty()) return editing::EditorUndoPolicy::Share;
28 return host_->mountedUndoPolicy(focusedOwner_);
29}
30
33 return session && session->transactions().canUndo();
34}
35
38 return session && session->transactions().canRedo();
39}
40
41} // namespace eve::editor
std::optional< InteractionSession > session
Definition Tactics.cpp:39
UIHostHandle host
Move-only operation result carrying either a value or Status.
Definition Result.h:176
Composition runtime that discovers EditorPackage providers and installs them.
Definition EditorHost.h:53
editing::EditorUndoPolicy mountedUndoPolicy(std::string_view ownerModule) const
Undo policy recorded for a mounted owner (Share when unknown).
bool isMounted(std::string_view ownerModule) const
True when owner is currently mounted.
Hosts interchangeable editor tools and routes their lifecycle/input.
bool canRedo(EditorSession *session) const
Whether the focused share stack can redo.
editing::EditorUndoPolicy focusedPolicy() const
Undo policy of the focused package (Share when none).
bool canUndo(EditorSession *session) const
Whether the focused share stack can undo (session-backed).
Result< void > focusOwner(std::string_view ownerModule)
Focus a mounted owner for undo/redo presentation.
EditorUndoPolicy
Undo participation policy for a mounted package.
eve::editing::RuleId RuleId
Definition EditorIds.h:32