#!/afs/ece/usr/tcl/bin/wish -f
#
# TH calling program
#

# TH programs & descriptions
set TH_App(configureth) {Change color, fonts, other display options of remote widgets}
set TH_App(dialogth) {Teach keyboard traversal to Tk's dialog routine}
set TH_App(historyth) {Teach remote entries to remember their previous contents}
set TH_App(menusplith) {Split a long menu into shorter submenus}
set TH_App(menutraverseth) {Add Tk keyboard menubar traversal to a set of menus}
set TH_App(packeth) {Repack and reorder widgets}

set Number_Of_Frames 3

foreach pair {{th_history_sanity_check lib/history.tcl}
		{get_widget aux/teach.tcl}} {
  if {[info procs [lindex $pair 0]] == ""} {
    source "[file dirname [info script]]/../[lindex $pair 1]"
}}

set Help "" ; append Help {Teacher Hypertools

This is a simple wish script designed to itemize the Teacher Hypertools
available. From this window, you can execute any hypertool available. Here
are the widgets shown:


XF Location Label and Entry

This contains the location for the source code to XF. TH attempts to read
your XF_DIR environment variable for this value, otherwise it uses a value
supplied in lib/th.tcl. Some programs, like configureth, use XF's template
procedures to allow the user more power in selecting colors, fonts, etc.


Arguments Menu, Button, and Entry

This contains the arguments sent to whatever hypertool you call. Any hypertool
can be called with no arguments, and a hypertool will ignore any arguments
it doesn't understand. 


Hypertools Buttons

Each button runs a different hypertool. When you pass the mouse over each button
a short description of the button's hypertool appears in the text widget.

} $TH_Help {

Bugs / Limitations

None
(I hope!)
}


set env(XF_DIR) $XF_Dir
catch {destroy .buttons.source}
catch {destroy .buttons.teach}

create_form_entry .xf "Location of XF" env(XF_DIR)
bind .xf.e <Tab> "th_Entry_complete_multiple %W [list [concat \
       {{th_line_complete th_filter_glob none}} $Entry_Completions]]"
create_form_entry .args "Arguments" app_args ""

.output configure -state normal -wrap word

for {set f 0} {$f < $Number_Of_Frames} {incr f} {
  frame .button$f
  pack .button$f -side left -fill both -expand yes
}

set i 0
set apps [lsort [array names TH_App]]
set l [llength $apps]
foreach app $apps {
  set w .button[expr ($i * $Number_Of_Frames) / $l ].$app
  incr i
  button $w -text "$app" -command "eval exec wish -f $TH_Dir/bin/$app \$app_args &"
  pack $w -side top -fill x
  bind $w <Any-Enter> "[bind Button <Any-Enter>] ; .output insert 1.0 [list $TH_App($app)]"
  bind $w <Any-Leave> "[bind Button <Any-Leave>] ; .output delete 1.0 end"
}


