예제 #1
0
파일: imp.go 프로젝트: CaptainSoOmA/Uni
func (x *Imp) Selected(cop CondOp) bool {
	//
loop:
	for {
		cop(x, true) // colour auffallend
		c, t := kbd.Command()
		cop(x, false) // colour normal
		switch c {
		case kbd.Enter:
			return true
		case kbd.Esc:
			break loop
		default:
			if x.fmt == Yy || x.fmt == Yyyy {
				if t == 0 {
					t = 3
				} else {
					t = 5
				}
			}
			x.Change(c, t)
		}
	}
	return false
}
예제 #2
0
파일: main.go 프로젝트: CaptainSoOmA/Uni
func main() {
	//
	scr.Switch(scr.TXT)
	var today, birthday *Imp
	today = New()
	today.Actualize()
	birthday = New()
	birthday.SetColours(col.LightWhite, col.Blue)
	scr.Colour(col.Yellow)
	scr.Write("Ihr Geburtsdatum:", 12, 0)
	birthday.Edit(12, 18)
	if birthday.Empty() {
		birthday.Actualize()
	} else {
		scr.Write(" war ein ", 12, 26)
		birthday.SetFormat(WD)
		birthday.Write(12, 35)
		errh.Error2("Sie sind heute", birthday.Distance(today), "Tage alt.", 0)
	}
	scr.Colours(col.ScreenF, col.ScreenB)
	scr.Cls()
	errh.Hint(" vor-/rückwärts: Pfeiltasten               fertig: Esc ")
	var (
		c kbd.Comm
		t uint
	)
	neu := true
loop:
	for {
		if neu {
			birthday.WriteYear(0, 0)
			neu = false
		}
		switch c, t = kbd.Command(); c {
		case kbd.Esc:
			break loop
		case kbd.Down:
			if t == 0 {
				birthday.Inc(Yearly)
			} else {
				birthday.Inc(Decadic)
			}
			neu = true
		case kbd.Up:
			if t == 0 {
				birthday.Dec(Yearly)
			} else {
				birthday.Dec(Decadic)
			}
			neu = true
		case kbd.PrintScr:
			birthday.PrintYear(0, 0)
			prt.GoPrint()
		}
	}
	ker.Terminate()
}
예제 #3
0
파일: imp.go 프로젝트: CaptainSoOmA/Uni
func (x *Imp) EditInYear(l, c uint) {
	//
	for {
		c, _ := kbd.Command()
		if c == kbd.Here {
			x.changeWithMouse(Yearly, false, 0, 0, 0, 0, 0)
			break
		}
	}
}
예제 #4
0
파일: imp.go 프로젝트: CaptainSoOmA/Uni
func Editieren() {
	//
	for {
		b.c, b.d = kbd.Command()
		switch b.c {
		case kbd.Esc:
			break
		case kbd.Enter,
			kbd.Left, kbd.Right, kbd.Up, kbd.Down, kbd.Pos1, kbd.End, kbd.Tab, kbd.Del, kbd.Ins, kbd.Help,
			kbd.Mark, kbd.Demark: // kbd.PrintScr:
			F(manip)
		}
	}
	Terminieren()
}
예제 #5
0
파일: col.go 프로젝트: CaptainSoOmA/Uni
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
}
예제 #6
0
파일: imp.go 프로젝트: CaptainSoOmA/Uni
func ausgewaehlt(Ecke *node.Imp) bool {
	//
loop:
	for {
		c, _ := kbd.Command()
		switch c {
		case kbd.Here:
			if Graph.ExPred(node.UnderMouse) {
				Ecke = Graph.Get().(*node.Imp)
				return true
			}
		case kbd.Esc:
			break loop
		}
	}
	return false
}
예제 #7
0
파일: imp.go 프로젝트: CaptainSoOmA/Uni
func schreiten() {
	//
	if !schrittweise {
		return
	}
	errh.Hint(errh.ToContinueOrNot)
loop:
	for {
		c, _ := kbd.Command()
		switch c {
		case kbd.Enter:
			break loop
		case kbd.Esc:
			ker.Terminate()
		}
	}
}
예제 #8
0
파일: imp.go 프로젝트: CaptainSoOmA/Uni
func (R *Imp) Editieren() {
	//
	//  errh.WriteHelp1 ()
	R.Aktualisieren()
	errh.Hint("Hilfe mit F1")
	//  R.aktionen = R.aktionen [0:0]
	var (
		K kbd.Comm
		T uint
	)
	for {
		K, T = kbd.Command()
		R.Manipulieren(K, T)
		if K == kbd.Esc {
			break
		}
	}
	errh.DelHint()
}
예제 #9
0
파일: imp.go 프로젝트: CaptainSoOmA/Uni
func gew() bool {
	//
	var dummy *bahnhof.Imp
	for {
		//    ok:= false
		c, _ := kbd.Command()
		scr.MouseCursor(true)
		switch c {
		case kbd.Esc:
			return false
		case kbd.Enter, kbd.Back, kbd.Left, kbd.Right, kbd.Up, kbd.Down:
			dummy.SkalaEditieren()
			write(false)
		case kbd.Help:
			errh.WriteHelp(help)
		case kbd.Hither:
			if netz.ExPred(func(a Any) bool { return a.(*bahnhof.Imp).UnterMaus() }) {
				return true
			}
		case kbd.There, kbd.Push, kbd.Thither:
			dummy.SkalaEditieren()
			write(false)
			/*
			   case kbd.This:
			     ok = netz.ExPred (func (a Any) bool { return a.(*bahnhof.Imp).UnterMaus() })
			   case kbd.Push:
			     x, y:= scr.MousePosGr ()
			     if ok {
			       bhf:= netz.Get ().(*bahnhof.Imp)
			       bhf.Rescale (uint(x), uint(y))
			       netz.Put (bhf)
			       write (false)
			     }
			*/
		case kbd.PrintScr:
			errh.DelHint()
			img.Print1()
		}
	}
	return false
}
예제 #10
0
파일: imp.go 프로젝트: CaptainSoOmA/Uni
func (w *Imp) Edit(l, c uint) { // l, c: fake
	//
	s := w.spec[w.line][w.column]
	sa := s
	y, x := scr.MousePos()
	ya, xa := y, x
loop:
	for {
		s.Write(y0+w.line, 2*w.column)
		ya, xa = y, x
		sa = s
		c, _ := kbd.Command()
		y, x = scr.MousePos()
		if y0 <= y && y < ny+y0 && x < 2*nx {
			w.line, w.column = y-y0, x/2
			s = w.spec[w.line][w.column]
		}
		if ya >= y0 {
			sa.Mark(false)
			sa.Write(ya, 2*(xa/2))
		}
		switch c {
		case kbd.Esc:
			break loop
		case kbd.Enter:
			w.modify()
			w.Write(0, 0)
		case kbd.Help:
			errh.WriteHelp(help[:])
		case kbd.Here:
			s.Inc()
		case kbd.There:
			s.Dec()
		}
		s.Mark(true)
		w.writeNumbers()
	}
	w.terminate()
}
예제 #11
0
파일: imp.go 프로젝트: CaptainSoOmA/Uni
func Edit(d *day.Imp, Z, S uint) {
	//
	globalPage.Set(d)
	globalPage.SetFormat(day.Daily)
	exists := content.Ex(globalPage)
	if exists { // haben wir an diesem Tag Termine
		errh.Hint(errh.ToSelect)
	loop:
		for {
			globalPage = content.Get().(*page.Imp)
			globalPage.Write(Z, S)
			K, _ := kbd.Command()
			switch K {
			case kbd.Enter:
				break loop
			case kbd.Esc:
				errh.DelHint()
				return
			case kbd.Down, kbd.Up:
				content.Step(K == kbd.Down)
			case kbd.Pos1, kbd.End:
				content.Jump(K == kbd.End)
			}
		}
		errh.DelHint()
		globalDay = globalPage.Day().(*day.Imp)
	}
	globalPage.Edit(Z, S)
	if globalPage.Empty() {
		if exists {
			content.Del()
		}
	} else if exists {
		content.Put(globalPage)
	} else {
		content.Ins(globalPage)
	}
}
예제 #12
0
파일: imp.go 프로젝트: CaptainSoOmA/Uni
func Edit() {
	//
	Write()
	errh.Hint("Graph editieren: Hilfe per F1, fertig: Abbruchtaste (Esc)")
	scr.MouseCursor(true)
loop:
	for {
		K, i := kbd.Command()
		//    errh.DelHint()
		switch K {
		case kbd.Esc:
			break loop
		case kbd.Help:
			errh.WriteHelp(help)
		case kbd.Here: // neue Ecke oder Namen vorhandener Ecke ändern:
			if Graph.ExPred(node.UnderMouse) {
				if i > 0 {
					Ecke = Graph.Get().(*node.Imp) // aktuell: Ecke
					Ecke.Edit()
					Graph.Put(Ecke)
				}
			} else {
				Ecke.Clr()
				Ecke.Locate()
				Ecke.Write(true, true)
				Ecke.Edit()
				Graph.Ins(Ecke)
			}
		case kbd.Del: // Ecke entfernen
			if Graph.ExPred(node.UnderMouse) {
				wr(false, false)
				Graph.Del()
			}
		case kbd.There: // Ecke verschieben
			switch i {
			case 0:
				if Graph.ExPred(node.UnderMouse) {
					wr(false, false)
					wr(false, true)
				loop1:
					for {
						geschoben := false
						kk, _ := kbd.Command()
						switch kk {
						case kbd.Push:
							geschoben = true
							wr(false, true)
							Ecke = Graph.Get().(*node.Imp)
							Ecke.Locate()
							Graph.Put(Ecke)
							wr(false, true)
						case kbd.Thither:
							wr(false, true)
							if geschoben {
								Graph.Put(Ecke)
							}
							wr(true, false)
							break loop1
						}
					}
				}
			default: // Ecke entfernen
				if Graph.ExPred(node.UnderMouse) {
					wr(false, false)
					Graph.Del()
				}
			}
		case kbd.This: // Ecken verbinden / Kante entfernen:
			x0, y0 := scr.MousePosGr()
			x, y := x0, y0
			if Graph.ExPred(node.UnderMouse) {
				Ecke = Graph.Get().(*node.Imp) // Ecke aktuell
				Graph.Position(true)           // Ecke auch postaktuell
			loop2:
				for {
					kk, _ := kbd.Command()
					switch kk {
					case kbd.Move:
						scr.LineInv(x0, y0, x, y)
						x, y = scr.MousePosGr()
						scr.LineInv(x0, y0, x, y)
					case kbd.Thus:
						scr.LineInv(x0, y0, x, y)
						if Graph.ExPred(node.UnderMouse) {
							Ecke1 = Graph.Get().(*node.Imp) // Ecke1 aktuell
							g := Graph.Directed()
							if g {
								Kante.Write(Ecke, Ecke1, g, false, false)
							}
							Kante.Edit(Ecke, Ecke1, g)
							Graph.Edge1(Kante)
							if Kante.Val() == 0 {
								Kante.Write(Ecke, Ecke1, g, false, false)
								Graph.Del1()
							}
						}
						break loop2
					}
				}
			}
		case kbd.PrintScr:
			//      img.Write (".tmp.Graph", 0, 0, scr.NX(), scr.NY())
			//      img.Print()
		}
	}
	errh.DelHint()
}
예제 #13
0
파일: imp.go 프로젝트: CaptainSoOmA/Uni
func (f *Imp) Edit() {
	//
	if f.Empty() {
		scr.Colour(f.colour)
		f.x, f.y = make([]int, 1), make([]int, 1)
		f.x[0], f.y[0] = scr.MousePosGr()
		switch f.sort {
		case Pointset, Segments, Polygon, Curve:
			f.editN()
		case InfLine, Rectangle, Circle, Ellipse:
			f.edit1()
		case Text:
			f.editText()
		case Image:
			//      ALLOCATE (Imageptr, Groesse())
			//      img.Get (tx [...], Imageptr)
			f.editImage()
		}
		if f.x == nil {
			f.Clr()
		}
	} else {
		n := uint(len(f.x))
		errh.Error("Figur hat Länge", n)
		switch f.sort {
		case Text:
			f.editText()
		case Image:
			f.editImage()
		default:
			f.Erase()
			f.Invert()
			if true { // f.sort == Curve {
				for i := uint(0); i < n; i++ {
					f.mark(i)
				}
			}
			i := f.uM()
			f.x[i], f.y[i] = scr.MousePosGr()
		loop:
			for {
				scr.MouseCursor(true)
				c, _ := kbd.Command()
				switch c {
				case kbd.Esc:
					break loop
				case kbd.Enter, kbd.Tab, kbd.LookFor:
					f.colour = sel.Colour()
				case kbd.Here:
					break loop
				case kbd.There:
					i = f.uM()
				case kbd.Push, kbd.Thither:
					if i < n {
						f.Invert()
						f.mark(i)
						f.x[i], f.y[i] = scr.MousePosGr()
						f.mark(i)
						f.Invert()
						if c == kbd.Thither {
							i = n
						} // ? ? ?
					}
				case kbd.This:
					switch f.sort {
					case Pointset, Segments, Polygon, Curve:
						if f.x == nil {
							f.Clr()
						} else {
							for i := uint(0); i < n; i++ {
								f.mark(i)
							}
							f.Erase()
							n-- // ? ? ?
							f.Invert()
							for i := uint(0); i < n; i++ {
								f.mark(i)
							}
						}
					}
				}
				errh.Hint(c.String())
			}
			f.Invert()
			if true { // sort != Text {
				for i := uint(0); i < n; i++ {
					f.mark(i)
				}
			}
			f.Write()
		}
	}
}
예제 #14
0
파일: imp.go 프로젝트: CaptainSoOmA/Uni
func (f *Imp) edit1() {
	//
	x0 := make([]int, 2)
	x0[0] = f.x[0]
	f.x = x0
	y0 := make([]int, 2)
	y0[0] = f.y[0]
	f.y = y0
	switch f.sort {
	case InfLine:
		if f.x[0] == 0 {
			f.x[1] = 1
		} else {
			f.x[1] = f.x[0] - 1
		}
		f.y[1] = f.y[0]
	case Rectangle:
		f.x[1] = f.x[0]
		f.y[1] = f.y[0]
	case Circle, Ellipse:
		f.x[1] = 0
		f.y[1] = 0
	default:
		return
	}
	//    scr.PointInv (f.x[0], f.y[0])
	f.invert1()
loop:
	for {
		K, T := kbd.Command()
		switch K {
		case kbd.Pull, kbd.Hither:
			f.invert1()
			f.x[1], f.y[1] = scr.MousePosGr()
			switch f.sort {
			case InfLine:
				if f.x[1] == f.x[0] && f.y[1] == f.y[0] {
					if f.x[0] == 0 {
						f.x[1] = 1
					} else {
						f.x[1] = f.x[0] - 1
					}
				}
			case Rectangle:

			case Circle, Ellipse:
				if f.x[1] > f.x[0] {
					f.x[1] -= f.x[0]
				} else {
					f.x[1] = f.x[0] - f.x[1]
				}
				if f.y[1] > f.y[0] {
					f.y[1] -= f.y[0]
				} else {
					f.y[1] = f.y[0] - f.y[1]
				}
				if f.sort == Circle {
					if f.x[1] > f.y[1] {
						f.y[1] = f.x[1]
					} else {
						f.x[1] = f.y[1]
					}
				}
			default:
				// stop (Modul, 1)
			}
			f.invert1()
			if K == kbd.Hither {
				f.filled = T > 0
				break loop
			}
		}
	}
	switch f.sort {
	case InfLine:
		scr.InfLine(f.x[0], f.y[0], f.x[1], f.y[1])
	case Rectangle:
		if f.filled {
			scr.RectangleFull(f.x[0], f.y[0], f.x[1], f.y[1])
		} else {
			scr.Rectangle(f.x[0], f.y[0], f.x[1], f.y[1])
		}
	case Circle, Ellipse:
		if f.filled {
			scr.EllipseFull(f.x[0], f.y[0], uint(f.x[1]), uint(f.y[1]))
		} else {
			scr.Ellipse(f.x[0], f.y[0], uint(f.x[1]), uint(f.y[1]))
		}
	}
}
예제 #15
0
파일: main.go 프로젝트: CaptainSoOmA/Uni
func main() {
	//
	/*
	   h:= [...]string {
	     "     <              Rücktaste <--                      ",
	     " <<    >>           Pfeiltaste auf-/abwärts            ",
	     "|<<    >>|          Pos1-Taste/Endetaste               ",
	     "    2 .. 12         F2 .. F12-Taste                    ",
	     "   13 .. 24         Umschalt- + F1 .. F12-Taste        ",
	     "               oder Mausklick auf entsprechende Zeile  ",
	     " Zufallsstück       Rollen-Taste                       ",
	     "                                                       ",
	     "  <  1 sek >        Bildtaste auf-/abwärts             ",
	     " << 10 sek >>       Umschalt- + Bildtaste auf-/abwärts ",
	     "<<<  1 min >>>      Alt- + Bildtaste auf-/abwärts      ",
	     "                                                       ",
	     "  Lautstärke        Pfeiltaste Links/Rechts und        ",
	     "                    Umschalt- + Pfeiltaste Links/Rechts",
	     "               oder mit Maus auf entsprechende Anzeige ",
	     "   Balance          Alt- + Pfeiltaste Links/Rechts     ",
	     "               oder mit Maus auf entsprechende Anzeige ",
	     "                                                       ",
	     " Pause/weiter       Pause-Taste                        ",
	     " Ende/CD raus       Abbruch-/Entfernungstaste          " }
	   Help:= make ([]string, len(h))
	   for i:= 0; i < len(h); i++ { str.Set (&Help[i], h[i]) }
	*/
	errh.WriteHeadline(program, version, author, col.LightWhite, col.DarkBlue)
	f := model.Soundfile()
	if f == nil {
		model.Term1()
		errh.Error("kein Zugriff auf CD", 0)
		ker.Terminate()
		return
	}
	view.WriteMask()
	var (
		help, stop bool
	)
	quit := make(chan bool)
	go func() {
		for !stop {
			ker.Sleep(1)
			if !help {
				view.Write()
			}
		}
		quit <- true
	}()
	model.PlayTrack(0)
loop:
	for {
		c, t := kbd.Command()
		help = false
		scr.MouseCursor(true)
		switch c {
		case kbd.Esc:
			if t == 0 {
				model.Term()
			} else {
				model.Term1()
			}
			stop = true
			break loop
		case kbd.Enter:
			if t == 0 {
				model.PlayTrack1(true)
			} else {
				model.PlayTrack(model.NTracks() - 1)
			}
		case kbd.Back:
			switch t {
			case 0:
				model.PlayTrack0()
			case 1:
				model.PlayTrack1(false)
			default:
				model.PlayTrack(0)
			}
		case kbd.Left, kbd.Right:
			switch t {
			case 0:
				model.Ctrl1(model.All, c == kbd.Right)
			case 1:
				_ = uint(model.Volume(model.All))
				for j := 0; j < 8; j++ {
					model.Ctrl1(model.All, c == kbd.Right)
				}
			default:
				model.Ctrl1(model.Balance, c == kbd.Left)
			}
		case kbd.Pos1:
			model.PlayTrack(0)
		case kbd.End:
			model.PlayTrack(model.NTracks() - 1)
		case kbd.Up, kbd.Down:
			switch t {
			case 0, 1:
				model.PlayTrack1(c == kbd.Down)
			case 2:
				model.PosTime1(c == kbd.Down, 1)
			case 3:
				model.PosTime1(c == kbd.Down, 10)
			default:
				model.PosTime1(c == kbd.Down, 60)
			}
		case kbd.Tab:
			model.PlayTrack1(t == 0)
		case kbd.Del:
			model.Term1()
			return
		case kbd.Help, kbd.LookFor, kbd.Act, kbd.Cfg,
			kbd.Mark, kbd.Demark, kbd.Deposit, kbd.Paste,
			kbd.Black, kbd.Red, kbd.Green, kbd.Blue:
			if t == 0 {
				if c == kbd.Help {
					//          help = true
					//          errh.WriteHelp (Help)
				} else {
					model.PlayTrack(uint8(c - kbd.Help))
				}
			} else {
				model.PlayTrack(10 + uint8(c-kbd.Help))
			}
		case kbd.Roll:
			model.PlayTrack(uint8(rand.Natural(uint(model.NTracks()))))
		case kbd.Pause:
			model.Switch()
		case kbd.Here, kbd.Pull:
			var ctrl model.Controller
			if track, b := view.TrackUnderMouse(); b {
				if c == kbd.Here {
					model.PlayTrack(track)
				}
			} else if ls, c := view.ControlUnderMouse(&ctrl); c {
				model.Ctrl(ctrl, uint8(ls))
			} else if b, sek, c := view.TimeUnderMouse(); c {
				model.PosTime(b, sek)
			}
		case kbd.Navigate:
			/*
			   var mov, rot space.Gridcoordinate
			   &mov, &rot = mouse3d.Read()
			   model.Ctrl1 (model.All, mov [space.Top] < 0)
			   model.Ctrl1 (model.All, rot [space.Right] < 0)
			   model.Ctrl1 (model.Balance, rot [space.Front] < 0)
			*/
		}
	}
	<-quit
	_ = f.Close()
	ker.Terminate()
}
예제 #16
0
파일: imp.go 프로젝트: CaptainSoOmA/Uni
func (f *Imp) editN() {
	//
	switch f.sort {
	case Pointset, Segments, Polygon, Curve:
	default:
		return
	}
	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.y[1] = scr.MousePosGr()
	f.invertN()
	var (
		K kbd.Comm
		T uint
	)
loop:
	for {
		K, T = kbd.Command()
		scr.MouseCursor(true)
		n := uint(len(f.x))
		switch K {
		case kbd.Esc:
			break loop
		case kbd.Go,
			kbd.Here, kbd.Pull, kbd.Hither,
			kbd.There, kbd.Push, kbd.Thither,
			kbd.This: // kbd.ToThis:
			f.invertN()
			//      if f.sort == Curve {
			//        if n == scr.MaxBezierdegree { break loop }
			//      }
			if f.sort == Pointset {
				if K != kbd.Go {
					n++
				}
			} else {
				if K == kbd.Here { // TODO Curve: missing
					n++
				}
			}
			if K == kbd.This {
				n := len(f.x)
				if n == 0 {
					break loop
				} else { // TODO
					n--
					if n == 0 {
						break loop
						//          } else {
						//            x0 = make ([]int, n); copy (x0, f.x[:n]); f.x = x0
						//            y0 = make ([]int, n); copy (y0, f.y[:n]); f.y = y0
					}
				}
			}
			if n > uint(len(f.x)) {
				x0 = make([]int, n)
				copy(x0, f.x)
				f.x = x0
				y0 = make([]int, n)
				copy(y0, f.y)
				f.y = y0
			}
			f.x[n-1], f.y[n-1] = scr.MousePosGr()
			f.invertN()
			if f.sort == Pointset {
				if K == kbd.Hither {
					break loop
				}
			} else {
				if K == kbd.Thither {
					break loop
				}
			}
		}
	}
	if f.x == nil {
		f.Clr()
		return
	}
	scr.Colour(f.colour)
	switch f.sort {
	case Pointset:
		scr.Pointset(f.x, f.y)
	case Segments:
		scr.Segments(f.x, f.y)
	case Polygon:
		scr.Polygon(f.x, f.y)
		f.filled = T > 0 && f.convex()
		if f.filled {
			//      scr.PolygonFull (f.x, f.y) // not yet implemented
		}
	case Curve:
		scr.Curve(f.x, f.y)
		f.filled = T > 0
		if f.filled {
			n := len(f.x) - 1
			scr.CircleFull(f.x[n], f.y[n], 4)
		}
	}
}
예제 #17
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)
	}
}