func (x *Imp) printYearMask(l, c uint) { // const X = 80 y := x.Clone().(*Imp) y.fmt = Yyyy y.font = font.Bold y.Print(l, c) y.Print(l, X-4) pbx.Print(str.Clr(X-4-c), l, c+4) pbx.Print(str.Clr(X-c), l+8, c) pbx.Print(str.Clr(X-c), l+16, c) y.fmt = M y.font = font.Italic var l1, c1 uint for m := uint(1); m <= maxmonth; m++ { y.month = m l1, c1 = 0, leftMargin y.shift(&l1, &c1) y.Print(l+l1, c+c1+3) } y.fmt = Wd c2 := leftMargin + monthsHorizontally*6*3 // 6 Spalten pro Monat tt-Format + 1 Zwischenraum pbx.SetFont(font.Italic) for m := uint(1); m <= maxmonth; m += monthsHorizontally { for w := Monday; w <= Sunday; w++ { for i := uint(0); i <= 2; i++ { l1 = 1 + 8*i + uint(w) pbx.Print(WdShorttext[w], l+l1, c+1) pbx.Print(WdShorttext[w], l+l1, c+c2) } } } }
func (x *Imp) Clr() { // x.cnt = keineAngabe x.att.iso = " " x.att.tld = " " switch x.fmt { case Tld: x.att.name = str.Clr(2) case Long: x.att.name = str.Clr(length) } x.att.prefix = 0 x.att.kfz = " " x.att.ioc = " " }
func writeHelp1() { // pre() s := "kurze Bedienungshinweise: F1-Taste" w := uint(len(s)) // mouseOn:= MouseCursorOn () var l, c uint if false { // mouseOn { l, c = MousePos() if l >= NLines()-2 { l = NLines() - 3 } if c > NColumns()-w { c = NColumns() - w } MouseCursor(false) } else { l = (NLines() - 3) / 2 c = (NColumns() - w - 4) / 2 } hintbox.Wd(w + 4) t := str.Clr(w + 4) Save(l, c, w+4, 3) for i := uint(0); i <= 2; i++ { hintbox.Write(t, l+i, c) } hintbox.Wd(w) hintbox.Write(s, l+1, c+2) wait() Restore(l, c, w+4, 3) // if mouseOn { MouseCursor (true) } post() }
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 }
func (x *Imp) String() string { // if x.Empty() { return str.Clr(length) } return nat.StringFmt(x.cent/hundred, nDigits, false) + "," + nat.StringFmt(x.cent%hundred, 2, true) }
func (x *Imp) String() string { // n := uint(x.n) if n == x.invalid { return str.Clr(x.wd) } return nat.StringFmt(n, x.wd, x.zero) }
func (x *Imp) Decode(b []byte) { // if uint(len(b)) == x.length { x.content = string(b) // str.Lat1 (&x.content) } else { x.content = str.Clr(x.length) } }
func names(mask, suffix string, n uint, l, c uint, f, b col.Colour) (string, string) { // t, t1 := uint(len(mask)), uint(0) if t > 0 { t1 = 1 + t } scr.Save(l, c, t1+n, 1) if t > 0 { mbx.Wd(t) mbx.ColoursScreen() mbx.Write(mask, l, c) } bx.Wd(n) bx.Colours(f, b) ptSuffix = "." + suffix errh.Hint("falls Dateien vorhanden, auswählen F2-, dann Pfeil-/Eingabetaste, ggf. Esc") name := env.Par(1) if name == "" { name = str.Clr(n) // Wörkeraunt um Fehler in box/imp.go } var p uint if str.Contains(name, '.', &p) { name = str.Part(name, 0, p) } bx.Edit(&name, l, c+t1) str.RemSpaces(&name) if str.Contains(name, '.', &p) { name = str.Part(name, 0, p) } filename := name + ptSuffix a := files.NumPred(hasSuffix) if a > 0 { var d uint switch kbd.LastCommand(&d) { case kbd.Esc: return "", "" // str.Clr (n), "" case kbd.Enter: // entered case kbd.LookFor: i := uint(0) select_(aus, a, a, n, &i, l, c+t1, b, f) if i == a { return "", "" // str.Clr (n), "" } else { str.Set(&filename, files.NamePred(hasSuffix, i)) } } } errh.DelHint() str.RemSpaces(&filename) if str.Contains(filename, '.', &p) { name = str.Part(filename, 0, p) } scr.Restore(l, c, t1+n, 1) return name, filename }
func (x *Imp) writeYearmask(l, c uint) { // const X = 80 // scr.Clr (l, S, X, 25 - 1) // y.day = 1 // y.year = x.year y := x.Clone().(*Imp) y.fmt = Yyyy y.SetColours(YearnumberF, YearnumberB) y.Write(l, c) y.Write(l, c+80-4) bx.Colours(MonthF, MonthB) bx.Wd(X - 4 /* - c */) T1 := str.Clr(X - 4 /* - c */) bx.Write(T1, l, c+4) bx.Wd(X /* - c */) T1 = str.Clr(X /* - c */) bx.Write(T1, l+8, c) bx.Write(T1, l+16, c) y.fmt = M var l1, c1 uint for m := uint(1); m <= maxmonth; m++ { y.month = m l1, c1 = 0, leftMargin y.shift(&l1, &c1) y.SetColours(MonthF, MonthB) y.Write(l+l1, c+c1+3) } bx.Colours(WeekdayNameF, WeekdayNameB) y.fmt = Wd c2 := leftMargin + monthsHorizontally*6*3 // 6 Spalten pro Monat tt-Format + 1 Zwischenraum bx.Wd(2) // len (WdShorttext) for m := uint(1); m <= maxmonth; m += monthsHorizontally { for w := Monday; w <= Sunday; w++ { for i := uint(0); i <= 2; i++ { l1 = 1 + 8*i + uint(w) bx.Write(WdShorttext[w], l+l1, c+1) bx.Write(WdShorttext[w], l+l1, c+c2) } } } }
func writeLicense(project, version, author string, f, cl, b col.Colour, g []string, Text *string) { // pre() post() w, h := uint(len(g[0])), uint(25) /* == len (license), see func init */ +6 l, c := (NLines()-h)/2, (NColumns()-w)/2 // l0, c0:= l, c // scr.Save (l, c, width, height) licenseBox.Wd(w) licenseBox.Colours(cl, b) emptyLine := str.Clr(w) licenseBox.Write(emptyLine, l, c) l++ var s string str.Set(&s, project+" v. "+version) str.Center(&s, w) licenseBox.Write(s, l, c) l++ licenseBox.Write(emptyLine, l, c) l++ str.Set(&s, "(c) "+author) str.Center(&s, w) licenseBox.Colours(f, b) licenseBox.Write(s, l, c) l++ // l, c = 30, 52 licenseBox.Colours(cl, b) licenseBox.Write(emptyLine, l, c) l++ for i := 0; i < len(g); i++ { licenseBox.Write(g[i], l, c) l++ } licenseBox.Write(emptyLine, l, c) l++ licenseBox.Colours(f, b) /* var line string if DocExists { str.Set (&line, "ausführliche Bedienungshinweise: siehe Dokumentation") } else { line = env.Parameter (0) if line == "murus" { line = str.Clr (w) } else { str.Set (&line, "kurze Bedienungshinweise: F1-Taste") } } if ! str.Empty (line) { str.Center (&line, w) } licenseBox.Write (line, l, c); l ++ licenseBox.Write (emptyLine, l, c) */ // kbd.Wait (true) // scr.Restore (l0, c0, w, height) }
func (x *Imp) String() string { // if x.r == x.invalid { return str.Clr(x.wd) } s := real.String(x.r) str.Move(&s, true) str.RemSpaces(&s) str.Norm(&s, x.wd) str.Move(&s, false) return s }
func New(n uint) *Imp { // if n == 0 { return nil } x := new(Imp) x.length = n x.content = str.Clr(n) x.cF, x.cB = col.ScreenF, col.ScreenB x.font = font.Normal return x }
func (x *Imp) Edit() { // if x.length > 0 { B := (x.length * scr.NX1()) / 2 H := scr.NY1() / 2 bx.Wd(x.length) bx.ColourF(Farbe[0]) bx.EditGr(&x.name, x.x-B+1, x.y-H+1) N := str.Clr(x.length) bx.WriteGr(N, int(x.x-B+1), int(x.y-H+1)) } x.write() }
func New() *Imp { // w := new(Imp) w.name = str.Clr(lenName) w.name = "welt" for y := uint(0); y < ny; y++ { for x := uint(0); x < nx; x++ { w.spec[y][x] = species.New() } } w.line, w.column = ny/2, nx/2 return w }
func (x *Imp) SetFormat(f, t string) { // x.rep[falseVal] = f x.length = str.ProperLen(x.rep[falseVal]) if x.length == 0 { x.rep = [nValues]string{" ", "n", "j"} return } x.rep[trueVal] = t n := str.ProperLen(x.rep[falseVal]) if n > x.length { x.length = n } x.rep[undecidable] = str.Clr(x.length) }
func (W *Welt) Ausgeben() { // l := str.Clr(scr.NColumns()) scr.Colours(farbeV, farbeH) scr.Write(l, 0, 0) // kollidiert mit geplanter Ausgabe des Weltnamens scr.Write(l, 1, 0) scr.Write(l, scr.NLines()-2, 0) // scr.Write (l, scr.NLines() - 3, 0) for y := null; y < nY; y++ { for x := null; x < nX; x++ { platzAusgeben(y, x) } } W.schatten.ausgeben() }
func (x *Imp) String() string { // if x.Empty() { return str.Clr(textlength[x.fmt]) } s := "" if x.fmt <= Hh_mm_ss { // Hh_mm s = nat.StringFmt(x.hour, 2, true) + "." } s += nat.StringFmt(x.minute, 2, true) if x.fmt >= Hh_mm_ss { s += ":" + nat.StringFmt(x.second, 2, true) } return s }
func defined() (string, bool) { // bx := box.New() bx.Wd(6) bx.Colours(col.LightCyan, col.Black) bx.Write("Welt:", 1, 0) const n = 12 bx.Wd(n) name := str.Clr(n) name = "" errh.Hint("Namen der Welt eingeben Programmende: leere Eingabe") bx.Edit(&name, 1, 6) str.RemSpaces(&name) errh.DelHint() return name, !str.Empty(name) }
func writeHelp(H []string) { // pre() h := uint(len(H)) var w, l, c uint for i := uint(0); i < h; i++ { c = uint(len(H[i])) if c > w { w = c } } if h+2 > NLines() { h = NLines() - 2 } if w+4 > NColumns() { w = NColumns() - 4 } mouseOn := MouseCursorOn() if false { // mouseOn { l, c = MousePos() if l >= NLines()-h-1 { l = NLines() - h - 2 } if c > NColumns()-w-4 { c = NColumns() - w - 4 } MouseCursor(false) } else { l, c = (NLines()-h-2)/2, (NColumns()-w-4)/2 } Save(l, c, w+4, h+2) hintbox.Wd(w + 4) T := str.Clr(w + 4) for i := uint(0); i <= h+1; i++ { hintbox.Write(T, l+i, c) } hintbox.Wd(w) for i := uint(0); i < h; i++ { hintbox.Write(H[i], l+1+i, c+2) } wait() Restore(l, c, w+4, h+2) if mouseOn { MouseCursor(true) } post() }
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) }
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) }
func init() { // txt[undef] = " " txt[priv] = ".priv" txt[Erl] = ">Erl." txt[Tel] = "#Tel." txt[Brf] = "/Brf." txt[Fin] = "$Fin." txt[Ren] = "^Ren." txt[Hob] = "&Hob." txt[Prog] = ";Prog" txt[Uni] = "!Uni " txt[Arzt] = "@Arzt" txt[Geb] = "*Geb." Hilfetext = str.Clr(2) for a := priv; a < NAttrs; a++ { Hilfetext += txt[a] + " " } setbx.Wd(uint(NAttrs)) setbx.Colours(cF, cB) var _ Attribute = New() }
func (x *Imp) Decode(b []byte) { // TODO cF, cB // i, a := uint(0), uint(4) x.num = Decode(uint(0), b[i:i+a]).(uint) i += a x.mask = make([]string, x.num) for k := uint(0); k < x.num; k++ { a = uint(4) n := Decode(uint(0), b[i:i+a]).(uint) i += a a = n x.mask[i] = Decode(str.Clr(n), b[i:i+a]).(string) i += a a = uint(4) n = Decode(uint(0), b[i:i+a]).(uint) x.l[i], x.c[i] = n%256, n/256 i += a a = col.Codelen() x.cF = Decode(col.Black, b[i:i+a]).(col.Colour) i += a x.cB = Decode(col.Black, b[i:i+a]).(col.Colour) i += a } }
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() }
func (x *Imp) String() string { // if x.year == emptyYear { return str.Clr(length[x.fmt]) } const mitNullen = true s := "" switch x.fmt { case Dd, Dd_mm_, Dd_mm_yy, Dd_mm_yyyy, Dd_M, Dd_M_yyyy: if x.day == 0 { Panic("day.String: x.day == 0") } s = nat.StringFmt(x.day, 2, mitNullen) if x.fmt == Dd { return s } s += "." switch x.fmt { case Dd_M, Dd_M_yyyy: s += " " + nameMonth[x.month] str.RemSpaces(&s) if x.fmt == Dd_M { return s } s += " " default: s += nat.StringFmt(x.month, 2, mitNullen) + "." } switch x.fmt { case Dd_mm_: case Dd_mm_yy: s += nat.StringFmt(x.year, 2, true) default: // Dd_mm_yyyy, Dd_M_yyyy: s += nat.StringFmt(x.year, 4, false) } case Yymmdd: s = nat.StringFmt(x.year%100, 2, true) + nat.StringFmt(x.month, 2, true) + nat.StringFmt(x.day, 2, true) case Yyyymmdd: s = nat.StringFmt(x.year, 4, true) + nat.StringFmt(x.month, 2, true) + nat.StringFmt(x.day, 2, true) case Yy: s = nat.StringFmt(x.year, 2, true) case Yyyy: s = nat.StringFmt(x.year, 4, false) case Wd: s = WdShorttext[x.Weekday(Daily)] case WD: s = WdText[x.Weekday(Daily)] case Mmm, M: s = nameMonth[x.month] if x.fmt == Mmm { s = str.Part(s, 0, 3) } case Myyyy: s = nameMonth[x.month] + " " + nat.StringFmt(x.year, 4, false) case Wn, WN, WNyyyy: s = nat.StringFmt(x.Weeknumber(), 2, false) if x.fmt > Wn { s += ".Woche" } if x.fmt == WNyyyy { s += " " + nat.StringFmt(x.year, 4, false) } case Qu: switch (x.month - 1) / 3 { case 0: s = " I" case 1: s = " II" case 2: s = "III" case 3: s = " IV" } s += "/" + nat.StringFmt(x.year, 2, true) } return s }
func (x *Imp) Clr() { // x.content = str.Clr(x.length) }
func (x *Imp) Clr() { // x.text = str.Clr(length) x.marked = false }