--- ray/src/util/trad.wsh 1995/07/24 13:31:26 2.10 +++ ray/src/util/trad.wsh 2019/05/01 16:47:54 2.17 @@ -1,5 +1,7 @@ -#!/usr/local/bin/wish -f -# SCCSid "$SunId$ LBL" +#!/usr/bin/wish +# RCSid: $Id: trad.wsh,v 2.17 2019/05/01 16:47:54 greg Exp $ +# the next line restarts using wish in case of shell execution \ +exec wish "$0" "$@" # # TCL/TK-based Rad Input File Editor # @@ -11,6 +13,14 @@ set helplib $radlib set auto_path [linsert $auto_path 0 $radlib] +# Assign global globbing variables + +set myglob(rif) *.rif +set myglob(materials) *.mat +set myglob(illum) *.rad +set myglob(scene) *.rad +set myglob(objects) * + # Create required procedures proc modified {} { # check for radvar modification @@ -119,7 +129,7 @@ pack .upper.right.title -side top -pady 10 proc setbutt v { radiobutton .$v -text [string toupper $v] \ -variable curmode -value $v \ - -width 9 -relief groove -anchor w \ + -width 10 -relief groove -anchor w \ -command changescreen pack .$v -in .upper.right -side top -pady 5 helplink .$v trad $v intro @@ -135,11 +145,11 @@ setbutt results rename setbutt {} button .upper.right.help -text HELP -width 9 \ -command "gethelp trad trad intro" -pack .upper.right.help -side top -pady 10 -anchor se +pack .upper.right.help -side top -pady 5 -anchor se helplink .upper.right.help trad trad help button .upper.right.quit -text QUIT \ -command {if [chksave] {destroy .}} -width 9 -pack .upper.right.quit -side top -pady 10 -anchor se +pack .upper.right.quit -side top -pady 5 -anchor se helplink .upper.right.quit trad trad quit if $smallscrn { @@ -151,7 +161,7 @@ if $smallscrn { } wm iconbitmap . @$radlib/trad.icon -proc gotfile {{o 1}} { # set file possession state +proc gotfile o { # set file possession state global oldradvar radvar catch {unset oldradvar} if $o { @@ -161,7 +171,6 @@ proc gotfile {{o 1}} { # set file possession state } } else { set mode disabled - .file invoke } foreach b {scene zone views options action results} { .$b configure -state $mode @@ -170,15 +179,19 @@ proc gotfile {{o 1}} { # set file possession state # Decide where to go and start +gotfile 0 if {[llength $argv] == 0} { set curmess "Choose a Radiance project file." - gotfile 0 + .file invoke } elseif {[llength $argv] == 1} { cd [file dirname $argv] set curfile [file tail $argv] - if {! [file exists $curfile]} { - newnew $curfile - .scene invoke + if {! [file isfile $curfile]} { + if [newnew $curfile] { + .scene invoke + } else { + .file invoke + } } elseif {[newload $curfile]} { if $alldone { set curmess "All renderings are finished."