Class UndoRedoSystem
The undo/redo sytem usually exists as a member in the Project and is accessed via Undo. The project handles the menu commands "MenuId.Edit.Undo" and ""MenuId.Edit.Redo" and calls UndoLastStep() rsp. RedoLastStep(). To add a step to the undo system call AddUndoStep(ReversibleChange)
Inheritance
Inherited Members
Namespace: CADability
Assembly: CADability.dll
Syntax
public class UndoRedoSystem
Fields
| Improve this Doc View SourceisRedoing
Declaration
public bool isRedoing
Field Value
| Type | Description |
|---|---|
| System.Boolean |
Properties
| Improve this Doc View SourceMaxUndoSteps
Set or get the maximum number of undo steps that will be kept in the undo stack. When setting this value the undo stack will be cleared.
Declaration
public int MaxUndoSteps { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
UndoFrame
Opens an undo frame, which means that all subsequent calls to AddUndoStep will be considered as a single undo step. Calling UndoLastStep or selecting Undo from the Menu will undo all this steps as a single step. Use the C# "using" construct, since this property supports the IDisposable interface, which closes the undoframe when Dispose is called.
Declaration
public IDisposable UndoFrame { get; }
Property Value
| Type | Description |
|---|---|
| System.IDisposable |
Methods
| Improve this Doc View SourceAddUndoStep(ReversibleChange)
Adds an undo step to the undo stack.
Declaration
public void AddUndoStep(ReversibleChange step)
Parameters
| Type | Name | Description |
|---|---|---|
| ReversibleChange | step | the step |
CanRedo()
Returns true, if there is a step on the redo stack
Declaration
public bool CanRedo()
Returns
| Type | Description |
|---|---|
| System.Boolean |
CanUndo()
Returns true, if there is a step on the undo stack
Declaration
public bool CanUndo()
Returns
| Type | Description |
|---|---|
| System.Boolean |
Clear()
Remove all undo and redo actions from the action stack.
Declaration
public void Clear()
ClearContext()
After several changes "using contextFrame" you can reset the context so that the following changes with the same context generate a new undo step.
Declaration
public void ClearContext()
CloseUndoFrame(Object)
Closes the previously opened undo frame. See OpenUndoFrame().
Declaration
public void CloseUndoFrame(object UndoFrame)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | UndoFrame | the result from OpenUndoFrame |
ContextFrame(Object)
All calls to AddUndoStep(ReversibleChange) that appeare inside the same context are considered to belong to the same action and override the previous call from the same context. So only the last call will be saved in the undo stack. Use ContextFrame with the C# "using" schema or call IDisposable.Dispose() to close the frame.
Declaration
public IDisposable ContextFrame(object context)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | context | any kind of object |
Returns
| Type | Description |
|---|---|
| System.IDisposable | the IDisposable interface for the using schema |
IgnoreLastStep()
The top undostep on the undo stack will be ignored.
Declaration
public bool IgnoreLastStep()
Returns
| Type | Description |
|---|---|
| System.Boolean | success: true, failure: false |
OpenUndoFrame()
Opens an undo frame: all subsequent calls to AddUndoStep(ReversibleChange) are considered as a single undo step until CloseUndoFrame(Object) is being called. You can use the property UndoFrame instead. UndoFrames may be nested.
Declaration
public object OpenUndoFrame()
Returns
| Type | Description |
|---|---|
| System.Object | an object that will be needed for the corresponding CloseUndoFrame call. |
PeekLastRedoStep()
Returns the next redo command if there are any. This will be either a ReversibleChange object or a untyped ArrayList. Returns null if there are no redosteps available
Declaration
public object PeekLastRedoStep()
Returns
| Type | Description |
|---|---|
| System.Object | The next undo command |
PeekLastUndoStep()
Returns the next undo command if there are any. This will be either a ReversibleChange object or a untyped ArrayList. Returns null if there are no undosteps available
Declaration
public object PeekLastUndoStep()
Returns
| Type | Description |
|---|---|
| System.Object | The next undo command |
RedoLastStep()
Executes the redo of the last step. Ususlly called by the project when handling the "MenuId.Edit.Redo" command.
Declaration
public bool RedoLastStep()
Returns
| Type | Description |
|---|---|
| System.Boolean | success: true, failure: false |
UndoLastStep()
Executes the undo of the last step. Ususlly called by the project when handling the "MenuId.Edit.Undo" command.
Declaration
public bool UndoLastStep()
Returns
| Type | Description |
|---|---|
| System.Boolean | success: true, failure: false |
Events
| Improve this Doc View SourceBeginContinousChangesEvent
Declaration
public event UndoRedoSystem.BeginContinousChangesDelegate BeginContinousChangesEvent
Event Type
| Type | Description |
|---|---|
| UndoRedoSystem.BeginContinousChangesDelegate |
ClosingUndoFrameEvent
Declaration
public event UndoRedoSystem.ClosingUndoFrameDelegate ClosingUndoFrameEvent
Event Type
| Type | Description |
|---|---|
| UndoRedoSystem.ClosingUndoFrameDelegate |
EndContinousChangesEvent
Declaration
public event UndoRedoSystem.EndContinousChangesDelegate EndContinousChangesEvent
Event Type
| Type | Description |
|---|---|
| UndoRedoSystem.EndContinousChangesDelegate |
OpeningUndoFrameEvent
Declaration
public event UndoRedoSystem.OpeningUndoFrameDelegate OpeningUndoFrameEvent
Event Type
| Type | Description |
|---|---|
| UndoRedoSystem.OpeningUndoFrameDelegate |