public override bool Merge(CommandItem newItem)
        {
            SelectionMovedOrResizedCommandItem newitemx = newItem as SelectionMovedOrResizedCommandItem;

            if (newitemx == null ||
                newitemx._editingOperationCount != _editingOperationCount ||
                !StrokeCollectionsAreEqual(newitemx._selectedStrokeCollection, _selectedStrokeCollection))
            {
                return(false);
            }

            _newRect = newitemx._newRect;

            return(true);
        }
Example #2
0
        public void Redo()
        {
            if (!CanRedo)
            {
                throw new InvalidOperationException("No actions to redo");
            }

            CommandItem commandItem = _redoStack.Pop();

            _disableChangeTracking = true;

            try
            {
                commandItem.Redo();
            }
            finally
            {
                _disableChangeTracking = false;
            }

            _undoStack.Push(commandItem);
        }
Example #3
0
        public override bool Merge(CommandItem newItem)
        {
            StrokesChangedCommandItem newStrokesChangedCommandItem = newItem as StrokesChangedCommandItem;

            if (newStrokesChangedCommandItem == null ||
                newStrokesChangedCommandItem._editingMode != _editingMode ||
                newStrokesChangedCommandItem._editingOperationCount != _editingOperationCount)
            {
                return(false);
            }

            if (_editingMode != InkCanvasEditingMode.EraseByPoint)
            {
                return(false);
            }
            if (newStrokesChangedCommandItem._editingMode != InkCanvasEditingMode.EraseByPoint)
            {
                return(false);
            }


            foreach (Stroke doomed in newStrokesChangedCommandItem._removed)
            {
                if (_added.Contains(doomed))
                {
                    _added.Remove(doomed);
                }
                else
                {
                    _removed.Add(doomed);
                }
            }
            _added.Add(newStrokesChangedCommandItem._added);

            return(true);
        }