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

Comparing ray/src/util/do_results3.6.tcl (file contents):
Revision 2.4 by greg, Tue Mar 14 10:16:46 1995 UTC vs.
Revision 2.12 by greg, Sat Feb 22 02:07:30 2003 UTC

# Line 1 | Line 1
1 < # SCCSid "$SunId$ LBL"
1 > # RCSid: $Id$
2   #
3   # Results screen for trad
4   #
# Line 33 | Line 33 | set conv(ras-8,suf)    .ras
33   set conv(ras-24,nam)    "Sun 24-bit"
34   set conv(ras-24,com)    "ra_pr24 %s %s"
35   set conv(ras-24,suf)    .ras
36 < set conv(PS,nam)        "PostScript B&W"
37 < set conv(PS,com)        "ra_ps %s %s"
38 < set conv(PS,suf)        .ps
36 > set conv(PS-bw,nam)     "PostScript B&W"
37 > set conv(PS-bw,com)     "ra_ps -b -C %s %s"
38 > set conv(PS-bw,suf)     .ps
39 > set conv(PS-clr,nam)    "PostScript Color"
40 > set conv(PS-clr,com)    "ra_ps -c -C %s %s"
41 > set conv(PS-clr,suf)    .ps
42   set conv(tga-bw,nam)    "Targa B&W"
43   set conv(tga-bw,com)    "ra_t8 -b %s %s"
44   set conv(tga-bw,suf)    .tga
# Line 48 | Line 51 | set conv(tga-16,suf)   .tga
51   set conv(tga-24,nam)    "Targa 24-bit"
52   set conv(tga-24,com)    "ra_t16 -3 %s %s"
53   set conv(tga-24,suf)    .tga
54 < set conv(types) {GIF-bw GIF-8 PICT PS PPM-asc PPM-bin ras-bw ras-8 ras-24\
55 <                tga-bw tga-8 tga-16 tga-24 TIFF-bw TIFF-24}
54 > set conv(types) {GIF-bw GIF-8 PICT PS-bw PS-clr PPM-asc PPM-bin ras-bw ras-8\
55 >                ras-24 tga-bw tga-8 tga-16 tga-24 TIFF-bw TIFF-24}
56   set conv(typ) tga-24
57  
58 + proc testappend {flst tf} {     # test if tf exists and append to flst if so
59 +        upvar $flst mylist
60 +        if [file isfile $tf] {
61 +                lappend mylist $tf
62 +        }
63 + }
64 +
65   proc list_views {} {            # List finished and unfinished pictures
66 <        global radvar fvwbox ufvwbox alldone
66 >        global radvar fvwbox ufvwbox alldone rawfroot
67          set fpics {}
68          set ufpics {}
69          foreach vw $radvar(view) {
70 <                set fnr $radvar(PICTURE)_[lindex $vw 0]
61 <                if [file exists $fnr.raw] {
70 >                if [file isfile ${rawfroot}_[lindex $vw 0].unf] {
71                          lappend ufpics [lindex $vw 0]
72 <                } elseif {[file exists $fnr.pic]} {
72 >                } elseif {[file isfile $radvar(PICTURE)_[lindex $vw 0].pic]} {
73                          lappend fpics [lindex $vw 0]
74                  }
75          }
# Line 73 | Line 82 | proc list_views {} {           # List finished and unfinished p
82  
83   proc delpic {} {                # Delete selected pictures
84          global curmess
85 <        set selected_pics [get_selpics]
86 <        if {"$selected_pics" == {}} {
85 >        set selected_pics [get_selpics 1]
86 >        if {$selected_pics == {}} {
87                  set curmess "No pictures selected."
88                  return
89          }
90          if [tk_dialog .dlg {Verification} \
91 <                        "Really delete picture file(s) $selected_pics?" \
91 >                        "Really delete file(s) $selected_pics?" \
92                          questhead 0 {Delete} {Cancel}] {
93                  return
94          }
# Line 89 | Line 98 | proc delpic {} {               # Delete selected pictures
98          list_views
99   }
100  
101 < proc get_selpics {} {           # return selected pictures
102 <        global fvwbox ufvwbox radvar
101 > proc get_selpics {{getall 0}} {         # return selected pictures
102 >        global fvwbox ufvwbox radvar rawfroot
103          set sl {}
104          foreach i [$fvwbox curselection] {
105 <                lappend sl $radvar(PICTURE)_[$fvwbox get $i].pic
105 >                testappend sl $radvar(PICTURE)_[$fvwbox get $i].pic
106 >                if {$getall && $rawfroot != $radvar(PICTURE)} {
107 >                        testappend sl ${rawfroot}_[$fvwbox get $i].pic
108 >                }
109 >                if {$getall && $radvar(ZFILE) != {}} {
110 >                        testappend sl $radvar(ZFILE)_[$fvwbox get $i].zbf
111 >                }
112          }
113          foreach i [$ufvwbox curselection] {
114 <                lappend sl $radvar(PICTURE)_[$ufvwbox get $i].raw
114 >                testappend sl ${rawfroot}_[$ufvwbox get $i].unf
115 >                if {$getall && $radvar(ZFILE) != {}} {
116 >                        testappend sl $radvar(ZFILE)_[$ufvwbox get $i].zbf
117 >                }
118          }
119          return $sl
120   }
# Line 104 | Line 122 | proc get_selpics {} {          # return selected pictures
122   proc dsppic {} {                # Display selected pictures
123          global curmess dispcom radvar
124          set selected_pics [get_selpics]
125 <        if {"$selected_pics" == {}} {
125 >        if {$selected_pics == {}} {
126                  set curmess "No pictures selected."
127                  return
128          }
129 <        if {"$radvar(EXPOSURE)" == {}} {
129 >        if {$radvar(EXPOSURE) == {}} {
130                  set ev 0
131          } else {
132                  if [regexp {^[+-]} $radvar(EXPOSURE)] {
133 <                        set ev $radvar(EXPOSURE)
133 >                        set ev [expr {round($radvar(EXPOSURE))}]
134                  } else {
135 <                        set ev [expr {log($radvar(EXPOSURE))/log(2)}]
135 >                        set ev [expr {round(log($radvar(EXPOSURE))/log(2))}]
136                  }
119                if {$ev < 0} {
120                        set ev [expr {int($ev - .5)}]
121                } else {
122                        set ev [expr {int($ev + .5)}]
123                }
137          }
138          foreach p $selected_pics {
139 <                if [string match *.raw $p] {
139 >                if {[string match *.unf $p] ||
140 >                                $radvar(PICTURE) == $radvar(RAWFILE)} {
141                          set dc [format $dispcom $ev $p]
142                  } else {
143                          set dc [format $dispcom 0 $p]
# Line 163 | Line 177 | proc prtpic {} {               # Print selected pictures
177   }
178  
179   proc do_results w {             # Results screen
180 <        global radvar curmess fvwbox ufvwbox dispcom prntcom conv convdest
180 >        global radvar curmess fvwbox ufvwbox dispcom prntcom conv \
181 >                        rawfroot convdest
182          if {"$w" == "done"} {
183 <                unset fvwbox ufvwbox convdest
183 >                unset fvwbox ufvwbox convdest rawfroot
184                  return
185          }
186          frame $w
# Line 217 | Line 232 | proc do_results w {            # Results screen
232          helplink $w.cnvb trad results convert
233          menubutton $w.typb -text $conv($conv(typ),nam) -relief raised \
234                          -menu $w.typb.m
235 <        place $w.typb -relwidth .1786 -relheight .0610 -relx .2143 -rely .7317
235 >        place $w.typb -relwidth .1986 -relheight .0610 -relx .2143 -rely .7317
236          helplink $w.typb trad results convtype
237          menu $w.typb.m
238          foreach t $conv(types) {
# Line 227 | Line 242 | proc do_results w {            # Results screen
242                                  set convdest $radvar(PICTURE)_%s$conv($t,suf)"
243          }
244          label $w.fil -text File:
245 <        place $w.fil -relx .4286 -rely .7317
245 >        place $w.fil -relx .4486 -rely .7317
246          set convdest $radvar(PICTURE)_%s$conv($conv(typ),suf)
247          entry $w.file -textvariable convdest -relief sunken
248 <        place $w.file -relwidth .4286 -relheight .0610 -relx .5000 -rely .7317
248 >        place $w.file -relwidth .4086 -relheight .0610 -relx .5200 -rely .7317
249          helplink $w.file trad results convfile
250          # Print picture(s)
251          button $w.prtb -text Print -relief raised -command prtpic
# Line 245 | Line 260 | proc do_results w {            # Results screen
260          place $w.prte -relwidth .5714 -relheight .0610 -relx .3571 -rely .8537
261          helplink $w.prte trad results printcommand
262          # Fill in views
263 +        if {$radvar(RAWFILE) != {}} {
264 +                set rawfroot $radvar(RAWFILE)
265 +                if {$radvar(RAWFILE) == $radvar(PICTURE)} {
266 +                        set curmess "Warning: finished views are unfiltered"
267 +                }
268 +        } else {
269 +                set rawfroot $radvar(PICTURE)
270 +        }
271          list_views
272   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines