annotate macrowin.c @ 3:5a977ccbc7a9 default tip

Empty changelog
author darius
date Sat, 06 Dec 1997 05:41:29 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1 /* $Id: macrowin.c,v 1.1.1.1 1997/12/06 05:41:29 darius Exp $ */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
3 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
4 * macrowin.c from helpwin.c
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
5 * copyright 1993 Nick Trown
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
6 * copyright 1991 ERic mehlhaff
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
7 * Free to use, hack, etc. Just keep these credits here.
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
8 * Use of this code may be dangerous to your health and/or system.
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
9 * Its use is at your own risk.
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
10 * I assume no responsibility for damages, real, potential, or imagined,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
11 * resulting from the use of it.
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
12 * Yeah.....what Eric said...
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
13 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
14 /* Modified for Paradise, 4/94 -JR */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
15
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
16 /*#include "config.h"*/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
17 #include <stdio.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
18 #include <math.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
19 #include <signal.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
20 #include <sys/types.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
21
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
22 #include <time.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
23 /*#include INC_SYS_TIME*/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
24 /*#include INC_STRINGS*/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
25
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
26 #include "Wlib.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
27 #include "defs.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
28 #include "struct.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
29 #include "data.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
30
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
31
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
32 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
33 Fills in macro window with the macros defined in the .xtrekrc.
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
34 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
35
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
36 #define NUMLINES 80
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
37
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
38 #define MAXMACRO 65
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
39 /* maximum length in characters of key explanation */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
40
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
41 #define MACROLEN 255
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
42 /* length of construction string since we don't know how long a macro can be */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
43
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
44
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
45 int lineno = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
46 char maclines[10][MAXMACRO];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
47 int maclevel = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
48 int macrocnt = 0; /* a global from COW-lite, only needed here
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
49 for Paradise. */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
50
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
51 int
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
52 formatline(line)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
53 char *line;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
54 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
55 register int end;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
56 char *temp;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
57 int num = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
58
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
59 if (!line)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
60 return 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
61 if (strlen(line) <= MAXMACRO) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
62 strncpy(maclines[num], line, sizeof(maclines[0]));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
63 lineno++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
64 return 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
65 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
66 temp = line;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
67 while (1) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
68 end = MAXMACRO - 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
69 if (end > strlen(temp)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
70 lineno++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
71 strncpy(maclines[num++], temp, sizeof(maclines[0]));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
72 return (num);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
73 } else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
74 for (; temp[end] != '%'; end--);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
75
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
76 lineno++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
77 strncpy(maclines[num++], temp, end);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
78
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
79 temp = temp + end;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
80 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
81 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
82
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
83
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
84 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
85 filldist(fill)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
86 int fill;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
87 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
88 register int i;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
89 register int row;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
90 register int c;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
91 int num;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
92 char key[3];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
93
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
94 lineno = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
95 for (i = 1, row = 5; distmacro[i].macro != '\0'; i++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
96 if (fill) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
97 if (distmacro[i].c < 128)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
98 sprintf(key, " %c", distmacro[i].c);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
99 else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
100 sprintf(key, "^%c", distmacro[i].c - 128);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
101 sprintf(maclines[0], "%-8s %s",
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
102 key,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
103 distmacro[i].name);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
104 W_WriteText(macroWin, 2, row++, W_Yellow, maclines[0],
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
105 strlen(maclines[0]), W_RegularFont);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
106 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
107 lineno++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
108 num = formatline(distmacro[i].macro);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
109 if (fill) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
110 for (c = 0; c < num; c++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
111 W_WriteText(macroWin, 8, row++, textColor, maclines[c],
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
112 strlen(maclines[c]), W_RegularFont);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
113 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
114 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
115 if (lineno > NUMLINES)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
116 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
117 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
118 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
119
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
120
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
121
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
122 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
123 fillmacro()
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
124 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
125 register int row, i;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
126 char macromessage[MACROLEN];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
127 struct macro *m;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
128
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
129 W_ClearWindow(macroWin);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
130 sprintf(macromessage, "Packages active: %s%s",
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
131 (F_UseNewMacro ? ", NEWMACRO" : ""),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
132 (F_gen_distress ? ", RCD" : ""));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
133 /* (UseSmartMacro ? ", SMARTMACRO" : "")); */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
134
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
135 W_WriteText(macroWin, 2, 1, textColor,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
136 macromessage, strlen(macromessage), W_RegularFont);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
137
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
138 sprintf(macromessage, "Currently showing: %s",
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
139 (maclevel ? "Macros" : "RCDS"));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
140
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
141 W_WriteText(macroWin, 2, 2, textColor,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
142 macromessage, strlen(macromessage), W_RegularFont);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
143
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
144
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
145 if (maclevel == 0) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
146 W_WriteText(macroWin, 2, 4, W_Yellow,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
147 "Key Distress Name", 21, W_RegularFont);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
148 filldist(1);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
149 return;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
150 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
151 /* 4 column macro window. This may be changed depending on font size */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
152 for (row = 4, i = 0; i < 256; i++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
153 for (m = macrotable[i]; m; m = m->next, row++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
154 if (m->flags & MACRCD)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
155 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
156 if (i <= 128)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
157 sprintf(macromessage, "%c ", i);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
158 else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
159 sprintf(macromessage, "^%c", i - 128);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
160 #ifdef NEWMOUSE
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
161 if (macro[i].type == NEWMMOUSE) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
162 switch (macro[i].who) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
163 case MACRO_PLAYER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
164 strcat(macromessage, " PL MS ");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
165 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
166 case MACRO_TEAM:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
167 strcat(macromessage, " TM MS ");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
168 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
169 default:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
170 strcat(macromessage, " SELF ");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
171 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
172 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
173 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
174 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
175 switch (m->to) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
176 case 'T':
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
177 strcat(macromessage, " TEAM ");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
178 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
179 case 'A':
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
180 strcat(macromessage, " ALL ");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
181 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
182 case 'F':
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
183 strcat(macromessage, " FED ");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
184 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
185 case 'R':
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
186 strcat(macromessage, " ROM ");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
187 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
188 case 'K':
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
189 strcat(macromessage, " KLI ");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
190 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
191 case 'O':
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
192 strcat(macromessage, " ORI ");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
193 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
194 #ifdef MOO
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
195 case 'M':
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
196 strcat(macromessage, " MOO ");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
197 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
198 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
199 #ifdef TOOLS
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
200 case '!':
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
201 strcat(macromessage, " SHELL ");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
202 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
203 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
204 #ifdef NEWMACRO
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
205 case '\0':
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
206 strcat(macromessage, " SPEC ");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
207 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
208 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
209 case -1:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
210 switch (m->specialto) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
211 case 'I':
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
212 case 'C':
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
213 strcat(macromessage, " SELF ");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
214 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
215 case 'U':
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
216 case 'P':
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
217 strcat(macromessage, " PL MS ");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
218 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
219 case 'T':
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
220 case 'Z':
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
221 strcat(macromessage, " TM MS ");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
222 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
223 case 'G':
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
224 strcat(macromessage, " NR FR ");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
225 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
226 case 'H':
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
227 strcat(macromessage, " NR EN ");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
228 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
229 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
230 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
231 case -2:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
232 strcat(macromessage, " QUERY ");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
233 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
234 default:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
235 strcat(macromessage, " ---- ");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
236 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
237 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
238
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
239 #ifdef NEWMOUSE
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
240 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
241 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
242 strcat(macromessage, m->string);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
243 macromessage[MAXMACRO] = '\0';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
244 W_WriteText(macroWin, 2, row, textColor,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
245 macromessage, strlen(macromessage), W_RegularFont);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
246 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
247 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
248 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
249
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
250 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
251 switchmacros()
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
252 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
253 int num, i;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
254 struct macro *m;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
255
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
256 if (!macroWin)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
257 return; /* paranoia? */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
258
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
259 maclevel = abs(maclevel - 1);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
260
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
261 if (maclevel == 0) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
262 lineno = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
263 filldist(0);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
264 num = lineno + 5;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
265 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
266 for (i = 0, macrocnt = 0; i < 256; i++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
267 for (m = macrotable[i]; m; m = m->next) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
268 if (m->flags & MACRCD)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
269 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
270 macrocnt++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
271 #if 0
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
272 len = strlen(m->string);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
273 while (len > 0) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
274 totmacros++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
275 len -= 70;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
276 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
277 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
278 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
279 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
280 num = macrocnt + 5;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
281 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
282 W_ResizeText(macroWin, 80, num);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
283 #if 0
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
284 W_SetWindowExposeHandler(macroWin, fillmacro);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
285 W_SetWindowButtonHandler(macroWin, switchmacros);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
286 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
287 W_MapWindow(macroWin);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
288 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
289
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
290
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
291
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
292 void showMacroWin()
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
293 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
294 int num, i;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
295 struct macro *m;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
296
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
297 if (!macroWin) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
298 if (maclevel == 0) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
299 lineno = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
300 filldist(0);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
301 num = lineno + 5;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
302 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
303 for (i = 0, macrocnt = 0; i < 256; i++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
304 for (m = macrotable[i]; m; m = m->next) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
305 if (m->flags & MACRCD)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
306 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
307 macrocnt++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
308 #if 0
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
309 len = strlen(m->string);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
310 while (len > 0) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
311 totmacros++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
312 len -= 70;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
313 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
314 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
315 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
316 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
317 num = macrocnt + 5;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
318 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
319
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
320 macroWin = W_MakeTextWindow("macrow", WINSIDE + BORDER, BORDER,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
321 80, num, NULL, (char*)0, BORDER);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
322
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
323 W_ResizeText(macroWin, 80, num);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
324 #if 0
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
325 W_DefineTrekCursor(macroWin);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
326 W_SetWindowExposeHandler(macroWin, fillmacro);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
327 W_SetWindowButtonHandler(macroWin, switchmacros);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
328 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
329 W_MapWindow(macroWin);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
330 } else if (W_IsMapped(macroWin)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
331 W_DestroyWindow(macroWin);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
332 macroWin = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
333 } else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
334 W_MapWindow(macroWin);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
335 }