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 |
proc list_views {} { # List finished and unfinished pictures |
56 |
global radvar fvwbox ufvwbox |
57 |
set fpics {} |
58 |
set ufpics {} |
59 |
foreach vw $radvar(view) { |
60 |
set fnr $radvar(PICTURE)_[lindex $vw 0] |
61 |
if [file exists $fnr.raw] { |
62 |
lappend ufpics [lindex $vw 0] |
63 |
} elseif {[file exists $fnr.pic]} { |
64 |
lappend fpics [lindex $vw 0] |
65 |
} |
66 |
} |
67 |
$fvwbox delete 0 end |
68 |
eval $fvwbox insert end $fpics |
69 |
$ufvwbox delete 0 end |
70 |
eval $ufvwbox insert end $ufpics |
71 |
} |
72 |
|
73 |
proc delpic {} { # Delete selected pictures |
74 |
global curmess alldone |
75 |
set selected_pics [get_selpics] |
76 |
if {"$selected_pics" == {}} { |
77 |
set curmess "No pictures selected." |
78 |
return |
79 |
} |
80 |
if [tk_dialog .dlg {Verification} \ |
81 |
"Really delete picture file(s) $selected_pics?" \ |
82 |
questhead 0 {Delete} {Cancel}] { |
83 |
return |
84 |
} |
85 |
if {! [catch {eval exec rm $selected_pics < /dev/null} curmess]} { |
86 |
set curmess "Deleted [llength $selected_pics] file(s)." |
87 |
} |
88 |
list_views |
89 |
set alldone 0 |
90 |
} |
91 |
|
92 |
proc get_selpics {} { # return selected pictures |
93 |
global fvwbox ufvwbox radvar |
94 |
set sl {} |
95 |
foreach i [$fvwbox curselection] { |
96 |
lappend sl $radvar(PICTURE)_[$fvwbox get $i].pic |
97 |
} |
98 |
foreach i [$ufvwbox curselection] { |
99 |
lappend sl $radvar(PICTURE)_[$ufvwbox get $i].raw |
100 |
} |
101 |
return $sl |
102 |
} |
103 |
|
104 |
proc dsppic {} { # Display selected pictures |
105 |
global curmess dispcom radvar |
106 |
set selected_pics [get_selpics] |
107 |
if {"$selected_pics" == {}} { |
108 |
set curmess "No pictures selected." |
109 |
return |
110 |
} |
111 |
if {"$radvar(EXPOSURE)" == {}} { |
112 |
set ev 0 |
113 |
} else { |
114 |
if [regexp {^[+-]} $radvar(EXPOSURE)] { |
115 |
set ev $radvar(EXPOSURE) |
116 |
} else { |
117 |
set ev [expr {log($radvar(EXPOSURE))/log(2)}] |
118 |
} |
119 |
if {$ev < 0} { |
120 |
set ev [expr {int($ev - .5)}] |
121 |
} else { |
122 |
set ev [expr {int($ev + .5)}] |
123 |
} |
124 |
} |
125 |
foreach p $selected_pics { |
126 |
if [string match *.raw $p] { |
127 |
set dc [format $dispcom $ev $p] |
128 |
} else { |
129 |
set dc [format $dispcom 0 $p] |
130 |
} |
131 |
catch {eval exec $dc} curmess |
132 |
} |
133 |
} |
134 |
|
135 |
proc cnvpic {} { # Convert selected pictures |
136 |
global curmess radvar conv convdest fvwbox |
137 |
set curmess "No finished pictures selected." |
138 |
foreach i [$fvwbox curselection] { |
139 |
set vw [$fvwbox get $i] |
140 |
set p $radvar(PICTURE)_$vw.pic |
141 |
set df [format $convdest $vw] |
142 |
set curmess "Converting $p to $df..." |
143 |
update |
144 |
set cc [format $conv($conv(typ),com) $p $df] |
145 |
if {! [catch {eval exec $cc} curmess]} { |
146 |
set curmess "Done." |
147 |
} |
148 |
} |
149 |
} |
150 |
|
151 |
proc prtpic {} { # Print selected pictures |
152 |
global curmess prntcom radvar fvwbox |
153 |
set curmess "No finished pictures selected." |
154 |
foreach i [$fvwbox curselection] { |
155 |
set p $radvar(PICTURE)_[$fvwbox get $i].pic |
156 |
set curmess "Printing $p..." |
157 |
update |
158 |
set pc [format $prntcom $p] |
159 |
if {! [catch {eval exec $pc} curmess]} { |
160 |
set curmess "Done." |
161 |
} |
162 |
} |
163 |
} |
164 |
|
165 |
proc do_results w { # Results screen |
166 |
global radvar curmess fvwbox ufvwbox dispcom prntcom conv convdest |
167 |
if {"$w" == "done"} { |
168 |
unset fvwbox ufvwbox convdest |
169 |
return |
170 |
} |
171 |
frame $w |
172 |
# Finished view box |
173 |
label $w.vvl -text "Finished views" |
174 |
place $w.vvl -relx .0714 -rely .0610 |
175 |
frame $w.vnl |
176 |
scrollbar $w.vnl.sb -relief sunken -command "$w.vnl.lb yview" |
177 |
listbox $w.vnl.lb -relief sunken -yscroll "$w.vnl.sb set" |
178 |
pack $w.vnl.sb -side right -fill y |
179 |
pack $w.vnl.lb -side left -expand yes -fill both |
180 |
place $w.vnl -relwidth .2143 -relheight .4268 -relx .0714 -rely .1220 |
181 |
set fvwbox $w.vnl.lb |
182 |
helplink $w.vnl.lb trad results finished |
183 |
# Unfinished view box |
184 |
label $w.uvvl -text "Unfinished views" |
185 |
place $w.uvvl -relx .7143 -rely .0610 |
186 |
frame $w.uvnl |
187 |
scrollbar $w.uvnl.sb -relief sunken -command "$w.uvnl.lb yview" |
188 |
listbox $w.uvnl.lb -relief sunken -yscroll "$w.uvnl.sb set" |
189 |
pack $w.uvnl.sb -side right -fill y |
190 |
pack $w.uvnl.lb -side left -expand yes -fill both |
191 |
place $w.uvnl -relwidth .2143 -relheight .4268 -relx .7143 -rely .1220 |
192 |
set ufvwbox $w.uvnl.lb |
193 |
helplink $w.uvnl.lb trad results unfinished |
194 |
# Rescan button |
195 |
button $w.rsb -text Rescan -relief raised -command list_views |
196 |
place $w.rsb -relwidth .1071 -relheight .0610 -relx .4464 -rely .2439 |
197 |
helplink $w.rsb trad results rescan |
198 |
# Delete button |
199 |
button $w.del -text Delete -relief raised -command delpic |
200 |
place $w.del -relwidth .1071 -relheight .0610 -relx .4464 -rely .3659 |
201 |
helplink $w.del trad results delete |
202 |
# Display picture(s) |
203 |
if {! [info exists dispcom]} { |
204 |
set dispcom "ximage -e %+d %s >& /dev/null &" |
205 |
} |
206 |
button $w.dpyb -text Display -relief raised -command dsppic |
207 |
place $w.dpyb -relwidth .1071 -relheight .0610 -relx .0714 -rely .6098 |
208 |
helplink $w.dpyb trad results display |
209 |
label $w.dpycl -text Command: |
210 |
place $w.dpycl -relx .2143 -rely .6098 |
211 |
entry $w.dpyce -textvariable dispcom -relief sunken |
212 |
place $w.dpyce -relwidth .5714 -relheight .0610 -relx .3571 -rely .6098 |
213 |
helplink $w.dpyce trad results dispcommand |
214 |
# Convert picture(s) |
215 |
button $w.cnvb -text Convert -relief raised -command cnvpic |
216 |
place $w.cnvb -relwidth .1071 -relheight .0610 -relx .0714 -rely .7317 |
217 |
helplink $w.cnvb trad results convert |
218 |
menubutton $w.typb -text $conv($conv(typ),nam) -relief raised \ |
219 |
-menu $w.typb.m |
220 |
place $w.typb -relwidth .1786 -relheight .0610 -relx .2143 -rely .7317 |
221 |
helplink $w.typb trad results convtype |
222 |
menu $w.typb.m |
223 |
foreach t $conv(types) { |
224 |
$w.typb.m add radiobutton -variable conv(typ) -value $t \ |
225 |
-label $conv($t,nam) \ |
226 |
-command "$w.typb configure -text \"$conv($t,nam)\" |
227 |
set convdest $radvar(PICTURE)_%s$conv($t,suf)" |
228 |
} |
229 |
label $w.fil -text File: |
230 |
place $w.fil -relx .4286 -rely .7317 |
231 |
set convdest $radvar(PICTURE)_%s$conv($conv(typ),suf) |
232 |
entry $w.file -textvariable convdest -relief sunken |
233 |
place $w.file -relwidth .4286 -relheight .0610 -relx .5000 -rely .7317 |
234 |
helplink $w.file trad results convfile |
235 |
# Print picture(s) |
236 |
button $w.prtb -text Print -relief raised -command prtpic |
237 |
place $w.prtb -relwidth .1071 -relheight .0610 -relx .0714 -rely .8537 |
238 |
helplink $w.prtb trad results print |
239 |
label $w.prtl -text Command: |
240 |
place $w.prtl -relx .2143 -rely .8537 |
241 |
if {! [info exists prntcom]} { |
242 |
set prntcom "ra_ps %s | lpr" |
243 |
} |
244 |
entry $w.prte -textvariable prntcom -relief sunken |
245 |
place $w.prte -relwidth .5714 -relheight .0610 -relx .3571 -rely .8537 |
246 |
helplink $w.prte trad results printcommand |
247 |
# Fill in views |
248 |
list_views |
249 |
} |