1 | pro pause,up=up,xcrs=xcrs,ycrs=ycrs,on_screen=on_screen |
---|
2 | ;+ |
---|
3 | ; routine: pause |
---|
4 | ; |
---|
5 | ; useage: pause |
---|
6 | ; pause,up=up,xcrs=xcrs,ycrs=ycrs,on_screen=on_screen |
---|
7 | ; |
---|
8 | ; input: none |
---|
9 | ; |
---|
10 | ; keyword input: |
---|
11 | ; up |
---|
12 | ; if set, don't return until a upward button transition is |
---|
13 | ; detected. This is useful when pause is used between plots which |
---|
14 | ; draw quickly. Setting this keyword ensures that no plots are |
---|
15 | ; skipped but also requires that each new plot be accompanied by a |
---|
16 | ; downward and upward button transition. The default is to skip |
---|
17 | ; to the next plot as long a mouse button is pressed down. |
---|
18 | ; |
---|
19 | ; |
---|
20 | ; xcrs,ycrs |
---|
21 | ; pixel location to put cursor while waiting |
---|
22 | ; |
---|
23 | ; on_screen |
---|
24 | ; if set, don't pause if cursor not in plot window |
---|
25 | ; |
---|
26 | ; output: none |
---|
27 | ; |
---|
28 | ; PURPOSE: |
---|
29 | ; Momentarily stop execution until a mouse key is pressed. While |
---|
30 | ; in the paused state the cursor is changed to what looks like an |
---|
31 | ; arrow pointing down on a button. When any of the mouse buttons |
---|
32 | ; are pressed the cursor returns to its original form and |
---|
33 | ; execution continues. |
---|
34 | ; |
---|
35 | ; PAUSE will only interrupt execution if the output device is 'X' |
---|
36 | ; and plot system variable !p.multi(0) eq 0. The first condition |
---|
37 | ; disables PAUSE when output is directed to a postscript file. |
---|
38 | ; The second condition ensures that pauses occur only just before |
---|
39 | ; the screen is erased for a new plot. |
---|
40 | ; |
---|
41 | ; NOTE: After PAUSE returns to the calling program different |
---|
42 | ; actions can be performed depending on whether the left, middle |
---|
43 | ; or right mouse button was pressed. Just test on the !err system |
---|
44 | ; variable: !err=1 => left !err=2 => middle !err=4 => right. |
---|
45 | ; |
---|
46 | ; COMMON BLOCKS: pause_blk |
---|
47 | ; |
---|
48 | ; EXAMPLE: |
---|
49 | ; |
---|
50 | ;x=findgen(201)/10.-10. |
---|
51 | ;for a=-2.,2.,.1 do begin & plot,x,1/(x^2*10.^a+1),tit=string(a) & pause & end |
---|
52 | ; |
---|
53 | ;for a=-2.,2.,.1 do begin & plot,x,1/(x^2*10.^a+1),tit=string(a) &$ |
---|
54 | ; pause,/u & end |
---|
55 | ; |
---|
56 | ; author: Paul Ricchiazzi 22sep92 |
---|
57 | ; Institute for Computational Earth System Science |
---|
58 | ; University of California, Santa Barbara |
---|
59 | ;- |
---|
60 | |
---|
61 | |
---|
62 | if !d.name eq 'X' and !p.multi(0) eq 0 then begin |
---|
63 | cursor,xw,yw,/nowait,/device |
---|
64 | |
---|
65 | if xw eq -1 then begin |
---|
66 | if keyword_set(on_screen) then return |
---|
67 | if n_elements(xcrs) eq 0 then xcrs=.9*!d.x_vsize |
---|
68 | if n_elements(ycrs) eq 0 then ycrs=.9*!d.y_vsize |
---|
69 | tvcrs,xcrs,ycrs |
---|
70 | endif |
---|
71 | device,cursor_standard=16 |
---|
72 | cursor,xdum,ydum,/wait,/device |
---|
73 | if keyword_set(up) then cursor,xdum,ydum,/up,/device |
---|
74 | device,cursor_standard=30 |
---|
75 | endif |
---|
76 | end |
---|