Exemplo n.º 1
0
        protected virtual DiagramText CreateLabel(bool top, string text)
        {
            DiagramText text1 = null;

            if (text != null)
            {
                text1            = new DiagramText();
                text1.Text       = text;
                text1.Selectable = false;
                if (this.Orientation == System.Windows.Forms.Orientation.Vertical)
                {
                    if (top)
                    {
                        text1.Alignment = 0x40;
                    }
                    else
                    {
                        text1.Alignment = 0x100;
                    }
                }
                else if (top)
                {
                    text1.Alignment = 0x80;
                }
                else
                {
                    text1.Alignment = 0x20;
                }
                text1.Editable = true;
                this.Editable  = true;
            }
            return(text1);
        }
Exemplo n.º 2
0
 public override void LayoutChildren(DiagramShape childchanged)
 {
     if (!base.Initializing)
     {
         DiagramShape obj1 = this.Icon;
         if (obj1 != null)
         {
             DiagramText text1 = this.Label;
             if (text1 != null)
             {
                 if (this.DraggableLabel && (childchanged == text1))
                 {
                     this.myLabelOffset = new SizeF(text1.Left - obj1.Left, text1.Top - obj1.Top);
                     return;
                 }
                 if (this.myLabelOffset.Width > -99999f)
                 {
                     text1.Position = new PointF(obj1.Left + this.myLabelOffset.Width, obj1.Top + this.myLabelOffset.Height);
                 }
                 else
                 {
                     text1.SetSpotLocation(0x20, obj1, 0x80);
                 }
             }
             if (this.Port != null)
             {
                 this.Port.SetSpotLocation(1, obj1, 1);
             }
         }
     }
 }
Exemplo n.º 3
0
        protected virtual DiagramText CreateLabel()
        {
            DiagramText text1 = new DiagramText();

            text1.Selectable = false;
            return(text1);
        }
Exemplo n.º 4
0
        internal static DiagramText FindLabel(DiagramShape obj)
        {
            DiagramText text1 = obj as DiagramText;

            if (text1 != null)
            {
                return(text1);
            }
            GroupShape group1 = obj as GroupShape;

            if (group1 != null)
            {
                GroupEnumerator enumerator2 = group1.GetEnumerator();
                GroupEnumerator enumerator1 = enumerator2.GetEnumerator();
                while (enumerator1.MoveNext())
                {
                    DiagramText text2 = DiagramNode.FindLabel(enumerator1.Current);
                    if (text2 != null)
                    {
                        return(text2);
                    }
                }
            }
            return(null);
        }
Exemplo n.º 5
0
        public virtual DiagramText AddString(string s)
        {
            int         num1  = this.ItemCount;
            DiagramText text1 = this.CreateText(s, num1);

            this.AddItem(text1, this.CreatePort(true, num1), this.CreatePort(false, num1));
            return(text1);
        }
Exemplo n.º 6
0
        protected virtual DiagramText CreateLabel(string name)
        {
            DiagramText text1 = new DiagramText();

            text1.Text       = name;
            text1.Selectable = false;
            return(text1);
        }
Exemplo n.º 7
0
        public virtual void SetString(int i, string s)
        {
            DiagramText text1 = this.myListGroup[i] as DiagramText;

            if (text1 != null)
            {
                text1.Text = s;
            }
        }
Exemplo n.º 8
0
        protected virtual DiagramShape CreateBody()
        {
            DiagramText text1 = new DiagramText();

            text1.TransparentBackground = false;
            text1.BackgroundColor       = Color.White;
            text1.Multiline             = true;
            text1.Selectable            = false;
            return(text1);
        }
Exemplo n.º 9
0
        public virtual void OnAutoResizesChanged(bool old)
        {
            DiagramText text1 = this.Label;

            if (text1 != null)
            {
                text1.Wrapping = old;
                text1.Clipping = old;
            }
        }
Exemplo n.º 10
0
        public virtual string GetString(int i)
        {
            DiagramText text1 = this.myListGroup[i] as DiagramText;

            if (text1 != null)
            {
                return(text1.Text);
            }
            return("");
        }
Exemplo n.º 11
0
        protected virtual DiagramText CreateLabel()
        {
            DiagramText text1 = new DiagramText();

            text1.Selectable = false;
            text1.Multiline  = true;
            text1.Editable   = true;
            this.Editable    = true;
            return(text1);
        }
Exemplo n.º 12
0
 public override void LayoutChildren(DiagramShape childchanged)
 {
     if (!base.Initializing)
     {
         DiagramText text1 = this.Label;
         if (text1 != null)
         {
             DiagramShape obj1 = this.Background;
             if (obj1 != null)
             {
                 SizeF ef1 = this.TopLeftMargin;
                 SizeF ef2 = this.BottomRightMargin;
                 if (this.AutoResizes)
                 {
                     obj1.Bounds = new RectangleF(text1.Left - ef1.Width, text1.Top - ef1.Height, (text1.Width + ef1.Width) + ef2.Width, (text1.Height + ef1.Height) + ef2.Height);
                 }
                 else
                 {
                     float single1 = System.Math.Max((float)(obj1.Width - (ef1.Width + ef2.Width)), (float)0f);
                     float single2 = System.Math.Max((float)(obj1.Height - (ef1.Height + ef2.Height)), (float)0f);
                     text1.Width         = single1;
                     text1.WrappingWidth = single1;
                     text1.UpdateSize();
                     float single3 = System.Math.Min(text1.Height, single2);
                     float single4 = obj1.Left + ef1.Width;
                     float single5 = (obj1.Top + ef1.Height) + ((single2 - single3) / 2f);
                     text1.Bounds = new RectangleF(single4, single5, single1, single3);
                 }
             }
             if ((obj1 == null) && this.AutoResizes)
             {
                 obj1 = text1;
             }
             if (obj1 != null)
             {
                 if (this.TopPort != null)
                 {
                     this.TopPort.SetSpotLocation(0x20, obj1, 0x20);
                 }
                 if (this.RightPort != null)
                 {
                     this.RightPort.SetSpotLocation(0x40, obj1, 0x40);
                 }
                 if (this.BottomPort != null)
                 {
                     this.BottomPort.SetSpotLocation(0x80, obj1, 0x80);
                 }
                 if (this.LeftPort != null)
                 {
                     this.LeftPort.SetSpotLocation(0x100, obj1, 0x100);
                 }
             }
         }
     }
 }
Exemplo n.º 13
0
        public virtual DiagramText InsertString(int i, string s)
        {
            if ((i < 0) || (i >= this.ItemCount))
            {
                return(null);
            }
            DiagramText text1 = this.CreateText(s, i);

            this.InsertItem(i, text1, this.CreatePort(true, i), this.CreatePort(false, i));
            return(text1);
        }
Exemplo n.º 14
0
        public virtual void OnAutoResizesChanged(bool old)
        {
            DiagramText text1 = this.Label;

            if (text1 != null)
            {
                text1.Wrapping = old;
                text1.Clipping = old;
                base.PropertiesDelegatedToSelectionObject = old;
            }
        }
Exemplo n.º 15
0
 public override void LayoutChildren(DiagramShape childchanged)
 {
     if (!base.Initializing)
     {
         DiagramGraph shape1 = this.Shape;
         if (shape1 != null)
         {
             DiagramText text1 = this.Label;
             if (text1 != null)
             {
                 if (this.LabelSpot == 1)
                 {
                     PointF tf1 = shape1.Center;
                     SizeF  ef1 = this.MiddleLabelMargin;
                     if (this.AutoResizes)
                     {
                         float single1 = text1.Width + ef1.Width;
                         float single2 = text1.Height + ef1.Height;
                         shape1.Bounds = new RectangleF(tf1.X - (single1 / 2f), tf1.Y - (single2 / 2f), single1, single2);
                     }
                     else
                     {
                         float single3 = System.Math.Max((float)(shape1.Width - (ef1.Width + ef1.Width)), (float)0f);
                         float single4 = System.Math.Max((float)(shape1.Height - (ef1.Height + ef1.Height)), (float)0f);
                         text1.Width         = single3;
                         text1.WrappingWidth = single3;
                         text1.UpdateSize();
                         float single5 = System.Math.Min(text1.Height, single4);
                         float single6 = shape1.Left + ef1.Width;
                         float single7 = (shape1.Top + ef1.Height) + ((single4 - single5) / 2f);
                         text1.Bounds = new RectangleF(single6, single7, single3, single5);
                     }
                     text1.Alignment = 1;
                     text1.Center    = tf1;
                     if (this.Port != null)
                     {
                         this.Port.Bounds = shape1.Bounds;
                     }
                 }
                 else
                 {
                     text1.Alignment = this.SpotOpposite(this.LabelSpot);
                     text1.SetSpotLocation(this.SpotOpposite(this.LabelSpot), shape1, this.LabelSpot);
                 }
             }
             if (this.Port != null)
             {
                 this.Port.SetSpotLocation(1, shape1, 1);
             }
         }
     }
 }
Exemplo n.º 16
0
        protected virtual DiagramText CreateLabel(string name)
        {
            DiagramText text1 = null;

            if (name != null)
            {
                text1            = new DiagramText();
                text1.Text       = name;
                text1.Selectable = false;
                text1.Alignment  = 1;
            }
            return(text1);
        }
Exemplo n.º 17
0
        protected override RectangleF ComputeBounds()
        {
            DiagramText text1 = this.Label;

            if (text1 == null)
            {
                return(base.ComputeBounds());
            }
            SizeF ef1 = this.TopLeftMargin;
            SizeF ef2 = this.BottomRightMargin;

            return(new RectangleF(text1.Left - ef1.Width, text1.Top - ef1.Height, (text1.Width + ef1.Width) + ef2.Width, (text1.Height + ef1.Height) + ef2.Height));
        }
Exemplo n.º 18
0
 public override void LayoutChildren(DiagramShape childchanged)
 {
     if (!base.Initializing)
     {
         DiagramText text1 = this.Label;
         if (text1 != null)
         {
             DiagramShape obj1 = this.Background;
             if (obj1 != null)
             {
                 SizeF ef1 = this.TopLeftMargin;
                 SizeF ef2 = this.BottomRightMargin;
                 obj1.Bounds = new RectangleF(text1.Left - ef1.Width, text1.Top - ef1.Height, (text1.Width + ef1.Width) + ef2.Width, (text1.Height + ef1.Height) + ef2.Height);
             }
         }
     }
 }
Exemplo n.º 19
0
        public virtual DiagramText CreateText(string s, int idx)
        {
            DiagramText text1 = new DiagramText();

            text1.Selectable = false;
            text1.Alignment  = 1;
            text1.Multiline  = true;
            text1.BackgroundOpaqueWhenSelected = true;
            text1.BackgroundColor = Color.LightBlue;
            text1.DragsNode       = true;
            text1.Text            = s;
            text1.Wrapping        = true;
            if (this.ItemWidth > 0f)
            {
                text1.WrappingWidth = this.ItemWidth;
                text1.Width         = this.ItemWidth;
            }
            return(text1);
        }
Exemplo n.º 20
0
        public virtual void OnItemWidthChanged(float old)
        {
            float           single1     = this.ItemWidth;
            GroupEnumerator enumerator1 = this.ListGroup.GetEnumerator();

            while (enumerator1.MoveNext())
            {
                DiagramShape obj1  = enumerator1.Current;
                DiagramText  text1 = obj1 as DiagramText;
                if ((text1 != null) && (single1 > 0f))
                {
                    text1.WrappingWidth = single1;
                }
                if ((obj1 != null) && (single1 > 0f))
                {
                    obj1.Width = single1;
                }
            }
        }
Exemplo n.º 21
0
 public override void LayoutChildren(DiagramShape childchanged)
 {
     if (!base.Initializing)
     {
         DiagramShape obj1  = this.Background;
         DiagramText  text1 = this.Label;
         DiagramShape obj2  = this.Icon;
         if ((obj2 != null) && (text1 != null))
         {
             obj2.SetSpotLocation(0x40, text1, 0x100);
         }
         if (obj1 != null)
         {
             RectangleF ef1 = this.Bounds;
             if (text1 != null)
             {
                 ef1 = text1.Bounds;
             }
             else if (obj2 != null)
             {
                 ef1 = obj2.Bounds;
             }
             if ((obj2 != null) && (text1 != null))
             {
                 ef1.X     -= obj2.Width;
                 ef1.Width += obj2.Width;
                 if (obj2.Height > text1.Height)
                 {
                     ef1.Y     -= ((obj2.Height - text1.Height) / 2f);
                     ef1.Height = obj2.Height;
                 }
             }
             SizeF ef2 = this.TopLeftMargin;
             SizeF ef3 = this.BottomRightMargin;
             ef1.X      -= ef2.Width;
             ef1.Width  += (ef2.Width + ef3.Width);
             ef1.Y      -= ef2.Height;
             ef1.Height += (ef2.Height + ef3.Height);
             obj1.Bounds = ef1;
         }
     }
 }
Exemplo n.º 22
0
        public virtual void LayoutLabel()
        {
            DiagramText text1 = this.Label;

            if (text1 != null)
            {
                GeneralNode node1 = base.Parent as GeneralNode;
                if ((node1 != null) && (node1.Orientation == Orientation.Vertical))
                {
                    if (this.LeftSide)
                    {
                        text1.Alignment = 1;
                        PointF tf1 = this.GetSpotLocation(0x20);
                        tf1.Y -= this.LabelSpacing;
                        text1.SetSpotLocation(0x80, tf1);
                    }
                    else
                    {
                        text1.Alignment = 1;
                        PointF tf2 = this.GetSpotLocation(0x80);
                        tf2.Y += this.LabelSpacing;
                        text1.SetSpotLocation(0x20, tf2);
                    }
                }
                else if (this.LeftSide)
                {
                    text1.Alignment = 0x40;
                    PointF tf3 = this.GetSpotLocation(0x100);
                    tf3.X -= this.LabelSpacing;
                    text1.SetSpotLocation(0x40, tf3);
                }
                else
                {
                    text1.Alignment = 0x100;
                    PointF tf4 = this.GetSpotLocation(0x40);
                    tf4.X += this.LabelSpacing;
                    text1.SetSpotLocation(0x100, tf4);
                }
            }
        }
Exemplo n.º 23
0
 public override void LayoutChildren(DiagramShape childchanged)
 {
     if (!base.Initializing)
     {
         DiagramText text1 = this.Label;
         if (text1 != null)
         {
             PolygonGraph polygon1 = base.Background as PolygonGraph;
             if ((polygon1 != null) && (childchanged != polygon1))
             {
                 SizeF      ef1     = this.TopLeftMargin;
                 SizeF      ef2     = this.BottomRightMargin;
                 RectangleF ef3     = new RectangleF(text1.Left - ef1.Width, text1.Top - ef1.Height, (text1.Width + ef1.Width) + ef2.Width, (text1.Height + ef1.Height) + ef2.Height);
                 SizeF      ef4     = this.Corner;
                 float      single1 = ef4.Width;
                 if (single1 > (ef3.Width / 2f))
                 {
                     single1 = ef3.Width / 2f;
                 }
                 float single2 = ef4.Height;
                 if (single2 > (ef3.Height / 2f))
                 {
                     single2 = ef3.Height / 2f;
                 }
                 float      single3  = ef3.X;
                 float      single4  = ef3.Y;
                 float      single5  = single3 + single1;
                 float      single6  = single4 + single2;
                 float      single7  = single3 + (ef3.Width / 2f);
                 float      single8  = single4 + (ef3.Height / 2f);
                 float      single9  = (single3 + ef3.Width) - single1;
                 float      single10 = (single4 + ef3.Height) - single2;
                 float      single11 = single3 + ef3.Width;
                 float      single12 = single4 + ef3.Height;
                 RectangleF ef5      = polygon1.Bounds;
                 bool       flag1    = base.SuspendsUpdates;
                 if (!flag1)
                 {
                     polygon1.Changing(0x584);
                 }
                 polygon1.SuspendsUpdates = true;
                 polygon1.ClearPoints();
                 if (this.Anchor != null)
                 {
                     PointF tf3;
                     PointF tf4;
                     float  single13 = System.Math.Min((float)(ef3.Width - single1), this.BaseWidth);
                     float  single14 = System.Math.Min((float)(ef3.Height - single2), this.BaseWidth);
                     float  single15 = text1.Left;
                     float  single16 = text1.Top;
                     float  single17 = text1.Right;
                     float  single18 = text1.Bottom;
                     PointF tf1      = text1.Center;
                     PointF tf2      = this.Anchor.Center;
                     text1.GetNearestIntersectionPoint(tf2, tf1, out tf3);
                     this.Anchor.GetNearestIntersectionPoint(tf1, tf2, out tf4);
                     if ((tf3.Y <= single16) && (tf3.X < single7))
                     {
                         polygon1.AddPoint(single3, single4);
                         polygon1.AddPoint(tf4);
                         polygon1.AddPoint(single3 + single13, single4);
                     }
                     else
                     {
                         polygon1.AddPoint(single5, single4);
                     }
                     if ((tf3.Y <= single16) && (tf3.X >= single7))
                     {
                         polygon1.AddPoint(single11 - single13, single4);
                         polygon1.AddPoint(tf4);
                         polygon1.AddPoint(single11, single4);
                     }
                     else
                     {
                         polygon1.AddPoint(single9, single4);
                     }
                     if ((tf3.X >= single17) & (tf3.Y < single8))
                     {
                         polygon1.AddPoint(single11, single4);
                         polygon1.AddPoint(tf4);
                         polygon1.AddPoint(single11, single4 + single14);
                     }
                     else
                     {
                         polygon1.AddPoint(single11, single6);
                     }
                     if ((tf3.X >= single17) & (tf3.Y >= single8))
                     {
                         polygon1.AddPoint(single11, single12 - single14);
                         polygon1.AddPoint(tf4);
                         polygon1.AddPoint(single11, single12);
                     }
                     else
                     {
                         polygon1.AddPoint(single11, single10);
                     }
                     if ((tf3.Y >= single18) && (tf3.X >= single7))
                     {
                         polygon1.AddPoint(single11, single12);
                         polygon1.AddPoint(tf4);
                         polygon1.AddPoint(single11 - single13, single12);
                     }
                     else
                     {
                         polygon1.AddPoint(single9, single12);
                     }
                     if ((tf3.Y >= single18) && (tf3.X < single7))
                     {
                         polygon1.AddPoint(single3 + single13, single12);
                         polygon1.AddPoint(tf4);
                         polygon1.AddPoint(single3, single12);
                     }
                     else
                     {
                         polygon1.AddPoint(single5, single12);
                     }
                     if ((tf3.X <= single15) && (tf3.Y >= single8))
                     {
                         polygon1.AddPoint(single3, single12);
                         polygon1.AddPoint(tf4);
                         polygon1.AddPoint(single3, single12 - single14);
                     }
                     else
                     {
                         polygon1.AddPoint(single3, single10);
                     }
                     if ((tf3.X <= single15) && (tf3.Y < single8))
                     {
                         polygon1.AddPoint(single3, single4 + single14);
                         polygon1.AddPoint(tf4);
                         polygon1.AddPoint(single3, single4);
                     }
                     else
                     {
                         polygon1.AddPoint(single3, single6);
                     }
                 }
                 else
                 {
                     polygon1.AddPoint(single5, single4);
                     polygon1.AddPoint(single9, single4);
                     polygon1.AddPoint(single11, single6);
                     polygon1.AddPoint(single11, single10);
                     polygon1.AddPoint(single9, single12);
                     polygon1.AddPoint(single5, single12);
                     polygon1.AddPoint(single3, single10);
                     polygon1.AddPoint(single3, single6);
                 }
                 polygon1.SuspendsUpdates = flag1;
                 if (!flag1)
                 {
                     polygon1.Changed(0x584, 0, null, ef5, 0, null, polygon1.Bounds);
                 }
             }
         }
     }
 }