Ejemplo n.º 1
0
        private void AddRedo(MultiCmd cmd)
        {
            string redo = "Re";

            redo    += cmd.text.Substring(2);
            cmd.text = redo;
            Redos.Push(cmd);
        }
Ejemplo n.º 2
0
        public void AddUndo(MultiCmd cmd)
        {
            string undo = "Un";

            undo    += cmd.text.Substring(2);
            cmd.text = undo;
            Undos.Push(cmd);
        }
Ejemplo n.º 3
0
 public void ExecRedo()
 {
     if (Redos.Count > 0)
     {
         MultiCmd first = Redos.Peek();
         first.Exec(this);
         AddUndo(Redos.Pop());
     }
 }
Ejemplo n.º 4
0
 public void ExecUndo()
 {
     if (Undos.Count > 0)
     {
         MultiCmd firstCommand = Undos.Peek();
         firstCommand.UnExec(this);
         AddRedo(Undos.Pop());
     }
 }
Ejemplo n.º 5
0
        public void ExecuteRedo()
        {
            var      pop            = mRedoStack.Pop();
            Cell     currentCell    = pop.GetCell();
            ICmd     current        = new MultiCmd();
            MultiCmd temp           = current as MultiCmd;
            ICmd     currentBGColor = new RestoreBGColor(currentCell, currentCell.BGColor);
            ICmd     currentText    = new RestoreText(currentCell, currentCell.Text);

            temp.Add(currentText);
            temp.Add(currentBGColor);
            AddUndo(current);
            ICmd command = pop.Exec();
        }
Ejemplo n.º 6
0
        public void ExecuteUndo()
        {
            var      pop            = mUndoStack.Pop(); //Get the top element of the stack
            Cell     currentCell    = pop.GetCell();
            ICmd     current        = new MultiCmd();
            MultiCmd temp           = current as MultiCmd;
            ICmd     currentBGColor = new RestoreBGColor(currentCell, currentCell.BGColor);
            ICmd     currentText    = new RestoreText(currentCell, currentCell.Text);

            temp.Add(currentText);
            temp.Add(currentBGColor);
            AddRedo(current);          //Push the current cell to the redo stack
            ICmd command = pop.Exec(); //Get the inverse action and apply to the cell
        }