--- ray/src/util/do_results3.6.tcl 1995/02/22 20:48:51 2.3 +++ ray/src/util/do_results3.6.tcl 2003/02/22 02:07:30 2.12 @@ -1,4 +1,4 @@ -# SCCSid "$SunId$ LBL" +# RCSid: $Id: do_results3.6.tcl,v 2.12 2003/02/22 02:07:30 greg Exp $ # # Results screen for trad # @@ -33,9 +33,12 @@ set conv(ras-8,suf) .ras set conv(ras-24,nam) "Sun 24-bit" set conv(ras-24,com) "ra_pr24 %s %s" set conv(ras-24,suf) .ras -set conv(PS,nam) "PostScript B&W" -set conv(PS,com) "ra_ps %s %s" -set conv(PS,suf) .ps +set conv(PS-bw,nam) "PostScript B&W" +set conv(PS-bw,com) "ra_ps -b -C %s %s" +set conv(PS-bw,suf) .ps +set conv(PS-clr,nam) "PostScript Color" +set conv(PS-clr,com) "ra_ps -c -C %s %s" +set conv(PS-clr,suf) .ps set conv(tga-bw,nam) "Targa B&W" set conv(tga-bw,com) "ra_t8 -b %s %s" set conv(tga-bw,suf) .tga @@ -48,19 +51,25 @@ set conv(tga-16,suf) .tga set conv(tga-24,nam) "Targa 24-bit" set conv(tga-24,com) "ra_t16 -3 %s %s" set conv(tga-24,suf) .tga -set conv(types) {GIF-bw GIF-8 PICT PS PPM-asc PPM-bin ras-bw ras-8 ras-24\ - tga-bw tga-8 tga-16 tga-24 TIFF-bw TIFF-24} +set conv(types) {GIF-bw GIF-8 PICT PS-bw PS-clr PPM-asc PPM-bin ras-bw ras-8\ + ras-24 tga-bw tga-8 tga-16 tga-24 TIFF-bw TIFF-24} set conv(typ) tga-24 +proc testappend {flst tf} { # test if tf exists and append to flst if so + upvar $flst mylist + if [file isfile $tf] { + lappend mylist $tf + } +} + proc list_views {} { # List finished and unfinished pictures - global radvar fvwbox ufvwbox + global radvar fvwbox ufvwbox alldone rawfroot set fpics {} set ufpics {} foreach vw $radvar(view) { - set fnr $radvar(PICTURE)_[lindex $vw 0] - if [file exists $fnr.raw] { + if [file isfile ${rawfroot}_[lindex $vw 0].unf] { lappend ufpics [lindex $vw 0] - } elseif {[file exists $fnr.pic]} { + } elseif {[file isfile $radvar(PICTURE)_[lindex $vw 0].pic]} { lappend fpics [lindex $vw 0] } } @@ -68,17 +77,18 @@ proc list_views {} { # List finished and unfinished p eval $fvwbox insert end $fpics $ufvwbox delete 0 end eval $ufvwbox insert end $ufpics + set alldone [expr [llength $fpics] == [llength $radvar(view)]] } proc delpic {} { # Delete selected pictures - global curmess alldone - set selected_pics [get_selpics] - if {"$selected_pics" == {}} { + global curmess + set selected_pics [get_selpics 1] + if {$selected_pics == {}} { set curmess "No pictures selected." return } if [tk_dialog .dlg {Verification} \ - "Really delete picture file(s) $selected_pics?" \ + "Really delete file(s) $selected_pics?" \ questhead 0 {Delete} {Cancel}] { return } @@ -86,17 +96,25 @@ proc delpic {} { # Delete selected pictures set curmess "Deleted [llength $selected_pics] file(s)." } list_views - set alldone 0 } -proc get_selpics {} { # return selected pictures - global fvwbox ufvwbox radvar +proc get_selpics {{getall 0}} { # return selected pictures + global fvwbox ufvwbox radvar rawfroot set sl {} foreach i [$fvwbox curselection] { - lappend sl $radvar(PICTURE)_[$fvwbox get $i].pic + testappend sl $radvar(PICTURE)_[$fvwbox get $i].pic + if {$getall && $rawfroot != $radvar(PICTURE)} { + testappend sl ${rawfroot}_[$fvwbox get $i].pic + } + if {$getall && $radvar(ZFILE) != {}} { + testappend sl $radvar(ZFILE)_[$fvwbox get $i].zbf + } } foreach i [$ufvwbox curselection] { - lappend sl $radvar(PICTURE)_[$ufvwbox get $i].raw + testappend sl ${rawfroot}_[$ufvwbox get $i].unf + if {$getall && $radvar(ZFILE) != {}} { + testappend sl $radvar(ZFILE)_[$ufvwbox get $i].zbf + } } return $sl } @@ -104,26 +122,22 @@ proc get_selpics {} { # return selected pictures proc dsppic {} { # Display selected pictures global curmess dispcom radvar set selected_pics [get_selpics] - if {"$selected_pics" == {}} { + if {$selected_pics == {}} { set curmess "No pictures selected." return } - if {"$radvar(EXPOSURE)" == {}} { + if {$radvar(EXPOSURE) == {}} { set ev 0 } else { if [regexp {^[+-]} $radvar(EXPOSURE)] { - set ev $radvar(EXPOSURE) + set ev [expr {round($radvar(EXPOSURE))}] } else { - set ev [expr {log($radvar(EXPOSURE))/log(2)}] + set ev [expr {round(log($radvar(EXPOSURE))/log(2))}] } - if {$ev < 0} { - set ev [expr {int($ev - .5)}] - } else { - set ev [expr {int($ev + .5)}] - } } foreach p $selected_pics { - if [string match *.raw $p] { + if {[string match *.unf $p] || + $radvar(PICTURE) == $radvar(RAWFILE)} { set dc [format $dispcom $ev $p] } else { set dc [format $dispcom 0 $p] @@ -163,9 +177,10 @@ proc prtpic {} { # Print selected pictures } proc do_results w { # Results screen - global radvar curmess fvwbox ufvwbox dispcom prntcom conv convdest + global radvar curmess fvwbox ufvwbox dispcom prntcom conv \ + rawfroot convdest if {"$w" == "done"} { - unset fvwbox ufvwbox convdest + unset fvwbox ufvwbox convdest rawfroot return } frame $w @@ -217,7 +232,7 @@ proc do_results w { # Results screen helplink $w.cnvb trad results convert menubutton $w.typb -text $conv($conv(typ),nam) -relief raised \ -menu $w.typb.m - place $w.typb -relwidth .1786 -relheight .0610 -relx .2143 -rely .7317 + place $w.typb -relwidth .1986 -relheight .0610 -relx .2143 -rely .7317 helplink $w.typb trad results convtype menu $w.typb.m foreach t $conv(types) { @@ -227,10 +242,10 @@ proc do_results w { # Results screen set convdest $radvar(PICTURE)_%s$conv($t,suf)" } label $w.fil -text File: - place $w.fil -relx .4286 -rely .7317 + place $w.fil -relx .4486 -rely .7317 set convdest $radvar(PICTURE)_%s$conv($conv(typ),suf) entry $w.file -textvariable convdest -relief sunken - place $w.file -relwidth .4286 -relheight .0610 -relx .5000 -rely .7317 + place $w.file -relwidth .4086 -relheight .0610 -relx .5200 -rely .7317 helplink $w.file trad results convfile # Print picture(s) button $w.prtb -text Print -relief raised -command prtpic @@ -245,5 +260,13 @@ proc do_results w { # Results screen place $w.prte -relwidth .5714 -relheight .0610 -relx .3571 -rely .8537 helplink $w.prte trad results printcommand # Fill in views + if {$radvar(RAWFILE) != {}} { + set rawfroot $radvar(RAWFILE) + if {$radvar(RAWFILE) == $radvar(PICTURE)} { + set curmess "Warning: finished views are unfiltered" + } + } else { + set rawfroot $radvar(PICTURE) + } list_views }