private void AddRedo(MultiCmd cmd) { string redo = "Re"; redo += cmd.text.Substring(2); cmd.text = redo; Redos.Push(cmd); }
public void AddUndo(MultiCmd cmd) { string undo = "Un"; undo += cmd.text.Substring(2); cmd.text = undo; Undos.Push(cmd); }
public void ExecRedo() { if (Redos.Count > 0) { MultiCmd first = Redos.Peek(); first.Exec(this); AddUndo(Redos.Pop()); } }
public void ExecUndo() { if (Undos.Count > 0) { MultiCmd firstCommand = Undos.Peek(); firstCommand.UnExec(this); AddRedo(Undos.Pop()); } }
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(); }
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 }