func (x *Imp) Edit(l, c uint) { // x.Write(l, c) i := 0 var d uint if kbd.LastCommand(&d) == kbd.Up { i = 4 } loop: for { switch i { case 0: x.street.Edit(l, c+cst) case 1: x.postcode.Edit(l+1, c+cpc) case 2: x.city.Edit(l+1, c+cci) case 3: x.phonenumber.Edit(l, c+cph) case 4: x.cellnumber.Edit(l+1, c+cph) } switch kbd.LastCommand(&d) { case kbd.Esc: break loop case kbd.Enter: if d == 0 { if i < 4 { i++ } else { break loop } } else { break loop } case kbd.Down, kbd.Right: if i < 4 { i++ } else { break loop } case kbd.Up, kbd.Left: if i > 0 { i-- } else { break loop } } } }
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 (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 (x *Imp) Edit(Z, S uint) { // bx.Colours(x.cF, x.cB) var l uint for { switch x.fmt { case Tld: l = 2 bx.Edit(&x.att.tld, Z, S) case Long: l = length bx.Edit(&x.att.name, Z, S) default: return } var T uint if kbd.LastCommand(&T) == kbd.LookFor { n := uint(x.cnt) sel.Select(func(P, Z, S uint, V, H col.Colour) { x.att = Folge[country(P)]; x.SetColours(V, H); x.Write(Z, S) }, noNations, scr.NLines(), l, &n, Z, S, x.cB, x.cF) if country(n) == noNations { n = uint(x.cnt) // Nation unverändert } else { x.cnt = country(n) } x.att = Folge[x.cnt] break } else { var ok bool switch x.fmt { case Tld: ok = x.Defined(x.att.tld) case Long: ok = x.Defined(x.att.name) } if ok { break } else { errh.Error("kein Land", 0) } } } x.Write(Z, S) }
func (x *Imp) Edit(l, c uint) { // x.Write(l, c) s := x.String() for { bx.Edit(&s, l, c) var d uint cmd := kbd.LastCommand(&d) if cmd == kbd.LookFor { if x.selected(l, c) { break } } if x.Defined(s) { break } else { errh.Error("geht nicht", 0) } } x.Write(l, c) }
func (x *Imp) Edit(l, c uint) { // x.Write(l, c) i := uint(0) loop: for { x.comp[i].Edit(l+x.l[i], c+x.c[i]) var d uint switch kbd.LastCommand(&d) { case kbd.Esc: break loop case kbd.Enter: if d == 0 { if i+1 < x.num { i++ } else { break loop } } else { break loop } case kbd.Down: if i+1 < x.num { i++ } else { i = 0 } case kbd.Up: if i > 0 { i-- } else { i = x.num - 1 } case kbd.Pos1: i = 0 case kbd.End: i = x.num - 1 } } }
func (x *Imp) Edit(Z, S uint) { // x.Write(Z, S) if x.fmt == VeryShort { return } var i, d uint if kbd.LastCommand(&d) == kbd.Up { i = 4 } else { i = 0 } loop: for { switch i { case 0: x.surname.Edit(Z, S+Sna) case 1: x.firstName.Edit(Z, S+Svn) case 2: switch x.fmt { case Short, ShortB: default: x.fm.Edit(Z, S+Smw) } case 3: switch x.fmt { case ShortB, LongB, LongTB: x.bd.Edit(Z, S+Sgb) } case 4: switch x.fmt { case LongT, LongTB: x.ti.Edit(Z+1, S+San) } } switch kbd.LastCommand(&d) { case kbd.Esc: break loop case kbd.Enter: if d == 0 { if i < 4 { i++ } else { break loop } } else { break loop } case kbd.Down, kbd.Right: if i < 4 { i++ } else { break loop } case kbd.Up, kbd.Left: if i > 0 { i-- } else { break loop } case kbd.LookFor: break loop } } }
func (x *Imp) Edit(l, c uint) { // const nKomponenten = 8 x.Write(l, c) i := 1 loop: for { switch i { case 1: x.person.Edit(l, c) case 2: if x.format == Long { x.placeOfBirth.Edit(l+lPb, c+cPb) } case 3: if x.format == Long { x.nationality.Edit(l+lNa, c+cNa) } case 4: if x.format == Long { x.address.Edit(l+lAd, c+cAd) // if ! x.person.FullAged () { // x.address.Copy (x.addressLG) // } } case 5: if x.format == Long { if x.person.FullAged() { // x.legalGuardian.Clr () } else { x.legalGuardian.Edit(l+lLg, c+cLg) } } case 6: if x.format == Long { if x.person.FullAged() { // x.legalGuardian.Clr () } else { x.addressLG.Edit(l+lAg, c+cAg) } } case 7: if x.format != Minimal && x.format != VeryShort { x.langSeq.Edit(l+lLs, c+cLs) } case nKomponenten: if x.format == Long { x.religion.Edit(l+lRe, c+cRe) } } var d uint switch kbd.LastCommand(&d) { case kbd.Enter: if d == 0 /* aufpassen bei i == 0 ! */ { if i < nKomponenten { i++ } else { break loop } } else { break loop } case kbd.Esc: break loop case kbd.Down: if i < nKomponenten { i++ } else { break loop } case kbd.Up: if i > 1 { i-- } } // if ! x.person.Identifiable () { // errh.Error ("Name, Vorname, Geb.-Datum ?", 0) // } } }
func (x *Imp) Edit(z, s uint) { // x.Write(z, s) i := 0 loop: for { switch i { case 0: x.c.Edit(z, s) case 1: x.a.Edit(z, s+as) case 2: switch actFmt { case Lang: x.w.Edit(z, s+ws) default: // x.w.Edit (z + 1, s) } case 3: if actFmt == Lang { x.t.Edit(z, s+ts) } } var e uint c := kbd.LastCommand(&e) switch c { case kbd.Help: case kbd.Enter: // kbd.Here: if e == 0 { if i < 3 { i++ } else { break loop } } else { break loop } case kbd.Esc: // , kbd.There: break loop case kbd.Pos1, kbd.End: break loop case kbd.Down, kbd.Right: if e > 0 { break loop } if i < 3 { i++ } else { break loop } case kbd.Up, kbd.Left: if e > 0 { break loop } if i > 0 { i-- } else { break loop } case kbd.Del: if e == 0 { x.Clr() x.Write(z, s) } else { break loop } case kbd.Mark, kbd.Demark: x.Mark(c == kbd.Mark) x.Write(z, s) break loop /* case kbd.Deposit: break loop case kbd.Paste: break loop case kbd.Mark: break loop case kbd.LookFor: break loop */ default: break loop } } }
func edit() { // var d uint c := kbd.LastCommand(&d) if d > 2 { d = 2 } switch c { case kbd.Back: if width < maxWidth { w := width * mm[d] if w > maxWidth { w = maxWidth } dw := (w - width) / 2 x0, y0 = x0-dw, y0-dw/scr.Proportion() width = w } else { // überschritten x0, y0 = xMin, yMin width = maxWidth } height = width / scr.Proportion() mX, mY = nX/width, nY/height case kbd.Enter: if width > maxWidth/maxMag { w := width / mm[d] if w < maxWidth/maxMag { w = maxWidth / maxMag } dw := (w - width) / 2 x0, y0 = x0-dw, y0-dw/scr.Proportion() width = w height = width / scr.Proportion() mX, mY = nX/width, nY/height } case kbd.Left: if x0 >= xMin { x0 = x0 - width/nn[d] } case kbd.Right: if x0+width <= xMin+maxWidth { x0 = x0 + width/nn[d] } // TODO: Rollrad von Maus einbauen - die sendet Up/Down case kbd.Up: if y0+height < yMin+maxHeight { y0 = y0 + width/nn[d] } case kbd.Down: if y0 >= yMin { y0 = y0 - width/nn[d] } case kbd.This: x, y := scr.MousePosGr() y = int(scr.NY()) - y x0 = x0 + float64(x)/mX - width/2 y0 = y0 + float64(y)/mY - height/2 case kbd.There: x, y := scr.MousePosGr() xt, yt = float64(x), float64(int(scr.NY())-y) case kbd.Push, kbd.Thither: x, y := scr.MousePosGr() x0 = x0 - (float64(x)-xt)/mX y0 = y0 - (float64(int(scr.NY())-y)-yt)/mY xt, yt = float64(x), float64(int(scr.NY())-y) } if x0 < xMin { x0 = xMin } if x0+width > xMin+maxWidth { x0 = xMin + maxWidth - width } if y0 < yMin { y0 = yMin } if y0+height >= yMin+maxHeight { y0 = yMin + maxHeight - height } }
func (x *Imp) Edit(Z, S uint) { // if aktuellesFormat != day.Daily { return } index := x.count() if index == nTermine { index-- } loop: for { x.Write(Z, S) /* pp:= x.Count () if pp > 0 { if pp == x.Pos () { Pos = pp x.Seek (pp - 1) t:= x.Get ().(*termin.Imp) x.Seek (Pos) if t.Empty () { x.Jump (false) } } } */ /* j:= x.anzahl if j < i { globalerTermin = x.Get ().(*termin.Imp) globalerTermin.Mark (markierteTermine.Contains (globalerTermin)) } else { globalerTermin.Clr () } */ x.termin[index].Edit(Z+dz*index, S) var e uint switch kbd.LastCommand(&e) { case kbd.Enter: switch e { case 0, 1: if index+1 < nTermine-1 { index++ } else { break loop } default: break loop } case kbd.Esc: break loop case kbd.Up: if index > 0 { index-- } case kbd.Down: if index+1 < nTermine-1 { index++ } case kbd.Pos1: index = 0 case kbd.End: index = nTermine - 1 for x.termin[index].Empty() && index > 0 { index-- } case kbd.Mark: if e == 0 { if !markierteTermine.Ex(x.termin[index]) { markierteTermine.Ins(x.termin[index]) } if index+1 < nTermine-1 { index++ } } else { for i := uint(0); i < nTermine; i++ { if !x.termin[i].Empty() { if markierteTermine.Num()+1 < nTermine { markierteTermine.Ins(x.termin[i]) } else { // TODO } } } } case kbd.Demark: if e == 0 { if markierteTermine.Ex(x.termin[index]) { markierteTermine.Del() } if index+1 < nTermine-1 { index++ } } else { markierteTermine.Clr() } case kbd.Deposit: if e == 0 { Papierkorb.Push(x.termin[index]) x.termin[index].Clr() x.sort() x.Write(Z, S) } else { // TODO alle Termine in Papierkorb ? } /* Papierkorb.Clr () // Papierkorb.Cut (func (a Any) bool { globalerTermin = a.(*termin.Imp); // return markierteTermine.Contains (globalerTermin) }) markierteTermine, Papierkorb = Papierkorb, markierteTermine // die sind jetzt leer */ case kbd.Paste: if e == 0 { if x.count()+1 < nTermine && !Papierkorb.Empty() { x.termin[x.count()] = Papierkorb.Top().(*termin.Imp) Papierkorb.Pop() } x.sort() x.Write(Z, S) } else { // TODO oberste Termine aus Papierkorb zurück, soweit < nTermine ? } } } x.sort() }
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 }