Exemple #1
0
func (f *Imp) editText() {
	//
	if f.sort != Text {
		return
	}
	scr.MouseCursor(false)
	bx.Wd(lenText)
	bx.ColourF(f.colour)
	x1 := f.x[0] + int(lenText*scr.NX1()) - 1
	if x1 >= xx {
		x1 = xx - 1
	}
	y1 := f.y[0] + int(scr.NY1()) - 1
	if y1 >= yy {
		y1 = yy - 1
	}
	scr.SaveGr(uint(f.x[0]), uint(f.y[0]), uint(x1), uint(y1))
	bx.SetTransparent(false)
	f.tx = str.Clr(lenText) // wörkeraunt
	bx.EditGr(&f.tx, uint(f.x[0]), uint(f.y[0]))
	bx.SetTransparent(true)
	scr.RestoreGr(uint(f.x[0]), uint(f.y[0]), uint(x1), uint(y1))
	var T uint
	if kbd.LastCommand(&T) == kbd.Enter {
		bx.SetTransparent(true)
		//    scr.RestoreGr (f.x[0], f.y[0], x1, y1)
		bx.WriteGr(f.tx, f.x[0], f.y[0])
		k := str.ProperLen(f.tx)
		x0 := make([]int, 2)
		x0[0] = f.x[0]
		f.x = x0
		y0 := make([]int, 2)
		y0[0] = f.y[0]
		f.y = y0
		f.x[1] = f.x[0] + int(scr.NX1()*k) - 1
		f.y[1] = f.y[0] + int(scr.NY1()) - 1
		scr.WarpMouseGr(f.x[0], f.y[1])
	} else {
		//    f.tx = str.Clr (lenText)
		//    bx.WriteGr (f.tx, f.x[0], f.y[0])
		//    f.tx = ""
		//    f.x, f.y = nil, nil
	}
	scr.MouseCursor(true)
}
Exemple #2
0
func April1st() {
	col.ScreenF, col.ScreenB = col.White, col.Black
	scr.Cls()
	scr.MouseCursor(false)
	scr.Colour(col.White)
	scr.Write("Found evil software: \"       \"", 7, x0)
	doof(7, 22)
	scr.Colour(col.White)
	scr.Write("Remove (yes/no) ?", y0, x0)
	b := box.New()
	b.Wd(3)
	t := "yes"
	b.Edit(&t, y0, 23)
	scr.WarpMouseGr(2*int(scr.NX()), 2*int(scr.NY()))
	b.Colours(col.LightOrange, col.Black)
	b.Write("yes", y0, 23)
	doodle(col.LightWhite, 2)
	doodle(col.LightWhite, 2)
	doodle(col.LightYellow, 5)
	doodle(col.Yellow, 3)
	doodle(col.LightOrange, 5)
	doodle(col.Orange, 8)
	doodle(col.LightRed, 3)
	// TODO erase all (f + "*.tmp")
	t = str.Clr(70)
	scr.Write(t, y0, x0)
	scr.Write(t, y0+1, x0)
	col.ScreenF, col.ScreenB = col.LightGreen, col.DarkBlue
	scr.Cls()
	scr.Write("The murus-tool has removed \"       \" - your disk is reformatted :-)", y0, x0)
	doof(y0, 28)
	scr.Colour(col.LightWhite)
	scr.Write("Please install Linux, TeX, mercurial, Go and murus completely new !", y0+2, x0)
	ker.Sleep(20)
	ker.Terminate()
}
Exemple #3
0
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)
	}
}