author | Claus Gittinger <cg@exept.de> |
Thu, 18 Jul 1996 13:37:32 +0200 | |
changeset 219 | 44246b9b4288 |
parent 201 | 0aadc66e6134 |
child 220 | ececd8efb00c |
permissions | -rw-r--r-- |
62 | 1 |
" |
2 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
50 | 12 |
|
13 |
View subclass:#ProgressIndicator |
|
183 | 14 |
instanceVariableNames:'percentage showPercentage fgColor connectedTop connectedLabel' |
15 |
classVariableNames:'' |
|
16 |
poolDictionaries:'' |
|
17 |
category:'Views-Misc' |
|
50 | 18 |
! |
19 |
||
219
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
20 |
!ProgressIndicator class methodsFor:'documentation'! |
50 | 21 |
|
62 | 22 |
copyright |
23 |
" |
|
24 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
25 |
All Rights Reserved |
|
26 |
||
27 |
This software is furnished under a license and may be used |
|
28 |
only in accordance with the terms of that license and with the |
|
29 |
inclusion of the above copyright notice. This software may not |
|
30 |
be provided or otherwise made available to, or used by, any |
|
31 |
other person. No title to or ownership of the software is |
|
32 |
hereby transferred. |
|
33 |
" |
|
34 |
! |
|
35 |
||
50 | 36 |
documentation |
37 |
" |
|
38 |
a view showing a rectangle filled according the percentage value. |
|
39 |
Can be used as a progress indicator a la MSwindows. |
|
183 | 40 |
|
41 |
[author:] |
|
42 |
Claus Gittinger |
|
43 |
||
44 |
[see also:] |
|
45 |
ActionWaitBox AnimatedLabel |
|
50 | 46 |
" |
47 |
! |
|
48 |
||
49 |
examples |
|
50 |
" |
|
62 | 51 |
basic (internal) interface |
52 |
(if progress indicator is to be used in a complex box ...): |
|
50 | 53 |
|
183 | 54 |
Before you get frustrated - see the convenient-interface examples |
55 |
at the end ;-) |
|
56 |
||
57 |
[exBegin] |
|
50 | 58 |
|top p h| |
59 |
||
62 | 60 |
top := ModalBox new. |
50 | 61 |
top extent:300@100. |
62 |
top label:'Progress'. |
|
63 |
p := ProgressIndicator in:top. |
|
64 |
p origin:(0.0@0.5) corner:(1.0@0.5). |
|
65 |
p level:-1. |
|
62 | 66 |
h := p preferredExtent y. |
50 | 67 |
p topInset:(h // 2) negated; |
183 | 68 |
bottomInset:(h // 2) negated; |
69 |
leftInset:5; |
|
70 |
rightInset:5. |
|
50 | 71 |
|
72 |
[ |
|
183 | 73 |
1 to:100 do:[:val | |
74 |
(Delay forSeconds:0.05) wait. |
|
75 |
p percentage:val |
|
76 |
]. |
|
77 |
top hide. |
|
62 | 78 |
] fork. |
79 |
top open. |
|
183 | 80 |
[exEnd] |
50 | 81 |
|
82 |
changing colors, turning percentage display off: |
|
183 | 83 |
[exBegin] |
50 | 84 |
|top p h| |
85 |
||
86 |
top := StandardSystemView new. |
|
87 |
top extent:300@100. |
|
88 |
top label:'Progress'. |
|
89 |
p := ProgressIndicator in:top. |
|
90 |
p origin:(0.0@0.5) corner:(1.0@0.5). |
|
91 |
p level:-1. |
|
92 |
p showPercentage:false. |
|
93 |
p foregroundColor:(Color red). |
|
94 |
h := 10. |
|
95 |
p topInset:(h // 2) negated; |
|
183 | 96 |
bottomInset:(h // 2) negated; |
97 |
leftInset:5; |
|
98 |
rightInset:5. |
|
50 | 99 |
top open. |
100 |
[ |
|
183 | 101 |
1 to:100 do:[:val | |
102 |
(Delay forSeconds:0.05) wait. |
|
103 |
p percentage:val |
|
104 |
] |
|
50 | 105 |
] fork |
183 | 106 |
[exEnd] |
50 | 107 |
|
108 |
with border (2D look): |
|
183 | 109 |
[exBegin] |
50 | 110 |
|top p h| |
111 |
||
112 |
top := StandardSystemView new. |
|
113 |
top extent:300@100. |
|
114 |
top label:'Progress'. |
|
115 |
p := ProgressIndicator in:top. |
|
116 |
p origin:(0.0@0.5) corner:(1.0@0.5). |
|
117 |
p borderWidth:1. |
|
62 | 118 |
h := p preferredExtent y. |
50 | 119 |
p topInset:(h // 2) negated; |
183 | 120 |
bottomInset:(h // 2) negated; |
121 |
leftInset:5; |
|
122 |
rightInset:5. |
|
50 | 123 |
top open. |
124 |
[ |
|
183 | 125 |
1 to:100 do:[:val | |
126 |
(Delay forSeconds:0.05) wait. |
|
127 |
p percentage:val |
|
128 |
] |
|
50 | 129 |
] fork |
183 | 130 |
[exEnd] |
50 | 131 |
|
132 |
||
133 |
getting progress from a model: |
|
183 | 134 |
[exBegin] |
50 | 135 |
|model top p h| |
136 |
||
137 |
model := 0 asValue. |
|
138 |
||
139 |
top := StandardSystemView new. |
|
140 |
top extent:300@100. |
|
141 |
top label:'Progress'. |
|
142 |
p := ProgressIndicator in:top. |
|
143 |
p model:model. |
|
144 |
p origin:(0.0@0.5) corner:(1.0@0.5). |
|
145 |
p level:-1. |
|
62 | 146 |
h := p preferredExtent y. |
50 | 147 |
p topInset:(h // 2) negated; |
183 | 148 |
bottomInset:(h // 2) negated; |
149 |
leftInset:5; |
|
150 |
rightInset:5. |
|
50 | 151 |
top open. |
152 |
||
153 |
[ |
|
183 | 154 |
1 to:100 do:[:val | |
155 |
(Delay forSeconds:0.05) wait. |
|
156 |
model value:val |
|
157 |
] |
|
50 | 158 |
] fork |
183 | 159 |
[exEnd] |
50 | 160 |
|
62 | 161 |
|
50 | 162 |
concrete example: |
163 |
search all files in the source directory for a string |
|
164 |
using grep. Show progress while doing so. |
|
183 | 165 |
[exBegin] |
50 | 166 |
|top p h names done| |
167 |
||
168 |
top := StandardSystemView new. |
|
169 |
top extent:300@100. |
|
170 |
top label:'Searching ...'. |
|
171 |
p := ProgressIndicator in:top. |
|
172 |
p origin:(0.0@0.5) corner:(1.0@0.5). |
|
173 |
p level:-1. |
|
62 | 174 |
h := p preferredExtent y. |
50 | 175 |
p topInset:(h // 2) negated; |
183 | 176 |
bottomInset:(h // 2) negated; |
177 |
leftInset:5; |
|
178 |
rightInset:5. |
|
50 | 179 |
top openWithPriority:(Processor activePriority + 1). |
180 |
||
181 |
names := 'source' asFilename directoryContents. |
|
182 |
done := 0. |
|
183 |
names do:[:aName | |
|
183 | 184 |
|fn stream line| |
50 | 185 |
|
183 | 186 |
p percentage:(done / names size * 100). |
187 |
fn := ('source/' , aName) asFilename. |
|
188 |
fn isDirectory ifFalse:[ |
|
189 |
stream := fn readStream. |
|
190 |
[stream atEnd] whileFalse:[ |
|
191 |
line := stream nextLine. |
|
192 |
(line findString:'subclass:') ~~ 0 ifTrue:[ |
|
184 | 193 |
Transcript showCR:line |
183 | 194 |
]. |
195 |
]. |
|
196 |
stream close. |
|
197 |
]. |
|
198 |
done := done + 1 |
|
50 | 199 |
]. |
200 |
||
201 |
top destroy |
|
183 | 202 |
[exEnd] |
62 | 203 |
|
204 |
||
205 |
using the convenient inBox-interface |
|
206 |
||
207 |
(this creates a box and an activity label and evaluates a block |
|
208 |
to indicate ...) |
|
209 |
||
210 |
basic interface demonstration: |
|
183 | 211 |
[exBegin] |
62 | 212 |
|p| |
213 |
||
214 |
p := ProgressIndicator |
|
183 | 215 |
inBoxWithLabel:'doing something ...' |
216 |
abortable:true. |
|
62 | 217 |
p showProgressOf: |
183 | 218 |
[:progressValue :currentAction | |
62 | 219 |
|
183 | 220 |
1 to:100 do:[:val | |
221 |
(Delay forSeconds:0.05) wait. |
|
222 |
val == 25 ifTrue:[ |
|
223 |
currentAction value:'still going ...' |
|
224 |
]. |
|
225 |
val == 50 ifTrue:[ |
|
226 |
currentAction value:'halfway through ...' |
|
227 |
]. |
|
228 |
val == 75 ifTrue:[ |
|
229 |
currentAction value:'almost finished ...' |
|
230 |
]. |
|
231 |
progressValue value:val |
|
232 |
] |
|
233 |
] |
|
234 |
[exEnd] |
|
62 | 235 |
|
236 |
||
237 |
above search example using this convenient interface: |
|
183 | 238 |
[exBegin] |
62 | 239 |
|p| |
240 |
||
183 | 241 |
p := ProgressIndicator |
242 |
inBoxWithLabel:'searching files ...' |
|
243 |
abortable:false. |
|
62 | 244 |
p showProgressOf: |
183 | 245 |
[:progressValue :currentAction | |
246 |
|names nDone| |
|
62 | 247 |
|
183 | 248 |
names := 'source' asFilename directoryContents. |
249 |
nDone := 0. |
|
250 |
names do:[:aName | |
|
251 |
|fn stream line| |
|
252 |
||
253 |
progressValue value:(nDone / names size * 100). |
|
254 |
currentAction value:'searching ' , 'source/' , aName , ' ...'. |
|
62 | 255 |
|
183 | 256 |
fn := ('source/' , aName) asFilename. |
257 |
fn isDirectory ifFalse:[ |
|
258 |
stream := fn readStream. |
|
259 |
[stream atEnd] whileFalse:[ |
|
260 |
line := stream nextLine. |
|
261 |
(line findString:'subclass:') ~~ 0 ifTrue:[ |
|
184 | 262 |
Transcript showCR:line |
183 | 263 |
]. |
264 |
]. |
|
265 |
stream close. |
|
266 |
]. |
|
267 |
nDone := nDone + 1 |
|
268 |
]. |
|
269 |
]. |
|
270 |
[exEnd] |
|
62 | 271 |
|
272 |
||
273 |
a nice example: copying files a la windows ... |
|
183 | 274 |
the following copies all files to /dev/null. |
275 |
[exBegin] |
|
62 | 276 |
|p| |
277 |
||
278 |
(ProgressIndicator |
|
183 | 279 |
inBoxWithLabel:'copy files to /dev/null ...' |
280 |
abortable:true) |
|
281 |
showProgressOf: |
|
282 |
[:progressValue :currentAction | |
|
283 |
|files nFiles nDone| |
|
62 | 284 |
|
183 | 285 |
files := '.' asFilename directoryContents. |
286 |
nFiles := files size. |
|
287 |
nDone := 0. |
|
288 |
files do:[:aFileName | |
|
289 |
|percent| |
|
50 | 290 |
|
183 | 291 |
nDone := nDone + 1. |
292 |
percent := nDone / nFiles * 100. |
|
293 |
progressValue value:percent. |
|
294 |
aFileName asFilename isDirectory ifTrue:[ |
|
184 | 295 |
Transcript showCR:('skipping ' , aFileName , ' ...'). |
183 | 296 |
currentAction value:('skipping ' , aFileName , ' ...'). |
297 |
] ifFalse:[ |
|
184 | 298 |
Transcript showCR:('copying ' , aFileName , ' ...'). |
183 | 299 |
currentAction value:('copying ' , aFileName , ' ...'). |
300 |
Object errorSignal handle:[:ex | |
|
301 |
self warn:'an error occurred while copying ' , aFileName. |
|
302 |
ex return |
|
303 |
] do:[ |
|
304 |
aFileName asFilename copyTo:'/dev/null'. |
|
305 |
] |
|
306 |
]. |
|
307 |
]. |
|
308 |
]. |
|
309 |
[exEnd] |
|
310 |
" |
|
50 | 311 |
! ! |
312 |
||
219
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
313 |
!ProgressIndicator class methodsFor:'instance creation'! |
62 | 314 |
|
315 |
inBox |
|
316 |
^ self inBoxWithLabel:'executing ...' abortable:false |
|
317 |
! |
|
318 |
||
319 |
inBoxWithLabel:aLabel |
|
320 |
"create a topView containing an instance of myself, |
|
321 |
for later use with #showProgressOf:" |
|
322 |
||
323 |
^ self inBoxWithLabel:aLabel abortable:false |
|
324 |
! |
|
325 |
||
326 |
inBoxWithLabel:aLabel abortable:abortable |
|
327 |
"create a topView containing an instance of myself, |
|
328 |
for later use with #showProgressOf:" |
|
329 |
||
219
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
330 |
^ self |
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
331 |
inBoxWithLabel:aLabel |
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
332 |
text:'' |
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
333 |
abortable:abortable |
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
334 |
|
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
335 |
"Modified: 17.7.1996 / 15:14:58 / cg" |
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
336 |
! |
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
337 |
|
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
338 |
inBoxWithLabel:aLabel text:text abortable:abortable |
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
339 |
"create a topView containing an instance of myself, |
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
340 |
for later use with #showProgressOf:" |
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
341 |
|
62 | 342 |
|top p l h| |
343 |
||
344 |
top := Dialog new. |
|
219
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
345 |
"/ top extent:300@100; sizeFixed:true. |
62 | 346 |
top label:aLabel. |
347 |
top cursor:(Cursor wait). |
|
348 |
||
219
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
349 |
l := top addTextLabel:text. |
62 | 350 |
l borderWidth:0. |
74 | 351 |
l adjust:#left. |
62 | 352 |
l cursor:(Cursor wait). |
353 |
||
354 |
top addVerticalSpace. |
|
355 |
||
356 |
p := ProgressIndicator new. |
|
357 |
p extent:(1.0 @ p preferredExtent y). |
|
358 |
p level:-1. |
|
359 |
p leftInset:5; |
|
360 |
rightInset:5. |
|
361 |
p cursor:(Cursor wait). |
|
362 |
p connectToTop:top label:l. |
|
363 |
||
364 |
top addComponent:p. |
|
365 |
||
366 |
abortable ifTrue:[ |
|
219
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
367 |
top addVerticalSpace. |
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
368 |
top addAbortButton |
62 | 369 |
]. |
370 |
||
371 |
^ p |
|
219
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
372 |
|
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
373 |
"Created: 17.7.1996 / 15:14:33 / cg" |
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
374 |
"Modified: 17.7.1996 / 15:16:58 / cg" |
62 | 375 |
! ! |
376 |
||
183 | 377 |
!ProgressIndicator methodsFor:'accessing'! |
378 |
||
379 |
foregroundColor:aColor |
|
380 |
fgColor := aColor |
|
381 |
! |
|
382 |
||
383 |
percentage:aNumber |
|
384 |
|newPercentage| |
|
385 |
||
386 |
newPercentage := ((aNumber max:0) min:100) rounded. |
|
387 |
newPercentage ~~ percentage ifTrue:[ |
|
388 |
percentage := newPercentage. |
|
389 |
shown ifTrue:[self redraw]. |
|
390 |
] |
|
391 |
! |
|
392 |
||
393 |
showPercentage:aBoolean |
|
394 |
showPercentage := aBoolean |
|
395 |
! ! |
|
396 |
||
397 |
!ProgressIndicator methodsFor:'change & update'! |
|
398 |
||
399 |
update:aspect with:aParameter from:changedObject |
|
400 |
(aspect == aspectMsg |
|
401 |
and:[changedObject == model]) ifTrue:[ |
|
402 |
self percentage:(model perform:aspectMsg). |
|
403 |
^ self |
|
404 |
]. |
|
405 |
^ super update:aspect with:aParameter from:changedObject |
|
406 |
! ! |
|
407 |
||
408 |
!ProgressIndicator methodsFor:'drawing'! |
|
409 |
||
410 |
redraw |
|
411 |
|s rx sx sy sw m w h| |
|
412 |
||
413 |
m := margin + 1. |
|
414 |
w := width - (m*2). |
|
415 |
h := height - (m*2). |
|
416 |
||
417 |
s := percentage printString , ' %'. |
|
418 |
sw := font widthOf:s. |
|
419 |
sx := (width - sw) // 2. |
|
420 |
sy := height // 2 + font descent + 2. |
|
421 |
||
422 |
rx := (w * percentage / 100) rounded. |
|
423 |
||
424 |
self paint:Color white. |
|
425 |
self fillRectangleX:m y:m width:w height:h. |
|
426 |
||
427 |
showPercentage ifTrue:[ |
|
201 | 428 |
rx <= (sx+sw) ifTrue:[ |
429 |
self paint:Color black. |
|
430 |
self displayString:s x:sx y:sy. |
|
431 |
] |
|
183 | 432 |
]. |
433 |
||
434 |
self paint:fgColor. |
|
435 |
self fillRectangleX:m y:m width:rx height:h. |
|
436 |
||
437 |
showPercentage ifTrue:[ |
|
201 | 438 |
rx >= sx ifTrue:[ |
439 |
self clippingRectangle:(m@m corner:rx+1 @ h). |
|
440 |
self paint:Color white. |
|
441 |
self displayString:s x:sx y:sy. |
|
442 |
self clippingRectangle:nil |
|
443 |
] |
|
183 | 444 |
] |
445 |
! ! |
|
446 |
||
447 |
!ProgressIndicator methodsFor:'initialization'! |
|
448 |
||
449 |
initialize |
|
450 |
super initialize. |
|
451 |
viewBackground := styleSheet colorAt:'progressIndicatorViewBackground' default:Color white. |
|
452 |
fgColor := styleSheet colorAt:'progressIndicatorForegroundColor' default:Color blue. |
|
453 |
percentage := 0. |
|
454 |
showPercentage := true. |
|
455 |
! ! |
|
456 |
||
457 |
!ProgressIndicator methodsFor:'queries'! |
|
458 |
||
459 |
preferredExtent |
|
460 |
^ 100 @ (font height + font descent + ((margin + 1) * 2)) |
|
461 |
! ! |
|
462 |
||
62 | 463 |
!ProgressIndicator methodsFor:'showing progress'! |
464 |
||
465 |
connectToTop:top label:label |
|
466 |
connectedTop := top. |
|
467 |
connectedLabel := label |
|
468 |
! |
|
469 |
||
470 |
showProgressOf:aBlock |
|
471 |
"show progress, while evaluating aBlock. |
|
472 |
If the receiver has been created with inBox, show the |
|
473 |
box centered on the screen. If not, the view is assumed to |
|
474 |
be contained in another view, and no special startup actions |
|
475 |
are performed. |
|
476 |
||
477 |
The block is passed two arguments, the progressValue, |
|
478 |
which should be set to the percentage from time-to-time |
|
479 |
within the block and an action value, which should be set to |
|
480 |
the currently performed action (a string) from time to time. |
|
481 |
The second valueHolder can be left unchanged. |
|
482 |
||
483 |
Caveat: cannot (currently) suppress close of the box ..." |
|
484 |
||
219
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
485 |
|progressValue labelValue p wg| |
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
486 |
|
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
487 |
wg := WindowGroup activeGroup. |
62 | 488 |
|
489 |
progressValue := 0 asValue. |
|
490 |
labelValue := '' asValue. |
|
491 |
||
492 |
connectedLabel notNil ifTrue:[ |
|
219
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
493 |
connectedLabel |
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
494 |
model:labelValue; |
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
495 |
aspect:#value; |
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
496 |
labelMessage:#value. |
62 | 497 |
]. |
498 |
||
499 |
self model:progressValue. |
|
500 |
||
501 |
p := [ |
|
219
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
502 |
[ |
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
503 |
WindowGroup windowGroupQuerySignal handle:[:ex | |
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
504 |
ex proceedWith:wg |
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
505 |
] do:[ |
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
506 |
aBlock value:progressValue value:labelValue |
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
507 |
] |
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
508 |
] valueNowOrOnUnwindDo:[ |
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
509 |
p := nil. |
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
510 |
connectedTop notNil ifTrue:[ |
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
511 |
connectedTop hide |
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
512 |
] |
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
513 |
] |
62 | 514 |
] fork. |
515 |
||
516 |
connectedTop notNil ifTrue:[ |
|
219
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
517 |
Processor activeProcess |
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
518 |
withPriority:(Processor activePriority + 1) |
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
519 |
do:[ |
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
520 |
self topView show. |
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
521 |
]. |
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
522 |
p notNil ifTrue:[p terminate]. |
62 | 523 |
] ifFalse:[ |
219
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
524 |
self halt:'not yet implemented'. |
62 | 525 |
] |
526 |
||
527 |
||
528 |
" |
|
529 |
|p| |
|
530 |
||
531 |
p := ProgressIndicator inBox. |
|
532 |
p showProgressOf: |
|
219
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
533 |
[:progressValue :currentAction | |
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
534 |
1 to:100 do:[:percent | |
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
535 |
(Delay forSeconds:0.05) wait. |
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
536 |
progressValue value:percent |
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
537 |
]. |
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
538 |
]. |
62 | 539 |
|
540 |
'it can be reused ...'. |
|
541 |
p showProgressOf: |
|
219
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
542 |
[:progressValue :currentAction | |
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
543 |
1 to:100 by:5 do:[:percent | |
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
544 |
(Delay forSeconds:0.05) wait. |
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
545 |
progressValue value:percent |
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
546 |
]. |
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
547 |
]. |
62 | 548 |
|
549 |
" |
|
219
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
550 |
|
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
551 |
"Modified: 17.7.1996 / 20:36:51 / cg" |
62 | 552 |
! ! |
553 |
||
219
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
554 |
!ProgressIndicator class methodsFor:'documentation'! |
50 | 555 |
|
183 | 556 |
version |
219
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
557 |
^ '$Header: /cvs/stx/stx/libwidg2/ProgressIndicator.st,v 1.8 1996-07-18 11:37:32 cg Exp $' |
50 | 558 |
! ! |