Skip to content

Editor → User Interface → history_panel.h

ui::history_panel

Syntax

class CONJURE_API history_panel final : public editor_panel

Inheritance Hierarchy

ui::editor_panel → ui::history_panel

Constructors

AccessSignatureDescription
publichistory_panel();

Destructors

AccessSignatureDescription
public~history_panel() override;

Variables

AccessNameTypeDefaultDescription
publicCLEAR_FROZEN_HINTstatic constexpr std::string_view"Frozen while playing: Clear works again after Stop"
publicCLEAR_HINTstatic constexpr std::string_view"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).
publicCLEAR_KEYstatic constexpr std::string_view"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.
publicEMPTY_KEYstatic constexpr std::string_view"no_entries"
publicENTRIES_KEYstatic constexpr std::string_view"entries"
publicFROZEN_HINTstatic constexpr std::string_view"Frozen while playing: the history steps again after Stop"The tooltip of a row while play freezes the stack: why its click sends nothing.
privatemDrawnSinceUpdateboolfalse
privatemEntriesDrawnu320
privatemFooterEndstd::string""
privatemFooterStartstd::string""
privatemHintstd::array<char, 160>{}
privatemRevealFramesu320
privatemRevealRowusizekit::NO_VIEW_ROW
privatemShownLastFrameboolfalse
privatemShownRevisionu640
privatemSourcestd::array<char, 32>{}
publicREVEAL_FRAMESstatic constexpr u323How 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).
publicSTART_HINTstatic constexpr std::string_view"Before every entry: a click undoes all those applied"The leading row's tooltip while the stack is not frozen.
publicSTART_LABELstatic constexpr std::string_view"Start"The leading row's label, the state before every entry.

Functions

Public

decorate

void 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

void draw_contents(
    editor_context &context,
    kit::panel_shell &shell) override;

entries_drawn

[[nodiscard]] u32 entries_drawn() const noexcept;

The rows the last draw drew (the list's visible entries).

rewind

bool 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

[[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

bool 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

void 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

[[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.