public IUndoActivity PopRedo() { IUndoActivity lastUndoable = PeekRedo(); _redoList.RemoveAt(_redoList.Count - 1); OnStackChanged(); return(lastUndoable); }
private void RemoveFirstElementInFullList(List <IUndoActivity> list) { if (list.Count >= _bufferSize) { IUndoActivity removedActivity = list [0]; list.RemoveAt(0); removedActivity.Release(); } }
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(); } }
public void Execute() { WrappedCommand.Execute(); IUndoActivity undoableCommand = WrappedCommand.UndoActivity; if (undoableCommand != null && undoableCommand.Undoable) { DrawingEditor.UndoManager.PushUndo(undoableCommand); DrawingEditor.UndoManager.ClearRedos(); } }
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(); } }
protected void PushUndoActivity() { if (!Undoable) { return; } IUndoActivity activity = UndoActivity; if (activity != null && activity.Undoable && Editor.UndoManager != null) { Editor.UndoManager.PushUndo(activity); Editor.UndoManager.ClearRedos(); } }
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(); }
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); } }
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(); }
// 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()); }
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(); }
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(); }