Example #1
0
func drawTagMenu(mb *MessageBase, tagged map[*Message]bool, cursor int) {
	w, h := termbox.Size()
	wnd := window.New(4, 2, w-4, h-2)
	wnd.SetFgPen(termbox.ColorWhite)
	wnd.SetBgPen(termbox.ColorBlack)
	wnd.Clear()
	wnd.MoveTo(0, 0)
	wnd.BoxTo(w-8, h-4)

	window.AtPrint(wnd, 1, 1, "X=Cancel   W=OK   Spc=Tag/Untag   J,K=Down,Up")
	for i, m := range mb.msgs {
		fg := termbox.ColorWhite
		bg := termbox.ColorBlack
		checkmark := " "
		if i == cursor {
			fg, bg = bg, fg
		}
		if mb.tagged[m] {
			fg |= termbox.AttrBold
			checkmark = "/"
		}
		wnd.SetFgPen(fg)
		wnd.SetBgPen(bg)
		window.AtPrint(wnd, 1, 3+i, checkmark)
		window.AtPrint(wnd, 3, 3+i, m.Name)
		window.AtPrint(wnd, 13, 3+i, m.Description)
		i++
	}
	termbox.Flush()
}
Example #2
0
func drawListMenu(listTitle, appTitle string, mb *MessageBase) {
	w, h := termbox.Size()
	wnd := window.New(0, 0, w, h)
	wnd.SetFgPen(termbox.ColorWhite)
	wnd.SetBgPen(termbox.ColorBlack)
	wnd.Clear()

	console.PrintMenuTitle(wnd, listTitle, appTitle)
	window.AtPrint(wnd, 2, 2, "C  Create   U  Untag All     E  Edit Tagged")
	window.AtPrint(wnd, 2, 3, "X  Exit     T  Tag/Untag     D  Delete Tagged")

	wnd.MoveTo(2, 4)
	wnd.BoxTo(w-2, h)

	wnd2 := window.New(3, 5, w-3, h-1)
	wnd2.SetFgPen(termbox.ColorWhite)
	wnd2.SetBgPen(termbox.ColorBlack)
	wnd2.Clear()

	for y, m := range mb.msgs {
		checkmark := " "
		fg := termbox.ColorWhite
		if mb.tagged[m] {
			fg |= termbox.AttrBold
			checkmark = "/"
		}
		wnd2.SetFgPen(fg)
		window.AtPrint(wnd2, 0, y, checkmark)
		window.AtPrint(wnd2, 2, y, m.Name)
		window.AtPrint(wnd2, 11, y, m.Description)
		y++
	}

	termbox.Flush()
}
Example #3
0
func drawMainMenu() {
	w, h := termbox.Size()
	wnd := window.New(0, 0, w, h)
	wnd.SetFgPen(termbox.ColorWhite)
	wnd.SetBgPen(termbox.ColorBlack)
	wnd.Clear()

	y := h / 5
	window.AtPrint(wnd, (w/2)-len(kTITLE)/2, y, kTITLE)
	window.AtPrint(wnd, (w/2)-len(kBY)/2, y+1, kBY)
	window.AtPrint(wnd, (w/2)-len(kVERSION)/2, y+2, kVERSION)

	y = h / 2
	window.AtPrint(wnd, 2, y, "S  List / Edit Stimuli")
	window.AtPrint(wnd, 2, y+1, "R  List / Edit Responses")
	window.AtPrint(wnd, 2, y+2, "X  Exit")
	termbox.Flush()
}
Example #4
0
func drawEditMenu(title, appTitle string, m *Message) {
	w, h := termbox.Size()
	wnd := window.New(0, 0, w, h)
	wnd.SetFgPen(termbox.ColorWhite)
	wnd.SetBgPen(termbox.ColorBlack)
	wnd.Clear()

	console.PrintMenuTitle(wnd, title, appTitle)
	window.AtPrint(wnd, 2, 2, "N  Name")
	console.PrintField(wnd, w-10, w-2, m.Name)

	window.AtPrint(wnd, 2, 3, "D  Description ")
	console.PrintField(wnd, w-60, w-2, m.Description)

	window.AtPrint(wnd, 2, 4, "G  Globals (opens editor)")
	window.AtPrint(wnd, 2, 5, "P  Procedure (opens editor)")

	window.AtPrint(wnd, 2, 7, "W  Exit and save changes")
	window.AtPrint(wnd, 2, 8, "X  Exit and discard chanegs")

	termbox.Flush()
}