载入中...
搜索中...
未找到
UiEditorModule.cpp
浏览该文件的文档.
37ui_editing::Result<T> editorError(ui_editing::EditorStatus status, std::string rule, std::string message) {
54ui_editing::Result<void> UiThemeEditor::configureWorkspace(editor::EditorWorkspace& workspace) const {
70 !candidate.setPanelCapability(panel.id, "ui.theme") || !candidate.setPanelContext(panel.id, panel.context))
94ui_editing::Result<void> UiThemeEditor::commit(ui_editing::Result<ui_editing::DomainOperation> operation,
103 if (!begun.ok()) return editorError(begun.code(), "editor.ui-theme.begin", "Could not begin the theme transaction");
118 return editorError(preview_.status, "editor.ui-theme.preview", "Could not rebuild the theme preview");
129ui_editing::Result<void> UiThemeEditor::createFromPreset(std::string id, std::string name, std::string preset) {
134 commit(target_.makeCreateFromPreset(ui_editing::ObjectId(id), std::move(name), presetFromName(preset)),
143 commit(target_.makeDuplicate(ui_editing::ObjectId(selectedId_), ui_editing::ObjectId(id), std::move(name)),
159 auto activated = commit(target_.makeSetActive(ui_editing::ObjectId(selectedId_)), "Activate theme");
170ui_editing::Result<void> UiThemeEditor::setToken(const std::string& path, const ui_editing::EditorValue& value) {
172 target_.makeSet(selection(), ui_editing::PropertyPath(path), value, ui_editing::PropertySetMode::Absolute),
182 if (!previewed.ok()) return ui_editing::Result<editor::TransactionReceipt>::failure(previewed.status());
190 if (!previewed.ok()) return ui_editing::Result<editor::TransactionReceipt>::failure(previewed.status());
198 if (preview_.status != ui_editing::EditorStatus::Applied || preview_.documentRevision != target_.revision()) {
276 return bind.checked(self, "theme editor must not be null", [&] { return self->editor().selectTheme(id); });
278 themeEditor.addFunc("createFromPreset", [bind](ScriptUiThemeEditor* self, const std::string& id,
289 return bind.checked(self, "theme editor must not be null", [&] { return self->editor().deleteSelected(); });
292 return bind.checked(self, "theme editor must not be null", [&] { return self->editor().setActiveSelected(); });
299 "setColor", [bind](ScriptUiThemeEditor* self, const std::string& path, float r, float g, float b, float a) {
306 themeEditor.addFunc("setFloat", [bind](ScriptUiThemeEditor* self, const std::string& path, float value) {
310 themeEditor.addFunc("applyPreviewHost", [bind](ScriptUiThemeEditor* self, const std::string& hostName) {
314 editor::registerEditorHistory<ScriptUiThemeEditor>(themeEditor, bind, "theme editor must not be null");
317 [](ScriptUiThemeEditor& self) { return static_cast<int>(self.editor().previewRevision()); }, 0);
319 themeEditor, "getSelectedId", [](ScriptUiThemeEditor& self) { return self.editor().selectedId(); },
322 themeEditor, "getActiveId", [](ScriptUiThemeEditor& self) { return self.editor().activeId(); }, std::string{});
327 themeEditor, "getThemeCount", [](ScriptUiThemeEditor& self) { return self.editor().themeCount(); }, 0);
359 vm, Status::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "theme editor must not be null",
Per-translation-unit VM + diagnostic-source helper for Squirrel bindings.
Squirrel adapter for the UI theme editor.
UI-neutral named Theme catalog editor: workspace, gallery preview, undo.
Owning, renderer-independent dynamic values.
Squirrel adapters for WorkspaceLayoutShell.
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.cpp:21
void ignore(std::string_view reason={}) const noexcept
Explicitly discard this result after documenting the reason.
Definition Result.h:571
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
static Status success(StatusCode code=StatusCode::Ok)
Construct a successful status with an explicit non-error outcome.
Definition Status.cpp:19
static Status failure(StatusCode code, Diagnostic diagnostic)
Construct a failed status with one diagnostic.
Definition Status.cpp:28
Dotted property path (layout.size) compared and persisted as text.
Definition EditingIds.h:78
Deterministic owning value tree shared by authoring hosts.
Definition EditingValue.h:23
Composition model shared by project-specific developer and runtime editors.
Definition EditorWorkspace.h:43
bool setPanelContext(const std::string &id, const std::string &context)
Attach a semantic input context such as scene, graph, or timeline.
Definition EditorVolumeTarget.cpp:206
Result< WorkspacePanelDescriptor > registerPanel(WorkspacePanelDescriptor descriptor)
Register a checked owning panel descriptor.
Definition EditorVolumeTarget.cpp:118
Result< WorkspacePanelDescriptor > activatePanel(const StableId &id)
Activate a visible panel with structured not-found/rejected results.
Definition EditorVolumeTarget.cpp:236
bool setPanelCapability(const std::string &id, const std::string &capability)
Attach a capability requirement used by the host when filtering panels.
Definition EditorVolumeTarget.cpp:197
Result< TransactionReceipt > commit() override
Preflight and commit all active operations through the authority.
Definition EditorSimulationPreview.cpp:258
Result< TransactionId > begin(TransactionSpec specification) override
Begin a transaction with a stable id and base revision.
Definition EditorSimulationPreview.cpp:244
Result< TransactionReceipt > undo() override
Compensate the most recent committed transaction.
Definition EditorSimulationPreview.cpp:266
Result< void > discard() override
Discard the active, not-yet-committed operation list.
Definition EditorSimulationPreview.cpp:260
Result< TransactionReceipt > redo() override
Reapply the most recently compensated transaction.
Definition EditorSimulationPreview.cpp:268
Result< void > append(DomainOperation operation) override
Append an operation to the active transaction without applying it.
Definition EditorSimulationPreview.cpp:252
Editor facade binder: common script::BindContext plus history/owned-create helpers.
Definition EditorScriptProjection.h:135
static eve::OptionalRef< UIHost > resolve(UIHostHandle handle) noexcept
Resolves a UI host handle with ECS generation checking.
Definition UIHost.cpp:62
static UIHostHandle findHost(const std::string &name)
Lookup by Meta.name across the UIHost View.
Definition UISystem.cpp:1992
Result< DomainOperation > makeDelete(const ObjectId &id) const
Make delete.
Definition UiTheme.cpp:276
Result< DomainOperation > makeSetActive(const ObjectId &id) const
Make set active.
Definition UiTheme.cpp:292
Result< DomainOperation > makeResetToBase(const ObjectId &id) const
Make reset to base.
Definition UiTheme.cpp:301
const ObjectId & activeId() const noexcept
Active publication id; empty only if the catalog failed to seed.
Definition UiTheme.h:93
Result< UiThemeAsset > theme(const ObjectId &id) const
Copy one named theme, or NotFound.
Definition UiTheme.cpp:143
PropertyReadResult read(const SelectionSnapshot &selection, const PropertyPath &path) const override
Reads .
Definition UiThemeProperty.cpp:31
Result< DomainOperation > makeCreateFromPreset(const ObjectId &id, std::string name, UiThemeBasePreset preset) const
Make create from preset.
Definition UiTheme.cpp:212
Result< DomainOperation > makeSet(const SelectionSnapshot &selection, const PropertyPath &path, const EditorValue &value, PropertySetMode mode) const override
Make set.
Definition UiThemeProperty.cpp:45
const std::vector< UiThemeAsset > & themes() const noexcept
Borrow authored themes in catalog order.
Definition UiTheme.h:91
Result< DomainOperation > makeDuplicate(const ObjectId &source, const ObjectId &id, std::string name) const
Make duplicate.
Definition UiTheme.cpp:237
UiThemePreviewSnapshot build(const UiThemeCatalogTarget &catalog, const ObjectId &themeId, Revision expectedRevision) const
Copy tokens for themeId when expectedRevision matches the catalog.
Definition UiPreview.cpp:138
Result< void > publish(const UiThemeCatalogTarget &catalog) const
Replace the process global theme with the catalog's active asset.
Definition UiPreview.cpp:162
Composition adapter that exposes the script-owned UiThemeEditor factory.
Definition UiEditorModule.h:8
ui_editing::Result< void > duplicateSelected(std::string id, std::string name)
Definition UiEditorModule.cpp:141
ui_editing::Result< void > deleteSelected()
Definition UiEditorModule.cpp:150
ui_editing::Result< void > configureWorkspace(editor::EditorWorkspace &workspace) const
Install Themes / Preview / Inspector panels.
Definition UiEditorModule.cpp:54
ui_editing::Result< void > setToken(const std::string &path, const ui_editing::EditorValue &value)
Definition UiEditorModule.cpp:170
ui_editing::Result< void > setActiveSelected()
Definition UiEditorModule.cpp:158
ui_editing::Result< editor::TransactionReceipt > redo()
Definition UiEditorModule.cpp:186
ui_editing::Result< void > applyPreviewHost(const std::string &hostName)
Copy the selected theme onto a live UIHost without changing globalTheme.
Definition UiEditorModule.cpp:194
ui_editing::Result< void > createFromPreset(std::string id, std::string name, std::string preset)
Definition UiEditorModule.cpp:129
UiThemeEditor(std::string targetId)
Construct a catalog seeded with built-in Dark and Light assets.
Definition UiEditorModule.cpp:48
ui_editing::Result< void > resetSelectedToBase()
Definition UiEditorModule.cpp:166
ui_editing::Result< editor::TransactionReceipt > undo()
Definition UiEditorModule.cpp:176
float getColorChannel(const std::string &path, int channel) const
Returns the color channel.
Definition UiEditorModule.cpp:232
ui_editing::Result< void > selectTheme(std::string id)
Definition UiEditorModule.cpp:122
ssq::Table projectStatusResult(HSQUIRRELVM vm, const Status &status)
Project a checked native status that carries no payload.
Definition SquirrelBinding.cpp:524
Definition UiEditorModule.cpp:17
void exposeUiThemeEditorScriptBindings(ssq::Table &table, ssq::Class &moduleClass)
Expose the script-owned UiThemeEditor factory on UiEditorModule.
Definition UiEditorModule.cpp:269
void exposeWorkspaceLayoutShellBindings(ssq::Table &table, ssq::Class &moduleClass)
Expose WorkspaceLayoutShell helpers on UiEditorModule.
Definition WorkspaceLayoutShellBindings.cpp:53
@ InvalidArgument
@ Applied
Definition Container.h:602
Revision documentRevision
Definition UiTheme.h:165