public override bool CanAppend(UndoRedoAction action) { CamViewObjAction castAction = action as CamViewObjAction; if (castAction == null) return false; if (castAction.postPerform != this.postPerform) return false; return castAction.targetObj.SetEqual(this.targetObj); }
public override void Append(UndoRedoAction action, bool performAction) { base.Append(action, performAction); MoveCamViewObjAction moveAction = action as MoveCamViewObjAction; if (performAction) { moveAction.backupPos = this.backupPos; moveAction.Do(); } this.moveBy += moveAction.moveBy; }
public override void Append(UndoRedoAction action, bool performAction) { base.Append(action, performAction); ScaleCamViewObjAction moveAction = action as ScaleCamViewObjAction; if (performAction) { moveAction.backupPos = this.backupPos; moveAction.backupScale = this.backupScale; moveAction.Do(); } this.scaleBy *= moveAction.scaleBy; }
public static void Redo() { UndoRedoAction action = NextAction; if (action == null) { return; } actionIndex++; action.Do(); OnStackChanged(); }
public static void Undo() { UndoRedoAction action = PrevAction; if (action == null) { return; } actionIndex--; action.Undo(); OnStackChanged(); }
public override void Append(UndoRedoAction action, bool performAction) { base.Append(action, performAction); RotateCamViewObjAction moveAction = action as RotateCamViewObjAction; if (performAction) { moveAction.backupPos = this.backupPos; moveAction.backupAngle = this.backupAngle; moveAction.Do(); } this.turnBy += moveAction.turnBy; }
public override bool CanAppend(UndoRedoAction action) { return action is ScaleCamViewObjAction && base.CanAppend(action); }
public static void Do(UndoRedoAction action) { AppendAction(action, true); }
public virtual void Append(UndoRedoAction action, bool performAction) { }
public virtual bool CanAppend(UndoRedoAction action) { return(false); }
private static void AppendAction(UndoRedoAction action, bool performAction) { if (action.IsVoid) { return; } if (macroBeginCount > 0) { UndoRedoAction prev = macroList.Count > 0 ? macroList[macroList.Count - 1] : null; if (prev != null && prev.CanAppend(action)) { prev.Append(action, performAction); } else { macroList.Add(action); if (performAction) { action.Do(); } } } else { if (Sandbox.IsActive) { if (performAction) { action.Do(); } return; } bool hadNext = false; if (actionStack.Count - actionIndex - 1 > 0) { actionStack.RemoveRange(actionIndex + 1, actionStack.Count - actionIndex - 1); hadNext = true; } UndoRedoAction prev = PrevAction; if (!lastActionFinished && !hadNext && prev != null && prev.CanAppend(action)) { prev.Append(action, performAction); } else { lastActionFinished = false; actionStack.Add(action); actionIndex++; if (performAction) { action.Do(); } } if (actionStack.Count > maxActions) { actionIndex -= actionStack.Count - maxActions; actionStack.RemoveRange(0, actionStack.Count - maxActions); } OnStackChanged(); } }
public virtual void Append(UndoRedoAction action, bool performAction) {}
public virtual bool CanAppend(UndoRedoAction action) { return false; }
private static void AppendAction(UndoRedoAction action, bool performAction) { if (action.IsVoid) return; if (macroBeginCount > 0) { UndoRedoAction prev = macroList.Count > 0 ? macroList[macroList.Count - 1] : null; if (prev != null && prev.CanAppend(action)) { prev.Append(action, performAction); } else { macroList.Add(action); if (performAction) action.Do(); } } else { if (Sandbox.IsActive) { if (performAction) action.Do(); return; } bool hadNext = false; if (actionStack.Count - actionIndex - 1 > 0) { actionStack.RemoveRange(actionIndex + 1, actionStack.Count - actionIndex - 1); hadNext = true; } UndoRedoAction prev = PrevAction; if (!lastActionFinished && !hadNext && prev != null && prev.CanAppend(action)) { prev.Append(action, performAction); } else { lastActionFinished = false; actionStack.Add(action); actionIndex++; if (performAction) action.Do(); } if (actionStack.Count > maxActions) { actionIndex -= actionStack.Count - maxActions; actionStack.RemoveRange(0, actionStack.Count - maxActions); } OnStackChanged(); } }