Editor → User Interface → history_panel.h
ui::history_panel
| Type | Class |
| Namespace | conjure::editor::ui |
| Include File Path | engine/include/conjure/editor/ui/panels/history_panel.h |
| Source File Path | engine/src/editor/ui/panels/history_panel.cpp |
| API ↗ | The editor, The workspace UI |
Syntax
Inheritance Hierarchy
ui::editor_panel → ui::history_panel
Constructors
| Access | Signature | Description |
|---|---|---|
| public | history_panel(); |
Destructors
| Access | Signature | Description |
|---|---|---|
| public | ~history_panel() override; |
Variables
| Access | Name | Type | Default | Description |
|---|---|---|---|---|
| public | CLEAR_ | static constexpr std:: | "Frozen while playing: Clear works again after Stop" | |
| public | CLEAR_HINT | static constexpr std:: | "Forgets every entry: nothing can be undone or redone after it" | Clear's tooltip, and its tooltip while play freezes the stack (it is disabled then: history.clear is refused in play, as undo and redo are). |
| public | CLEAR_KEY | static constexpr std:: | "clear" | The keys of the panel's kit widgets (tests and automation find them in the frame record): the tool strip's Clear, the list of entries and the empty state. |
| public | EMPTY_KEY | static constexpr std:: | "no_entries" | |
| public | ENTRIES_KEY | static constexpr std:: | "entries" | |
| public | FROZEN_HINT | static constexpr std:: | "Frozen while playing: the history steps again after Stop" | The tooltip of a row while play freezes the stack: why its click sends nothing. |
| private | m | bool | false | |
| private | m | u32 | 0 | |
| private | mFooterEnd | std::string | "" | |
| private | mFooterStart | std::string | "" | |
| private | mHint | std::array<char, 160> | {} | |
| private | m | u32 | 0 | |
| private | mRevealRow | usize | kit::NO_VIEW_ROW | |
| private | m | bool | false | |
| private | m | u64 | 0 | |
| private | mSource | std::array<char, 32> | {} | |
| public | REVEAL_ | static constexpr u32 | 3 | How many frames of a list that draws the current entry's row it is scrolled to after it came into view or the stack moved: a list that has just appeared does not know its height yet, and a docked window's first frame draws nothing (as the Hierarchy's reveal, hierarchy_panel::REVEAL_FRAMES). |
| public | START_HINT | static constexpr std:: | "Before every entry: a click undoes all those applied" | The leading row's tooltip while the stack is not frozen. |
| public | START_LABEL | static constexpr std:: | "Start" | The leading row's label, the state before every entry. |
Functions
Public
decorate
decoratevoid decorate(
editor_context &context,
kit::panel_shell &shell) override;The body begins at the window's edges (kit::panel_shell::set_flush): the strip and the rows run across the panel.
draw_contents
draw_contentsvoid draw_contents(
editor_context &context,
kit::panel_shell &shell) override;entries_drawn
entries_drawn[[nodiscard]] u32 entries_drawn() const noexcept;The rows the last draw drew (the list's visible entries).
rewind
rewindbool rewind(
editor_context &context);Undoes every entry applied, one history.undo with the cursor's count: what a click on the leading Start row sends. Nothing while none is applied or the stack is frozen. Returns whether a command was sent.
source_text
source_text[[nodiscard]] static std::string_view source_text(
undo_source source,
u32 clientId,
std::span<char> buffer) noexcept;Who made an entry, as a row shows it: "Editor" for the editor's own UI, "Agent N" for an agent, "Client N" for another client, from the kind the stack told as the entry was pushed (undo_entry::source) and the entry's client id. Written into buffer (at least 24 bytes), whose part written is returned.
step_to
step_tobool step_to(
editor_context &context,
usize index);Steps the undo stack so the entry at index (oldest first) is the last one applied: history.undo with the count of entries after it that are applied, or history.redo with the count up to it that are not. What a click on a row sends; public so tests and tools drive it. Nothing for the entry already last applied, an index past the entries, or while the stack is frozen. Returns whether a command was sent.
update
updatevoid update(
editor_context &context) override;Notes whether the list drew in the frame before (a list drawn again after a frame without it reveals the current entry).
Private
entry_hint
entry_hint[[nodiscard]] std::string_view entry_hint(
const undo_entry &entry,
bool frozen);An entry's tooltip, written into mHint: how many commands it undoes and redoes and its size ("1 undo command, 2 redo commands, 340 bytes"), and on a line of its own FROZEN_HINT while frozen.
update_footer
update_footer