Example #1
0
        public void Undo()
        {
            if (undoHistory.Count == 0)
            {
                return;
            }

            var action = undoHistory.Peek();

            action.Undo();
            undoHistory.Pop();
            redoHistory.Push(action);
            ActionUndone?.Invoke(this, action);
        }
Example #2
0
        public void Undo()
        {
            if (Pointer < 0)
            {
                throw new InvalidOperationException("Undo stack is empty");
            }
            else
            {
                var item = history[Pointer];
                item.Undo();
                item.State = HistoryItemState.Redo;

                if (item.CausesDirty)
                {
                    document.IsDirty = true;
                }

                ListStore.SetValue(item.Id, 0, item);
                history[Pointer] = item;
                Pointer--;
            }

            if (Pointer == clean_pointer)
            {
                document.IsDirty = false;
            }

            if (Pointer == 0)
            {
                PintaCore.Actions.Edit.Undo.Sensitive = false;
            }

            PintaCore.Actions.Edit.Redo.Sensitive = true;

            ActionUndone?.Invoke(this, EventArgs.Empty);
        }
 /// <summary>
 /// </summary>
 protected void OnActionUndone()
 {
     ActionUndone?.Invoke(sender: null, e: null);
 }
Example #4
0
 /// <summary>
 /// </summary>
 protected void OnActionUndone()
 {
     ActionUndone?.Invoke(null, null);
 }