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() }
func (x *Imp) Print(l, c uint) { // s := x.String() c0 := c for i := 0; i < len(s); i++ { prt.Print1(s[i], l, c, x.t) if c+1 < prt.NColumns() { c++ } else if l+2 < prt.NLines() { l++ c = c0 } else { break } } prt.GoPrint() }
func (x *Imp) PageReady() { // prt.GoPrint() }
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 }