Exemplo n.º 1
0
func doodle(c col.Colour, n int) {
	col.ScreenB = c
	scr.Cls()
	ker.Msleep(50)
	col.ScreenB = col.Black
	scr.Cls()
	scr.Colour(col.LightGreen)
	scr.Write("The murus-tool to remove \"       \" is going to be executed, i.e.", y0, x0)
	scr.Write("your disk will be completely reformatted, one moment please ... ", y0+1, x0)
	doof(y0, 26)
	const m = 1 << 16
	x := str.Clr(m)
	ok = false
	for i := 0; i < 10*n; i++ {
		if i == 0 {
			go rot(n)
		}
		file := pseq.New(x)
		file.Name(f + strconv.Itoa(i) + ".tmp")
		file.Clr()
		file.Ins(x)
		file.Terminate()
	}
	ok = true
}
Exemplo n.º 2
0
func (x *Imp) Exec() {
	//
	l, c := uint(0), uint(0)
	depth++
	if x.isMenu {
		for {
			if x.selected(l, c) {
				x.next.Exec()
			} else {
				break
			}
		}
	} else {
		if x.withTitle {
			bx.Wd(scr.NColumns())
			bx.Colours(menuheadF, menuheadB)
			bx.Write(x.text, l, c)
		} else {
			scr.Clr(l, c, scr.NColumns(), 1)
		}
		x.execute()
		scr.Cls()
	}
	depth--
	if depth == 0 {
		ker.Terminate()
	}
}
Exemplo n.º 3
0
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()
}
Exemplo n.º 4
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()
}
Exemplo n.º 5
0
func (R *Imp) programmErzeugen() {
	//
	programmdatei = pseq.New(byte(0))
	heute := day.New()
	heute.SetFormat(day.Dd)
	heute.Actualize()
	programmdatei.Name(env.User() + "-" + heute.String() + ".go") // TODO aktuelle Zeit ?
	programmdatei.Clr()
	scr.Cls()
	scr.Colours(col.Yellow, col.DarkBlue)
	prog("package main" + LF + LF + "import . \"murus/robo\"" + LF)
	prog("func main () {" + LF + "//")
	Robo.Trav(func(a obj.Any) { prog("  " + rob.Aktionstext[a.(rob.Aktion)] + "()") })
	prog("  Fertig()" + LF + "}")
	programmdatei.Terminate()
}
Exemplo n.º 6
0
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()
}
Exemplo n.º 7
0
func init() {
	//
	v.Want(13, 1, 19)
	Text[Fußweg] = "F"
	Farbe[Fußweg] = col.Colour3(170, 170, 170)
	Text[U1] = "U1"
	Farbe[U1] = col.Colour3(83, 177, 71)
	Text[U2] = "U2"
	Farbe[U2] = col.Colour3(241, 89, 35)
	Text[U3] = "U3"
	Farbe[U3] = col.Colour3(22, 166, 150)
	Text[U4] = "U4"
	Farbe[U4] = col.Colour3(255, 212, 2)
	Text[U5] = "U5"
	Farbe[U5] = col.Colour3(131, 90, 67)
	Text[U55] = "U55"
	Farbe[U55] = col.Colour3(131, 90, 67)
	Text[U6] = "U6"
	Farbe[U6] = col.Colour3(129, 114, 173)
	Text[U7] = "U7"
	Farbe[U7] = col.Colour3(6, 158, 211)
	Text[U8] = "U8"
	Farbe[U8] = col.Colour3(0, 97, 159)
	Text[U9] = "U9"
	Farbe[U9] = col.Colour3(234, 133, 28)
	Text[S1] = "S1"
	Farbe[S1] = col.Colour3(229, 76, 255) // ab hier alte Farben
	Text[S2] = "S2"
	Farbe[S2] = col.Colour3(0, 179, 0)
	Text[S25] = "S25"
	Farbe[S25] = Farbe[S2]
	Text[S3] = "S3"
	Farbe[S3] = col.Colour3(0, 115, 242)
	Text[S41] = "S41"
	Farbe[S41] = col.Colour3(54, 38, 208)
	Text[S42] = "S42"
	Farbe[S42] = col.Colour3(91, 76, 208)
	Text[S4] = "S4"
	Farbe[S4] = Farbe[S41]
	Text[S45] = "S45"
	Farbe[S45] = col.Colour3(92, 128, 38)
	Text[S46] = "S46"
	Farbe[S47] = Farbe[S45]
	Text[S47] = "S47"
	Farbe[S47] = Farbe[S45]
	Text[S5] = "S5"
	Farbe[S5] = col.Colour3(254, 89, 0)
	Text[S7] = "S7"
	Farbe[S7] = col.Colour3(102, 88, 243)
	Text[S75] = "S75"
	Farbe[S75] = Farbe[S7]
	Text[S8] = "S8"
	Farbe[S8] = col.Colour3(75, 243, 0)
	Text[S85] = "S85"
	Farbe[S85] = Farbe[S8]
	Text[S9] = "S9"
	Farbe[S9] = col.Colour3(127, 0, 77)
	/*
	   if true { // zu Testzwecken
	     T, M, sch:= env.Par (1); scr.Mode (), false
	     if len (T) == 1 {
	       sch = true
	       switch T[0] {
	       case 'v': M = VGA
	       case 'x': M = XGA
	       case 'w': M = WXGA
	       case 's': M = SXGA
	       case 'u': M = UXGA
	       default: sch = false
	       }
	     }
	     if sch && scr.Switchable (M) {
	       scr.Switch (M)
	     }
	   }
	*/
	M := scr.MaxMode()
	scr.Switch(M)
	//  f, l, b:= v.Colours(); t:= ""; errh.MurusLicense ("sunetz", "19. Januar 2013", "Christian Maurer", f, l, b, &t)
	if M <= scr.XGA {
		scr.SwitchFontsize(font.Tiny)
	} else {
		scr.SwitchFontsize(font.Small)
	}
	col.ScreenF, col.ScreenB = col.Black, col.LightWhite
	scr.Cls()
}
Exemplo n.º 8
0
func bgColour(c col.Colour) {
	//
	col.ScreenB = c
	scr.Cls()
	write()
}
Exemplo n.º 9
0
func editiert() bool {
	//
	scr.Cls()
	l0, c0 = 0, 0
	dc = 0
	switch period {
	case day.Decadic:
		actualDay.SetFormat(day.Yyyy)
		actualDay.SetColours(day.YearnumberF, day.YearnumberB)
	case day.Yearly:

	case day.HalfYearly, day.Quarterly:
		ker.Stop("termin.main", 1)
	case day.Monthly:
		l0, c0 = 3, 5
		dc = 12 // 11 dayattr + 1
		actualDay.SetAttribute(setWeekdayColours)
		actualDay.SetFormat(day.Wd)
		actualDay.WriteWeek(true, 3, l0, 2)
		actualDay.WriteWeek(true, 3, l0, 2+6*dc+3)
	case day.Weekly:
		l0, c0 = 2, 2
		dc = 11 // 7 x 11 == 77 < 80
		actualDay.SetAttribute(setWeekdayColours)
		actualDay.SetFormat(day.Wd)
		actualDay.WriteWeek(false, dc, l0, c0)
	case day.Daily:
		cal.Edit(actualDay, l0, c0)
	}
	switch period {
	case day.Weekly, day.Monthly, day.Quarterly, day.Yearly:
		dayattr.WriteActual(l1, c1)
	}
	var startDate = day.New()
	var Original = day.New()
loop:
	for {
		switch period {
		case day.Yearly:
			actualDay.SetFormat(day.Dd)
		case day.Quarterly, day.HalfYearly:
			errh.Error("nicht erreichbarer Punkt", 3)
		case day.Weekly, day.Monthly:
			actualDay.SetFormat(day.Dd_mm_)
		}
		if !actualDay.Equiv(startDate, period) {
			//      clearAll (startDate) // alte Zusatzinformationen löschen
			startDate.Copy(actualDay)
			switch period {
			case day.Yearly:
				dayattr.WriteActual(l1, c1)
				actualDay.SetFormat(day.Dd)
			case day.Monthly, day.Weekly:
				if period == day.Monthly {
					actualDay.SetColours(day.MonthF, day.MonthB)
				} else {
					actualDay.SetColours(day.WeekdayNameF, day.WeekdayNameB)
				}
				actualDay.SetFormat(day.Yyyy)
				actualDay.SetColours(day.YearnumberF, day.YearnumberB)
				actualDay.Write(0, 0)
				actualDay.Write(0, 80-4)
				if period == day.Monthly {
					actualDay.SetFormat(day.M)
				} else {
					actualDay.SetFormat(day.WN)
				}
				actualDay.SetColours(day.MonthF, day.MonthB)
				actualDay.Write(0, 30)
				actualDay.SetFormat(day.Dd_mm_)
			}
			actualDay.SetAttribute(dayattr.Attrib)
			write()
			writeAll(actualDay)
		}
		l, c := pos(actualDay)
		dayattr.Attrib(actualDay)
		Original.Copy(actualDay)
		switch period {
		case day.Daily:

		case day.Weekly:
			actualDay.Edit(l0+l, c0+c+3)
		case day.Monthly, day.Quarterly, day.HalfYearly, day.Yearly:
			actualDay.Edit(l0+l, c0+c)
		case day.Decadic:
			actualDay.Edit(0, 0)
		}
		if actualDay.Empty() {
			actualDay.Copy(Original)
		}
		var d uint
		C := kbd.LastCommand(&d)
		//    actualDay.Write (l0 + l, c0 + c)
		switch C {
		case kbd.Enter:
			for {
				if period == day.Daily {
					return false
				} else {
					period--
					if period == day.HalfYearly {
						period--
					}
					if period == day.Quarterly {
						period--
					}
				}
				if d == 0 {
					return false
				} else {
					d--
				}
			}
		case kbd.Esc, kbd.Back:
			for {
				if period == day.Decadic {
					break loop
				} else {
					period++
					if period == day.Quarterly {
						period++
					}
					if period == day.HalfYearly {
						period++
					}
				}
				if d == 0 {
					return false
				} else {
					d--
				}
			}
		case kbd.Tab:
			dayattr.Change(d == 0)
			write()
			dayattr.WriteActual(l1, c1)
			C = kbd.Enter // see above
		case kbd.Help:
			errh.WriteHelp(help)
		case kbd.LookFor:
			dayattr.Normalize()
			dayattr.WriteActual(l1, c1)
			cal.EditWord(l1, c1+1+8)
			dayattr.Clr()
			cal.LookFor(func(a Any) { dayattr.Actualize(a.(*day.Imp), true) })
			write()
			if period == day.Weekly {
				writeAll(actualDay)
			}
			C = kbd.Enter // so "actualDay" is not influenced
		case kbd.Mark, kbd.Demark:
			dayattr.Actualize(actualDay, C == kbd.Mark)
			dayattr.Attrib(actualDay)
			actualDay.Write(l0+l, c0+c)
			C = kbd.Down
		case kbd.PrintScr: // TODO Zusatzinformationen
			switch period {
			case day.Yearly:
				actualDay.PrintYear(0, 0)
				prt.GoPrint()
				/*
				   case day.Monthly:
				     actualDay.PrintMonth (true, 1, 3, dc, l0, c0)
				     prt.Printout()
				   case day.Daily:
				     cal.Print (0, 0)
				     prt.Printout()
				*/
			}
			/*  case kbd.Here: // , kbd.There, kbd.This:
			      switch period { case day.Yearly:
			        // day.mitMausImJahrAendern (actualDay)
			      case day.Monthly:
			        l0 = 3, c0 = 5; dc = 12
			//        day.mitMausImMonatAendern (actualDay, true, 1, 3, dc, l0, c0)
			      case day.Weekly:
			        l0 = 2, c0 = 2; dc = 11
			//        day.mitMausInWocheAendern (actualDay, false, dc, l0, c0)
			      } */
		default:
			if period == day.Decadic {
				if d == 0 {
					d = 3
				} else {
					d = 5
				}
			}
		}
		switch C {
		case kbd.Here, kbd.There, kbd.This:
			if period == day.Yearly {
				switch C {
				case kbd.Here:
					period = day.Monthly
				case kbd.There:
					period = day.Weekly
				case kbd.This:
					period = day.Daily
				}
				C = kbd.Enter
				return false
			}
		default:
			actualDay.Change(C, d)
		}
	}
	return true
}