public virtual DiagramSelection CreateDragSelection() { DiagramSelection selection1 = new DiagramSelection(null); Shapes.RectangleGraph rectangle1 = new Shapes.RectangleGraph(); rectangle1.Bounds = base.CurrentObject.Bounds; rectangle1.Visible = false; base.View.Layers.Default.Add(rectangle1); selection1.Add(rectangle1); Shapes.DiagramShapeCollection collection1 = new Shapes.DiagramShapeCollection(); CollectionEnumerator enumerator1 = ((this.EffectiveSelection != null) ? this.EffectiveSelection : base.Selection).GetEnumerator(); while (enumerator1.MoveNext()) { Shapes.DiagramShape obj1 = enumerator1.Current; collection1.Add(obj1.DraggingObject); } RectangleF ef1 = DiagramDocument.ComputeBounds(collection1, base.View); float single1 = base.View.WorldScale.Width; if (((ef1.Width * single1) > 2000f) || ((ef1.Height * single1) > 2000f)) { single1 *= System.Math.Min((float)(2000f / (ef1.Width * single1)), (float)(2000f / (ef1.Height * single1))); } Bitmap bitmap1 = base.View.GetBitmapFromCollection(collection1, ef1, single1, false); Shapes.DiagramImage image1 = new Shapes.DiagramImage(); image1.Image = bitmap1; image1.Bounds = new RectangleF(ef1.X, ef1.Y, ((float)bitmap1.Width) / single1, ((float)bitmap1.Height) / single1); base.View.Layers.Default.Add(image1); selection1.Add(image1); return(selection1); }
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 void RemoveAllSelectionHandles() { CollectionEnumerator enumerator1 = this.Backwards.GetEnumerator(); while (enumerator1.MoveNext()) { Shapes.DiagramShape obj2 = enumerator1.Current.SelectionObject; if (obj2 != null) { obj2.RemoveSelectionHandles(this); } } }
public virtual void ClearDragSelection() { if (this.DragSelection != null) { CollectionEnumerator enumerator1 = this.DragSelection.GetEnumerator(); while (enumerator1.MoveNext()) { enumerator1.Current.Remove(); } this.DragSelection = null; base.CurrentObject = this.DragSelectionOriginalObject; this.DragSelectionOriginalObject = null; } }
public void AddAllSelectionHandles() { CollectionEnumerator enumerator1 = this.GetEnumerator(); while (enumerator1.MoveNext()) { Shapes.DiagramShape obj1 = enumerator1.Current; Shapes.DiagramShape obj2 = obj1.SelectionObject; if (obj2 != null) { if (obj1.CanView()) { obj2.AddSelectionHandles(this, obj1); continue; } obj2.RemoveSelectionHandles(this); } } }
public virtual bool MayBeMoving() { if (!base.LastInput.Control) { if (!base.View.CanMoveObjects()) { return(false); } CollectionEnumerator enumerator1 = base.Selection.GetEnumerator(); while (enumerator1.MoveNext()) { if (!enumerator1.Current.CanMove()) { continue; } return(true); } } return(false); }
public virtual bool MayBeCopying() { if (!base.LastInput.Shift) { if (!base.View.CanInsertObjects()) { return(false); } CollectionEnumerator enumerator1 = base.Selection.GetEnumerator(); while (enumerator1.MoveNext()) { if (!enumerator1.Current.CanCopy()) { continue; } return(true); } } return(false); }
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); }