载入中...
搜索中...
未找到
UiThemeEditor.h
浏览该文件的文档.
1#pragma once
2
12#include "ui/editing/UiTheme.h"
13
14#include <cstdint>
15#include <string>
16
17namespace eve::ui_editor {
18
31public:
33 explicit UiThemeEditor(std::string targetId);
34
35 UiThemeEditor(const UiThemeEditor&) = delete;
37
39 const ui_editing::UiThemeCatalogTarget& target() const noexcept { return target_; }
40
46
47 [[nodiscard]] ui_editing::Result<void> selectTheme(std::string id);
48 [[nodiscard]] ui_editing::Result<void> createFromPreset(std::string id, std::string name, std::string preset);
49 [[nodiscard]] ui_editing::Result<void> duplicateSelected(std::string id, std::string name);
53 [[nodiscard]] ui_editing::Result<void> setToken(const std::string& path, const ui_editing::EditorValue& value);
56
61 [[nodiscard]] ui_editing::Result<void> applyPreviewHost(const std::string& hostName);
62
63 bool canUndo() const noexcept { return transactions_.canUndo(); }
65 bool canRedo() const noexcept { return transactions_.canRedo(); }
67 std::uint64_t revision() const noexcept { return target_.revision(); }
69 std::uint64_t previewRevision() const noexcept { return preview_.documentRevision; }
71 std::string selectedId() const { return selectedId_; }
73 std::string activeId() const { return target_.activeId().value(); }
75 std::string previewRuntimeName() const { return preview_.runtimeName; }
76
78 int themeCount() const { return static_cast<int>(target_.themes().size()); }
80 std::string themeId(int index) const;
82 std::string themeName(int index) const;
84 bool isThemeSelected(int index) const;
86 bool isThemeActive(int index) const;
87
89 float getColorChannel(const std::string& path, int channel) const;
91 float getFloat(const std::string& path) const;
92
93private:
94 [[nodiscard]] ui_editing::Result<void> commit(
96 [[nodiscard]] ui_editing::Result<void> refreshPreview();
97 editor::SelectionSnapshot selection() const;
104 const ui_editing::UiThemeAsset* themeAt(int index) const;
105
112 std::string selectedId_ = "dark";
113 std::uint64_t txSequence_ = 0;
114};
115
116} // namespace eve::ui_editor
ActionParameterOperation operation
double value
std::string label
std::string name
std::string path
Definition PlayHost.cpp:110
std::uint32_t targetId
uint32_t index
Move-only operation result carrying either a value or Status.
Definition Result.h:155
std::uint64_t revision() const override
Return the current revision.
In-process authority for a single editable runtime or document target.
Deterministic owning value tree shared by authoring hosts.
Composition model shared by project-specific developer and runtime editors.
Local transaction coordinator backed by an injected edit authority.
bool canUndo() const noexcept override
True when one or more committed transactions can be compensated.
bool canRedo() const noexcept override
True when one or more compensated transactions can be reapplied.
Serializable catalog of named UI themes with one active publication slot.
Definition UiTheme.h:60
const ObjectId & activeId() const noexcept
Active publication id; empty only if the catalog failed to seed.
Definition UiTheme.h:93
const std::vector< UiThemeAsset > & themes() const noexcept
Borrow authored themes in catalog order.
Definition UiTheme.h:91
Builds a Theme copy for a catalog revision without touching runtime globals.
Definition UiTheme.h:173
Publishes the active catalog theme through ui::setGlobalTheme.
Definition UiTheme.h:184
Workspace controller for one authored UI theme catalog.
ui_editing::Result< void > duplicateSelected(std::string id, std::string name)
std::string previewRuntimeName() const
Preview runtime name.
ui_editing::Result< void > deleteSelected()
std::string themeId(int index) const
Theme id.
ui_editing::Result< void > configureWorkspace(editor::EditorWorkspace &workspace) const
Install Themes / Preview / Inspector panels.
UiThemeEditor & operator=(const UiThemeEditor &)=delete
int themeCount() const
Theme count.
const ui_editing::UiThemeCatalogTarget & target() const noexcept
Borrow the authoritative theme catalog.
std::string selectedId() const
Selected id.
ui_editing::Result< void > setToken(const std::string &path, const ui_editing::EditorValue &value)
ui_editing::Result< void > setActiveSelected()
float getFloat(const std::string &path) const
Returns the float.
bool isThemeActive(int index) const
True when theme active.
ui_editing::Result< editor::TransactionReceipt > redo()
bool canRedo() const noexcept
Can redo.
ui_editing::Result< void > applyPreviewHost(const std::string &hostName)
Copy the selected theme onto a live UIHost without changing globalTheme.
ui_editing::Result< void > createFromPreset(std::string id, std::string name, std::string preset)
std::string activeId() const
Active id.
ui_editing::Result< void > resetSelectedToBase()
std::string themeName(int index) const
Theme name.
ui_editing::Result< editor::TransactionReceipt > undo()
float getColorChannel(const std::string &path, int channel) const
Returns the color channel.
std::uint64_t revision() const noexcept
Revision.
bool canUndo() const noexcept
UiThemeEditor(const UiThemeEditor &)=delete
bool isThemeSelected(int index) const
True when theme selected.
ui_editing::Result< void > selectTheme(std::string id)
std::uint64_t previewRevision() const noexcept
Preview revision.
SelectionSnapshot public API.
One named, fully snapshotted Theme asset.
Definition UiTheme.h:47
Revision-bound Theme copy used by gallery hosts without mutating globalTheme.
Definition UiTheme.h:163