载入中...
搜索中...
未找到
UiPreview.cpp
浏览该文件的文档.
15UiPreviewSnapshot UiDocumentPreviewService::build(const UiDocumentTarget& document, double width, double height) const {
35 const double parentWidth = std::max(0.0, parent.width - widget.style.marginLeft - widget.style.marginRight);
36 const double parentHeight = std::max(0.0, parent.height - widget.style.marginTop - widget.style.marginBottom);
44 contentX + parentWidth * widget.layout.anchorX + widget.layout.x - preview.width * widget.layout.pivotX;
46 contentY + parentHeight * widget.layout.anchorY + widget.layout.y - preview.height * widget.layout.pivotY;
53 childParent.width = std::max(0.0, childParent.width - widget.style.paddingLeft - widget.style.paddingRight);
54 childParent.height = std::max(0.0, childParent.height - widget.style.paddingTop - widget.style.paddingBottom);
61 [](const EditorDiagnostic& diagnostic) { return diagnostic.severity() == DiagnosticSeverity::Error; });
66Result<ObjectId> UiDocumentPreviewService::pick(const UiPreviewSnapshot& preview, double x, double y) const {
68 return eve::editing::failed<ObjectId>(EditorStatus::Rejected, RuleId("editor.ui.invalid-pick-point"),
87 return eve::editing::failed<EditorValue>(EditorStatus::Conflict, RuleId("editor.ui.stale-preview"),
91 return eve::editing::failed<EditorValue>(EditorStatus::NotFound, RuleId("editor.ui.widget-not-found"),
93 double parentX = 0.0, parentY = 0.0, parentW = preview.viewportWidth, parentH = preview.viewportHeight;
106 0.0, parent->width - parentWidget.value().style.paddingLeft - parentWidget.value().style.paddingRight);
108 0.0, parent->height - parentWidget.value().style.paddingTop - parentWidget.value().style.paddingBottom);
138UiThemePreviewSnapshot UiThemePreviewService::build(const UiThemeCatalogTarget& catalog, const ObjectId& themeId,
180 return eve::editing::ruleDiagnostic(eve::DiagnosticCode::InvalidArgument, RuleId(rule), DiagnosticSeverity::Error,
317 return EditorValue::Array{static_cast<double>(src[0]), static_cast<double>(src[1]), static_cast<double>(src[2]),
369 for (const FloatTok& token : kFloats) object[token.path] = static_cast<double>(theme.*(token.member));
420Result<void> assignThemeToken(ui::Theme& theme, const PropertyPath& path, const EditorValue& value) {
424 return eve::editing::failed<void>(EditorStatus::Rejected, RuleId("editor.ui-theme.token-color"),
432 return eve::editing::failed<void>(EditorStatus::Rejected, RuleId("editor.ui-theme.token-float"),
519 "editor.ui-theme.color-range", std::string("Theme color channel is out of range: ") + token.path));
553 if (name == "custom") return eve::editing::applied<UiThemeBasePreset>(UiThemeBasePreset::Custom);
A structured explanation of a failed, degraded, or noteworthy result.
Definition Diagnostic.h:94
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
const std::string & value() const noexcept
Returns the exact legacy or canonical compatibility spelling.
Definition Identity.h:365
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
Result< EditorValue > anchorGizmo(const UiDocumentTarget &document, const UiPreviewSnapshot &preview, const ObjectId &widget) const
Return anchor point, pivot point and connecting line as numeric pairs.
Definition UiPreview.cpp:84
UiPreviewSnapshot build(const UiDocumentTarget &document, double width, double height) const
Compute absolute rectangles for a viewport without mutating runtime UI.
Definition UiPreview.cpp:15
Result< ObjectId > pick(const UiPreviewSnapshot &preview, double x, double y) const
Pick the deepest visible widget under a preview-space point.
Definition UiPreview.cpp:66
Serializable UI authoring document with hierarchy and inspector capabilities.
Definition UiDocument.h:157
std::vector< EditorDiagnostic > validate() const
Validate style, hierarchy and viewport layout constraints.
Definition UiDocument.cpp:277
std::vector< ObjectId > children(const ObjectId &parent) const override
Children.
Definition UiDocument.cpp:127
Result< UiWidgetSnapshot > widget(const ObjectId &id) const override
Widget.
Definition UiDocument.cpp:119
Serializable catalog of named UI themes with one active publication slot.
Definition UiTheme.h:60
std::string runtimeName(const ObjectId &id) const
Runtime name written to ui::globalThemeName(): dark, light, or custom.
Definition UiTheme.cpp:151
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
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
editing::PropertyDescriptor PropertyDescriptor
Definition ArchSpaceTarget.h:31
editing::PropertyPath PropertyPath
Definition ArchSpaceTarget.h:33
const Value * field(const Value &value, const char *key)
Borrow an optional object field.
Definition BuildingSnapshot.cpp:96
Diagnostic ruleDiagnostic(eve::DiagnosticCode code, RuleId rule, DiagnosticSeverity severity, std::string message)
Build an owning common diagnostic carrying an open editing rule identity.
Definition EditingResult.cpp:20
Definition UiDocument.cpp:9
EditorValue readThemeToken(const ui::Theme &theme, const PropertyPath &path)
Reads theme token.
Definition UiPreview.cpp:466
Result< void > assignThemeToken(ui::Theme &theme, const PropertyPath &path, const EditorValue &value)
Assign theme token.
Definition UiPreview.cpp:420
std::vector< EditorDiagnostic > validateThemeTokens(const ui::Theme &theme)
Validate theme tokens.
Definition UiPreview.cpp:512
Result< UiThemeBasePreset > parsePreset(const std::string &name)
Parse preset.
Definition UiPreview.cpp:550
Result< ui::Theme > parseThemeTokens(const EditorValue &value)
Parse theme tokens.
Definition UiPreview.cpp:376
@ InvalidArgument
@ PreconditionViolation
std::string displayNameKey
Definition EditingProperty.h:77
std::vector< PropertyDescriptor > properties
Definition EditingProperty.h:120
Unified UI design tokens (colors, geometry, typography). Applied to ImGui each frame via applyThemeTo...
Definition Theme.h:41
static Theme dark()
Built-in presets with matching geometry; only colors differ.
Definition Theme.cpp:174
Deterministic UI layout preview used by canvas rendering and picking.
Definition UiDocument.h:254
std::vector< UiPreviewWidget > widgets
Definition UiDocument.h:258
Revision documentRevision
Definition UiDocument.h:256
Computed widget rectangle in a revision-bound UI preview.
Definition UiDocument.h:245
Revision-bound Theme copy used by gallery hosts without mutating globalTheme.
Definition UiTheme.h:163
Immutable widget snapshot used across editor/runtime boundaries.
Definition UiDocument.h:102