コード例 #1
0
ファイル: imp.go プロジェクト: CaptainSoOmA/Uni
func NodesSelected() bool {
	//
	scr.MouseCursor(true)
	g := false
	for {
		errh.Hint("Start auswählen")
		if ausgewaehlt(Ecke) { // Ecke aktuell
			Graph.Position(true) // Ecke postaktuell
			Write()
			errh.Hint("Ziel auswählen")
			if ausgewaehlt(Ecke1) { // Ecke1 aktuell
				errh.DelHint()
				if Graph.Positioned() {
					errh.Error("Fehler: Start und Ziel sind gleich !", 0)
				} else {
					g = true
					break
				}
			}
		} else {
			break
		}
	}
	Write()
	errh.DelHint()
	scr.MouseCursor(false)
	return g
}
コード例 #2
0
ファイル: imp.go プロジェクト: CaptainSoOmA/Uni
func NodeSelected() bool {
	//
	scr.MouseCursor(true)
	errh.Hint("Ecke auswählen")
	g := false
	if ausgewaehlt(Ecke) { // Ecke aktuell
		Graph.Position(true) // Ecke postaktuell
		g = true
		Write()
	}
	errh.DelHint()
	scr.MouseCursor(false)
	return g
}
コード例 #3
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
}
コード例 #4
0
ファイル: main.go プロジェクト: CaptainSoOmA/Uni
func main() {
	//
	cF, cB := col.Black, col.LightWhite
	col.ScreenF, col.ScreenB = cF, cB
	scr.Switch(scr.TXT)
	/*
	   if scr.Switchable (scr.WXGA) {
	     scr.Switch (scr.WXGA)
	     scr.SwitchFontsize (font.Huge)
	   } else if scr.Switchable (scr.WSVGA) {
	     scr.Switch (scr.WSVGA)
	     scr.SwitchFontsize (font.Big)
	   } else {
	     scr.Cls ()
	   }
	*/
	help = make([]string, 1)
	help[0] = "Bedienungsanleitung siehe Handbuch S. 18 - 23"
	actualDay = day.New()
	actualDay.Actualize()
	period = day.Yearly
	day.WeekdayF, day.WeekdayB = cF, cB
	day.HolidayB = cB
	day.WeekdayNameF, day.WeekdayNameB = col.Magenta, cB
	//  errh.DocAvail = true
	scr.MouseCursor(true)
	for !editiert() {
	}
	cal.Terminate()
	ker.Terminate()
}
コード例 #5
0
ファイル: imp.go プロジェクト: CaptainSoOmA/Uni
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)
}
コード例 #6
0
ファイル: imp.go プロジェクト: CaptainSoOmA/Uni
func (f *Imp) editImage() {
	//
	if f.sort != Image {
		return
	}
	scr.MouseCursor(false)
	errh.Hint("Name des Bildes eingeben")
	bx.Wd(32) // reine Willkür
	Hf := col.ScreenB
	bx.Colours(f.colour, Hf)
	f.tx = str.Clr(BB)
	bx.EditGr(&f.tx, uint(f.x[0]), uint(f.y[0]))
	str.RemSpaces(&f.tx)
	W, H := img.Size(f.tx)
	w, h := int(W), int(H)
	if w <= xx && h <= yy {
		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] + w - 1
		f.y[1] = f.y[0] + h - 1
		if f.x[1] >= xx {
			f.x[0] = xx - w
			f.x[1] = xx - 1
		}
		if f.y[1] >= yy {
			f.y[0] = yy - h
			f.y[1] = yy - 1
		}
		errh.DelHint()
		//  besser:
		//    img.Get ...
		//    NEW (Imagespeicher)
		//    img.Get ( ... dort rein ...)
		//    img.Get (tx, x[0], y[0])
	} else {
		errh.DelHint()
	}
	scr.MouseCursor(true)
}
コード例 #7
0
ファイル: imp.go プロジェクト: CaptainSoOmA/Uni
func init() {
	//
	bMin, lMin := 12.8800, 52.2850 // x, y
	bMax, hMax := 1.0647, 0.4859   // 72, 54 km
	if scr.Proportion() > 4/3 {
		bMax = bMax / 4 * 3 * scr.Proportion()
	}
	b0, l0 := 13.2610, 52.4550
	scale.Def(b0*dB, l0*dL, 16)
	scale.Lim(bMin*dB, lMin*dL, bMax*dB, hMax*dL, 6)
	scr.SwitchTransparence(true)
	scr.MouseCursor(true)
	var bhf Bahnhof = New()
	if bhf == nil {
	}
}
コード例 #8
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
}
コード例 #9
0
ファイル: imp.go プロジェクト: CaptainSoOmA/Uni
func init() {
	//
	scr.Switch(scr.TXT)
	cF, cB = col.LightMagenta, col.Black
	// scr.Colours (cF, cB)
	lengthF, timeF = col.Red, col.LightBlue
	trackTimeF, ctrlF = col.Colour3(191, 191, 255), col.Colour3(63, 111, 255)
	for c := cdker.Controller(0); c < cdker.NCtrl; c++ {
		ctrlText[c] = cdker.Ctrltext[c]
		str.Center(&ctrlText[c], wr)
		lv[c] = l0 + 3*uint(c)
	}
	timeText = [2]string{"tracktime", "total time"}
	str.Center(&timeText[0], wr)
	str.Center(&timeText[1], wr)
	lt = [2]uint{l1 + 2, l1 + 2 + 3}
	bx = box.New()
	bx.Wd(wr)
	bx.Colours(col.HintF, col.HintB)
	bx.Colours(trackTimeF, cB)
	bx.Write(" track", l1, cr+wr-6-2)
	cw, lh := scr.NX1(), scr.NY1()
	bx.Colours(cF, cB)
	bx.Wd(wr)
	for c := cdker.Controller(0); c < cdker.NCtrl; c++ {
		ctrlBar[c] = pbar.New(true)
		ctrlBar[c].Def(cdker.MaxVol)
		ctrlBar[c].SetColours(ctrlF, cB)
		ctrlBar[c].Locate(cr*cw, lv[c]*lh, wr*cw, lh)
		bx.Write(ctrlText[c], lv[c]+1, cr)
	}
	for i := 0; i < 2; i++ {
		timeBar[i] = pbar.New(true)
		timeBar[i].SetColours(ctrlF, cB)
		timeBar[i].Locate(cr*cw, lt[i]*lh, wr*cw, lh)
		bx.Write(timeText[i], lt[i]+1, cr)
	}
	scr.MouseCursor(true)
	scr.WarpMouse(lv[cdker.All]+1, cr+wr/4)
}
コード例 #10
0
ファイル: april.go プロジェクト: CaptainSoOmA/Uni
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()
}
コード例 #11
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()
}
コード例 #12
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()
		}
	}
}
コード例 #13
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()
}
コード例 #14
0
ファイル: main.go プロジェクト: CaptainSoOmA/Uni
func main() {
	//
	h := [...]string{
		// 0         1         2         3         4         5         6         7
		// 012345678901234567890123456789012345678901234567890123456789012345678901234567
		"   Art (Farbe) für neue Figur auswählen: (Umschalt- +) Leer- oder Rolltaste   ",
		//  "                 Schriftgröße auswählen: Alt- + Leer- oder Rolltaste          ",
		"                    neue Figur erzeugen: linke Maustaste,                     ",
		"                                         Streckenzüge, Polygone und Kurven    ",
		"                                         mit rechter Maustaste abschließen,   ",
		"                                         Texteingabe mit Eingabetaste beenden ",
		"                           Figur ändern: Alt- + linke Maustaste, die 'Punkte' ",
		"                                         mit rechter Maustaste verschieben,   ",
		"                                         mit linker Maustaste abschließen     ",
		"                           Figur färben: Umschalt-, Alt- + linke Maustaste    ",
		"             (alle) Figur(en) markieren: (Umschalt- +) F5-Taste oder          ",
		"                                         (Alt- +) mittlere Maustaste          ",
		"          (alle) Figur(en) entmarkieren: (Umschalt- +) F6-Taste oder          ",
		"                                         Umschalt- + (Alt- +) mittl. Maustaste",
		"           markierte Figur(en) kopieren: Umschalt- + linke Maustaste          ",
		"      (markierte) Figur(en) verschieben: (Umschalt- +) rechte Maustaste       ",
		"          (markierte) Figur(en) löschen: (Umschalt- +) Entfernungtaste oder   ",
		"                                         (Umschalt-,) Alt- + rechte Maustaste ",
		"     letzte gelöschte Figur zurückholen: Rücktaste (<-)                       ",
		"          letzte erzeugte Figur löschen: Umschalt- + Rücktaste (<-)           ",
		"letzte gelöschte mark. Fig. zurückholen: Alt- + Rücktaste (<-)                ",
		"Hintergrundfarbe umschalten (auswählen): (Umschalt- +) F4-Taste               ",
		" Figuren aus eBoard holen und markieren: F7-Taste                             ",
		"    markierte Figuren in eBoard ablegen: F8-Taste                             ",
		"                      eBoard ausdrucken: Drucktaste                           ",
		"                           ePen beenden: Abbruchtaste (Esc)                   ",
		"                                                                              ",
		"                  Steuerungstaste (Strg) wirkt wie Umschalttaste              "}
	help := make([]string, len(h))
	for i := 0; i < len(h); i++ {
		str.Set(&help[i], h[i])
	}
	scr.Switch(scr.SXGA)
	actColour = col.ScreenF
	paperColour = col.ScreenB
	//  fo = scr.Normal
	figure = fig2.New()
	newFigure := fig2.New()
	newFigure.SetColour(actColour)
	figures, copiedFigures, image = seq.New(newFigure), seq.New(newFigure), seq.New(newFigure)
	cuttedFigures, depot = seq.New(newFigure), seq.New(newFigure)
	stack = stk.New(newFigure)
	name, filename := names()
	if filename == "" {
		return
	}
	origname := filename
	load(figures, filename)
	//  extract (paperColour)
	write()
	var x0, y0 int // kbd.Push
	var movable bool
	var Schub int
loop:
	for {
		scr.MouseCursor(true)
		//    control(); write()
		c, cmd, d := kbd.Read()
		if cmd == kbd.None {
			switch c {
			case ' ':
				cmd = kbd.Roll
			}
		}
		xm, ym := scr.MousePosGr()
		switch d {
		case 0:
			Schub = 8
		case 1:
			Schub = int(scr.NY() / 40)
		default:
			Schub = int(scr.NX() / 8)
		}
		switch cmd {
		case kbd.Esc:
			break loop
		case kbd.Enter:
			// actualize ?
		case kbd.Back:
			switch d {
			case 0:
				ins(top())
			case 1:
				delLast()
			default:
				getMarked()
			}
		case kbd.Left:
			kick(spc.Right, Schub)
		case kbd.Right:
			Schub = -Schub
			kick(spc.Right, Schub)
		case kbd.Up:
			kick(spc.Top, Schub)
		case kbd.Down:
			Schub = -Schub
			kick(spc.Top, Schub)
		case kbd.Del:
			switch d {
			case 0:
				if deleted(xm, ym) {
					push()
				}
			default:
				delMarked()
			}
		case kbd.Tab:
			// free for use
		case kbd.Help:
			scr.SwitchFontsize(font.Normal)
			errh.WriteHelp(help)
		case kbd.LookFor:
			// wird für die Auswahl des eBoards verwendet - NEIN, sondern:
			load(figures, filename)
			write()
		case kbd.Act:
			//      inject (paperColour)
			store(figures, filename)
		case kbd.Cfg:
			paperColour = sel.Colour()
			bgColour(paperColour)
		case kbd.Mark:
			switch d {
			case 0:
				mark(xm, ym, true)
			case 1:
				markAll(true)
			default:
				showMarked()
			}
		case kbd.Demark:
			switch d {
			case 0:
				mark(xm, ym, false)
			case 1:
				markAll(false)
			default:
				showMarked()
			}
		case kbd.Deposit:
			writeMarked()
		case kbd.Paste:
			readMarked()
		case kbd.PrintScr:
			print(name)
		case kbd.Roll:
			switch d {
			case 0:
				newFigure.Select()
			case 1:
				actColour = sel.Colour()
				newFigure.SetColour(actColour)
			case 2:
				scr.SwitchFontsize(font.Normal)
				//        fo = sel.Size (actColour)
				//        newFigure.SetFont (fo)
			}
		case kbd.Here:
			switch d {
			case 0:
				generate(newFigure)
			case 1:
				copyMarked()
			case 2:
				change(xm, ym)
			case 3:
				setColours(xm, ym, actColour)
			}
		case kbd.There:
			movable = underMouse(uint(xm), uint(ym)) && d <= 1
			x0, y0 = xm, ym // kbd.Push
			switch d {
			case 0:
				if movable {
					cut(xm, ym)
				}
			case 1:
				if movable {
					cutMarked()
				}
			case 2:
				if deleted(xm, ym) {
					push()
				}
			default:
				delMarked()
				write()
			}
		case kbd.Push:
			if movable {
				switch d {
				case 0:
					move(xm-x0, ym-y0)
				case 1:
					moveMarked(xm-x0, ym-y0)
				}
				x0, y0 = scr.MousePosGr()
			}
		case kbd.Thither:
			if movable {
				switch d {
				case 0:
					join()
				case 1:
					joinMarked()
				}
			}
		case kbd.This:
			switch d {
			case 0:
				mark(xm, ym, true)
			case 1:
				mark(xm, ym, false)
			case 2:
				markAll(true)
			case 3:
				markAll(false)
			}
			invMarked()
		case kbd.Thus:
			invMarked()
		}
	}
	markAll(false)
	_, filename = names()
	if filename == "" {
		filename = origname
	}
	//  inject (paperColour)
	store(figures, filename) // -> Terminieren
	ker.Terminate()
}
コード例 #15
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)
	}
}
コード例 #16
0
ファイル: main.go プロジェクト: CaptainSoOmA/Uni
func main() {
	//
	if !scr.MouseEx() {
		return
	}
	var symbol [Nfigure]byte
	symbol[line] = 'S'      // "Strecke"
	symbol[rectangle] = 'R' // "Rechteck"
	symbol[circle] = 'K'    // "Kreis"
	symbol[ellipse] = 'E'   // "Ellipse"
	X, Y := 0, 0
	X1, Y1 := scr.NX(), scr.NY()
	//  Farbe, Papier:= col.LightWhite, col.Black
	Farbe, Papier := col.Black, col.LightWhite
	col.ScreenF, col.ScreenB = Farbe, Papier
	scr.Cls()
	paintColour := Farbe
	scr.Colour(paintColour)
	//  Staerke = 3
	bx := box.New()
	bx.Wd(20)
	bx.Colours(Papier, Farbe)
	Name := env.Par(1)
	if str.Empty(Name) {
		Name = "temp"
	}
	scr.Save(0, 0, 20, 1)
	for {
		bx.Edit(&Name, 0, 0)
		if !str.Empty(Name) {
			str.RemSpaces(&Name)
			break
		}
	}
	scr.Restore(0, 0, 20, 1)
	img.Get(Name, uint(X), uint(Y))
	scr.MouseCursor(true)
	Figur := figure(rectangle)
	var x, y, x0, y0 int
loop:
	for {
		scr.Colour(paintColour)
		Zeichen, Kommando, T := kbd.Read()
		switch Kommando {
		case kbd.None:
			x, y = scr.MousePosGr()
			scr.SwitchTransparence(true)
			scr.Write1Gr(Zeichen, x, y-int(scr.NY1()))
			//    scr.WarpMouse (x + scr.NX1(), y)
		case kbd.Esc:
			break loop
		case kbd.Back:
			switch T {
			case 0:
				x, y = scr.MousePosGr()
				x -= int(scr.NX1())
				scr.Colour(Papier)
				scr.Write1Gr(' ', x, y-int(scr.NY1()))
				//        scr.RectangleFull (x, y - scr.NY1(), x + scr.NX1(), y)
				//        scr.WarpMouseGr (x, y)
				scr.Colour(paintColour)
			default:
				scr.Cls()
			}
			/*
			   case kbd.Ins:
			     img.Write (X, Y, X1, Y1 - 16, Name)
			     box.Edit (Feld, Name, scr.Zeilenzahl () - 1, 0)
			     img.Get (X, Y, Name)
			*/
		case kbd.Help:
			paintColour = sel.Colour()
			//    case kbd.LookFor:
			//      Staerke = Strichstaerken.Staerke()
		case kbd.Enter:
			if T > 0 {
				x0, y0 = scr.MousePosGr()
				//        scr.Fill1 (x0, y0)
			}
		case kbd.PrintScr:
			img.Print(uint(X), uint(Y), X1, Y1-16)
		case kbd.Tab:
			if T == 0 {
				if Figur+1 < Nfigure {
					Figur++
				} else {
					Figur = figure(0)
				}
			} else {
				if Figur > 0 {
					Figur--
				} else {
					Figur = figure(Nfigure - 1)
				}
			}
			scr.Colours(col.White, Papier)
			scr.Write1(symbol[Figur], scr.NY()-1, 0)
		case kbd.Here:
			x0, y0 = scr.MousePosGr()
			scr.CircleFull(x0, y0, 3/2)
		case kbd.Pull:
			x, y = scr.MousePosGr()
			scr.Line(x0, y0, x, y)
			x0, y0 = x, y
		case kbd.Hither:
			x, y = scr.MousePosGr()
			scr.Line(x0, y0, x, y)
		case kbd.There:
			x0, y0 = scr.MousePosGr()
			x, y = x0, y0
		case kbd.Push:
			paint(Figur, inv, x0, y0, x, y)
			x, y = scr.MousePosGr()
			paint(Figur, inv, x0, y0, x, y)
		case kbd.Thither:
			paint(Figur, inv, x0, y0, x, y)
			//      scr.Colour (paintColour)
			x, y = scr.MousePosGr()
			paint(Figur, border, x0, y0, x, y)
			x0, y0 = x, y
		case kbd.This:
			x0, y0 = scr.MousePosGr()
			x, y = x0, y0
		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)
			x, y = scr.MousePosGr()
			scr.Line(x0, y0, x, y)
			x0, y0 = x, y
		}
	}
	scr.Save(0, 0, 20, 1)
	for {
		bx.Edit(&Name, 0, 0)
		// TODO make sure, that "Name" is x{x|y} where x is letter, y is digit
		if !str.Empty(Name) {
			str.RemSpaces(&Name)
			break
		}
	}
	scr.Restore(0, 0, 20, 1)
	img.Put(Name, uint(X), uint(Y), X1, Y1)
	ker.Terminate()
}
コード例 #17
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)
		}
	}
}