#! /bin/sh -f
# The next line is executed by /bin/sh, but not Tcl \
exec guiwish -f $0 ${1+"$@"}

if [file executable guiBuilder] {
  set env(GUI_BUILDER) $env(PWD)
} else {
  set env(GUI_BUILDER) [file dirname [exec which guiBuilder]]
}
global num_images images
if {![info exists num_images]} {set num_images 0}
global Menu_string
global auto_path images num_images
if {[file exists $env(GUI_BUILDER)/common.tcl]} {
  puts "loading $env(GUI_BUILDER)/common.tcl"
  source  $env(GUI_BUILDER)/common.tcl
  puts "loading $env(GUI_BUILDER)/extensions.tcl"
  source  $env(GUI_BUILDER)/extensions.tcl
}
set align_list ""
wm withdraw .
global Topgeom Toppos
catch "destroy .top0"
#- TOP LEVEL -----------------------------------------
toplevel .top0 
wm title .top0 {Source View}
wm minsize .top0 1 1
set Toppos(.top0) 0
set Topgeom(.top0) 0

set Name .top0
set Parent $Name

set Name $Parent.f3
#------------------------------------------
frame $Name -borderwidth 2 -height 56 -relief raised -width 64
pack $Name -anchor center -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 0 -side top

set Name $Parent.f3.t5
#------------------------------------------
text $Name -borderwidth 3 -height 25 -yscrollcommand {.top0.f3.sb7 set}
set file [open [lindex $argv 0] r]
set txt [read $file 100000000]
close $file
$Name insert end $txt

pack $Name -anchor center -expand 1 -fill both -ipadx 0 -ipady 0 -padx 0 -pady 0 -side left

set Name $Parent.f3.sb7
#------------------------------------------
scrollbar $Name -command {.top0.f3.t5 yview}
pack $Name -anchor center -expand 0 -fill y -ipadx 0 -ipady 0 -padx 0 -pady 0 -side right

set Name $Parent.b9
#------------------------------------------
button $Name -command exit -text Close
pack $Name -anchor center -expand 0 -fill x -ipadx 0 -ipady 0 -padx 0 -pady 0 -side top
