Example #1
0
func trackUnderMouse() (uint8, bool) {
	//
	if scr.UnderMouse(l0, 0, cs+5, uint(cdker.NTracks())) {
		l, _ := scr.MousePos()
		return uint8(l) - l0, true
	}
	return 0, false
}
Example #2
0
func size(c col.Colour) font.Size {
	//
	cF, cH := c, c
	col.Contrast(&cH)
	n := uint(0)
	z, s := scr.MousePos()
	Select1(font.Name, font.NSizes, font.M, &n, z, s, cF, cH)
	if n < font.NSizes {
		return font.Size(n)
	}
	return font.Normal
}
Example #3
0
func (w *Imp) Edit(l, c uint) { // l, c: fake
	//
	s := w.spec[w.line][w.column]
	sa := s
	y, x := scr.MousePos()
	ya, xa := y, x
loop:
	for {
		s.Write(y0+w.line, 2*w.column)
		ya, xa = y, x
		sa = s
		c, _ := kbd.Command()
		y, x = scr.MousePos()
		if y0 <= y && y < ny+y0 && x < 2*nx {
			w.line, w.column = y-y0, x/2
			s = w.spec[w.line][w.column]
		}
		if ya >= y0 {
			sa.Mark(false)
			sa.Write(ya, 2*(xa/2))
		}
		switch c {
		case kbd.Esc:
			break loop
		case kbd.Enter:
			w.modify()
			w.Write(0, 0)
		case kbd.Help:
			errh.WriteHelp(help[:])
		case kbd.Here:
			s.Inc()
		case kbd.There:
			s.Dec()
		}
		s.Mark(true)
		w.writeNumbers()
	}
	w.terminate()
}
Example #4
0
func (x *Imp) changeWithMouse(p Period, vertical bool, a, l, c, l0, c0 uint) {
	//
	if !scr.MouseEx() {
		return
	}
	switch p {
	case Daily, Decadic:
		return
	default:
	}
	lm, cm := scr.MousePos()
	//  if p == Yearly { SM += leftMargin }
	y := x.Clone().(*Imp)
	y.SetBeginning(p)
	A := y.Clone().(*Imp)
	y.SetFormat(Dd_mm_yy)
	n := length[x.fmt]
	var lpos, cpos uint
	for {
		n = length[x.fmt]
		if !y.Equiv(A, p) {
			break
		}
		switch p {
		case Weekly:
			lpos, cpos = y.PosInWeek(vertical, a)
			lpos += l0
			cpos += c0
		case Monthly:
			lpos, cpos = y.PosInMonth(vertical, a, l, c)
			lpos += l0
			cpos += c0
		case Quarterly:
			errh.Error("in "+pack+" not yet implemented", 3)
			return
		case HalfYearly:
			errh.Error("in "+pack+" not yet implemented", 6)
			return
		case Yearly:
			n = 2
			lpos, cpos = y.PosInYear()
		default:
		}
		if lm == lpos && cpos <= cm && cm < cpos+n {
			y.Copy(x)
			break
		} else {
			y.Inc(Daily)
		}
	}
}
Example #5
0
func (f *Imp) Select() {
	//
	f.Clr()
	Acolour := f.colour
	Hcolour := Acolour
	col.Contrast(&Hcolour)
	scr.SwitchFontsize(font.Normal)
	n := uint(Rectangle)
	Z, S := scr.MousePos()
	sel.Select1(name, NSorts, BB, &n, Z, S, Acolour, Hcolour)
	if n < NSorts {
		f.sort = Sort(n)
	}
}
Example #6
0
func Selected(l, c uint) *Imp {
	//
	cF, cH := col.ScreenF, col.ScreenB
	col.Contrast(&cH)
	n := uint(0)
	z, s := scr.MousePos()
	x := new(Imp)
	sel.Select1(name, uint(NAtomtypes), M, &n, z, s, cF, cH)
	if n < uint(NAtomtypes) {
		x.typ = Atomtype(n)
	} else {
		return nil
	}
	switch x.typ {
	case Enumerator:
		e := enum.Title // TODO e per select-menue aussuchen
		x.Object = enum.New(e)
	case TruthValue:
		x.Object = tval.New()
	case Character:
		x.Object = char.New()
	case Text:
		n := uint(10) // TODO n editieren
		x.Object = text.New(n)
	case Natural:
		n := uint(10) // TODO n editieren
		x.Object = bnat.New(n)
	case Real:
		n := uint(6) // TODO n editieren
		x.Object = breal.New(n)
	case Clocktime:
		x.Object = clk.New()
	case Calendarday:
		x.Object = day.New()
	case Euro:
		x.Object = euro.New()
	case Country:
		x.Object = cntry.New()
	case Person:
		x.Object = pers.New()
	case PhoneNumber:
		x.Object = phone.New()
	case Address:
		x.Object = addr.New()
	}
	return New(x)
}