public override bool CanMerge(DocumentUndoAction action) { if (!(action is UndoMyEditAction)) return false; var action_casted = (UndoMyEditAction)action; if (!(action_casted.__UndoAction is UndoTextEnter)) return false; return __UndoAction.CanBeMergedWith((UndoTextEnter)(action_casted.__UndoAction)); }
public override bool CanMerge(DocumentUndoAction action) { if (!(action is UndoMyEditAction)) { return(false); } var action_casted = (UndoMyEditAction)action; if (!(action_casted.__UndoAction is UndoTextEnter)) { return(false); } return(__UndoAction.CanBeMergedWith((UndoTextEnter)(action_casted.__UndoAction))); }
public override void Merge(DocumentUndoAction action) { Debug.Assert(action is UndoMyEditAction); Debug.Assert(((UndoMyEditAction)action).__UndoAction is UndoTextEnter); __UndoAction.Merge((UndoTextEnter)(((UndoMyEditAction)action).__UndoAction)); }
public void Add(DocumentUndoAction action) { __UndoActions.Add(action); }
public void SaveUndoActionStack(DocumentUndoAction undoAction) { /* var ser = new DataContractSerializer(typeof(DocumentUndoAction)); using (XmlWriter xw = XmlWriter.Create(Console.Out)) { ser.WriteObject(xw, undoAction); }*/ }
public void PushUndoAction(DocumentUndoAction action) { // if the action is empty (does not modifies the docuement, skip adding it to the stack if (action.IsEmptyAction()) return; SaveUndoActionStack(action); if (__UndoActions.Count == 0 || !CanMerge) { if (__UndoGroup != null) __UndoGroup.Add(action); else __UndoActions.Push(action); } else { DocumentUndoAction lastAction = __UndoActions.Peek(); if (lastAction.CanMerge(action)) lastAction.Merge(action); else { if (__UndoGroup != null) __UndoGroup.Add(action); else __UndoActions.Push(action); } } CanMerge = true; __RedoActions.Clear(); DoUndoCountChanged(); }
public virtual void Merge(DocumentUndoAction action) { }
public virtual bool CanMerge(DocumentUndoAction action) { return false; }
public virtual bool CanMerge(DocumentUndoAction action) { return(false); }