public void Undo() { // ensure that the current tool's modifications are added to the history first (e.g. editing text) PintaCore.Tools.CurrentTool.DoCommit(); if (historyPointer < 0) { throw new InvalidOperationException("Undo stack is empty"); } else { BaseHistoryItem item = history[historyPointer]; item.Undo(); item.State = HistoryItemState.Redo; ListStore.SetValue(item.Id, 0, item); history[historyPointer] = item; historyPointer--; } if (historyPointer == 0) { document.IsDirty = false; PintaCore.Actions.Edit.Undo.Sensitive = false; CanUndo = false; } PintaCore.Actions.Edit.Redo.Sensitive = true; CanRedo = true; PintaCore.History.OnActionUndone(); }
public void Undo() { if (historyPointer < 0) { throw new InvalidOperationException("Undo stack is empty"); } else { BaseHistoryItem item = history[historyPointer]; item.Undo(); item.State = HistoryItemState.Redo; ListStore.SetValue(item.Id, 0, item); history[historyPointer] = item; historyPointer--; } if (historyPointer == 0) { document.IsDirty = false; PintaCore.Actions.Edit.Undo.Sensitive = false; CanUndo = false; } PintaCore.Actions.Edit.Redo.Sensitive = true; CanRedo = true; PintaCore.History.OnActionUndone(); }