aboutsummaryrefslogtreecommitdiff
path: root/pkg/images/tv/iis/ids/testcode/zmin.x
blob: 676a72f0a4d7148aa315b1a5d1785057328c6ba1 (plain) (blame)
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
77
78
79
80
81
82
83
84
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

include <error.h>
include <fio.h>
include <fset.h>
include "ids.h"
include <gki.h>
include <gset.h>

define	DIM	512
define	MCXSCALE	64
define	MCYSCALE	64

# zoom

procedure t_im()

pointer	gp
char	device[SZ_FNAME]

pointer	gopen()
int	dd[LEN_GKIDD]

short	i,data[DIM+1]
short	set_image[6]
int	key
real	x[30],y[30]
real	xjunk, yjunk

begin
	call clgstr("device", device, SZ_FNAME)
	call ids_open (device, dd)
	call gki_inline_kernel (STDIMAGE, dd)
	gp = gopen ( device, NEW_FILE, STDIMAGE)

	call fseti (STDIMAGE, F_TYPE, SPOOL_FILE)
	call fseti (STDIMAGE, F_CANCEL, OK)
	call ids_grstream (STDIMAGE)

	# now zoom after reading button presses
	# read first to clear box
	call gseti(gp, G_CURSOR, IDS_BUT_RD)
	call ggcur(gp, xjunk, yjunk, key)

	for ( i = 1 ; i < 5 ; i = i + 1) {
	    call gseti (gp, G_CURSOR, IDS_BUT_WT)
	    call ggcur(gp, xjunk, yjunk, key)
	    call gseti (gp, G_CURSOR, 1)
	    call rpc(gp, xjunk, yjunk, key)

	    data[11] = IDS_ZOOM
	    data[12] = IDS_WRITE
	    data[13] = 3
	    data[14] = IDS_EOD
	    data[15] = IDS_EOD
	    data[16] = 0
	    data[17] = 4
	    data[18] = min(((i-1)* 128) * MCXSCALE, GKI_MAXNDC)
	    data[19] = min(((i-1)* 128) * MCYSCALE, GKI_MAXNDC)
	    call gescape ( gp, IDS_CONTROL, data[11], 9)
	}

	# all done
	call gclose ( gp )
	call ids_close
end

# rpcursor --- read and print cursor

procedure rpc(gp, sx, sy, key)

pointer	gp
real	sx,sy
int 	key

begin
	call ggcur (gp, sx, sy, key)
	call eprintf("cursor: (%f,%f) (%d,%d) key %d\n")
	    call pargr (sx)
	    call pargr (sy)
	    call pargi ( int(sx*32767)/64)
	    call pargi ( int(sy*32767)/64)
	    call pargi (key)
end