示例#1
0
        public virtual void SetRightPort(int i, GeneralNodePort p)
        {
            GeneralNodePort port1 = this.GetRightPort(i);

            if (port1 != p)
            {
                if (port1 != null)
                {
                    if (p != null)
                    {
                        p.Bounds = port1.Bounds;
                    }
                    if (port1.Label != null)
                    {
                        this.Remove(port1.Label);
                    }
                    base.Remove(port1);
                    port1.SideIndex = -1;
                }
                this.myRightPorts[i] = p;
                p.LeftSide           = false;
                p.SideIndex          = i;
                this.initializePort(p);
                this.Changed(0x963, i, port1, DiagramShape.NullRect, i, p, DiagramShape.NullRect);
            }
        }
示例#2
0
        public virtual void OnOrientationChanged(System.Windows.Forms.Orientation old)
        {
            int num1 = this.LeftPortsCount;

            for (int num2 = 0; num2 < num1; num2++)
            {
                GeneralNodePort port1 = this.GetLeftPort(num2);
                if (this.Orientation == System.Windows.Forms.Orientation.Vertical)
                {
                    port1.ToSpot   = 0x20;
                    port1.FromSpot = 0x20;
                }
                else
                {
                    port1.ToSpot   = 0x100;
                    port1.FromSpot = 0x100;
                }
            }
            num1 = this.RightPortsCount;
            for (int num3 = 0; num3 < num1; num3++)
            {
                GeneralNodePort port2 = this.GetRightPort(num3);
                if (this.Orientation == System.Windows.Forms.Orientation.Vertical)
                {
                    port2.ToSpot   = 0x80;
                    port2.FromSpot = 0x80;
                }
                else
                {
                    port2.ToSpot   = 0x40;
                    port2.FromSpot = 0x40;
                }
            }
            this.LayoutChildren(null);
        }
示例#3
0
 public virtual void RemoveRightPort(int i)
 {
     if ((i >= 0) && (i < this.RightPortsCount))
     {
         GeneralNodePort port1 = (GeneralNodePort)this.myRightPorts[i];
         this.Remove(port1);
     }
 }
示例#4
0
        protected virtual GeneralNodePort CreatePort(bool input)
        {
            GeneralNodePort port1 = new GeneralNodePort();

            port1.LeftSide    = input;
            port1.IsValidFrom = !input;
            port1.IsValidTo   = input;
            return(port1);
        }
示例#5
0
 private void initializePort(GeneralNodePort p)
 {
     if ((p != null) && (p.Parent == null))
     {
         this.Add(p);
         if (p.Label != null)
         {
             this.Add(p.Label);
         }
     }
 }
示例#6
0
        public override DiagramShape CopyObject(CopyDictionary env)
        {
            GeneralNodePort port1 = (GeneralNodePort)base.CopyObject(env);

            if ((port1 != null) && (this.myPortLabel != null))
            {
                port1.myPortLabel = (GeneralNodePortLabelText)env.Copy(this.myPortLabel);
                if (port1.myPortLabel != null)
                {
                    port1.myPortLabel.Port = port1;
                }
            }
            return(port1);
        }
示例#7
0
        public override void Remove(DiagramShape obj)
        {
            GeneralNodePort port1 = obj as GeneralNodePort;

            if (port1 != null)
            {
                int num1 = this.myLeftPorts.IndexOf(port1);
                if (num1 >= 0)
                {
                    this.myLeftPorts.RemoveAt(num1);
                    if (port1.Label != null)
                    {
                        this.Remove(port1.Label);
                    }
                    base.Remove(port1);
                    port1.SideIndex = -1;
                    this.Changed(0x962, -(num1 + 1), port1, DiagramShape.NullRect, -(num1 + 1), port1, DiagramShape.NullRect);
                    return;
                }
                int num2 = this.myRightPorts.IndexOf(port1);
                if (num2 >= 0)
                {
                    this.myRightPorts.RemoveAt(num2);
                    if (port1.Label != null)
                    {
                        this.Remove(port1.Label);
                    }
                    base.Remove(port1);
                    port1.SideIndex = -1;
                    this.Changed(0x962, num2, port1, DiagramShape.NullRect, num2, port1, DiagramShape.NullRect);
                    return;
                }
            }
            base.Remove(obj);
            if (obj == this.myTopLabel)
            {
                this.myTopLabel = null;
            }
            else if (obj == this.myBottomLabel)
            {
                this.myBottomLabel = null;
            }
            else if (obj == this.myIcon)
            {
                this.myIcon = null;
            }
        }
示例#8
0
 private void initializeCommon(string top, string bottom, int numinports, int numoutports)
 {
     this.TopLabel    = this.CreateLabel(true, top);
     this.BottomLabel = this.CreateLabel(false, bottom);
     for (int num1 = 0; num1 < numinports; num1++)
     {
         GeneralNodePort port1 = this.MakePort(true);
         this.AddLeftPort(port1);
     }
     for (int num2 = 0; num2 < numoutports; num2++)
     {
         GeneralNodePort port2 = this.MakePort(false);
         this.AddRightPort(port2);
     }
     base.PropertiesDelegatedToSelectionObject = true;
     base.Initializing = false;
     this.LayoutChildren(null);
 }
示例#9
0
 public virtual void InsertRightPort(int i, GeneralNodePort p)
 {
     if ((p != null) && (i >= 0))
     {
         p.LeftSide = false;
         if (i < this.RightPortsCount)
         {
             this.myRightPorts.Insert(i, p);
             p.SideIndex = i;
         }
         else
         {
             this.myRightPorts.Add(p);
             i           = this.RightPortsCount - 1;
             p.SideIndex = i;
         }
         this.initializePort(p);
         this.Changed(0x961, i, p, DiagramShape.NullRect, i, p, DiagramShape.NullRect);
     }
 }
示例#10
0
        protected override void CopyChildren(GroupShape newgroup, CopyDictionary env)
        {
            GeneralNode node1 = (GeneralNode)newgroup;

            base.CopyChildren(newgroup, env);
            node1.myLeftPorts   = new ArrayList();
            node1.myRightPorts  = new ArrayList();
            node1.myIcon        = (DiagramShape)env[this.myIcon];
            node1.myTopLabel    = (DiagramText)env[this.myTopLabel];
            node1.myBottomLabel = (DiagramText)env[this.myBottomLabel];
            for (int num1 = 0; num1 < this.myLeftPorts.Count; num1++)
            {
                GeneralNodePort port1 = (GeneralNodePort)this.myLeftPorts[num1];
                if (port1 != null)
                {
                    GeneralNodePort port2 = (GeneralNodePort)env[port1];
                    if (port2 != null)
                    {
                        node1.myLeftPorts.Add(port2);
                        port2.SideIndex = node1.myLeftPorts.Count - 1;
                        port2.LeftSide  = true;
                    }
                }
            }
            for (int num2 = 0; num2 < this.myRightPorts.Count; num2++)
            {
                GeneralNodePort port3 = (GeneralNodePort)this.myRightPorts[num2];
                if (port3 != null)
                {
                    GeneralNodePort port4 = (GeneralNodePort)env[port3];
                    if (port4 != null)
                    {
                        node1.myRightPorts.Add(port4);
                        port4.SideIndex = node1.myRightPorts.Count - 1;
                        port4.LeftSide  = false;
                    }
                }
            }
        }
示例#11
0
 public virtual void SetRightPort(int i, GeneralNodePort p)
 {
     GeneralNodePort port1 = this.GetRightPort(i);
     if (port1 != p)
     {
         if (port1 != null)
         {
             if (p != null)
             {
                 p.Bounds = port1.Bounds;
             }
             if (port1.Label != null)
             {
                 this.Remove(port1.Label);
             }
             base.Remove(port1);
             port1.SideIndex = -1;
         }
         this.myRightPorts[i] = p;
         p.LeftSide = false;
         p.SideIndex = i;
         this.initializePort(p);
         this.Changed(0x963, i, port1, DiagramShape.NullRect, i, p, DiagramShape.NullRect);
     }
 }
示例#12
0
 public virtual void InsertRightPort(int i, GeneralNodePort p)
 {
     if ((p != null) && (i >= 0))
     {
         p.LeftSide = false;
         if (i < this.RightPortsCount)
         {
             this.myRightPorts.Insert(i, p);
             p.SideIndex = i;
         }
         else
         {
             this.myRightPorts.Add(p);
             i = this.RightPortsCount - 1;
             p.SideIndex = i;
         }
         this.initializePort(p);
         this.Changed(0x961, i, p, DiagramShape.NullRect, i, p, DiagramShape.NullRect);
     }
 }
示例#13
0
 private void initializePort(GeneralNodePort p)
 {
     if ((p != null) && (p.Parent == null))
     {
         this.Add(p);
         if (p.Label != null)
         {
             this.Add(p.Label);
         }
     }
 }
示例#14
0
 public void AddRightPort(GeneralNodePort p)
 {
     this.InsertRightPort(this.RightPortsCount, p);
 }
示例#15
0
 protected virtual GeneralNodePort CreatePort(bool input)
 {
     GeneralNodePort port1 = new GeneralNodePort();
     port1.LeftSide = input;
     port1.IsValidFrom = !input;
     port1.IsValidTo = input;
     return port1;
 }
示例#16
0
 public void AddLeftPort(GeneralNodePort p)
 {
     this.InsertLeftPort(this.LeftPortsCount, p);
 }
示例#17
0
 public void AddLeftPort(GeneralNodePort p)
 {
     this.InsertLeftPort(this.LeftPortsCount, p);
 }
示例#18
0
 public void AddRightPort(GeneralNodePort p)
 {
     this.InsertRightPort(this.RightPortsCount, p);
 }
示例#19
0
        public virtual GeneralNodePort MakePort(bool input)
        {
            GeneralNodePort port1 = this.CreatePort(input);

            if (port1 != null)
            {
                PointF tf1;
                GeneralNodePortLabelText label1 = this.CreatePortLabel(input);
                port1.Label = label1;
                if (label1 != null)
                {
                    label1.Port = port1;
                }
                if (this.Orientation == System.Windows.Forms.Orientation.Vertical)
                {
                    port1.ToSpot   = 0x20;
                    port1.FromSpot = 0x80;
                }
                else
                {
                    port1.ToSpot   = 0x100;
                    port1.FromSpot = 0x40;
                }
                if (input)
                {
                    port1.Name = this.LeftPortsCount.ToString(CultureInfo.CurrentCulture);
                }
                else
                {
                    port1.Name = this.RightPortsCount.ToString(CultureInfo.CurrentCulture);
                }
                if (this.Icon != null)
                {
                    tf1 = this.Icon.Position;
                    if (this.Orientation == System.Windows.Forms.Orientation.Vertical)
                    {
                        if (input)
                        {
                            tf1.Y -= port1.Height;
                        }
                        else
                        {
                            tf1.Y = this.Icon.Bottom;
                        }
                    }
                    else if (input)
                    {
                        tf1.X -= port1.Width;
                    }
                    else
                    {
                        tf1.X = this.Icon.Right;
                    }
                }
                else
                {
                    tf1 = base.Position;
                }
                port1.Position = tf1;
                if (label1 != null)
                {
                    label1.Position = tf1;
                }
            }
            return(port1);
        }
示例#20
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;
     }
 }