1 |
greg |
2.1 |
# SCCSid "$SunId$ LBL" |
2 |
|
|
# |
3 |
|
|
# Results screen for trad |
4 |
|
|
# |
5 |
|
|
|
6 |
|
|
set conv(TIFF-bw,nam) "TIFF B&W" |
7 |
|
|
set conv(TIFF-bw,com) "ra_tiff -b %s %s" |
8 |
|
|
set conv(TIFF-bw,suf) .tif |
9 |
|
|
set conv(TIFF-24,nam) "TIFF 24-bit" |
10 |
|
|
set conv(TIFF-24,com) "ra_tiff %s %s" |
11 |
|
|
set conv(TIFF-24,suf) .tif |
12 |
|
|
set conv(GIF-bw,nam) "GIF B&W" |
13 |
|
|
set conv(GIF-bw,com) "ra_gif -b %s %s" |
14 |
|
|
set conv(GIF-bw,suf) .gif |
15 |
|
|
set conv(GIF-8,nam) "GIF" |
16 |
|
|
set conv(GIF-8,com) "ra_gif -n 10 -d %s %s" |
17 |
|
|
set conv(GIF-8,suf) .gif |
18 |
|
|
set conv(PPM-bin,nam) "PPM (binary)" |
19 |
|
|
set conv(PPM-bin,com) "ra_ppm %s %s" |
20 |
|
|
set conv(PPM-bin,suf) .ppm |
21 |
|
|
set conv(PPM-asc,nam) "PPM (ASCII)" |
22 |
|
|
set conv(PPM-asc,com) "ra_ppm -a %s %s" |
23 |
|
|
set conv(PPM-asc,suf) .ppm |
24 |
|
|
set conv(PICT,nam) "PICT 32-bit" |
25 |
|
|
set conv(PICT,com) "ra_pict -g 1.8 %s %s" |
26 |
|
|
set conv(PICT,suf) .pict |
27 |
|
|
set conv(ras-bw,nam) "Sun B&W" |
28 |
|
|
set conv(ras-bw,com) "ra_pr -b %s %s" |
29 |
|
|
set conv(ras-bw,suf) .ras |
30 |
|
|
set conv(ras-8,nam) "Sun 8-bit" |
31 |
|
|
set conv(ras-8,com) "ra_pr %s %s" |
32 |
|
|
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 |
39 |
|
|
set conv(tga-bw,nam) "Targa B&W" |
40 |
|
|
set conv(tga-bw,com) "ra_t8 -b %s %s" |
41 |
|
|
set conv(tga-bw,suf) .tga |
42 |
|
|
set conv(tga-8,nam) "Targa 8-bit" |
43 |
|
|
set conv(tga-8,com) "ra_t8 -n 10 -d %s %s" |
44 |
|
|
set conv(tga-8,suf) .tga |
45 |
|
|
set conv(tga-16,nam) "Targa 16-bit" |
46 |
|
|
set conv(tga-16,com) "ra_t16 -2 %s %s" |
47 |
|
|
set conv(tga-16,suf) .tga |
48 |
|
|
set conv(tga-24,nam) "Targa 24-bit" |
49 |
|
|
set conv(tga-24,com) "ra_t16 -3 %s %s" |
50 |
|
|
set conv(tga-24,suf) .tga |
51 |
|
|
set conv(types) {GIF-bw GIF-8 PICT PS PPM-asc PPM-bin ras-bw ras-8 ras-24\ |
52 |
|
|
tga-bw tga-8 tga-16 tga-24 TIFF-bw TIFF-24} |
53 |
|
|
set conv(typ) tga-24 |
54 |
|
|
|
55 |
greg |
2.5 |
proc testappend {flst tf} { # test if tf exists and append to flst if so |
56 |
|
|
upvar $flst mylist |
57 |
|
|
if [file exists $tf] { |
58 |
|
|
lappend mylist $tf |
59 |
|
|
} |
60 |
|
|
} |
61 |
|
|
|
62 |
greg |
2.1 |
proc list_views {} { # List finished and unfinished pictures |
63 |
greg |
2.5 |
global radvar fvwbox ufvwbox alldone rawfroot |
64 |
greg |
2.1 |
set fpics {} |
65 |
|
|
set ufpics {} |
66 |
|
|
foreach vw $radvar(view) { |
67 |
greg |
2.5 |
if [file exists ${rawfroot}_[lindex $vw 0].unf] { |
68 |
greg |
2.1 |
lappend ufpics [lindex $vw 0] |
69 |
greg |
2.5 |
} elseif {[file exists $radvar(PICTURE)_[lindex $vw 0].pic]} { |
70 |
greg |
2.1 |
lappend fpics [lindex $vw 0] |
71 |
|
|
} |
72 |
|
|
} |
73 |
|
|
$fvwbox delete 0 end |
74 |
|
|
eval $fvwbox insert end $fpics |
75 |
|
|
$ufvwbox delete 0 end |
76 |
|
|
eval $ufvwbox insert end $ufpics |
77 |
greg |
2.4 |
set alldone [expr [llength $fpics] == [llength $radvar(view)]] |
78 |
greg |
2.1 |
} |
79 |
|
|
|
80 |
|
|
proc delpic {} { # Delete selected pictures |
81 |
greg |
2.4 |
global curmess |
82 |
greg |
2.6 |
set selected_pics [get_selpics 1] |
83 |
greg |
2.1 |
if {"$selected_pics" == {}} { |
84 |
|
|
set curmess "No pictures selected." |
85 |
|
|
return |
86 |
|
|
} |
87 |
|
|
if [tk_dialog .dlg {Verification} \ |
88 |
greg |
2.5 |
"Really delete file(s) $selected_pics?" \ |
89 |
greg |
2.3 |
questhead 0 {Delete} {Cancel}] { |
90 |
greg |
2.1 |
return |
91 |
|
|
} |
92 |
|
|
if {! [catch {eval exec rm $selected_pics < /dev/null} curmess]} { |
93 |
|
|
set curmess "Deleted [llength $selected_pics] file(s)." |
94 |
|
|
} |
95 |
|
|
list_views |
96 |
|
|
} |
97 |
|
|
|
98 |
greg |
2.6 |
proc get_selpics {{getall 0}} { # return selected pictures |
99 |
greg |
2.5 |
global fvwbox ufvwbox radvar rawfroot |
100 |
greg |
2.1 |
set sl {} |
101 |
|
|
foreach i [$fvwbox curselection] { |
102 |
greg |
2.5 |
testappend sl $radvar(PICTURE)_[$fvwbox get $i].pic |
103 |
greg |
2.6 |
if {$getall && $rawfroot != $radvar(PICTURE)} { |
104 |
greg |
2.5 |
testappend sl ${rawfroot}_[$fvwbox get $i].pic |
105 |
|
|
} |
106 |
greg |
2.6 |
if {$getall && $radvar(ZFILE) != {}} { |
107 |
greg |
2.5 |
testappend sl $radvar(ZFILE)_[$fvwbox get $i].zbf |
108 |
|
|
} |
109 |
greg |
2.1 |
} |
110 |
|
|
foreach i [$ufvwbox curselection] { |
111 |
greg |
2.5 |
testappend sl ${rawfroot}_[$ufvwbox get $i].unf |
112 |
greg |
2.6 |
if {$getall && $radvar(ZFILE) != {}} { |
113 |
greg |
2.5 |
testappend sl $radvar(ZFILE)_[$ufvwbox get $i].zbf |
114 |
|
|
} |
115 |
greg |
2.1 |
} |
116 |
|
|
return $sl |
117 |
|
|
} |
118 |
|
|
|
119 |
|
|
proc dsppic {} { # Display selected pictures |
120 |
|
|
global curmess dispcom radvar |
121 |
|
|
set selected_pics [get_selpics] |
122 |
|
|
if {"$selected_pics" == {}} { |
123 |
|
|
set curmess "No pictures selected." |
124 |
|
|
return |
125 |
|
|
} |
126 |
|
|
if {"$radvar(EXPOSURE)" == {}} { |
127 |
|
|
set ev 0 |
128 |
|
|
} else { |
129 |
|
|
if [regexp {^[+-]} $radvar(EXPOSURE)] { |
130 |
|
|
set ev $radvar(EXPOSURE) |
131 |
|
|
} else { |
132 |
|
|
set ev [expr {log($radvar(EXPOSURE))/log(2)}] |
133 |
|
|
} |
134 |
|
|
if {$ev < 0} { |
135 |
|
|
set ev [expr {int($ev - .5)}] |
136 |
|
|
} else { |
137 |
|
|
set ev [expr {int($ev + .5)}] |
138 |
|
|
} |
139 |
|
|
} |
140 |
|
|
foreach p $selected_pics { |
141 |
greg |
2.5 |
if [string match *.unf $p] { |
142 |
greg |
2.1 |
set dc [format $dispcom $ev $p] |
143 |
|
|
} else { |
144 |
|
|
set dc [format $dispcom 0 $p] |
145 |
|
|
} |
146 |
|
|
catch {eval exec $dc} curmess |
147 |
|
|
} |
148 |
|
|
} |
149 |
|
|
|
150 |
|
|
proc cnvpic {} { # Convert selected pictures |
151 |
|
|
global curmess radvar conv convdest fvwbox |
152 |
|
|
set curmess "No finished pictures selected." |
153 |
|
|
foreach i [$fvwbox curselection] { |
154 |
|
|
set vw [$fvwbox get $i] |
155 |
|
|
set p $radvar(PICTURE)_$vw.pic |
156 |
|
|
set df [format $convdest $vw] |
157 |
|
|
set curmess "Converting $p to $df..." |
158 |
greg |
2.2 |
update |
159 |
greg |
2.1 |
set cc [format $conv($conv(typ),com) $p $df] |
160 |
|
|
if {! [catch {eval exec $cc} curmess]} { |
161 |
|
|
set curmess "Done." |
162 |
|
|
} |
163 |
|
|
} |
164 |
|
|
} |
165 |
|
|
|
166 |
|
|
proc prtpic {} { # Print selected pictures |
167 |
|
|
global curmess prntcom radvar fvwbox |
168 |
|
|
set curmess "No finished pictures selected." |
169 |
|
|
foreach i [$fvwbox curselection] { |
170 |
|
|
set p $radvar(PICTURE)_[$fvwbox get $i].pic |
171 |
|
|
set curmess "Printing $p..." |
172 |
greg |
2.2 |
update |
173 |
greg |
2.1 |
set pc [format $prntcom $p] |
174 |
|
|
if {! [catch {eval exec $pc} curmess]} { |
175 |
|
|
set curmess "Done." |
176 |
|
|
} |
177 |
|
|
} |
178 |
|
|
} |
179 |
|
|
|
180 |
|
|
proc do_results w { # Results screen |
181 |
greg |
2.5 |
global radvar curmess fvwbox ufvwbox dispcom prntcom conv \ |
182 |
|
|
rawfroot convdest |
183 |
greg |
2.1 |
if {"$w" == "done"} { |
184 |
greg |
2.5 |
unset fvwbox ufvwbox convdest rawfroot |
185 |
greg |
2.1 |
return |
186 |
|
|
} |
187 |
|
|
frame $w |
188 |
|
|
# Finished view box |
189 |
|
|
label $w.vvl -text "Finished views" |
190 |
|
|
place $w.vvl -relx .0714 -rely .0610 |
191 |
|
|
frame $w.vnl |
192 |
|
|
scrollbar $w.vnl.sb -relief sunken -command "$w.vnl.lb yview" |
193 |
|
|
listbox $w.vnl.lb -relief sunken -yscroll "$w.vnl.sb set" |
194 |
|
|
pack $w.vnl.sb -side right -fill y |
195 |
|
|
pack $w.vnl.lb -side left -expand yes -fill both |
196 |
|
|
place $w.vnl -relwidth .2143 -relheight .4268 -relx .0714 -rely .1220 |
197 |
|
|
set fvwbox $w.vnl.lb |
198 |
|
|
helplink $w.vnl.lb trad results finished |
199 |
|
|
# Unfinished view box |
200 |
|
|
label $w.uvvl -text "Unfinished views" |
201 |
|
|
place $w.uvvl -relx .7143 -rely .0610 |
202 |
|
|
frame $w.uvnl |
203 |
|
|
scrollbar $w.uvnl.sb -relief sunken -command "$w.uvnl.lb yview" |
204 |
|
|
listbox $w.uvnl.lb -relief sunken -yscroll "$w.uvnl.sb set" |
205 |
|
|
pack $w.uvnl.sb -side right -fill y |
206 |
|
|
pack $w.uvnl.lb -side left -expand yes -fill both |
207 |
|
|
place $w.uvnl -relwidth .2143 -relheight .4268 -relx .7143 -rely .1220 |
208 |
|
|
set ufvwbox $w.uvnl.lb |
209 |
|
|
helplink $w.uvnl.lb trad results unfinished |
210 |
|
|
# Rescan button |
211 |
|
|
button $w.rsb -text Rescan -relief raised -command list_views |
212 |
|
|
place $w.rsb -relwidth .1071 -relheight .0610 -relx .4464 -rely .2439 |
213 |
|
|
helplink $w.rsb trad results rescan |
214 |
|
|
# Delete button |
215 |
|
|
button $w.del -text Delete -relief raised -command delpic |
216 |
|
|
place $w.del -relwidth .1071 -relheight .0610 -relx .4464 -rely .3659 |
217 |
|
|
helplink $w.del trad results delete |
218 |
|
|
# Display picture(s) |
219 |
|
|
if {! [info exists dispcom]} { |
220 |
|
|
set dispcom "ximage -e %+d %s >& /dev/null &" |
221 |
|
|
} |
222 |
|
|
button $w.dpyb -text Display -relief raised -command dsppic |
223 |
|
|
place $w.dpyb -relwidth .1071 -relheight .0610 -relx .0714 -rely .6098 |
224 |
|
|
helplink $w.dpyb trad results display |
225 |
|
|
label $w.dpycl -text Command: |
226 |
|
|
place $w.dpycl -relx .2143 -rely .6098 |
227 |
|
|
entry $w.dpyce -textvariable dispcom -relief sunken |
228 |
|
|
place $w.dpyce -relwidth .5714 -relheight .0610 -relx .3571 -rely .6098 |
229 |
|
|
helplink $w.dpyce trad results dispcommand |
230 |
|
|
# Convert picture(s) |
231 |
|
|
button $w.cnvb -text Convert -relief raised -command cnvpic |
232 |
|
|
place $w.cnvb -relwidth .1071 -relheight .0610 -relx .0714 -rely .7317 |
233 |
|
|
helplink $w.cnvb trad results convert |
234 |
|
|
menubutton $w.typb -text $conv($conv(typ),nam) -relief raised \ |
235 |
|
|
-menu $w.typb.m |
236 |
|
|
place $w.typb -relwidth .1786 -relheight .0610 -relx .2143 -rely .7317 |
237 |
|
|
helplink $w.typb trad results convtype |
238 |
|
|
menu $w.typb.m |
239 |
|
|
foreach t $conv(types) { |
240 |
|
|
$w.typb.m add radiobutton -variable conv(typ) -value $t \ |
241 |
|
|
-label $conv($t,nam) \ |
242 |
|
|
-command "$w.typb configure -text \"$conv($t,nam)\" |
243 |
|
|
set convdest $radvar(PICTURE)_%s$conv($t,suf)" |
244 |
|
|
} |
245 |
|
|
label $w.fil -text File: |
246 |
|
|
place $w.fil -relx .4286 -rely .7317 |
247 |
|
|
set convdest $radvar(PICTURE)_%s$conv($conv(typ),suf) |
248 |
|
|
entry $w.file -textvariable convdest -relief sunken |
249 |
|
|
place $w.file -relwidth .4286 -relheight .0610 -relx .5000 -rely .7317 |
250 |
|
|
helplink $w.file trad results convfile |
251 |
|
|
# Print picture(s) |
252 |
|
|
button $w.prtb -text Print -relief raised -command prtpic |
253 |
|
|
place $w.prtb -relwidth .1071 -relheight .0610 -relx .0714 -rely .8537 |
254 |
|
|
helplink $w.prtb trad results print |
255 |
|
|
label $w.prtl -text Command: |
256 |
|
|
place $w.prtl -relx .2143 -rely .8537 |
257 |
|
|
if {! [info exists prntcom]} { |
258 |
|
|
set prntcom "ra_ps %s | lpr" |
259 |
|
|
} |
260 |
|
|
entry $w.prte -textvariable prntcom -relief sunken |
261 |
|
|
place $w.prte -relwidth .5714 -relheight .0610 -relx .3571 -rely .8537 |
262 |
|
|
helplink $w.prte trad results printcommand |
263 |
|
|
# Fill in views |
264 |
greg |
2.5 |
if {[info exists radvar(RAWFILE)] && $radvar(RAWFILE) != {}} { |
265 |
|
|
set rawfroot $radvar(RAWFILE) |
266 |
|
|
} else { |
267 |
|
|
set rawfroot $radvar(PICTURE) |
268 |
|
|
} |
269 |
|
|
if {! [info exists radvar(ZFILE)]} { |
270 |
|
|
set radvar(ZFILE) {} |
271 |
|
|
} |
272 |
greg |
2.1 |
list_views |
273 |
|
|
} |