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));
        }
Exemple #2
0
        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));
 }
Exemple #4
0
 public void Add(DocumentUndoAction action)
 {
     __UndoActions.Add(action);
 }
Exemple #5
0
 public override void Merge(DocumentUndoAction action)
 {
     Debug.Assert(action is UndoMyEditAction);
     Debug.Assert(((UndoMyEditAction)action).__UndoAction is UndoTextEnter);
     __UndoAction.Merge((UndoTextEnter)(((UndoMyEditAction)action).__UndoAction));
 }
Exemple #6
0
 public void SaveUndoActionStack(DocumentUndoAction undoAction)
 {
     /*
     var ser = new DataContractSerializer(typeof(DocumentUndoAction));
     using (XmlWriter xw = XmlWriter.Create(Console.Out))
     {
         ser.WriteObject(xw, undoAction);
     }*/
 }
Exemple #7
0
        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;
 }
Exemple #10
0
 public virtual void Merge(DocumentUndoAction action)
 {
 }
Exemple #11
0
 public virtual bool CanMerge(DocumentUndoAction action)
 {
     return(false);
 }
Exemple #12
0
 public void Add(DocumentUndoAction action)
 {
     __UndoActions.Add(action);
 }