History / Undo-Redo Architecture
Command-pattern undo/redo system with HistoryManager and DrawingAction subclasses.
The undo/redo system uses a command pattern with HistoryManager and concrete DrawingAction subclasses.
Action Types
- AddComponentAction: Tracks component creation; undo removes, redo re-adds
- RemoveComponentAction: Tracks component deletion with full state snapshot
- DeleteComponentsAction: Removes a multi-selection and its attached lines as one unit
- MoveComponentsAction: Stores old/new positions for a set of components
- ConnectComponentsAction: Tracks line creation between connection points
- DisconnectComponentsAction: Tracks line removal
- PasteComponentsAction: Re-creates copied components and their internal lines
- AlignComponentsAction: Records alignment moves across the selection
- MoveLineAction: Tracks a line being re-routed or re-attached
- ConnectAutomationNodesAction: Connects automation nodes with port management
Each action implements Execute() and Undo(). The HistoryManager maintains a bounded stack (configurable depth, default 100).
Action Catalog
Every mutating operation is recorded as a DrawingAction subclass. The manager pushes these automatically; hosts only construct them when applying their own commands.
AddComponentAction
Action for adding a component.
| Member | Kind | Description |
|---|---|---|
AddComponentAction(DrawingManager manager, SkiaComponent component) | Method | |
override void Execute() | Method | |
override void Undo() | Method |
RemoveComponentAction
Action for removing a component.
| Member | Kind | Description |
|---|---|---|
RemoveComponentAction(DrawingManager manager, SkiaComponent component, List<IConnectionLine> lines) | Method | |
override void Execute() | Method | |
override void Undo() | Method |
DeleteComponentsAction
Action for deleting multiple components.
| Member | Kind | Description |
|---|---|---|
DeleteComponentsAction(DrawingManager manager, List<SkiaComponent> components, List<IConnectionLine> lines) | Method | |
override void Execute() | Method | |
override void Undo() | Method |
MoveComponentsAction
Action for moving components.
| Member | Kind | Description |
|---|---|---|
MoveComponentsAction(DrawingManager manager, List<SkiaComponent> components, SKPoint offset) | Method | |
override void Execute() | Method | |
override void Undo() | Method |
ConnectComponentsAction
Action for connecting components.
| Member | Kind | Description |
|---|---|---|
ConnectComponentsAction(DrawingManager manager, SkiaComponent component1, SkiaComponent component2, IConnectionLine line) | Method | |
override void Execute() | Method | |
override void Undo() | Method |
DisconnectComponentsAction
Action for disconnecting components.
| Member | Kind | Description |
|---|---|---|
DisconnectComponentsAction(DrawingManager manager, SkiaComponent component1, SkiaComponent component2, IConnectionLine line) | Method | |
override void Execute() | Method | |
override void Undo() | Method |
PasteComponentsAction
Action for pasting components from the clipboard.
| Member | Kind | Description |
|---|---|---|
PasteComponentsAction(DrawingManager manager, List<SkiaComponent> components, List<IConnectionLine> lines = null) | Method | |
override void Execute() | Method | |
override void Undo() | Method |
AlignComponentsAction
Action for alignment/distribution operations.
| Member | Kind | Description |
|---|---|---|
AlignComponentsAction(DrawingManager manager, List<SkiaComponent> components, List<SKPoint> beforePositions) | Method | |
override void Execute() | Method | |
override void Undo() | Method |
MoveLineAction
Action for moving a connection line.
| Member | Kind | Description |
|---|---|---|
MoveLineAction(DrawingManager manager, IConnectionLine line, IConnectionPoint oldStartPoint, IConnectionPoint oldEndPoint, IConnectionPoint newStartPoint, IConnectionPoint newEndPoint) | Method | |
override void Execute() | Method | |
override void Undo() | Method |
ConnectAutomationNodesAction
Action for connecting automation nodes.
| Member | Kind | Description |
|---|---|---|
ConnectAutomationNodesAction(DrawingManager manager, Components.AutomationNode node1, Components.AutomationNode node2, IConnectionLine line, IConnectionPoint outputPoint, IConnectionPoint inputPoint) | Method | |
override void Execute() | Method | |
override void Undo() | Method |