Beispiel #1
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()
}
Beispiel #2
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()
}