示例#1
0
文件: imp.go 项目: CaptainSoOmA/Uni
func (B *Imp) Edit(s *string, l, c uint) {
	//
	if l >= scr.NLines() {
		return
	}
	if c >= scr.NColumns() {
		return
	}
	n, b := uint(len(*s)), B.width
	if c+b > scr.NColumns() {
		B.width = scr.NColumns() - c
	}
	if B.width == 0 {
		B.width = n
	}
	//  if B.width > n { B.width = n }
	if B.width < n {
		Norm(s, B.width)
	}
	B.graphical = false
	if B.numerical || B.TRnumerical {
		B.editNumber(false, s, scr.NX1()*c, scr.NY1()*l)
	} else {
		B.editText(false, s, scr.NX1()*c, scr.NY1()*l)
	}
	B.width = b
}
示例#2
0
文件: imp.go 项目: CaptainSoOmA/Uni
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
}
示例#3
0
文件: imp.go 项目: CaptainSoOmA/Uni
func (R *Imp) Eingabe() uint {
	//
	var n uint
	nat.SetColours(col.Yellow, col.Blue)
	nat.SetWd(10)
	nat.Edit(&n, scr.NLines()-2, 9)
	nat.SetWd(0)
	return n
}
示例#4
0
文件: imp.go 项目: CaptainSoOmA/Uni
func (x *Imp) Ins(Y Menue) {
	//
	y := x.imp(Y)
	if y == nil || !x.isMenu {
		return
	}
	n := uint(len(x.nextLevel))
	if n >= scr.NLines()-2 {
		return
	}
	x.nextLevel = append(x.nextLevel, y)
}
示例#5
0
文件: imp.go 项目: CaptainSoOmA/Uni
func Show() {
	//
	if line >= scr.NLines() {
		SetAttributes(Zero, scr.NColumns()-textlength[clock.fmt], col.HintF, col.HintB)
	}
	for {
		clock.Actualize()
		clockbx.Write(clock.String(), line, column)
		Sleep(1) // not precise, but good enough for practical purposes
		// more precise would be: sleep until AlarmClock rings
	}
}
示例#6
0
文件: welt.go 项目: CaptainSoOmA/Uni
func (W *Welt) Ausgeben() {
	//
	l := str.Clr(scr.NColumns())
	scr.Colours(farbeV, farbeH)
	scr.Write(l, 0, 0) // kollidiert mit geplanter Ausgabe des Weltnamens
	scr.Write(l, 1, 0)
	scr.Write(l, scr.NLines()-2, 0)
	//  scr.Write (l, scr.NLines() - 3, 0)
	for y := null; y < nY; y++ {
		for x := null; x < nX; x++ {
			platzAusgeben(y, x)
		}
	}
	W.schatten.ausgeben()
}
示例#7
0
文件: imp.go 项目: CaptainSoOmA/Uni
func (x *Imp) Write(l, c uint) {
	//
	s := x.String()
	c0 := c
	for n := 0; n < len(s); n++ {
		scr.Write1(s[n], l, c)
		if c+1 < scr.NColumns() {
			c++
		} else if l+2 < scr.NLines() {
			l++
			c = c0
		} else {
			break
		}
	}
}
示例#8
0
文件: imp.go 项目: CaptainSoOmA/Uni
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)
}
示例#9
0
文件: murus.go 项目: CaptainSoOmA/Uni
func main() { // just to get all stuff compiled
	//
	var _ chanm.ChannelModel = chanm.New(nil)
	t := integ.String(0)
	_ = real.String(0.0)
	var _ lint.LongInteger = lint.New(0)
	var _ brat.Rational = brat.New()
	var _ Object = date.New()
	var _ buf.Buffer = bpqu.New(0, 1)
	var _ pset.PersistentSet = pset.New(persaddr.New())
	var _ acc.Account = acc.New()
	var _ schol.Scholar = schol.New()
	eye.Touch()
	fuday.Touch()
	gra1.Touch()
	fig.Touch()
	var _ asem.AddSemaphore = asem.New(2)
	var _ barr.Barrier = barr.New(2)
	var _ rw.ReaderWriter = rw.New()
	var _ lr.LeftRight = lr.New()
	var _ lock2.Locker2 = lock2.NewPeterson()
	var _ lockp.LockerP = phil.NewLockNaiv()
	var _ barb.Barber = barb.NewSem()
	var _ smok.Smokers = smok.NewNaiv()
	var _ lock.Locker = dlock.New(nil)
	puls.Touch()
	var _ conn.Connection = conn.New()
	rob.Touch()
	var _ Indexer = audio.New()
	scr.Switch(scr.MaxMode()) // >= scr.PAL
	xx, yy := scr.NColumns(), scr.NLines()
	cf, cl, cb := v.Colours()
	circ(cb, xx/2, yy)
	circ(cl, xx-yy, yy)
	circ(cf, yy, yy)
	t = ""
	errh.MurusLicense("murus", v.String(), "1986-2013  Christian Maurer   http://murus.org", cf, cl, cb, &t)
	col.ScreenB = cb
	done := make(chan bool)
	go drive(cf, cl, cb, done)
	<-done
	ker.Terminate()
}
示例#10
0
文件: imp.go 项目: CaptainSoOmA/Uni
func New(h bool) *Imp {
	//
	B := new(Imp)
	l := scr.NLines()
	c := scr.NX()
	B.max = 100
	B.horizontal = h
	B.value = 0
	if h {
		B.width = c
		B.height = scr.NY1()
		B.Locate(0, (l-1)*B.height, B.width, B.height)
	} else {
		B.width = scr.NX1()
		B.height = scr.NY()
		B.Locate(c-B.width, 0, B.width, B.height)
	}
	B.cF, B.cB = col.HintF, col.HintB
	B.Locate(B.x0, B.y0, B.width, B.height)
	return B
}
示例#11
0
文件: imp.go 项目: CaptainSoOmA/Uni
func (B *Imp) Write(s string, l, c uint) {
	//
	if l >= scr.NLines() {
		return
	}
	if c >= scr.NColumns() {
		return
	}
	//  Wd (&s, s)
	n, b := uint(len(s)), B.width
	if c+b > scr.NColumns() {
		B.width = scr.NColumns() - c
	}
	if B.width == 0 {
		B.width = n
	}
	if B.width > n {
		B.width = n
	}
	if B.width < n {
		Norm(&s, B.width)
	}
	//  Norm (&s, B.width)
	if B.numerical || B.TRnumerical {
		Move(&s, false)
	}
	scr.Lock()
	scr.Colours(B.cF, B.cB)
	if B.transparent {
		scr.SwitchTransparence(true)
	}
	scr.Write(s, l, c)
	if B.transparent {
		scr.SwitchTransparence(false)
	}
	scr.Unlock()
	B.width = b
}
示例#12
0
文件: murus.go 项目: CaptainSoOmA/Uni
func drive(cc, cl, cb col.Colour, d chan bool) {
	//
	nx, nx1, ny1 := int(scr.NX()), int(scr.NX1()), int(scr.NY1())
	dw := 96 * nx1
	x0 := (nx - dw) / 2
	x1 := x0 + dw - car.W
	y0 := ((int(scr.NLines())-31)/2 + 3) * ny1
	dr(x0, x1, y0, cc, false)
	dr(x0, x1, y0+2*ny1, cl, false)
	dr(x0, x1, y0+3*ny1, cl, false)
	joke(x0, x1, y0, nx1, ny1, 2, 4, 48, cl, "nsp", true)
	dr(x0, x1, y0+19*ny1, cl, false)
	dr(x0, x0+68*nx1, y0+20*ny1, cl, false)
	csb := col.ScreenB
	col.ScreenB = col.Black
	dr(x0+69*nx1, nx, y0+20*ny1, col.FlashRed, true)
	col.ScreenB = csb
	joke(x0, x1, y0, nx1, ny1, 67, 21, 14, cl, "fire", false)
	joke(x0, x1, y0, nx1, ny1, 48, 22, 15, cl, "mca", false)
	moon(x0 + 90*nx1)
	dr(x0, x1, y0+26*ny1, cc, false)
	d <- true
}
示例#13
0
文件: imp.go 项目: CaptainSoOmA/Uni
func (R *Imp) Ausgeben(n uint) {
	//
	nat.SetColours(col.Yellow, col.Blue)
	nat.Write(n, scr.NLines()-2, 9)
	kbd.Wait(true)
}
示例#14
0
文件: imp.go 项目: CaptainSoOmA/Uni
func select_(write WritingCol, n, h, w uint, i *uint, l, c uint, f, b col.Colour) {
	//
	if n == 0 {
		ker.Stop(pack, 1)
	}
	if n == 1 {
		*i = 0
		return
	}
	if h == 0 {
		ker.Stop(pack, 2)
	}
	if h > n {
		h = n
	}
	if w == 0 {
		w = scr.NColumns()
	}
	if w > scr.NColumns() {
		w = scr.NColumns()
	}
	if c+w > scr.NColumns() {
		c = scr.NColumns() - w
	}
	// so, dass letzte Zeile frei bleibt
	if l+h >= scr.NLines() {
		h = scr.NLines() - l - 1
	}
	if *i >= n {
		*i = n - 1
	}
	MouseOn := scr.MouseCursorOn()
	var x, y int
	if MouseOn {
		scr.MouseCursor(false)
		x, y = scr.MousePosGr()
	}
	scr.WarpMouse(l+*i, c)
	scr.Save(l, c, w, h)
	i0, n0 := uint(0), uint(0)
	if *i == 0 {
		n0 = 1
	} // else { n0 = 0 }
	neu := true
loop:
	for {
		if *i < i0 {
			i0 = *i
			neu = true
		} else if *i > i0+h-1 {
			i0 = *i - (h - 1)
			neu = true
		} else {
			neu = *i != n0
		}
		if neu {
			neu = false
			var cF, cB col.Colour
			for j := uint(0); j < h; j++ {
				if i0+j == *i {
					cF, cB = f, b
				} else {
					cF, cB = b, f
				}
				write(i0+j, l+j, c, cF, cB)
			}
		}
		n0 = *i
		C, d := kbd.Command()
		switch C {
		case kbd.Esc, kbd.Thither:
			*i = n
			break loop
		case kbd.Enter, kbd.Hither:
			break loop
		case kbd.Left, kbd.Up:
			if d == 0 {
				if *i > 0 {
					*i--
				}
			} else {
				if *i >= 10 {
					*i -= 10
				}
			}
		case kbd.Right, kbd.Down:
			if d == 0 {
				if *i+1 < n {
					*i++
				}
			} else {
				if *i+10 < n {
					*i += 10
				}
			}
		case kbd.Pos1:
			*i = 0
		case kbd.End:
			*i = n - 1
		case kbd.Go:
			_, yM := scr.MousePosGr()
			if uint(yM) <= l*scr.NY1()+scr.NY1()/2 {
				if *i > 0 {
					*i--
				}
			} else if uint(yM) >= (l+h)*scr.NY1() {
				if *i < n-1 {
					*i++
				}
			} else {
				*i = i0 + uint(yM)/scr.NY1() - l
			}
			/*
			   case kbd.Help:
			     errh.Hint (errh.zumAuswaehlen)
			     kbd.Wait (true)
			     errh.DelHint()
			*/
		}
	}
	scr.Restore(l, c, w, h)
	if MouseOn {
		scr.MouseCursor(true)
		scr.WarpMouseGr(x, y)
	}
}