/// <summary> /// Stores arc info for a create redo operation. /// </summary> /// <param name="id">The id of the deleted arc.</param> /// <param name="sourceId">The id of the source of the deleted arc.</param> /// <param name="targetId">The id of the target of the deleted arc.</param> /// <param name="selected">The selected state of the deleted arc.</param> public void AddCreateRedoArcInfo(String id, String sourceId, String targetId, bool selected) { CreateRedoParams[1] = new ArcInfo(id, sourceId, targetId, selected); }
/// <summary> /// Redoes a create operation. /// </summary> /// <param name="node">Node info about the node that is to be restored.</param> /// <param name="arc">Arc info about the arc that is to be restored.</param> /// <param name="viewSize">The view size before the element was removed.</param> /// <param name="shift">The amount by which elements had to be shifted in x- and y-direction.</param> public void RedoCreate(NodeInfo node, ArcInfo arc, Point viewSize, Point shift) { // redo create if (node != null) { UndoManager.AddCreateUndoId(node.Id); UndoManager.AddCreateUndoViewSize(ViewWidth, ViewHeight); UndoManager.CreateRightShift = shift.X; UndoManager.CreateDownShift = shift.Y; if (node.TokenCount != null) { ElementCreator.CreatePlace(new Point(node.X, node.Y), node.Id); ElementProvider.GetNode(node.Id).SetTokens((int)node.TokenCount); } else ElementCreator.CreateTrans(new Point(node.X, node.Y), node.Id); if (node.Name != null) { INameField nField = ElementProvider.GetNameField(node.Id); nField.DrawSize = ElementManager.DrawSize; nField.SetName(node.Name); } } if (arc != null) { UndoManager.AddCreateUndoId(arc.Id); UndoManager.AddCreateUndoViewSize(ViewWidth, ViewHeight); ElementCreator.CreateArc(arc.Id, arc.SourceId, arc.TargetId, arc.Selected); } // redo shift if (shift.X > 0 || shift.Y > 0) { for (int i = 0; i < ElementProvider.NodesCount; i++) { IVisualNode vNode = ElementProvider.GetNode(i); if (!vNode.Id.Equals(node.Id)) { vNode.XPos += shift.X; vNode.YPos += shift.Y; ElementProvider.GetNameField(node.Id).AdjustNameField(); Model.ChangePosition(vNode.Id, (int)vNode.XPos, (int)vNode.YPos); } } } ViewSizeChanged(this, new ViewSizeChangedEventArgs(viewSize.X, viewSize.Y)); ReevaluateCommandState(this, new EventArgs()); UndoManager.PushCreateUndo(); Modified(this, new EventArgs()); }