func (p *port) treeAddNewObject(tree tr.TreeIf, cursor tr.Cursor, conn bh.ConnectionIf, otherPort bh.PortIf) (newCursor tr.Cursor) { newCursor = tree.Insert(cursor) conn.AddToTree(tree, newCursor) contextCursor := tree.Parent(tree.Parent(cursor)) cCursor := tree.CursorAt(contextCursor, otherPort) cChild := tree.Append(cCursor) conn.AddToTree(tree, cChild) return }
func CreateXmlConnection(c bh.ConnectionIf) *backend.XmlConnect { from := c.From() to := c.To() fromNode := from.Node() toNode := to.Node() switch from.Direction() { case gr.OutPort: return backend.XmlConnectNew(fromNode.Name(), toNode.Name(), from.Name(), to.Name()) default: return backend.XmlConnectNew(toNode.Name(), fromNode.Name(), to.Name(), from.Name()) } }
func (v *signalGraphView) selectConnect(conn bh.ConnectionIf) { n1 := v.findNode(conn.From().Node().Name()) n2 := v.findNode(conn.To().Node().Name()) for _, c := range v.connections { if n1 == c.From() && n2 == c.To() && n1.OutPorts()[c.FromId()] == conn.From() && n2.InPorts()[c.ToId()] == conn.To() { if c.Select() { v.repaintConnection(c) } } else { if c.Deselect() { v.repaintConnection(c) } } } }