/usr/bin/trad is in radiance 4R0+20110410-1build1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | #!/usr/bin/wish
# RCSid: $Id: trad.wsh,v 2.15 2003/02/22 02:07:30 greg Exp $
#
# TCL/TK-based Rad Input File Editor
#
# Insert our autoload directory (may require local system modification)
set radlib /usr/share/radiance/tcl
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
global radvar oldradvar
if {! [info exists oldradvar]} {return 0}
foreach n [array names oldradvar] {
if {! [info exists radvar($n)] ||
"$radvar($n)" != "$oldradvar($n)"} {
return 1
}
}
return 0
}
proc chksave {} { # check if RIF is saved and accost user if not
global readonly rifname oldradvar curmess
if [modified] {
if $readonly {
set warnmess "You have modified variables, but the\
file \"[file tail $rifname]\" was opened read-only.
Do you wish to save this information somehow?"
set yesmess {Go to File Screen}
} else {
set warnmess "The file \"[file tail $rifname]\" has\
been modified since it was last saved.
Do you wish to save it now?"
set yesmess {Save File}
}
switch [tk_dialog .dlg {File Modified} $warnmess \
warning 0 $yesmess {Discard Changes} \
{Cancel Operation}] {
1 { return 1 }
2 { return 0 }
}
if $readonly {
set curmess {Rename file or uncheck read-only to save.}
.file invoke
return 0
} elseif {[save_vars $rifname]} {
gotfile 1
return 1
}
return 0
}
return 1
}
# Set global variable default values
set readonly 0
set alldone 0
set rifname [pwd]/
# Propogate essential variables
proc setrname {name elem op} {
global rifname
wm title . $rifname
wm iconname . [file tail $rifname]
}
trace variable rifname w setrname
# Make main window frames
set smallscrn [expr [winfo screenwidth .] < 830]
message .mess -relief ridge -font fixed -textvariable curmess -anchor nw
if $smallscrn {
frame .upper -width 640 -height 410
frame .upper.right -width 120 -height 410
.mess configure -width 640
} else {
frame .upper -width 830 -height 410
frame .upper.right -width 130 -height 410
.mess configure -width 830
}
pack .upper -side top
place .upper.right -relx .98 -rely 0 -anchor ne
pack .mess -side top -expand yes -fill both
helplink .mess trad trad messages
. configure -cursor top_left_arrow
# Make mode buttons
proc changescreen {} { # switch screen according to curmode
global curscreen curmode curmess smallscrn
if [info exists curscreen] {
if {"$curmode" == "$curscreen"} {return}
destroy .upper.left
do_$curscreen done
set curmess {}
}
set curscreen $curmode
do_$curscreen .upper.left
if $smallscrn {
.upper.left configure -width 520 -height 410
} else {
.upper.left configure -width 700 -height 410
}
place .upper.left -x 0 -y 0
}
label .upper.right.title -text "- TRAD -"
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 \
-command changescreen
pack .$v -in .upper.right -side top -pady 5
helplink .$v trad $v intro
}
setbutt file
setbutt scene
setbutt zone
setbutt views
setbutt options
setbutt action
setbutt results
rename setbutt {}
button .upper.right.help -text HELP -width 9 \
-command "gethelp trad trad intro"
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 5 -anchor se
helplink .upper.right.quit trad trad quit
if $smallscrn {
wm minsize . 640 460
wm maxsize . 640 512
} else {
wm minsize . 830 460
wm maxsize . 830 512
}
wm iconbitmap . @$radlib/trad.icon
proc gotfile o { # set file possession state
global oldradvar radvar
catch {unset oldradvar}
if $o {
set mode normal
foreach n [array names radvar] {
set oldradvar($n) $radvar($n)
}
} else {
set mode disabled
}
foreach b {scene zone views options action results} {
.$b configure -state $mode
}
}
# Decide where to go and start
gotfile 0
if {[llength $argv] == 0} {
set curmess "Choose a Radiance project file."
.file invoke
} elseif {[llength $argv] == 1} {
cd [file dirname $argv]
set curfile [file tail $argv]
if {! [file isfile $curfile]} {
if [newnew $curfile] {
.scene invoke
} else {
.file invoke
}
} elseif {[newload $curfile]} {
if $alldone {
set curmess "All renderings are finished."
.results invoke
} else {
.action invoke
}
} else {
.file invoke
}
} else {
puts stderr {Usage: trad [rifname]}
exit 1
}
|