History

References
[IoId("00000000-4a34-4f65-83ba-480c30841fb4")] public class History : IStorable
Provides access to the undo/redo history of a Grasshopper document.

Properties

CentralRedoSequence

#
Enumerate over all the central redo nodes from the first to the final.
public IEnumerable<Node> CentralRedoSequence { get; }

CentralUndoSequence

#
Enumerate over all the central undo nodes from the first to the root.
public IEnumerable<Node> CentralUndoSequence { get; }

Document

#
Gets the document this undo history is associated with.
public Document Document { get; }

FirstRedo

#
Gets the first node to be redone, if any.
public Node FirstRedo { get; }

FirstUndo

#
Gets the first node to be undone, if any.
public Node FirstUndo { get; }

IsEmpty

#
Gets whether this history contains any undo or redo records.
public bool IsEmpty { get; }

RedoActions

#
Enumerate over all undo actions in the central redo sequence.
public IEnumerable<Action> RedoActions { get; }

Root

#
Gets the root of this history.
public Node Root { get; }

UndoActions

#
Enumerate over all undo actions in the central undo sequence.
public IEnumerable<Action> UndoActions { get; }

Methods

Clear

#
Clear the entire undo and redo stacks.
public void Clear()

Clear

#
Remove all children from the given node.
public void Clear(
Node
node
)

Do

#
Adds a new undo node to this history as the primary child of the current FirstUndo node. The new node will automatically become the new FirstUndo node and the FirstRedo field will go blank.
public void Do(
Record
record
Record to add.
)

Do

#
Adds a new undo node to this history as the primary child of the current FirstUndo node. The new node will automatically become the new FirstUndo node and the FirstRedo field will go blank.
public void Do(
name,
action
)

Do

#
Adds a new undo node to this history as the primary child of the current FirstUndo node. The new node will automatically become the new FirstUndo node and the FirstRedo field will go blank.
public void Do(
name,
actions
)

Do

#
Adds a new undo node to this history as the primary child of the current FirstUndo node. The new node will automatically become the new FirstUndo node and the FirstRedo field will go blank.
public void Do()

Do

#
Adds a new undo node to this history as the primary child of the current FirstUndo node. The new node will automatically become the new FirstUndo node and the FirstRedo field will go blank.
public void Do(
name,
params Action[]
actions
)

FindCreationAction

#
Find the youngest action in the central undo sequence which covers the creation of an object.
public CreateObjectAction FindCreationAction(
instanceId
)

FindDeletionAction

#
Find the youngest action in the central undo sequence which covers the deletion of an object.
public DeleteObjectAction FindDeletionAction(
instanceId
)

FindDeletionRecord

#
Find the youngest record in the central undo sequence which covers the deletion of an object.
public Record FindDeletionRecord(
instanceId
)

Move

#
Move a node to a new parent.
public void Move(
Node[]
nodes,
Nodes to move. Each subsequent node in the array must be the primary child of the previous node.
(Node Parent, Node Child)
link,
The parent+child pair into which to move the nodes.
showStateWarning
If true, and if not already disabled by the user, and if applicable, shows the warning regarding the dangers of moving records in one state into a region with a different state.
)

Prune

#
Clear all non-central undo and redo records.
public void Prune()

Prune

#
Clear all non-central undo or redo records that descent from a given node.
public void Prune(
Node
node,
recursive = false
)

Redo

#
Undo the FirstUndo record and adjust the FirstUndo and FirstRedo fields accordingly.
public void Redo()

Redo

#
Perform all the steps required to redo a specific node.
public void Redo(
Node
node
)

RedoActionsOfType<T>

#
Enumerate over all undo actions of a specific type in the central redo sequence.
public IEnumerable<T> RedoActionsOfType<T>()

Remove

#
Remove a node and all its secondary children from this history, and connect the primary child to the parent if possible.
public void Remove(
Node
node
)

ShowHistory

#
Show the history of an existing canvas in a window.
public static Form ShowHistory(
canvas
)
Canvas to link to.

ShowHistory

#
Show the full history in a window.
public Form ShowHistory(
Window
owner
)
Form containing the history browser.

Store

#
public void Store(
writer
)
Store

Undo

#
Undo the FirstUndo record and adjust the FirstUndo and FirstRedo fields accordingly.
public void Undo()

Undo

#
Perform all the steps required to undo a specific node.
public void Undo(
Node
node
)

UndoActionsOfType<T>

#
Enumerate over all undo actions of a specific type in the central undo sequence.
public IEnumerable<T> UndoActionsOfType<T>()

Events

Modified

#
This event is raised whenever the topology of the history graph is changed. The Modified event always follows a more specific event such as NodeAdded, NodeMerged or NodeMoved.
public event EventHandler<UndoEventArgs> Modified

NodeAdded

#
This event is raised whenever a new node is added to the history. This event is always followed by the Modified event.
public event EventHandler<UndoNodeEventArgs> NodeAdded

NodeMerged

#
This event is raised whenever a node is merged with its primary child. This event is always followed by the Modified event.
public event EventHandler<UndoNodeEventArgs> NodeMerged

NodeMoved

#
This event is raised whenever a node and all its child nodes are moved from one location in the history to another. This event is always followed by the Modified event.
public event EventHandler<UndoNodeMovedEventArgs> NodeMoved

NodeRemoved

#
This event is raised whenever a new node and all its child nodes are removed from the history. This event is always followed by the Modified event.
public event EventHandler<UndoNodeEventArgs> NodeRemoved

Redone

#
This event is raised when a record is redone.
public event EventHandler<UndoEventArgs> Redone

Undone

#
This event is raised when a record is undone.
public event EventHandler<UndoEventArgs> Undone