protected override void OnApply(LinkLineNode node)
        {
            LinkLineNode node1 = GetLineNode(_node1);
            LinkLineNode node2 = GetLineNode(_node2);
            LinkLineNode start = (LinkLineNode)node1.PrevNode;
            LinkLineNode end   = (LinkLineNode)node2.NextNode;

            node1.ClearLine();
            node2.ClearLine();
            node.Parent.Controls.Remove(node1);
            node.Parent.Controls.Remove(node2);
            start.SetNext(end);
            end.SetPrevious(start);
            if (start.Line == null)
            {
                start.CreateForwardLine();
            }
            else
            {
                end.CreateBackwardLine();
            }
            if (start.LinkedOutPort != null)
            {
                if (end.LinkedInPort != null)
                {
                    start.LinkedOutPort.LinkedPortID = end.LinkedInPort.PortID;
                    end.LinkedInPort.LinkedPortID    = start.LinkedOutPort.PortID;
                }
            }
            ActiveDrawing.RefreshControl(node.Parent);
        }
        public void Apply()
        {
            bool b = _host.DisableUndo;

            _host.DisableUndo = true;
            Control c = _host.GetUndoControl(_ctrlKey);

            if (c != null)
            {
                c.Size = _size;
                if (c.Parent != null)
                {
                    ActiveDrawing.RefreshControl(c.Parent);
                }
            }
            _host.DisableUndo = b;
        }
        private void miDisconnectNodes_Click(object sender, EventArgs e)
        {
            MenuItem mi = sender as MenuItem;

            if (mi != null)
            {
                NodeData nd = mi.Tag as NodeData;
                if (nd != null)
                {
                    LinkLineNode node = nd.Node;

                    if (node != null)
                    {
                        if (nd.Data != null)
                        {
                            if (nd.Data.GetType().Equals(typeof(Point)))
                            {
                                Point pt = (Point)nd.Data;
                                if (node.Line != null)
                                {
                                    //===================
                                    UInt32             key  = node.ActiveDrawingID;
                                    UInt32             key1 = 0;
                                    UInt32             key2 = 0;
                                    LinkLineNodeInPort ip   = node.LinkedInPort;
                                    node.BreakLine(pt, ref key1, ref key2);
                                    OnDisconnectLine(ip);
                                    if (UndoHost != null)
                                    {
                                        if (!UndoHost.DisableUndo)
                                        {
                                            LinkLineUndoReconnect undo = new LinkLineUndoReconnect(UndoHost, key, key1, key2);
                                            LinkLineUndoBreak     redo = new LinkLineUndoBreak(UndoHost, key, key1, key2, pt);
                                            UndoHost.AddUndoEntity(new UndoEntity(undo, redo));
                                        }
                                    }
                                    ActiveDrawing.RefreshControl(this);
                                }
                            }
                        }
                    }
                }
            }
        }
        private void miAddLineNode_Click(object sender, EventArgs e)
        {
            MenuItem mi = sender as MenuItem;

            if (mi != null)
            {
                NodeData nd = mi.Tag as NodeData;
                if (nd != null)
                {
                    LinkLineNode node = nd.Node;

                    if (node != null)
                    {
                        if (nd.Data != null)
                        {
                            if (nd.Data.GetType().Equals(typeof(Point)))
                            {
                                Point pt = (Point)nd.Data;
                                if (node.Line != null)
                                {
                                    UInt32       key2    = node.ActiveDrawingID;
                                    LinkLineNode newNode = node.InsertNode(pt.X + 5, pt.Y + 5);
                                    if (UndoHost != null)
                                    {
                                        if (!UndoHost.DisableUndo)
                                        {
                                            UInt32     key1   = newNode.ActiveDrawingID;
                                            UndoEntity entity = new UndoEntity(
                                                new LinkLineUndoDelete(UndoHost, key1), new LinkLineUndoAdd(UndoHost, key2, pt));
                                            UndoHost.AddUndoEntity(entity);
                                        }
                                    }
                                    newNode.SaveLocation();
                                    newNode.Selected = true;
                                    ActiveDrawing.RefreshControl(this);
                                    OnLineNodeAdded(newNode);
                                }
                            }
                        }
                    }
                }
            }
        }
        protected override void OnApply(LinkLineNode node)
        {
            LinkLineNode prevNode = node;

            if (prevNode != null)
            {
                LinkLineNode nextNode = GetLineNode(_next);
                if (nextNode != null)
                {
                    if (prevNode.Line != null)
                    {
                        if (prevNode.Line.EndPoint == nextNode)
                        {
                            prevNode.ClearLine();
                        }
                    }
                    if (nextNode.Line != null)
                    {
                        if (nextNode.Line.StartPoint == prevNode)
                        {
                            nextNode.ClearLine();
                        }
                    }
                    LinkLineNode newNode = new LinkLineNode(nextNode, prevNode);
                    newNode.Location        = _point;
                    newNode.ActiveDrawingID = _deleted;
                    nextNode.Parent.Controls.Add(newNode);
                    if (prevNode.Line == null)
                    {
                        prevNode.CreateForwardLine();
                        newNode.CreateForwardLine();
                    }
                    else
                    {
                        newNode.CreateBackwardLine();
                        nextNode.CreateBackwardLine();
                    }
                    ActiveDrawing.RefreshControl(nextNode.Parent);
                }
            }
        }
Ejemplo n.º 6
0
 private void showEditor(IMathExpression exp)
 {
     try
     {
         Rectangle   rc  = this.Parent.RectangleToScreen(this.Bounds);
         IMathEditor dlg = exp.CreateEditor(rc);
         if (((Form)dlg).ShowDialog(this.FindForm()) == DialogResult.OK)
         {
             LoadData(dlg.MathExpression);
             //
             Refresh();
             if (this.Parent != null)
             {
                 ActiveDrawing.RefreshControl(this.Parent);
             }
             setChanged();
         }
     }
     catch (Exception err)
     {
         MathNode.Log(this.FindForm(), err);
     }
 }
 protected override void OnApply(LinkLineNode node)
 {
     node.BreakLine(_point, ref _node1, ref _node2);
     ActiveDrawing.RefreshControl(node.Parent);
 }