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

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

CentralUndoSequence

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

Document

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

FirstRedo

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

FirstUndo

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

IsEmpty

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

RedoActions

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

Root

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

UndoActions

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

Methods

Clear

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

Clear

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

Do

#
public void Do(Record record)
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.
record (Record)Record to add.

Do

#
public void Do(VerbNoun name, Action action)
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.
name (VerbNoun)
action (Action)

Do

#
public void Do(VerbNoun name, ActionList actions)
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.
name (VerbNoun)
actions (ActionList)

Do

#
public void Do(VerbNoun name, IEnumerable<Action> actions)
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.
name (VerbNoun)
actions (IEnumerable<Action>)

Do

#
public void Do(VerbNoun name, params Action[] actions)
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.
name (VerbNoun)
actions (params Action[])

FindCreationAction

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

FindDeletionAction

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

FindDeletionRecord

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

Move

#
public void Move(Node[] nodes, (Node Parent, Node Child) link, bool showStateWarning)
Move a node to a new parent.
nodes (Node[])Nodes to move. Each subsequent node in the array must be the primary child of the previous node.
link ((Node Parent, Node Child))The parent+child pair into which to move the nodes.
showStateWarning (bool)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

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

Prune

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

Redo

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

Redo

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

RedoActionsOfType<T>

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

Remove

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

ShowHistory

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

ShowHistory

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

Store

#
public void Store(IWriter writer)
writer (IWriter)
Store

Undo

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

Undo

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

UndoActionsOfType<T>

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

Events

Modified

#
public event EventHandler<UndoEventArgs> 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.

NodeAdded

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

NodeMerged

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

NodeMoved

#
public event EventHandler<UndoNodeMovedEventArgs> 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.

NodeRemoved

#
public event EventHandler<UndoNodeEventArgs> 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.

Redone

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

Undone

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