示例#1
0
        public IUndoActivity PopRedo()
        {
            IUndoActivity lastUndoable = PeekRedo();

            _redoList.RemoveAt(_redoList.Count - 1);
            OnStackChanged();

            return(lastUndoable);
        }
示例#2
0
 private void RemoveFirstElementInFullList(List <IUndoActivity> list)
 {
     if (list.Count >= _bufferSize)
     {
         IUndoActivity removedActivity = list [0];
         list.RemoveAt(0);
         removedActivity.Release();
     }
 }
示例#3
0
        public void InvokeEnd(double x, double y, IDrawingView view)
        {
            WrappedHandle.InvokeEnd(x, y, view);

            IUndoActivity activity = WrappedHandle.UndoActivity;

            if (activity != null && activity.Undoable && view.Editor.UndoManager != null)
            {
                view.Editor.UndoManager.PushUndo(activity);
                view.Editor.UndoManager.ClearRedos();
            }
        }
示例#4
0
        public void Execute()
        {
            WrappedCommand.Execute();

            IUndoActivity undoableCommand = WrappedCommand.UndoActivity;

            if (undoableCommand != null && undoableCommand.Undoable)
            {
                DrawingEditor.UndoManager.PushUndo(undoableCommand);
                DrawingEditor.UndoManager.ClearRedos();
            }
        }
示例#5
0
        public void InvokeEnd(MouseEvent ev)
        {
            WrappedHandle.InvokeEnd(ev);

            IUndoActivity activity = WrappedHandle.UndoActivity;

            if (activity != null && activity.Undoable && ev.View.Editor.UndoManager != null)
            {
                ev.View.Editor.UndoManager.PushUndo(activity);
                ev.View.Editor.UndoManager.ClearRedos();
            }
        }
示例#6
0
        protected void PushUndoActivity()
        {
            if (!Undoable)
            {
                return;
            }

            IUndoActivity activity = UndoActivity;

            if (activity != null && activity.Undoable && Editor.UndoManager != null)
            {
                Editor.UndoManager.PushUndo(activity);
                Editor.UndoManager.ClearRedos();
            }
        }
示例#7
0
 public void PushUndo(IUndoActivity undoActivity)
 {
     if (undoActivity.Undoable)
     {
         RemoveFirstElementInFullList(_undoList);
         _undoList.Add(undoActivity);
     }
     else
     {
         // a not undoable activity clears the stack because
         // the last activity does not correspond with the
         // last undo activity
         _undoList = new List <IUndoActivity> ();
     }
     OnStackChanged();
 }
示例#8
0
        public override void Execute()
        {
            base.Execute();
            UndoManager manager = DrawingEditor.UndoManager;

            if ((manager == null) || manager.Redoable == false)
            {
                return;
            }

            IUndoActivity lastRedoable = manager.PopRedo();
            // Execute redo
            bool hasBeenRedone = lastRedoable.Redo();

            // Add to undo stack
            if (hasBeenRedone && lastRedoable.Undoable)
            {
                manager.PushUndo(lastRedoable);
            }
        }
示例#9
0
 public void PushRedo(IUndoActivity redoActivity)
 {
     if (redoActivity.Redoable)
     {
         RemoveFirstElementInFullList(_redoList);
         // add redo activity only if it is not already the last
         // one in the buffer
         if (_redoList.Count == 0 || (PeekRedo() != redoActivity))
         {
             _redoList.Add(redoActivity);
         }
     }
     else
     {
         // a not undoable activity clears the tack because
         // the last activity does not correspond with the
         // last undo activity
         _redoList = new List <IUndoActivity> ();
     }
     OnStackChanged();
 }
示例#10
0
        // TODO: Make more readable.
        public override void Execute()
        {
            base.Execute();
            UndoManager manager = DrawingEditor.UndoManager;

            if (manager == null || manager.Undoable == false)
            {
                return;
            }

            IUndoActivity lastUndoable = manager.PopUndo();
            // Execute undo
            bool hasBeenUndone = lastUndoable.Undo();

            // Add to redo
            if (hasBeenUndone && lastUndoable.Redoable)
            {
                manager.PushRedo(lastUndoable);
            }

            //lastUndoable.getDrawingView().checkDamage();
            //DrawingEditor.fre getDrawingEditor().figureSelectionChanged(lastUndoable.getDrawingView());
        }
示例#11
0
 public void PushUndo(IUndoActivity undoActivity)
 {
     if (undoActivity.Undoable) {
         RemoveFirstElementInFullList (_undoList);
         _undoList.Add (undoActivity);
     } else {
         // a not undoable activity clears the stack because
         // the last activity does not correspond with the
         // last undo activity
         _undoList = new List<IUndoActivity> ();
     }
     OnStackChanged();
 }
示例#12
0
 public void PushRedo(IUndoActivity redoActivity)
 {
     if (redoActivity.Redoable) {
         RemoveFirstElementInFullList (_redoList);
         // add redo activity only if it is not already the last
         // one in the buffer
         if (_redoList.Count == 0 || (PeekRedo () != redoActivity)) {
             _redoList.Add (redoActivity);
         }
     } else {
         // a not undoable activity clears the tack because
         // the last activity does not correspond with the
         // last undo activity
         _redoList = new List <IUndoActivity> ();
     }
     OnStackChanged();
 }