Ejemplo n.º 1
0
func printMouseEvent(ev *termbox.Event) {
	button := ""
	switch ev.Key {
	case termbox.MouseLeft:
		button = "MouseLeft"
	case termbox.MouseMiddle:
		button = "MouseMiddle"
	case termbox.MouseRight:
		button = "MouseRight"
	}
	cntrMouseEvents++
	tboxc.PriToRect(ReStatusLe, "Mouse event: %d x %d", ev.MouseX, ev.MouseY)
	tboxc.PriToRect(ReStatusRi, "Key: %s, #%v", button, cntrMouseEvents)
}
Ejemplo n.º 2
0
func printKeyPress(ev *termbox.Event) {

	tboxc.PriToRect(ReStatusLe, "Key: %-2v %-4s", ev.Key, tboxc.FuncKeyMap(ev.Key))
	tboxc.PriToRect(ReStatusRi, "Char:    %-2d %2s", ev.Ch, string(ev.Ch))

	modifier := "none"
	if ev.Mod != 0 {
		modifier = "termbox.ModAlt"
	}
	tboxc.PriToRect(ReStatusLeBo, "Mod: %s", modifier)

	im := termbox.SetInputMode(termbox.InputCurrent)
	tboxc.PriToRect(ReStatusRiBo, "InpMode: %v", im)

}
Ejemplo n.º 3
0
func painAppStageData() {

	if currStage < 0 {
		currStage = 0
	}

	idxTBD := 0
	if len(appStageTBDs) > 0 {
		idxTBD = currStage % len(appStageTBDs)
	}

	msg := ""

	if len(appStageTBDs) > 0 {
		if len(appStageTBDs[idxTBD]) > 0 {
			frozenBuf := appStageTBDs[idxTBD]
			currntBuf := termbox.CellBuffer()
			dimX, dimY := termbox.Size()
			_, _ = dimX, dimY
			if x1, x2 := termbox.Size(); x1*x2 != len(currntBuf) {
				panic(spf("should be %v - really is %v", x1*x2, len(currntBuf)))
			}
			msg += spf("taking #%v of %v.", idxTBD, len(appStageTBDs)-1)
			// msg += spf("Dump size %v (%v*%v)", len(currntBuf), dimX, dimY)
			copy(currntBuf, frozenBuf)
			termbox.Flush()
		} else {
			// dump is empty;
			// probably the first element of slice
			tboxc.BlankOut(RectOutp2)
			msg += spf("empty Dump #%v", idxTBD)
		}
	} else {
		msg += "no appStageTBDs"
	}

	// logoutput limps one ahead of termbox dumps.
	// i.e. three dumps - four logs
	// With last TBD, we want last log AND the log since

	logTillTBD := spf("%v\n", appStageLogs[idxTBD+0])
	if strings.HasSuffix(logTillTBD, "\n\n") {
		logTillTBD = logTillTBD[0 : len(logTillTBD)-1]
	}
	logSince := "" // since last TBC
	if idxTBD+1 == len(appStageLogs)-1 {
		logSince = spf("log since TBD:%v\n", appStageLogs[idxTBD+1])
	}
	tboxc.PriToRect(RectOutp1, "AD%v %v\n%v%v", idxTBD, msg, logTillTBD, logSince)

}
Ejemplo n.º 4
0
func printResizeEvent(ev *termbox.Event) {
	tboxc.PriToRect(ReStatusTo, "Resize event: %d x %d", ev.Width, ev.Height)
}