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 Redo() { if (historyPointer >= history.Count - 1) { throw new InvalidOperationException("Redo stack is empty"); } historyPointer++; BaseHistoryItem item = history[historyPointer]; item.Redo(); item.State = HistoryItemState.Undo; ListStore.SetValue(item.Id, 0, item); history[historyPointer] = item; if (historyPointer == history.Count - 1) { PintaCore.Actions.Edit.Redo.Sensitive = false; CanRedo = false; } if (item.CausesDirty) { document.IsDirty = true; } if (history.Count > 1) { PintaCore.Actions.Edit.Undo.Sensitive = true; CanUndo = true; } PintaCore.History.OnActionRedone(); }
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(); }
protected internal void OnHistoryItemRemoved(BaseHistoryItem item) { if (HistoryItemRemoved != null) { HistoryItemRemoved(this, new HistoryItemRemovedEventArgs(item)); } }
public void PushNewItem(BaseHistoryItem item) { // If we have un-did items on the stack, they // all get destroyed before we add a new item while (items.Count - 1 > stack_pointer) { BaseHistoryItem bhi = items[items.Count - 1]; items.RemoveAt (items.Count - 1); bhi.Dispose (); PintaCore.Actions.Edit.Redo.Sensitive = false; // TODO: Delete from ListStore } items.Add (item); stack_pointer++; PintaCore.Workspace.IsDirty = true; PintaCore.Actions.Edit.Undo.Sensitive = true; OnHistoryItemAdded (item); }
public void PushNewItem(BaseHistoryItem newItem) { //Remove all old redos starting from the end of the list for (int i = history.Count - 1; i >= 0; i--) { BaseHistoryItem item = history[i]; if (item.State == HistoryItemState.Redo) { history.RemoveAt(i); item.Dispose(); //Remove from ListStore ListStore.Remove(ref item.Id); } else if (item.State == HistoryItemState.Undo) { break; } } //Add new undo to ListStore newItem.Id = ListStore.AppendValues(newItem); history.Add(newItem); historyPointer = history.Count - 1; if (newItem.CausesDirty) { document.IsDirty = true; } if (history.Count > 1) { PintaCore.Actions.Edit.Undo.Sensitive = true; CanUndo = true; } PintaCore.Actions.Edit.Redo.Sensitive = false; CanRedo = false; PintaCore.History.OnHistoryItemAdded(newItem); }
public void PushNewItem (BaseHistoryItem newItem) { //Remove all old redos starting from the end of the list for (int i = history.Count - 1; i >= 0; i--) { BaseHistoryItem item = history[i]; if (item.State == HistoryItemState.Redo) { history.RemoveAt(i); item.Dispose(); //Remove from ListStore ListStore.Remove (ref item.Id); } else if (item.State == HistoryItemState.Undo) { break; } } //Add new undo to ListStore newItem.Id = ListStore.AppendValues (newItem); history.Add (newItem); historyPointer = history.Count - 1; if (newItem.CausesDirty) document.IsDirty = true; if (history.Count > 1) { PintaCore.Actions.Edit.Undo.Sensitive = true; CanUndo = true; } PintaCore.Actions.Edit.Redo.Sensitive = false; CanRedo = false; PintaCore.History.OnHistoryItemAdded (newItem); }
protected void OnHistoryItemRemoved(BaseHistoryItem item) { if (HistoryItemRemoved != null) HistoryItemRemoved (this, new HistoryItemRemovedEventArgs (item)); }
protected internal void OnHistoryItemAdded (BaseHistoryItem item) { if (HistoryItemAdded != null) HistoryItemAdded (this, new HistoryItemAddedEventArgs (item)); }
public void PushNewItem (BaseHistoryItem newItem) { PintaCore.Workspace.ActiveWorkspace.History.PushNewItem (newItem); }
public HistoryItemRemovedEventArgs(BaseHistoryItem item) { Item = item; }
public void Push(BaseHistoryItem item) { history_stack.Add(item); }
public void PushNewItem(BaseHistoryItem newItem) { PintaCore.Workspace.ActiveWorkspace.History.PushNewItem(newItem); }
public HistoryItemRemovedEventArgs (BaseHistoryItem item) { Item = item; }
public HistoryItemAddedEventArgs(BaseHistoryItem item) { Item = item; }
public void Push (BaseHistoryItem item) { history_stack.Add (item); }
public HistoryItemAddedEventArgs (BaseHistoryItem item) { Item = item; }