public CatchOperationsFromHistoryForDelegatedPrimitive(UndoHistoryImpl history, DelegatedUndoPrimitiveImpl primitive, DelegatedUndoPrimitiveState state) { this.history = history; this.primitive = primitive; primitive.State = state; history.ForwardToUndoOperation(primitive); }
/// <summary> /// This method ends the lifetime of the activeUndoOperationPrimitive and should be called after ForwardToUndoOperation. /// </summary> /// <param name="primitive">The previously active delegated primitive--used for sanity check.</param> public void EndForwardToUndoOperation(DelegatedUndoPrimitiveImpl primitive) { if (this.activeUndoOperationPrimitive != primitive) { throw new InvalidOperationException(); } this.activeUndoOperationPrimitive = null; }
public UndoHistoryImpl(UndoHistoryRegistryImpl undoHistoryRegistry) { this.currentTransaction = null; this.UndoHistoryRegistry = undoHistoryRegistry; this.undoStack = new Stack <ITextUndoTransaction>(); this.redoStack = new Stack <ITextUndoTransaction>(); this.activeUndoOperationPrimitive = null; this.state = TextUndoHistoryState.Idle; }