Exemple #1
0
 public void Remove(Shapes.DiagramShape obj)
 {
     if (obj != null)
     {
         DiagramLayer layer1 = obj.Layer;
         if (layer1 != null)
         {
             if (layer1 != this)
             {
                 throw new ArgumentException("Cannot remove an object from a layer if it does not belong to that layer.");
             }
             Shapes.GroupShape group1 = obj.Parent;
             if (group1 != null)
             {
                 group1.Remove(obj);
             }
             else
             {
                 this.removeFromLayer(obj, false);
             }
         }
     }
     if (this.ShapeRemoved != null)
     {
         this.ShapeRemoved(this, new SelectionEventArgs(obj));
     }
 }
        public void MoveBefore(DiagramLayer dest, DiagramLayer moving)
        {
            if (dest == null)
            {
                dest = this.Bottom;
            }
            if (dest == moving)
            {
                throw new ArgumentException("Cannot move a layer before (behind) itself");
            }
            int num1 = this.IndexOf(moving);

            if (num1 < 0)
            {
                throw new ArgumentException("MoveBefore layer to be moved must be in the GoLayerCollection");
            }
            int num2 = this.IndexOf(dest);

            if (num2 < 0)
            {
                throw new ArgumentException("MoveBefore destination layer must be in the GoLayerCollection");
            }
            if (num2 > num1)
            {
                num2--;
            }
            if (num2 != num1)
            {
                this.myLayers.RemoveAt(num1);
                this.myLayers.Insert(num2, moving);
                this.LayerCollectionContainer.RaiseChanged(0x323, 0, moving, num1, dest, LayerCollection.NullRect, num2, dest, LayerCollection.NullRect);
            }
        }
        public void MoveAfter(DiagramLayer dest, DiagramLayer moving)
        {
            if (dest == null)
            {
                dest = this.Top;
            }
            if (dest == moving)
            {
                throw new ArgumentException("Cannot move a layer after (on top of) itself");
            }
            int num1 = this.IndexOf(moving);

            if (num1 < 0)
            {
                throw new ArgumentException("MoveAfter layer to be moved must be in the GoLayerCollection");
            }
            int num2 = this.IndexOf(dest);

            if (num2 < 0)
            {
                throw new ArgumentException("MoveAfter destination layer must be in the GoLayerCollection");
            }
            if (num2 > num1)
            {
                num2--;
            }
            if ((num2 + 1) != num1)
            {
                this.myLayers.RemoveAt(num1);
                this.myLayers.Insert(num2 + 1, moving);
                this.LayerCollectionContainer.RaiseChanged(0x323, 1, moving, num1, dest, LayerCollection.NullRect, num2 + 1, dest, LayerCollection.NullRect);
            }
        }
Exemple #4
0
 public void Add(Shapes.DiagramShape obj)
 {
     if (obj != null)
     {
         if (obj.Layer != null)
         {
             if (obj.Layer.LayerCollectionContainer != this.LayerCollectionContainer)
             {
                 throw new ArgumentException("Cannot add an object to a layer when it is already part of a different document's or view's layer.");
             }
             if (obj.Parent != null)
             {
                 throw new ArgumentException("Cannot add an object to a layer when it is part of a group.");
             }
             DiagramLayer layer1 = obj.Layer;
             if (layer1 != this)
             {
                 this.changeLayer(obj, layer1, false);
             }
         }
         else
         {
             if (obj.Parent != null)
             {
                 obj.Parent.Remove(obj);
             }
             this.addToLayer(obj, false);
         }
     }
     if (this.ShapeAdded != null)
     {
         this.ShapeAdded(this, new SelectionEventArgs(obj));
     }
 }
 public DiagramLayer CreateNewLayerBefore(DiagramLayer dest)
 {
     if ((dest != null) && (this.IndexOf(dest) < 0))
     {
         throw new ArgumentException("Cannot create a new layer before a layer that is not in this layer collection.");
     }
     DiagramLayer layer1 = new DiagramLayer();
     layer1.init(this.LayerCollectionContainer);
     this.InsertBefore(dest, layer1);
     return layer1;
 }
        public DiagramLayer CreateNewLayerBefore(DiagramLayer dest)
        {
            if ((dest != null) && (this.IndexOf(dest) < 0))
            {
                throw new ArgumentException("Cannot create a new layer before a layer that is not in this layer collection.");
            }
            DiagramLayer layer1 = new DiagramLayer();

            layer1.init(this.LayerCollectionContainer);
            this.InsertBefore(dest, layer1);
            return(layer1);
        }
Exemple #7
0
        internal void changeLayer(Shapes.DiagramShape obj, DiagramLayer oldLayer, bool undoing)
        {
            oldLayer.RemoveFromCache(obj);
            int num1 = Shapes.DiagramShapeCollection.fastRemove(oldLayer.myObjects, obj);

            this.myObjects.Add(obj);
            obj.SetLayer(this, obj, undoing);
            this.InsertIntoCache(obj);
            RectangleF ef1 = obj.Bounds;

            this.LayerCollectionContainer.RaiseChanged(0x388, 0, obj, num1, oldLayer, ef1, -1, this, ef1);
        }
        internal void InsertBefore(DiagramLayer dest, DiagramLayer newlayer)
        {
            if (dest == null)
            {
                dest = this.Bottom;
            }
            int num1 = this.IndexOf(dest);

            if (num1 >= 0)
            {
                this.myLayers.Insert(num1, newlayer);
                this.LayerCollectionContainer.RaiseChanged(0x321, 0, newlayer, num1, dest, LayerCollection.NullRect, num1, newlayer, LayerCollection.NullRect);
            }
        }
Exemple #9
0
 public virtual void RemoveHandles(Shapes.DiagramShape obj)
 {
     if (this.myHandles != null)
     {
         object obj1 = this.myHandles[obj];
         if (obj1 != null)
         {
             if (this.View != null)
             {
                 ArrayList list1 = obj1 as ArrayList;
                 if (list1 != null)
                 {
                     for (int num1 = 0; num1 < list1.Count; num1++)
                     {
                         IShapeHandle        handle1 = (IShapeHandle)list1[num1];
                         Shapes.DiagramShape obj2    = handle1.DiagramShape;
                         handle1.SelectedObject = null;
                         if (obj2 != null)
                         {
                             DiagramLayer layer1 = obj2.Layer;
                             if (layer1 != null)
                             {
                                 layer1.Remove(obj2);
                             }
                         }
                     }
                 }
                 else
                 {
                     IShapeHandle handle2 = (IShapeHandle)obj1;
                     handle2.SelectedObject = null;
                     Shapes.DiagramShape obj3 = handle2.DiagramShape;
                     if (obj3 != null)
                     {
                         DiagramLayer layer2 = obj3.Layer;
                         if (layer2 != null)
                         {
                             layer2.Remove(obj3);
                         }
                     }
                 }
             }
             this.myHandles.Remove(obj);
         }
     }
 }
 public DiagramLayer Find(object identifier)
 {
     if (identifier != null)
     {
         LayerCollectionEnumerator enumerator1 = this.Backwards.GetEnumerator();
         while (enumerator1.MoveNext())
         {
             DiagramLayer layer1 = enumerator1.Current;
             object       obj1   = layer1.Identifier;
             if ((obj1 != null) && obj1.Equals(identifier))
             {
                 return(layer1);
             }
         }
     }
     return(null);
 }
        public void InsertDocumentLayerBefore(DiagramLayer dest, DiagramLayer doclayer)
        {
            int num1 = this.IndexOf(doclayer);

            if (num1 < 0)
            {
                if ((dest != null) && (this.IndexOf(dest) < 0))
                {
                    throw new ArgumentException("Cannot insert a document layer before a layer that is not in this layer collection.");
                }
                DiagramView view1 = this.View;
                if (view1 == null)
                {
                    throw new ArgumentException("Cannot insert a layer into a document layer collection.");
                }
                if (((doclayer == null) || !doclayer.IsInDocument) || (view1.Document != doclayer.Document))
                {
                    throw new ArgumentException("Layer to be inserted into a view layer collection must be a document layer in the view's document.");
                }
                this.InsertBefore(dest, doclayer);
            }
        }
Exemple #12
0
 public bool MoveNext()
 {
     if (this.myEnumeratorValid)
     {
         if (this.myEnumerator.MoveNext())
         {
             return(true);
         }
         this.myEnumeratorValid = false;
     }
     if (this.myForward)
     {
         while ((this.myIndex + 1) < this.myArray.Count)
         {
             this.myIndex++;
             DiagramLayer layer1 = (DiagramLayer)this.myArray[this.myIndex];
             this.myEnumerator      = layer1.GetEnumerator();
             this.myEnumeratorValid = true;
             if (this.myEnumerator.MoveNext())
             {
                 return(true);
             }
         }
         return(false);
     }
     while ((this.myIndex - 1) >= 0)
     {
         this.myIndex--;
         DiagramLayer layer2 = (DiagramLayer)this.myArray[this.myIndex];
         this.myEnumerator      = layer2.Backwards;
         this.myEnumeratorValid = true;
         if (this.myEnumerator.MoveNext())
         {
             return(true);
         }
     }
     return(false);
 }
Exemple #13
0
        public virtual Shapes.IDiagramPort PickNearestPort(PointF dc)
        {
            Shapes.IDiagramPort port1 = null;
            float single1             = base.View.PortGravity;

            single1 *= single1;
            LayerCollectionEnumerator enumerator1 = base.View.Layers.Backwards.GetEnumerator();

            while (enumerator1.MoveNext())
            {
                DiagramLayer layer1 = enumerator1.Current;
                if (layer1.IsInDocument && layer1.CanViewObjects())
                {
                    LayerEnumerator enumerator3 = layer1.Backwards.GetEnumerator();
                    while (enumerator3.MoveNext())
                    {
                        Shapes.DiagramShape obj1 = enumerator3.Current;
                        port1 = this.pickNearestPort1(obj1, dc, port1, ref single1);
                    }
                }
            }
            return(port1);
        }
 public void Remove(DiagramLayer layer)
 {
     if (layer != null)
     {
         int num1 = this.IndexOf(layer);
         if (num1 >= 0)
         {
             if (layer.LayerCollectionContainer == this.LayerCollectionContainer)
             {
                 layer.Clear();
             }
             DiagramLayer layer1 = null;
             foreach (DiagramLayer layer2 in this.myLayers)
             {
                 if ((layer2 != layer) && (layer2.LayerCollectionContainer == this.LayerCollectionContainer))
                 {
                     layer1 = layer2;
                     break;
                 }
             }
             if (layer1 != null)
             {
                 DiagramLayer layer3 = null;
                 if ((num1 + 1) < this.myLayers.Count)
                 {
                     layer3 = (DiagramLayer)this.myLayers[num1 + 1];
                 }
                 this.myLayers.RemoveAt(num1);
                 this.LayerCollectionContainer.RaiseChanged(0x322, 0, layer, 0, layer3, LayerCollection.NullRect, 0, null, LayerCollection.NullRect);
                 if (layer == this.Default)
                 {
                     this.Default = layer1;
                 }
             }
         }
     }
 }
Exemple #15
0
 public void CopyTo(DiagramLayer[] array, int index)
 {
     this.myLayers.CopyTo(array, index);
 }
Exemple #16
0
 public void Remove(DiagramLayer layer)
 {
     if (layer != null)
     {
         int num1 = this.IndexOf(layer);
         if (num1 >= 0)
         {
             if (layer.LayerCollectionContainer == this.LayerCollectionContainer)
             {
                 layer.Clear();
             }
             DiagramLayer layer1 = null;
             foreach (DiagramLayer layer2 in this.myLayers)
             {
                 if ((layer2 != layer) && (layer2.LayerCollectionContainer == this.LayerCollectionContainer))
                 {
                     layer1 = layer2;
                     break;
                 }
             }
             if (layer1 != null)
             {
                 DiagramLayer layer3 = null;
                 if ((num1 + 1) < this.myLayers.Count)
                 {
                     layer3 = (DiagramLayer)this.myLayers[num1 + 1];
                 }
                 this.myLayers.RemoveAt(num1);
                 this.LayerCollectionContainer.RaiseChanged(0x322, 0, layer, 0, layer3, LayerCollection.NullRect, 0, null, LayerCollection.NullRect);
                 if (layer == this.Default)
                 {
                     this.Default = layer1;
                 }
             }
         }
     }
 }
Exemple #17
0
 public DiagramLayer[] CopyArray()
 {
     DiagramLayer[] layerArray1 = new DiagramLayer[this.Count];
     this.CopyTo(layerArray1, 0);
     return layerArray1;
 }
Exemple #18
0
 public void MoveBefore(DiagramLayer dest, DiagramLayer moving)
 {
     if (dest == null)
     {
         dest = this.Bottom;
     }
     if (dest == moving)
     {
         throw new ArgumentException("Cannot move a layer before (behind) itself");
     }
     int num1 = this.IndexOf(moving);
     if (num1 < 0)
     {
         throw new ArgumentException("MoveBefore layer to be moved must be in the GoLayerCollection");
     }
     int num2 = this.IndexOf(dest);
     if (num2 < 0)
     {
         throw new ArgumentException("MoveBefore destination layer must be in the GoLayerCollection");
     }
     if (num2 > num1)
     {
         num2--;
     }
     if (num2 != num1)
     {
         this.myLayers.RemoveAt(num1);
         this.myLayers.Insert(num2, moving);
         this.LayerCollectionContainer.RaiseChanged(0x323, 0, moving, num1, dest, LayerCollection.NullRect, num2, dest, LayerCollection.NullRect);
     }
 }
Exemple #19
0
 public void MoveAfter(DiagramLayer dest, DiagramLayer moving)
 {
     if (dest == null)
     {
         dest = this.Top;
     }
     if (dest == moving)
     {
         throw new ArgumentException("Cannot move a layer after (on top of) itself");
     }
     int num1 = this.IndexOf(moving);
     if (num1 < 0)
     {
         throw new ArgumentException("MoveAfter layer to be moved must be in the GoLayerCollection");
     }
     int num2 = this.IndexOf(dest);
     if (num2 < 0)
     {
         throw new ArgumentException("MoveAfter destination layer must be in the GoLayerCollection");
     }
     if (num2 > num1)
     {
         num2--;
     }
     if ((num2 + 1) != num1)
     {
         this.myLayers.RemoveAt(num1);
         this.myLayers.Insert(num2 + 1, moving);
         this.LayerCollectionContainer.RaiseChanged(0x323, 1, moving, num1, dest, LayerCollection.NullRect, num2 + 1, dest, LayerCollection.NullRect);
     }
 }
Exemple #20
0
 public void InsertDocumentLayerBefore(DiagramLayer dest, DiagramLayer doclayer)
 {
     int num1 = this.IndexOf(doclayer);
     if (num1 < 0)
     {
         if ((dest != null) && (this.IndexOf(dest) < 0))
         {
             throw new ArgumentException("Cannot insert a document layer before a layer that is not in this layer collection.");
         }
         DiagramView view1 = this.View;
         if (view1 == null)
         {
             throw new ArgumentException("Cannot insert a layer into a document layer collection.");
         }
         if (((doclayer == null) || !doclayer.IsInDocument) || (view1.Document != doclayer.Document))
         {
             throw new ArgumentException("Layer to be inserted into a view layer collection must be a document layer in the view's document.");
         }
         this.InsertBefore(dest, doclayer);
     }
 }
Exemple #21
0
 internal void changeLayer(Shapes.DiagramShape obj, DiagramLayer oldLayer, bool undoing)
 {
     oldLayer.RemoveFromCache(obj);
     int num1 = Shapes.DiagramShapeCollection.fastRemove(oldLayer.myObjects, obj);
     this.myObjects.Add(obj);
     obj.SetLayer(this, obj, undoing);
     this.InsertIntoCache(obj);
     RectangleF ef1 = obj.Bounds;
     this.LayerCollectionContainer.RaiseChanged(0x388, 0, obj, num1, oldLayer, ef1, -1, this, ef1);
 }
 public DiagramLayer[] CopyArray()
 {
     DiagramLayer[] layerArray1 = new DiagramLayer[this.Count];
     this.CopyTo(layerArray1, 0);
     return(layerArray1);
 }
Exemple #23
0
 internal void InsertBefore(DiagramLayer dest, DiagramLayer newlayer)
 {
     if (dest == null)
     {
         dest = this.Bottom;
     }
     int num1 = this.IndexOf(dest);
     if (num1 >= 0)
     {
         this.myLayers.Insert(num1, newlayer);
         this.LayerCollectionContainer.RaiseChanged(0x321, 0, newlayer, num1, dest, LayerCollection.NullRect, num1, newlayer, LayerCollection.NullRect);
     }
 }
Exemple #24
0
 internal int IndexOf(DiagramLayer layer)
 {
     return this.myLayers.IndexOf(layer);
 }
 internal int IndexOf(DiagramLayer layer)
 {
     return(this.myLayers.IndexOf(layer));
 }