Show / Hide Table of Contents

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
System.Object
UndoRedoSystem
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: CADability
Assembly: CADability.dll
Syntax
public class UndoRedoSystem

Fields

| Improve this Doc View Source

isRedoing

Declaration
public bool isRedoing
Field Value
Type Description
System.Boolean

Properties

| Improve this Doc View Source

MaxUndoSteps

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
| Improve this Doc View Source

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 Source

AddUndoStep(ReversibleChange)

Adds an undo step to the undo stack.

Declaration
public void AddUndoStep(ReversibleChange step)
Parameters
Type Name Description
ReversibleChange step

the step

| Improve this Doc View Source

CanRedo()

Returns true, if there is a step on the redo stack

Declaration
public bool CanRedo()
Returns
Type Description
System.Boolean
| Improve this Doc View Source

CanUndo()

Returns true, if there is a step on the undo stack

Declaration
public bool CanUndo()
Returns
Type Description
System.Boolean
| Improve this Doc View Source

Clear()

Remove all undo and redo actions from the action stack.

Declaration
public void Clear()
| Improve this Doc View Source

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()
| Improve this Doc View Source

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

| Improve this Doc View Source

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

| Improve this Doc View Source

IgnoreLastStep()

The top undostep on the undo stack will be ignored.

Declaration
public bool IgnoreLastStep()
Returns
Type Description
System.Boolean

success: true, failure: false

| Improve this Doc View Source

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.

| Improve this Doc View Source

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

| Improve this Doc View Source

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

| Improve this Doc View Source

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

| Improve this Doc View Source

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 Source

BeginContinousChangesEvent

Declaration
public event UndoRedoSystem.BeginContinousChangesDelegate BeginContinousChangesEvent
Event Type
Type Description
UndoRedoSystem.BeginContinousChangesDelegate
| Improve this Doc View Source

ClosingUndoFrameEvent

Declaration
public event UndoRedoSystem.ClosingUndoFrameDelegate ClosingUndoFrameEvent
Event Type
Type Description
UndoRedoSystem.ClosingUndoFrameDelegate
| Improve this Doc View Source

EndContinousChangesEvent

Declaration
public event UndoRedoSystem.EndContinousChangesDelegate EndContinousChangesEvent
Event Type
Type Description
UndoRedoSystem.EndContinousChangesDelegate
| Improve this Doc View Source

OpeningUndoFrameEvent

Declaration
public event UndoRedoSystem.OpeningUndoFrameDelegate OpeningUndoFrameEvent
Event Type
Type Description
UndoRedoSystem.OpeningUndoFrameDelegate
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX