--- ray/src/util/do_results3.6.tcl 1995/02/22 20:48:51 2.3 +++ ray/src/util/do_results3.6.tcl 1995/09/21 10:19:54 2.7 @@ -52,15 +52,21 @@ set conv(types) {GIF-bw GIF-8 PICT PS PPM-asc PPM-bin 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 exists $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 exists ${rawfroot}_[lindex $vw 0].unf] { lappend ufpics [lindex $vw 0] - } elseif {[file exists $fnr.pic]} { + } elseif {[file exists $radvar(PICTURE)_[lindex $vw 0].pic]} { lappend fpics [lindex $vw 0] } } @@ -68,17 +74,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 +93,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,11 +119,11 @@ 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)] { @@ -123,7 +138,8 @@ proc dsppic {} { # Display selected pictures } } 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 +179,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 @@ -245,5 +262,10 @@ 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) + } else { + set rawfroot $radvar(PICTURE) + } list_views }