ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/do_file.tcl
(Generate patch)

Comparing ray/src/util/do_file.tcl (file contents):
Revision 2.1 by greg, Thu Oct 27 15:56:06 1994 UTC vs.
Revision 2.14 by greg, Wed Jul 10 11:48:58 1996 UTC

# Line 3 | Line 3
3   # Choose the Rad Input File to work on.
4   #
5  
6 set rif_glob *.rif
7
6   proc preen {} {                 # clean up radvar
7          global radvar rifname
8          foreach n {objects scene materials illum mkillum render oconv pfilt
9 <                        AMBFILE OPTFILE EXPOSURE ZONE REPORT} {
9 >                        RAWFILE ZFILE AMBFILE OPTFILE EXPOSURE ZONE REPORT} {
10                  if {! [info exists radvar($n)]} {
11                          set radvar($n) {}
12                  }
# Line 19 | Line 17 | proc preen {} {                        # clean up radvar
17                  set n 1
18                  foreach v $oldval {
19                          if {"[string index $v 0]" == "-"} {
20 <                                lappend radvar(view) "$n $v"
20 >                                lappend radvar(view) "u$n $v"
21                          } elseif {[lsearch -glob $radvar(view) \
22                                          "[lindex $v 0] *"] >= 0} {
23                                  continue
# Line 100 | Line 98 | proc setradvar stmt {          # assign a rad variable
98                  PEN* { set radvar(PENUMBRAS) $vval }
99                  VAR* { set radvar(VARIABILITY) $vval }
100                  REP* { set radvar(REPORT) $vval }
101 +                RAW* { set radvar(RAWFILE) $vval }
102 +                ZF* {set radvar(ZFILE) $vval }
103          }
104                  
105   }
# Line 119 | Line 119 | proc putradvar {fi vn} {       # print out a rad variable
119          }
120          if {[lsearch -exact {ZONE QUALITY OCTREE PICTURE AMBFILE OPTFILE
121                          EXPOSURE RESOLUTION UP INDIRECT DETAIL PENUMBRAS
122 <                        VARIABILITY REPORT} $vn] >= 0} {
122 >                        RAWFILE ZFILE VARIABILITY REPORT} $vn] >= 0} {
123                  puts $fi "$vn= $radvar($vn)"
124                  return
125          }
# Line 141 | Line 141 | proc putradvar {fi vn} {       # print out a rad variable
141   proc load_vars {f {vl all}} {   # load RIF variables
142          global curmess radvar alldone
143          if {"$f" == ""} {return 0}
144 <        if {! [file exists $f]} {
144 >        if {! [file isfile $f]} {
145                  beep
146                  set curmess "$f: no such file."
147                  return 0
148          }
149          if {"$vl" == "all" && ! [chksave]} {return 0}
150          set curmess {Please wait...}
151 <        update idletasks
151 >        update
152          if [catch {exec rad -n -w -e $f >& /usr/tmp/ro[pid]}] {
153                  set curmess [exec cat /usr/tmp/ro[pid]]
154                  exec rm -f /usr/tmp/ro[pid]
# Line 167 | Line 167 | proc load_vars {f {vl all}} {  # load RIF variables
167                  set curmess {Project loaded.}
168          } else {
169                  foreach n $vl {
170 <                        set radvar($n) {}
170 >                        if [regexp {[a-z][a-z]*} $n] {
171 >                                set radvar($n) {}
172 >                        } else {
173 >                                catch {unset radvar($n)}
174 >                        }
175                  }
176                  while {[gets $fi curli] != -1} {
177                          if [regexp {^[a-zA-Z][a-zA-Z0-9]* *=} $curli] {
# Line 236 | Line 240 | proc newsave f {               # save a RIF
240                          return 0
241                  }
242          } elseif {[file exists $f]} {
243 +                set ftyp [file type $f]
244 +                if { $ftyp != "file" } {
245 +                        beep
246 +                        set curmess "Selected file $f is a $ftyp."
247 +                        return 0
248 +                }
249                  if [tk_dialog .dlg {Verification} \
250                                  "Overwrite existing file $f?" \
251                                  questhead 1 {Go Ahead} {Cancel}] {
252                          return 0
253                  }
254          }
255 +        if {[file isfile $f] && ! [file writable $f] &&
256 +                        [catch {exec chmod u+w $f} curmess]} {
257 +                beep
258 +                return 0
259 +        }
260          if [save_vars $f] {
261                  set rifname [pwd]/$f
262                  set readonly 0
# Line 254 | Line 269 | proc newsave f {               # save a RIF
269   proc newnew f {                 # create a new RIF
270          global rifname readonly curmess radvar
271          if [file exists $f] {
272 +                set ftyp [file type $f]
273 +                if { $ftyp != "file" } {
274 +                        beep
275 +                        set curmess "Selected file $f is a $ftyp."
276 +                        return 0
277 +                }
278                  if [tk_dialog .dlg {Verification} \
279                                  "File $f exists -- disregard it?" \
280                                  questhead 1 {Yes} {Cancel}] {
# Line 271 | Line 292 | proc newnew f {                        # create a new RIF
292   }
293  
294   proc do_file w {
295 <        global rifname readonly rif_glob curfile curpat
295 >        global rifname readonly myglob curfile curpat
296          if {"$w" == "done"} {
297 <                set rif_glob $curpat
297 >                cd [file dirname $rifname]
298 >                set myglob(rif) $curpat
299                  return
300          }
301          frame $w
# Line 281 | Line 303 | proc do_file w {
303          pack $w.left -side left
304          button $w.left.load -text LOAD -width 5 \
305                          -relief raised -command {newload $curfile}
306 <        button $w.left.save -text SAVE -width 5 \
307 <                        -relief raised -command {newsave $curfile}
306 >        button $w.left.save -text SAVE -width 5 -relief raised \
307 >                        -command "newsave \$curfile; update_dir $w.right"
308          button $w.left.new -text NEW -width 5 \
309                          -relief raised -command {newnew $curfile}
310          pack $w.left.load $w.left.save $w.left.new -side top -pady 15 -padx 20
# Line 294 | Line 316 | proc do_file w {
316          helplink $w.left.new trad file new
317          helplink $w.left.ro trad file readonly
318          getfile -view view_txt -perm \
319 <                        -win $w.right -glob [file dirname $rifname]/$rif_glob
319 >                        -win $w.right -glob [file dirname $rifname]/$myglob(rif)
320          set curfile [file tail $rifname]
321   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines