Ejemplo n.º 1
0
 public override void LayoutChildren(DiagramShape childchanged)
 {
     if (!base.Initializing)
     {
         base.Initializing = true;
         DiagramShape obj1 = this.Icon;
         DiagramShape obj2 = this.TopLabel;
         DiagramShape obj3 = this.BottomLabel;
         if (this.myOrientation == System.Windows.Forms.Orientation.Horizontal)
         {
             int   num1    = this.LeftPortsCount;
             float single1 = 0f;
             float single2 = 0f;
             for (int num2 = 0; num2 < num1; num2++)
             {
                 GeneralNodePort port1 = this.GetLeftPort(num2);
                 if (port1.Visible)
                 {
                     single1 += port1.PortAndLabelHeight;
                     single2  = System.Math.Max(single2, port1.PortAndLabelWidth);
                 }
             }
             if (obj1 != null)
             {
                 SizeF ef1     = this.MinimumIconSize;
                 float single3 = System.Math.Max(ef1.Width, obj1.Width);
                 float single4 = System.Math.Max(ef1.Height, obj1.Height);
                 obj1.Bounds = new RectangleF(obj1.Left - ((single3 - obj1.Width) / 2f), obj1.Top - ((single4 - obj1.Height) / 2f), single3, single4);
             }
             float single5 = 0f;
             float single6 = 0f;
             if (obj1 != null)
             {
                 single5 = obj1.Left;
             }
             else
             {
                 single5 = base.Left;
             }
             if (obj1 != null)
             {
                 single6 = obj1.Top;
             }
             else
             {
                 single6 = base.Top + ((obj2 != null) ? obj2.Height : 0f);
             }
             if ((obj1 != null) && (obj1.Height > single1))
             {
                 single6 += ((obj1.Height - single1) / 2f);
             }
             float single7 = 0f;
             for (int num3 = 0; num3 < num1; num3++)
             {
                 GeneralNodePort port2 = this.GetLeftPort(num3);
                 if (port2.Visible)
                 {
                     single7 += (port2.PortAndLabelHeight / 2f);
                     port2.SetSpotLocation(0x40, new PointF(single5, single6 + single7));
                     port2.LayoutLabel();
                     single7 += (port2.PortAndLabelHeight / 2f);
                 }
             }
             num1    = this.RightPortsCount;
             single1 = 0f;
             for (int num4 = 0; num4 < num1; num4++)
             {
                 GeneralNodePort port3 = this.GetRightPort(num4);
                 if (port3.Visible)
                 {
                     single1 += port3.PortAndLabelHeight;
                 }
             }
             if (obj1 != null)
             {
                 single5 = obj1.Right;
             }
             else
             {
                 single5 = base.Right;
             }
             if (obj1 != null)
             {
                 single6 = obj1.Top;
             }
             else
             {
                 single6 = base.Top + ((obj2 != null) ? obj2.Height : 0f);
             }
             if ((obj1 != null) && (obj1.Height > single1))
             {
                 single6 += ((obj1.Height - single1) / 2f);
             }
             single7 = 0f;
             for (int num5 = 0; num5 < num1; num5++)
             {
                 GeneralNodePort port4 = this.GetRightPort(num5);
                 if (port4.Visible)
                 {
                     single7 += (port4.PortAndLabelHeight / 2f);
                     port4.SetSpotLocation(0x100, new PointF(single5, single6 + single7));
                     port4.LayoutLabel();
                     single7 += (port4.PortAndLabelHeight / 2f);
                 }
             }
             if (obj2 != null)
             {
                 if (obj1 != null)
                 {
                     obj2.SetSpotLocation(0x80, obj1, 0x20);
                 }
                 else
                 {
                     obj2.SetSpotLocation(0x20, this, 0x20);
                 }
             }
             if (obj3 != null)
             {
                 if (obj1 != null)
                 {
                     obj3.SetSpotLocation(0x20, obj1, 0x80);
                 }
                 else
                 {
                     obj3.SetSpotLocation(0x80, this, 0x80);
                 }
             }
         }
         else
         {
             int   num6    = this.LeftPortsCount;
             float single8 = 0f;
             float single9 = 0f;
             for (int num7 = 0; num7 < num6; num7++)
             {
                 GeneralNodePort port5 = this.GetLeftPort(num7);
                 if (port5.Visible)
                 {
                     single8 += port5.PortAndLabelWidth;
                     single9  = System.Math.Max(single9, port5.PortAndLabelHeight);
                 }
             }
             if (obj1 != null)
             {
                 SizeF ef2      = this.MinimumIconSize;
                 float single10 = System.Math.Max(ef2.Width, obj1.Width);
                 float single11 = System.Math.Max(ef2.Height, obj1.Height);
                 obj1.Bounds = new RectangleF(obj1.Left - ((single10 - obj1.Width) / 2f), obj1.Top - ((single11 - obj1.Height) / 2f), single10, single11);
             }
             float single12 = 0f;
             float single13 = 0f;
             if (obj1 != null)
             {
                 single12 = obj1.Left;
             }
             else
             {
                 single12 = base.Left + ((obj2 != null) ? obj2.Width : 0f);
             }
             if (obj1 != null)
             {
                 single13 = obj1.Top;
             }
             else
             {
                 single13 = base.Top;
             }
             if ((obj1 != null) && (obj1.Width > single8))
             {
                 single12 += ((obj1.Width - single8) / 2f);
             }
             float single14 = 0f;
             for (int num8 = 0; num8 < num6; num8++)
             {
                 GeneralNodePort port6 = this.GetLeftPort(num8);
                 if (port6.Visible)
                 {
                     single14 += (port6.PortAndLabelWidth / 2f);
                     port6.SetSpotLocation(0x80, new PointF(single12 + single14, single13));
                     port6.LayoutLabel();
                     single14 += (port6.PortAndLabelWidth / 2f);
                 }
             }
             num6    = this.RightPortsCount;
             single8 = 0f;
             for (int num9 = 0; num9 < num6; num9++)
             {
                 GeneralNodePort port7 = this.GetRightPort(num9);
                 if (port7.Visible)
                 {
                     single8 += port7.PortAndLabelWidth;
                 }
             }
             if (obj1 != null)
             {
                 single12 = obj1.Left;
             }
             else
             {
                 single12 = base.Left + ((obj2 != null) ? obj2.Width : 0f);
             }
             if (obj1 != null)
             {
                 single13 = obj1.Bottom;
             }
             else
             {
                 single13 = base.Bottom;
             }
             if ((obj1 != null) && (obj1.Width > single8))
             {
                 single12 += ((obj1.Width - single8) / 2f);
             }
             single14 = 0f;
             for (int num10 = 0; num10 < num6; num10++)
             {
                 GeneralNodePort port8 = this.GetRightPort(num10);
                 if (port8.Visible)
                 {
                     single14 += (port8.PortAndLabelWidth / 2f);
                     port8.SetSpotLocation(0x20, new PointF(single12 + single14, single13));
                     port8.LayoutLabel();
                     single14 += (port8.PortAndLabelWidth / 2f);
                 }
             }
             if (obj2 != null)
             {
                 if (obj1 != null)
                 {
                     obj2.SetSpotLocation(0x40, obj1, 0x100);
                 }
                 else
                 {
                     obj2.SetSpotLocation(0x100, this, 0x100);
                 }
             }
             if (obj3 != null)
             {
                 if (obj1 != null)
                 {
                     obj3.SetSpotLocation(0x100, obj1, 0x40);
                 }
                 else
                 {
                     obj3.SetSpotLocation(0x40, this, 0x40);
                 }
             }
         }
         base.Initializing = false;
     }
 }