#!/usr/bin/wish -f
tk_dialog .blah "Xconfig" "Welcome to MudBot! This is a configuration menu for the Xwindows system." info 0 OK
button .b1 -text "1- Configuration" -command {config} -width 25
button .b2 -text "2- Edit channels.file" -command { exec "xedit" "channels.file" } -width 25
button .b3 -text "3- Read the README file" -command {Readme} -width 25
button .b4 -text "4- Edit config.h" -command { exec "xedit" "config.h" } -width 25
button .b5 -text "5- Read the WEB page" -command { exec "mosaic" "http://www.darkelf.net/drow/mudbot.html" } -width 25
button .b6 -text "6- Start MudBot" -command { exec "xterm" "-exec" "mudbot" } -width 25
button .b7 -text "7- Exit" -command { exit } -width 25
grid .b1 -row 0 -column 0
grid .b2 -row 1 -column 0
grid .b3 -row 2 -column 0
grid .b4 -row 3 -column 0
grid .b5 -row 4 -column 0
grid .b6 -row 5 -column 0
grid .b7 -row 6 -column 0

proc config args {
toplevel .conf
wm title .conf "Configuration"
label .conf.l -text "What kind of configure method do you want?"
button .conf.lb1 -text "Quick config" -command { exec "xterm" "-exec" "./config" "-quick" } -width 15
button .conf.lb2 -text "Complete config" -command { exec "xterm" "-exec" "./config" "-all" } -width 15
button .conf.lb3 -text "Check config.h" -command { exec "xterm" "-exec" "./config" "-check" } -width 15
button .conf.lb4 -text "Back" -command {destroy .conf} -width 15
grid .conf.lb1 -row 1 -column 0
grid .conf.lb2 -row 2 -column 0
grid .conf.lb3 -row 3 -column 0
grid .conf.lb4 -row 4 -column 0
}

proc Readme {} {
 catch {destroy .readme}
 toplevel .readme
 frame .readme.top
 wm title .readme "README file"
 text .readme.t -yscrollcommand {.readme.s set}
 scrollbar .readme.s -command {.readme.t yview} -orient vertical
 pack .readme.s -side right -fill y -in .readme.top
 pack .readme.t -side left -fill both -expand true -in .readme.top
 pack .readme.top
 if [catch {open README} in] {
  .readme.t insert insert $in
 } else {
  .readme.t insert insert [read $in]
 close $in
 }
 button .readme.quit -text "Back" -command {destroy .readme}   
 pack .readme.quit
}
