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