#---------------------------------------------------------------
# (1) The menu bar
#---------------------------------------------------------------

frame .menu -relief raised -bd 2
pack .menu -side top -fill x

menubutton .menu.file -text "File" -underline 0 \
	-menu .menu.file.menu
menubutton .menu.options -text "Options" -underline 0 \
	-menu .menu.options.menu
menubutton .menu.help -text "Help" -underline 0 \
	-menu .menu.help.menu

pack .menu.file .menu.options -side left -ipady 2 -ipadx 10
pack .menu.help -side right -ipady 2 -ipadx 10

#---------------------------------------------------------------
# The file menu
#---------------------------------------------------------------
menu .menu.file.menu -tearoff 0
.menu.file.menu add command -label "Reload initial screen" \
	-underline 7 -command {reload}
.menu.file.menu add command -label "Load file..." \
	-underline 0 -command {filepopup}
.menu.file.menu add command -label "Reinitialize stats" \
	-underline 0 -command {reinit}
.menu.file.menu add command -label "Quit program" \
	-underline 0 -command {exit}

#---------------------------------------------------------------
# The options menu
#---------------------------------------------------------------
menu .menu.options.menu -tearoff 0
.menu.options.menu add cascade -label "Filter" \
	-underline 0 -menu .menu.options.menu.filter
.menu.options.menu add checkbutton -label "Show keytop" \
	-underline 0 -variable showkeytop \
	-onvalue "Show keytop symbols" -offvalue "Don't show keytop symbols"
.menu.options.menu add checkbutton -label "Show next key" \
	-underline 5 -variable shownextkey \
	-onvalue "Show next key" -offvalue "Don't show next key"
.menu.options.menu add checkbutton -label "Case insensitive" \
	-underline 0 -variable ignorecases \
	-onvalue "Case insensitive" -offvalue "Case sensitive"
.menu.options.menu add cascade -label "Keyboard" \
	-underline 0 -menu .menu.options.menu.keyboard

#---------------------------------------------------------------
# The help menu
#---------------------------------------------------------------
menu .menu.help.menu -tearoff 0
.menu.help.menu add command -label "About" -underline 0 -command {about}
.menu.help.menu add command -label "Help" -underline 0 -command {help}

#---------------------------------------------------------------
# The filter menu
#---------------------------------------------------------------
menu .menu.options.menu.filter -tearoff 0
.menu.options.menu.filter add command -label "Filter..." \
	-underline 0 -command {filterpopup}
.menu.options.menu.filter add command -label "Unfilter" \
	-underline 0 -command {unfilter}

#---------------------------------------------------------------
# The keyboard menu
#---------------------------------------------------------------
menu .menu.options.menu.keyboard -tearoff 0
.menu.options.menu.keyboard add radiobutton -label "Qwerty" \
	-underline 0 -variable keyboard -value "Qwerty"
.menu.options.menu.keyboard add radiobutton -label "Dvorak" \
	-underline 0 -variable keyboard -value "Dvorak"
