public void ExecuteCommand(Command cmd) { if (disabledCommands > 0) { return; } if (cmd is UndoableCommand) { (cmd as UndoableCommand).autoUndo = autoUndoCommands > 0; history.Push(cmd as UndoableCommand); } try { cmd.Execute(); } catch (ArgumentOutOfRangeException) { //OnTextChanging cancels enter of the text if (cmd is UndoableCommand) { history.Pop(); } } // redoStack.Clear(); // TextSource.CurrentTB.OnUndoRedoStateChanged(); }
public virtual void ExecuteCommand(Command cmd) { if (disabledCommands > 0) { return; } //multirange ? if (cmd.ts.CurrentTB.Selection.ColumnSelectionMode) { if (cmd is UndoableCommand) { //make wrapper cmd = new MultiRangeCommand((UndoableCommand)cmd); } } if (cmd is UndoableCommand) { //if range is ColumnRange, then create wrapper (cmd as UndoableCommand).autoUndo = autoUndoCommands > 0; history.Push(cmd as UndoableCommand); } try { cmd.Execute(); } catch (ArgumentOutOfRangeException) { //OnTextChanging cancels enter of the text if (cmd is UndoableCommand) { history.Pop(); } } // if (!UndoRedoStackIsEnabled) { ClearHistory(); } // redoStack.Clear(); // TextSource.CurrentTB.OnUndoRedoStateChanged(); }
public void ExecuteCommand(Command cmd) { if (disabledCommands > 0) { return; } if (cmd is UndoableCommand) { (cmd as UndoableCommand).autoUndo = autoUndoCommands > 0; history.Push(cmd as UndoableCommand); } cmd.Execute(); // redoStack.Clear(); }
public void ExecuteCommand(Command cmd) { if (disabledCommands > 0) { return; } if (cmd is UndoableCommand) { (cmd as UndoableCommand).autoUndo = autoUndoCommands > 0; history.Push(cmd as UndoableCommand); } cmd.Execute(); // redoStack.Clear(); // TextSource.CurrentTB.OnUndoRedoStateChanged(); }
public void ExecuteCommand(Command cmd) { if (disabledCommands <= 0) { var undo = cmd as UndoableCommand; //multirange ? if (cmd.ts.CurrentTB.Selection.ColumnSelectionMode && undo != null) { //make wrapper cmd = new MultiRangeCommand(undo); } if (undo != null) { //if range is ColumnRange, then create wrapper undo.autoUndo = autoUndoCommands > 0; _history.Push(undo); } try { cmd.Execute(); } catch (ArgumentOutOfRangeException) { if (undo != null) { _history.Pop(); } } _redoStack.Clear(); TextSource.CurrentTB.OnUndoRedoStateChanged(); } }