Exemplo n.º 1
0
func (x *Imp) selected(l, c uint) bool {
	//
	n := uint(len(x.nextLevel))
	if n == 0 || !x.isMenu {
		return false
	}
	if n == 1 {
		return true
	}
	bx.Colours(menuheadF, menuheadB)
	bx.Wd(scr.NColumns())
	bx.Write(x.text, l, c)
	errh.Hint(errh.ToSelect)
	i := x.lastPos
	sel.Select(func(p, l, c uint, f, b col.Colour) {
		bx.Colours(f, b)
		bx.Write(x.nextLevel[p].text, l, c)
	}, n, scr.NLines()-2, scr.NColumns(), &i, 2, 0, menuF, menuB)
	if i < n {
		x.lastPos = i
		x.next = x.nextLevel[i]
	}
	errh.DelHint()
	return i < n
}
Exemplo n.º 2
0
func (x *Imp) selected(l, c uint) bool {
	//
	if x.num == 0 {
		return false
	}
	if x.num == 1 {
		return true
	}
	x.Write(l, c)
	i := uint(0)
	h := x.num / 2
	if h < 5 {
		h = 5
	}
	if h > x.num {
		h = x.num
	}
	errh.Hint(errh.ToSelect)
	//  f, b:= x.cF, x.cB
	//  f, b = col.Pink, col.Darkmagenta
	sel.Select(func(p, l, c uint, f, b col.Colour) {
		bx.Colours(f, b)
		bx.Write(x.s[x.f][p], l, c)
	}, x.num, h, x.wd[x.f], &i, l, c, x.cB, x.cF)
	errh.DelHint()
	if i < x.num {
		x.b = byte(i)
	}
	return i < x.num
}
Exemplo n.º 3
0
func (x *Imp) Edit(Z, S uint) {
	//
	bx.Colours(x.cF, x.cB)
	var l uint
	for {
		switch x.fmt {
		case Tld:
			l = 2
			bx.Edit(&x.att.tld, Z, S)
		case Long:
			l = length
			bx.Edit(&x.att.name, Z, S)
		default:
			return
		}
		var T uint
		if kbd.LastCommand(&T) == kbd.LookFor {
			n := uint(x.cnt)
			sel.Select(func(P, Z, S uint, V, H col.Colour) { x.att = Folge[country(P)]; x.SetColours(V, H); x.Write(Z, S) },
				noNations, scr.NLines(), l, &n, Z, S, x.cB, x.cF)
			if country(n) == noNations {
				n = uint(x.cnt) // Nation unverändert
			} else {
				x.cnt = country(n)
			}
			x.att = Folge[x.cnt]
			break
		} else {
			var ok bool
			switch x.fmt {
			case Tld:
				ok = x.Defined(x.att.tld)
			case Long:
				ok = x.Defined(x.att.name)
			}
			if ok {
				break
			} else {
				errh.Error("kein Land", 0)
			}
		}
	}
	x.Write(Z, S)
}