/// <summary> /// Pushes a Command on the undo stack. /// Also clears the redo stack. /// </summary> /// <remarks> /// The command is not run here. The reason is making /// it simpler to add support to existing editors. They /// will have to run it before calling this. /// </remarks> /// <param name="command">The command to operate on</param> public static void AddCommand(Command command) { UndoStack.Push(command); RedoStack.Clear(); LogManager.Log(LogLevel.Debug, "UndoManager.AddCommand({0})", command.Title); if (OnAddCommand != null) OnAddCommand(command); }
public static void MarkAsSaved() { savedEmpty = UndoStack.Count < 1; if (savedEmpty) { LogManager.Log(LogLevel.Debug, "UndoManager.MarkAsSaved() called when UndoStack was empty."); return; } savedCommand = UndoStack.Peek(); LogManager.Log(LogLevel.Debug, "UndoManager.MarkAsSaved()"); }
public void Add(Command command) { commandList.Add(command); }