Exemplo n.º 1
0
 public bool MoveNext()
 {
     if ((this.myIndex + 1) >= this.myArray.Count)
     {
         return(false);
     }
     this.myIndex++;
     if (this.myDest)
     {
         Shapes.IDiagramLine link1 = (Shapes.IDiagramLine) this.myArray[this.myIndex];
         if (link1.FromPort != this.myPort)
         {
             return(this.MoveNext());
         }
     }
     else
     {
         Shapes.IDiagramLine link2 = (Shapes.IDiagramLine) this.myArray[this.myIndex];
         if (link2.ToPort != this.myPort)
         {
             return(this.MoveNext());
         }
     }
     return(true);
 }
Exemplo n.º 2
0
 protected virtual Shapes.IDiagramLine CreateTemporaryLink(Shapes.IDiagramPort fromPort, Shapes.IDiagramPort toPort)
 {
     Shapes.IDiagramLine link1 = (Shapes.IDiagramLine)Activator.CreateInstance(base.View.LineType);
     if ((link1 == null) || (link1.DiagramShape == null))
     {
         return(null);
     }
     link1.FromPort = fromPort;
     link1.ToPort   = toPort;
     Shapes.DiagramShape obj1 = link1.DiagramShape;
     if (obj1 is Shapes.LineGraph)
     {
         Shapes.LineGraph link2 = (Shapes.LineGraph)obj1;
         if (this.myOrthogonalSet)
         {
             link2.Orthogonal = this.Orthogonal;
         }
         link2.AdjustingStyle = Shapes.LineAdjustingStyle.Calculate;
     }
     else if (obj1 is Shapes.TextLine)
     {
         Shapes.TextLine link3 = (Shapes.TextLine)obj1;
         if (this.myOrthogonalSet)
         {
             link3.Orthogonal = this.Orthogonal;
         }
         link3.AdjustingStyle = Shapes.LineAdjustingStyle.Calculate;
     }
     base.View.Layers.Default.Add(obj1);
     return(link1);
 }
Exemplo n.º 3
0
 public virtual void DoNoRelink(Shapes.IDiagramLine oldlink, Shapes.IDiagramPort fromPort, Shapes.IDiagramPort toPort)
 {
     Shapes.DiagramShape obj1 = oldlink.DiagramShape;
     if ((obj1 != null) && (obj1.Layer != null))
     {
         if (obj1.Movable)
         {
             oldlink.FromPort       = fromPort;
             oldlink.ToPort         = toPort;
             base.TransactionResult = "Relink";
             base.View.RaiseLinkRelinked(oldlink.DiagramShape);
             return;
         }
         if (obj1.CanDelete())
         {
             CancelEventArgs args1 = new CancelEventArgs();
             base.View.RaiseSelectionDeleting(args1);
             if (!args1.Cancel)
             {
                 obj1.Remove();
                 base.View.RaiseSelectionDeleted();
                 base.TransactionResult = "Relink";
                 return;
             }
             this.DoCancelMouse();
         }
         else
         {
             this.DoCancelMouse();
         }
     }
     base.TransactionResult = null;
 }
Exemplo n.º 4
0
 public override PointF GetToLinkPoint(Shapes.IDiagramLine link)
 {
     if (this.Target != null)
     {
         return(this.Target.GetToLinkPoint(link));
     }
     return(base.GetToLinkPoint(link));
 }
Exemplo n.º 5
0
 public override float GetToLinkDir(Shapes.IDiagramLine link)
 {
     if (this.Target != null)
     {
         return(this.Target.GetToLinkDir(link));
     }
     return(base.GetToLinkDir(link));
 }
Exemplo n.º 6
0
 public virtual void DoRelink(Shapes.IDiagramLine oldlink, Shapes.IDiagramPort fromPort, Shapes.IDiagramPort toPort)
 {
     oldlink.FromPort = fromPort;
     oldlink.ToPort   = toPort;
     Shapes.SubGraphNode.ReparentToCommonSubGraph(oldlink.DiagramShape, (fromPort != null) ? fromPort.DiagramShape : null, (toPort != null) ? toPort.DiagramShape : null, true, base.View.Document.LinksLayer);
     base.TransactionResult = "Relink";
     base.View.RaiseLinkRelinked(oldlink.DiagramShape);
 }
Exemplo n.º 7
0
        public override bool CanStart()
        {
            if (base.FirstInput.IsContextButton)
            {
                return(false);
            }
            if (!base.View.CanLinkObjects())
            {
                return(false);
            }
            IShapeHandle handle1 = this.PickRelinkHandle(base.FirstInput.DocPoint);

            if (handle1 == null)
            {
                return(false);
            }
            if (handle1.HandleID == 0x400)
            {
                base.CurrentObject = handle1.HandledObject;
                Shapes.IDiagramLine link1 = handle1.SelectedObject as Shapes.IDiagramLine;
                if (link1 is Shapes.LineGraph)
                {
                    Shapes.LineGraph link2 = (Shapes.LineGraph)link1;
                    if (link2.AbstractLink != null)
                    {
                        link1 = link2.AbstractLink;
                    }
                }
                if (link1 == null)
                {
                    return(false);
                }
                base.Link            = link1;
                base.OriginalEndPort = base.Link.FromPort;
                return(true);
            }
            if (handle1.HandleID != 0x401)
            {
                return(false);
            }
            base.CurrentObject = handle1.HandledObject;
            Shapes.IDiagramLine link3 = handle1.SelectedObject as Shapes.IDiagramLine;
            if (link3 is Shapes.LineGraph)
            {
                Shapes.LineGraph link4 = (Shapes.LineGraph)link3;
                if (link4.AbstractLink != null)
                {
                    link3 = link4.AbstractLink;
                }
            }
            if (link3 == null)
            {
                return(false);
            }
            base.Link            = link3;
            base.OriginalEndPort = base.Link.ToPort;
            return(true);
        }
Exemplo n.º 8
0
 public virtual void DoNewLink(Shapes.IDiagramPort fromPort, Shapes.IDiagramPort toPort)
 {
     Shapes.IDiagramLine link1 = base.View.CreateLink(fromPort, toPort);
     if (link1 != null)
     {
         base.TransactionResult = "New Link";
         base.View.RaiseLinkCreated(link1.DiagramShape);
     }
     else
     {
         base.TransactionResult = null;
     }
 }
Exemplo n.º 9
0
 public virtual void StartRelink(Shapes.IDiagramLine oldlink, Shapes.IDiagramPort oldport, PointF dc)
 {
     if (oldlink != null)
     {
         Shapes.DiagramShape obj1 = oldlink.DiagramShape;
         if ((obj1 != null) && (obj1.Layer != null))
         {
             base.StartTransaction();
             this.myLinkingNew    = false;
             this.OriginalEndPort = oldport;
             this.Link            = oldlink;
             if (oldlink.ToPort == oldport)
             {
                 this.Forwards          = true;
                 this.OriginalStartPort = oldlink.FromPort;
                 PointF tf1 = dc;
                 if (this.OriginalStartPort != null)
                 {
                     tf1 = this.OriginalStartPort.DiagramShape.Center;
                 }
                 else if (oldlink is Shapes.LineGraph)
                 {
                     Shapes.LineGraph link1 = (Shapes.LineGraph)oldlink;
                     if (link1.PointsCount > 0)
                     {
                         tf1 = link1.GetPoint(0);
                     }
                 }
                 else if (oldlink is Shapes.TextLine)
                 {
                     Shapes.TextLine link2 = (Shapes.TextLine)oldlink;
                     if (link2.RealLink.PointsCount > 0)
                     {
                         tf1 = link2.RealLink.GetPoint(0);
                     }
                 }
                 this.StartPort   = this.CreateTemporaryPort(this.OriginalStartPort, tf1, false, false);
                 oldlink.FromPort = this.StartPort;
                 this.EndPort     = this.CreateTemporaryPort(this.OriginalEndPort, dc, true, true);
                 oldlink.ToPort   = this.EndPort;
             }
             else if (oldlink.FromPort == oldport)
             {
                 this.Forwards          = false;
                 this.OriginalStartPort = oldlink.ToPort;
                 PointF tf2 = dc;
                 if (this.OriginalStartPort != null)
                 {
                     tf2 = this.OriginalStartPort.DiagramShape.Center;
                 }
                 else if (oldlink is Shapes.LineGraph)
                 {
                     Shapes.LineGraph link3 = (Shapes.LineGraph)oldlink;
                     if (link3.PointsCount > 0)
                     {
                         tf2 = link3.GetPoint(link3.PointsCount - 1);
                     }
                 }
                 else if (oldlink is Shapes.TextLine)
                 {
                     Shapes.TextLine link4 = (Shapes.TextLine)oldlink;
                     if (link4.RealLink.PointsCount > 0)
                     {
                         tf2 = link4.RealLink.GetPoint(link4.RealLink.PointsCount - 1);
                     }
                 }
                 this.StartPort   = this.CreateTemporaryPort(this.OriginalStartPort, tf2, true, false);
                 oldlink.ToPort   = this.StartPort;
                 this.EndPort     = this.CreateTemporaryPort(this.OriginalEndPort, dc, false, true);
                 oldlink.FromPort = this.EndPort;
             }
             base.View.Cursor = Cursors.Hand;
         }
     }
 }
Exemplo n.º 10
0
 public virtual void DoCancelRelink(Shapes.IDiagramLine oldlink, Shapes.IDiagramPort fromPort, Shapes.IDiagramPort toPort)
 {
     oldlink.FromPort       = fromPort;
     oldlink.ToPort         = toPort;
     base.TransactionResult = null;
 }