Beispiel #1
0
func CreateXmlInChannel(ch pf.ChannelIf) *backend.XmlInChannel {
	ret := backend.XmlInChannelNew(ch.Name(), ch.IOType().Name(), ch.(*channel).linkText)
	//ret.Entry = freesp.CreateXmlModePosition(ch).Entry
	//c := ch.(*channel)
	//ret.ArchPortHints.Entry = freesp.CreateXmlModePosition(c.archport).Entry
	return ret
}
Beispiel #2
0
func (a Arch) drawLocalChannel(ctxt interface{}, ch pf.ChannelIf) {
	switch ctxt.(type) {
	case *cairo.Context:
		context := ctxt.(*cairo.Context)
		link := ch.Link()
		if ch.Process().Arch().Name() != a.Name() {
			log.Fatal("Arch.drawLocalChannel: channel not in arch %s\n", a.Name())
		}
		if link.Process().Arch().Name() == a.Name() {
			var r, g, b float64
			p1 := a.channelMap[ch]
			p2 := a.channelMap[link]
			if p1.IsSelected() || p2.IsSelected() {
				r, g, b, _ = ColorOption(SelectChannelLine)
			} else if p1.IsHighlighted() || p2.IsHighlighted() {
				r, g, b, _ = ColorOption(HighlightChannelLine)
			} else {
				r, g, b, _ = ColorOption(NormalChannelLine)
			}
			context.SetLineWidth(2)
			context.SetSourceRGB(r, g, b)
			var pos1, pos2 image.Point
			if ch.Direction() == gr.InPort {
				pos1 = link.ModePosition(a.mode).Add(image.Point{procPortWidth, procPortHeight}.Div(2))
				pos2 = ch.ModePosition(a.mode).Add(image.Point{procPortWidth, procPortHeight}.Div(2))
			} else {
				pos1 = ch.ModePosition(a.mode).Add(image.Point{procPortWidth, procPortHeight}.Div(2))
				pos2 = link.ModePosition(a.mode).Add(image.Point{procPortWidth, procPortHeight}.Div(2))
			}
			DrawArrow(context, pos1, pos2)
		}
	}
}
Beispiel #3
0
func (a *Arch) addExternalPort(c pf.ChannelIf, mode gr.PositionMode, idx int) {
	config := DrawConfig{ColorInit(ColorOption(NormalArchPort)),
		ColorInit(ColorOption(HighlightArchPort)),
		ColorInit(ColorOption(SelectArchPort)),
		ColorInit(ColorOption(BoxFrame)),
		Color{},
		image.Point{}}
	ap := c.ArchPort()
	if ap == nil {
		log.Printf("Arch.addExternalPort error: channel %v has no arch port\n", c)
		return
	}
	positioner := gr.ModePositionerProxyNew(ap, mode)
	a.AddPort(config, ap, positioner)
}
Beispiel #4
0
func (a Arch) channelIsExtern(c pf.ChannelIf) bool {
	link := c.Link()
	cp := link.Process()
	ca := cp.Arch()
	return ca != a.userObj
}