Esempio n. 1
0
        public void Undo()
        {
            if (history.Count > 0)
            {
                var cmd = history.Pop();
                //
                BeginDisableCommands();//prevent text changing into handlers
                try
                {
                    cmd.Undo();
                }
                finally
                {
                    EndDisableCommands();
                }
                //
                redoStack.Push(cmd);
            }

            //undo next autoUndo command
            if (history.Count > 0)
            {
                if (history.Peek().autoUndo)
                {
                    Undo();
                }
            }
        }
        public void Undo()
        {
            if (_history.Count > 0)
            {
                var cmd = _history.Pop();
                //
                BeginDisableCommands(); //prevent text changing into handlers
                try
                {
                    cmd.Undo();
                }
                finally
                {
                    EndDisableCommands();
                }
                //
                _redoStack.Push(cmd);
            }

            //undo next autoUndo command
            if (_history.Count > 0)
            {
                if (_history.Peek().AutoUndo)
                {
                    Undo();
                }
            }

            TextSource.CurrentTb.OnUndoRedoStateChanged();
        }
Esempio n. 3
0
 public void EndAutoUndoCommands()
 {
     autoUndoCommands--;
     if (autoUndoCommands == 0)
     {
         if (history.Count > 0)
         {
             history.Peek().autoUndo = false;
         }
     }
 }
Esempio n. 4
0
        public void Undo()
        {
            if (history.Count > 0)
            {
                var cmd = history.Pop();
                WasFastUndo = cmd.FastUndo;
                if (cmd.FastUndo)
                {
                    OldPosition.Push(cmd.ts.CurrentTB.Selection.Clone());               // By WendyH
                }
                //
                BeginDisableCommands();//prevent text changing into handlers
                try
                {
                    cmd.Undo();
                }
                finally
                {
                    EndDisableCommands();
                    if (cmd.FastUndo)
                    {
                        cmd.ts.CurrentTB.Selection = OldPosition.Pop();                                   // By WendyH
                    }
                }
                //
                redoStack.Push(cmd);
            }

            //undo next autoUndo command
            if (history.Count > 0)
            {
                if (history.Peek().autoUndo)
                {
                    Undo();
                }
            }
            TextSource.CurrentTB.OnUndoRedoStateChanged();
        }