
#   "gui.tcl" - part of "RAGMAAN, een anagrammengenerator" 
#
#            Copyright (C) 1999 Raymond Zandbergen
#
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#    The maintainer of this program is Raymond Zandbergen (ray@wirehub.nl)
#
#
##################################################
# main frames
##################################################

if {[info exists version] == 0} {set version xxx}
wm title . [list Ragmaan $version]
wm resizable . 0 0
wm iconbitmap . @[file join $env(RM_LIB_PATH) ragmaan.xbm]
frame .f_top -class SpecialFrame
# set blend [.f_top cget -background]
frame .f_left
frame .f_right 
frame .f_status -class SpecialFrame

##################################################
# top menu
##################################################

menubutton .mb_file -text bestand
menu .mb_file.m_file -tearoff 0
.mb_file.m_file add command -label {woordenlijst laden} \
	-command {eval $file_command}
.mb_file.m_file add command -label {resultaten opslaan} \
	-command {eval $save_command}
.mb_file.m_file add separator
.mb_file.m_file add command -label afsluiten -command {eval $exit_command}
.mb_file configure -menu .mb_file.m_file

menubutton .mb_info -text info
menu .mb_info.m_info -tearoff 0
.mb_info.m_info add command -label {ragmaan-info} -command {eval $info_command}
.mb_info configure -menu .mb_info.m_info

pack .mb_file -in .f_top -side left -anchor w -padx 10
pack .mb_info -in .f_top -side right -anchor e -padx 10

##################################################
# user entry field
##################################################

frame .f_search
label .f_search.l -text zoekwoord 
entry .f_search.e -textvariable user_entry
button .f_search.b -text zoek

pack .f_search.l .f_search.e -side left
pack .f_search.b -side right

pack .f_search -in .f_left -pady 10

##################################################
# regexp mask
##################################################

frame .f_mask
checkbutton .f_mask.c -text {regexp-masker} \
	-variable use_filter \
	-command cmd_filter
entry .f_mask.e -textvariable filter

pack .f_mask.c .f_mask.e -side left
pack .f_mask.e -side right -fill x


##################################################
# search results
##################################################

frame .f_searchlist
listbox .f_searchlist.lb -yscrollcommand {.f_searchlist.sb set}
scrollbar .f_searchlist.sb -command {.f_searchlist.lb yview}
pack .f_searchlist.lb -side left -expand 1 -fill x
pack .f_searchlist.sb -side right -fill y
pack .f_searchlist -in .f_left -fill x

##################################################
# 'terug' & 'bewaar'
##################################################

frame .f_buttons
button .f_buttons.up -text terug
button .f_buttons.keep -text {bewaar}
pack .f_buttons.up -side left
pack .f_buttons.keep -side right
pack .f_buttons -in .f_left -fill x -pady 10

pack .f_mask -in .f_left -pady 10 -fill x

##################################################
# eventual anagram
##################################################

set acc_result {<geen anagram>}
label .result -textvariable acc_result
pack .result -in .f_right -anchor w -pady 15

##################################################
# kept anagrams
##################################################

frame .f_kept
text .f_kept.t -width 30 -height 19 -yscrollcommand {.f_kept.sb set}
scrollbar .f_kept.sb -command {.f_kept.t yview}
pack .f_kept.t -side left -expand 1 -fill x -in .f_kept
pack .f_kept.sb -side right -fill y -in .f_kept

pack .f_kept -in .f_right -fill y

##################################################
# bottom status bar
##################################################

set status_text {initialiseren...}
label .status -textvariable status_text -anchor w
canvas .p_gauge -width 200 -height 16
pack .status -in .f_status -fill x -padx 10 -side left
pack .p_gauge -in .f_status -side right -padx 10

##################################################
# show stuff
##################################################

pack .f_top -fill x -ipady 4
pack .f_status  -side bottom -fill x -ipady 4 -ipadx 4 
pack .f_left  -side left  -padx 10 -pady 10
pack .f_right -side right -padx 10 -pady 10 -fill y -ipady 10
. configure -background [.f_left cget -background]

##################################################
# "sort" popup
##################################################

menu .sort_popup -tearoff 0 -disabledforeground black
.sort_popup add command -label {SORTEREN} -state disabled \
	-background [.f_top cget -background ]
.sort_popup add command -label {op lengte} -command cmd_sort_length
.sort_popup add command -label {alfabetisch} -command cmd_sort_alpha
.sort_popup add separator
.sort_popup add command -label {omkeren} -command cmd_sort_reverse
