Skip to main content

Module undo

Module undo 

Source
Expand description

Shared undo / redo infrastructure.

Mirrors the C# agg-sharp IUndoRedoCommand / UndoBuffer pattern so that any subsystem — text editing, layout, graph editing — can participate in a common, extensible undo stack.

§Usage

use agg_gui::undo::{DoUndoActions, UndoBuffer};

let mut buf = UndoBuffer::new();

// Execute an action and make it undoable:
let v = std::rc::Rc::new(std::cell::Cell::new(0i32));
let v2 = v.clone();
buf.add_and_do(Box::new(DoUndoActions::new(
    "set value",
    move || v.set(42),
    move || v2.set(0),
)));

Structs§

DoUndoActions
A command backed by two closures: one for do_it and one for undo_it.
UndoBuffer
Two-stack undo/redo history buffer.

Traits§

UndoRedoCommand
A named, reversible operation.