public Shapes.IDiagramShapeCollection AddCollection(Shapes.IDiagramShapeCollection coll, bool reparentLinks) { Shapes.DiagramShapeCollection collection1 = new Shapes.DiagramShapeCollection(); foreach (Shapes.DiagramShape obj1 in coll) { collection1.Add(obj1); } CollectionEnumerator enumerator2 = collection1.GetEnumerator(); while (enumerator2.MoveNext()) { Shapes.DiagramShape obj2 = enumerator2.Current; bool flag1 = obj2.Layer != null; if (flag1) { Shapes.GroupShape.setAllNoClear(obj2, true); obj2.Remove(); } this.Add(obj2); if (flag1) { Shapes.GroupShape.setAllNoClear(obj2, false); } } if (reparentLinks && this.IsInDocument) { Shapes.SubGraphNode.ReparentAllLinksToSubGraphs(collection1, true, this.Document.LinksLayer); } return(collection1); }
public Shapes.IDiagramShapeCollection AddCollection(Shapes.IDiagramShapeCollection coll, bool reparentLinks) { Shapes.DiagramShapeCollection collection1 = new Shapes.DiagramShapeCollection(); foreach (Shapes.DiagramShape obj1 in coll) { collection1.Add(obj1); } CollectionEnumerator enumerator2 = collection1.GetEnumerator(); while (enumerator2.MoveNext()) { Shapes.DiagramShape obj2 = enumerator2.Current; bool flag1 = obj2.Layer != null; if (flag1) { Shapes.GroupShape.setAllNoClear(obj2, true); obj2.Remove(); } this.Add(obj2); if (flag1) { Shapes.GroupShape.setAllNoClear(obj2, false); } } if (reparentLinks && this.IsInDocument) { Shapes.SubGraphNode.ReparentAllLinksToSubGraphs(collection1, true, this.Document.LinksLayer); } return collection1; }
public virtual IDiagramShapeCollection AddCollection(IDiagramShapeCollection coll, bool reparentLinks) { foreach (DiagramShape obj1 in coll) { if (!base.IsChildOf(obj1) && (this != obj1)) { continue; } throw new ArgumentException("Cannot add a group to itself or to one of its own children."); } DiagramShapeCollection collection1 = new DiagramShapeCollection(); foreach (DiagramShape obj2 in coll) { collection1.Add(obj2); } CollectionEnumerator enumerator2 = collection1.GetEnumerator(); while (enumerator2.MoveNext()) { DiagramShape obj3 = enumerator2.Current; bool flag1 = obj3.Layer != null; if (flag1) { GroupShape.setAllNoClear(obj3, true); obj3.Remove(); } this.Add(obj3); if (flag1) { GroupShape.setAllNoClear(obj3, false); } } if (reparentLinks && base.IsInDocument) { SubGraphNode.ReparentAllLinksToSubGraphs(collection1, true, base.Document.LinksLayer); } return(collection1); }
public virtual IDiagramShapeCollection AddCollection(IDiagramShapeCollection coll, bool reparentLinks) { foreach (DiagramShape obj1 in coll) { if (!base.IsChildOf(obj1) && (this != obj1)) { continue; } throw new ArgumentException("Cannot add a group to itself or to one of its own children."); } DiagramShapeCollection collection1 = new DiagramShapeCollection(); foreach (DiagramShape obj2 in coll) { collection1.Add(obj2); } CollectionEnumerator enumerator2 = collection1.GetEnumerator(); while (enumerator2.MoveNext()) { DiagramShape obj3 = enumerator2.Current; bool flag1 = obj3.Layer != null; if (flag1) { GroupShape.setAllNoClear(obj3, true); obj3.Remove(); } this.Add(obj3); if (flag1) { GroupShape.setAllNoClear(obj3, false); } } if (reparentLinks && base.IsInDocument) { SubGraphNode.ReparentAllLinksToSubGraphs(collection1, true, base.Document.LinksLayer); } return collection1; }
public virtual DiagramSelection ComputeEffectiveSelection(Shapes.IDiagramShapeCollection coll, bool move) { Hashtable hashtable1 = new Hashtable(); Shapes.DiagramShapeCollection collection1 = null; DiagramSelection selection1 = new DiagramSelection(null); Shapes.DiagramShapeCollection collection2 = null; foreach (Shapes.DiagramShape obj1 in coll) { Shapes.DiagramShape obj2 = obj1.DraggingObject; if (((obj2 != null) && !(move ? !obj2.CanMove() : !obj2.CanCopy())) && !this.alreadyDragged(hashtable1, obj2)) { if ((collection1 != null) && (obj2 is Shapes.GroupShape)) { CollectionEnumerator enumerator2 = collection1.GetEnumerator(); while (enumerator2.MoveNext()) { Shapes.DiagramShape obj3 = enumerator2.Current; if (obj3.IsChildOf(obj2)) { hashtable1.Remove(7); if (collection2 == null) { collection2 = new Shapes.DiagramShapeCollection(); } collection2.Add(obj3); selection1.Remove(obj3); } } if ((collection2 != null) && !collection2.IsEmpty) { enumerator2 = collection2.GetEnumerator(); while (enumerator2.MoveNext()) { Shapes.DiagramShape obj4 = enumerator2.Current; collection1.Remove(obj4); } collection2.Clear(); } } hashtable1.Add(obj2, obj2); if (!obj2.IsTopLevel) { if (collection1 == null) { collection1 = new Shapes.DiagramShapeCollection(); } collection1.Add(obj2); } selection1.Add(obj2); } } Shapes.DiagramShape[] objArray1 = selection1.CopyArray(); for (int num1 = 0; num1 < objArray1.Length; num1++) { Shapes.DiagramShape obj5 = objArray1[num1]; Shapes.IDiagramNode node1 = obj5 as Shapes.IDiagramNode; if (node1 != null) { foreach (Shapes.IDiagramLine link1 in node1.DestinationLinks) { if (!this.alreadyDragged(hashtable1, link1.DiagramShape) && ((link1.ToPort == null) || this.alreadyDragged(hashtable1, link1.ToPort.DiagramShape))) { hashtable1.Add(link1.DiagramShape, link1.DiagramShape); selection1.Add(link1.DiagramShape); } } foreach (Shapes.IDiagramLine link2 in node1.SourceLinks) { if (!this.alreadyDragged(hashtable1, link2.DiagramShape) && ((link2.FromPort == null) || this.alreadyDragged(hashtable1, link2.FromPort.DiagramShape))) { hashtable1.Add(link2.DiagramShape, link2.DiagramShape); selection1.Add(link2.DiagramShape); } } } } return(selection1); }
public virtual CopyDictionary CopyFromCollection(Shapes.IDiagramShapeCollection coll, bool copyableOnly, bool dragging, SizeF offset, CopyDictionary env) { CollectionEnumerator enumerator2; if (env == null) { env = this.CreateCopyDictionary(); } env.SourceCollection = coll; Hashtable hashtable1 = new Hashtable(); Shapes.DiagramShapeCollection collection1 = null; Shapes.DiagramShapeCollection collection2 = new Shapes.DiagramShapeCollection(); Shapes.DiagramShapeCollection collection3 = null; foreach (Shapes.DiagramShape obj1 in coll) { Shapes.DiagramShape obj2 = dragging ? obj1.DraggingObject : obj1; if (((obj2 != null) && (!copyableOnly || obj2.CanCopy())) && !this.alreadyCopied(hashtable1, obj2)) { if ((collection1 != null) && (obj2 is Shapes.GroupShape)) { enumerator2 = collection1.GetEnumerator(); while (enumerator2.MoveNext()) { Shapes.DiagramShape obj3 = enumerator2.Current; if (obj3.IsChildOf(obj2)) { hashtable1.Remove(obj3); if (collection3 == null) { collection3 = new Shapes.DiagramShapeCollection(); } collection3.Add(obj3); collection2.Remove(obj3); } } if ((collection3 != null) && !collection3.IsEmpty) { enumerator2 = collection3.GetEnumerator(); while (enumerator2.MoveNext()) { Shapes.DiagramShape obj4 = enumerator2.Current; collection1.Remove(obj4); } collection3.Clear(); } } hashtable1.Add(obj2, obj2); if (!obj2.IsTopLevel) { if (collection1 == null) { collection1 = new Shapes.DiagramShapeCollection(); } collection1.Add(obj2); } collection2.Add(obj2); } } PointF tf1 = new PointF(); enumerator2 = collection2.GetEnumerator(); while (enumerator2.MoveNext()) { Shapes.DiagramShape obj5 = enumerator2.Current; Shapes.DiagramShape obj6 = env[obj5] as Shapes.DiagramShape; if (obj6 == null) { obj6 = env.Copy(obj5); if (obj6 != null) { tf1 = obj6.Location; obj6.Location = obj6.ComputeMove(tf1, new PointF(tf1.X + offset.Width, tf1.Y + offset.Height)); DiagramLayer layer1 = obj5.Layer; DiagramLayer layer2 = null; if (layer1 != null) { if (layer1.Document == this) { layer2 = layer1; } else { layer2 = this.Layers.Find(layer1.Identifier); } } if (layer2 == null) { layer2 = this.DefaultLayer; } if (!copyableOnly || layer2.CanInsertObjects()) { layer2.Add(obj6); } } } } foreach (Shapes.DiagramShape obj8 in env.Delayeds) { if (obj8 != null) { Shapes.DiagramShape obj9 = env[obj8] as Shapes.DiagramShape; if (obj9 != null) { obj8.CopyObjectDelayed(env, obj9); } } } return env; }
protected virtual Shapes.IDiagramShapeCollection DoExternalDrop(DragEventArgs evt) { DiagramSelection selection1 = evt.Data.GetData(typeof(DiagramSelection)) as DiagramSelection; if (selection1 != null) { DiagramDocument document1 = this.Document; if (document1 != null) { PointF tf1 = this.LastInput.DocPoint; Shapes.DiagramShape obj2 = selection1.Primary; if (obj2 != null) { string text1 = null; Shapes.DiagramShapeCollection collection1 = new Shapes.DiagramShapeCollection(); try { this.StartTransaction(); SizeF ef1 = DiagramTool.SubtractPoints(tf1, new PointF(obj2.Left + selection1.HotSpot.Width, obj2.Top + selection1.HotSpot.Height)); CopyDictionary dictionary1 = document1.CopyFromCollection(selection1, false, true, ef1, null); foreach (Shapes.DiagramShape obj4 in dictionary1.Values) { if (((obj4 == null) || !obj4.IsTopLevel) || (obj4.Document != document1)) { continue; } collection1.Add(obj4); if (this.GridSnapDrag != DiagramViewSnapStyle.None) { PointF tf2 = obj4.Location; PointF tf3 = this.FindNearestGridPoint(tf2); obj4.DoMove(this, tf2, tf3); } } DiagramSelection selection2 = this.Selection; selection2.Clear(); Shapes.DiagramShape obj5 = (Shapes.DiagramShape)dictionary1[obj2]; if ((obj5 != null) && collection1.Contains(obj5)) { selection2.Add(obj5); } CollectionEnumerator enumerator2 = collection1.GetEnumerator(); while (enumerator2.MoveNext()) { Shapes.DiagramShape obj6 = enumerator2.Current; selection2.Add(obj6); } selection2.HotSpot = selection1.HotSpot; text1 = "Drop"; this.RaiseExternalObjectsDropped(this.LastInput); } finally { this.FinishTransaction(text1); } return collection1; } } } return null; }