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
|
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
include <ctotok.h>
include <ctype.h>
include "../lib/ids.h"
# TEXT -- put text into image planes or graphics bit planes
procedure text()
char token[SZ_LINE]
int tok, ip, cnum
short frames[IDS_MAXIMPL+2] # frames, graphics, EOD
short colors[IDS_MAXGCOLOR]
real x, y
int button, cv_wtbut()
char line[SZ_LINE]
real size, clgetr()
begin
frames[1] = ERR
colors[1] = ERR
# which frames for text
call gargtok (tok, token, SZ_LINE)
call strlwr (token)
if (tok == TOK_IDENTIFIER) {
if (token[1] == 'f') {
call cv_frame (token[2], frames)
if (frames[1] == ERR)
return
} else if (token[1] == 'c') {
call cv_color (token[2], colors)
if (colors[1] == ERR)
return
}
} else if (tok == TOK_NUMBER) {
call cv_frame (token[1], frames)
if (frames[1] == ERR)
return
}
if ( (frames[1] == ERR) && (colors[1] == ERR)) {
call eprintf ("Inadequate text specification: %s\n")
call pargstr (token)
return
}
call gargstr (line, SZ_LINE)
# Prompt user to set cursor
call eprintf ("Set cursor to desired location, then press any button\n")
button = cv_wtbut()
# Set up kernel for write
if (frames[1] != ERR) {
cnum = frames[1]
call cv_iset (frames)
} else {
cnum = 16 # SORRY, is IIS specific - we should do better
call cv_gset (colors)
}
call cv_rcur (cnum, x, y)
size = clgetr("textsize")
ip = 1
while (IS_WHITE(line[ip]))
ip = ip + 1
call cvtext (x, y, line[ip], size)
end
|