public override void Trigger(EditableView.ClickPosition.Sources source, EditableView pnlView, Transaction transaction) { bool ongoing = pnlView.OngoingShape != null; pnlView.ConcludeOngoing(); if (ongoing) { return; // we cancelled the current; better to not also undo a previous - that can look like 2 operations } if (CurrentDocument.UndoTransactions.Count == 0) { return; } CurrentPage.DeselectAll(); // in case undo deletes something in selected list Transaction actualTransaction = CurrentDocument.UndoTransactions[CurrentDocument.UndoTransactions.Count - 1]; CurrentDocument.UndoTransactions.RemoveAt(CurrentDocument.UndoTransactions.Count - 1); actualTransaction.Undo(); pnlView.InvalidateAll(); CurrentDocument.RedoTransactions.Add(actualTransaction); if (CurrentDocument.Changed != actualTransaction.ChangedAtStart) { CurrentDocument.Changed = actualTransaction.ChangedAtStart; } Editor.IndirectEffectsUndoRedo(actualTransaction, true); Shape.RestoreCaretState(actualTransaction); // Ignored unless objTransaction.CaretState is defined }
public override void Trigger(EditableView.ClickPosition.Sources source, EditableView pnlView, Transaction transaction) { if (CurrentDocument.RedoTransactions.Count == 0) { return; } pnlView.ConcludeOngoing(); CurrentPage.DeselectAll(); // in case undo deletes something in selected list Transaction actualTransaction = CurrentDocument.RedoTransactions[CurrentDocument.RedoTransactions.Count - 1]; CurrentDocument.RedoTransactions.RemoveAt(CurrentDocument.RedoTransactions.Count - 1); actualTransaction.Undo(); pnlView.InvalidateAll(); CurrentDocument.UndoTransactions.Add(actualTransaction); if (!CurrentDocument.Changed) { CurrentDocument.Changed = true; } Editor.IndirectEffectsUndoRedo(actualTransaction, false); }