Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
        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();
        }
Ejemplo n.º 3
0
        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();
        }
Ejemplo n.º 5
0
        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();
            }
        }