--- ray/src/util/do_results3.6.tcl 1994/11/06 21:35:52 2.2 +++ ray/src/util/do_results3.6.tcl 1995/09/13 14:24:16 2.6 @@ -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,35 +74,44 @@ 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] + 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?" \ - questhead 1 {Delete} {Cancel}] { + "Really delete file(s) $selected_pics?" \ + questhead 0 {Delete} {Cancel}] { return } if {! [catch {eval exec rm $selected_pics < /dev/null} curmess]} { 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 } @@ -123,7 +138,7 @@ proc dsppic {} { # Display selected pictures } } foreach p $selected_pics { - if [string match *.raw $p] { + if [string match *.unf $p] { set dc [format $dispcom $ev $p] } else { set dc [format $dispcom 0 $p] @@ -163,9 +178,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 +261,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 {[info exists radvar(RAWFILE)] && $radvar(RAWFILE) != {}} { + set rawfroot $radvar(RAWFILE) + } else { + set rawfroot $radvar(PICTURE) + } + if {! [info exists radvar(ZFILE)]} { + set radvar(ZFILE) {} + } list_views }