func colour(FZ, B uint) col.Colour { // MausAn := scr.MouseCursorOn() if !MausAn { scr.MouseCursor(true) } xm, ym := scr.MousePosGr() X, Y = uint(xm), uint(ym) M := FZ * B / 2 if X >= scr.NY()-M { X = scr.NX() - M } if X >= M { X -= M } else { X = 0 } if Y >= H { Y -= H } else { Y = 0 } scr.SaveGr(X, Y, X+2*FZ*B, Y+H) write(FZ, B, X, Y) clicked := false C := col.ScreenF loop: for { scr.MouseCursor(true) K, _ := kbd.Command() switch K { case kbd.Esc, kbd.Back, kbd.There, kbd.This: break loop case kbd.Here: define(FZ, B, &C) clicked = true case kbd.Hither: if clicked { break loop } } } scr.RestoreGr(X, Y, X+2*FZ*B, Y+H) if !MausAn { scr.MouseCursor(false) } return C }
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) } }