1 #include <stdlib.h>
2 #include <stdio.h>
3 #include <conio.h>
4 #include <math.h>
5 #include <dos.h>
6 #include <string.h>
7 #include <direct.h>
8 
9 
10 #include "fix.h"
11 #include "types.h"
12 #include "gr.h"
13 #include "key.h"
14 
15 #include "mono.h"
16 
17 #include "ui.h"
18 
19 #include "mem.h"
20 //#include "cflib.h"
21 #include "func.h"
22 #include "error.h"
23 
24 #define MAX_NUM_PADS 20
25 
26 static UI_GADGET_BUTTON * Pad[17];
27 static UI_KEYPAD * KeyPad[MAX_NUM_PADS];
28 static int active_pad;
29 
30 static int desc_x, desc_y;
31 
32 static int HotKey[17];
33 static int HotKey1[17];
34 
35 #define REMOVE_EOL(s)     (*(strstr( (s), "\n" ))='\0')
36 
ui_pad_get_current()37 int ui_pad_get_current()
38 {
39 	return active_pad;
40 }
41 
ui_pad_init()42 void ui_pad_init()
43 {
44 	int i;
45 
46 	for (i=0; i< MAX_NUM_PADS; i++ )
47 		KeyPad[i] = NULL;
48 
49 	active_pad = -1;
50 }
51 
ui_pad_close()52 void ui_pad_close()
53 {
54 	int i, j;
55 
56 	for (i=0; i< MAX_NUM_PADS; i++ )
57 		if (KeyPad[i])
58 		{
59 			for (j=0; j<17; j++ )
60 				free(KeyPad[i]->buttontext[j]);
61 			free( KeyPad[i] );
62 			KeyPad[i] = NULL;
63 		}
64 
65 }
66 
67 
LineParse(int n,char * dest,char * source)68 void LineParse( int n, char * dest, char * source )
69 {
70 	int i = 0, j=0, cn = 0;
71 
72 	// Go to the n'th line
73 	while (cn < n )
74 		if (source[i++] == 179 )
75 			cn++;
76 
77 	// Read up until the next comma
78 	while ( source[i] != 179 )
79 	{
80 		dest[j] = source[i++];
81 		j++;
82 	}
83 
84 	// Null-terminate
85 	dest[j++] = 0;
86 }
87 
ui_pad_activate(UI_WINDOW * wnd,int x,int y)88 void ui_pad_activate( UI_WINDOW * wnd, int x, int y )
89 {
90 	int w,h,row,col, n;
91 	int bh, bw;
92 
93 	bw = 56; bh = 30;
94 
95 	gr_set_current_canvas( wnd->canvas );
96 	ui_draw_box_in( x, y, x+(bw*4)+10 + 200, y+(bh*5)+45 );
97 
98 	x += 5;
99 	y += 20;
100 
101 	desc_x = x+2;
102 	desc_y = y-17;
103 
104 	n=0; row = 0; col = 0; w = 1; h = 1;
105 	Pad[n] = ui_add_gadget_button( wnd, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
106 	Pad[n]->canvas->cv_font = ui_small_font;
107 	n=1; row = 0; col = 1; w = 1; h = 1;
108 	Pad[n] = ui_add_gadget_button( wnd, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
109 	Pad[n]->canvas->cv_font = ui_small_font;
110 	n=2; row = 0; col = 2; w = 1; h = 1;
111 	Pad[n] = ui_add_gadget_button( wnd, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
112 	Pad[n]->canvas->cv_font = ui_small_font;
113 	n=3; row = 0; col = 3; w = 1; h = 1;
114 	Pad[n] = ui_add_gadget_button( wnd, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
115 	Pad[n]->canvas->cv_font = ui_small_font;
116 	n=4; row = 1; col = 0; w = 1; h = 1;
117 	Pad[n] = ui_add_gadget_button( wnd, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
118 	Pad[n]->canvas->cv_font = ui_small_font;
119 	n=5; row = 1; col = 1; w = 1; h = 1;
120 	Pad[n] = ui_add_gadget_button( wnd, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
121 	Pad[n]->canvas->cv_font = ui_small_font;
122 	n=6; row = 1; col = 2; w = 1; h = 1;
123 	Pad[n] = ui_add_gadget_button( wnd, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
124 	Pad[n]->canvas->cv_font = ui_small_font;
125 	n=7; row = 1; col = 3; w = 1; h = 2;
126 	Pad[n] = ui_add_gadget_button( wnd, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
127 	Pad[n]->canvas->cv_font = ui_small_font;
128 	n=8; row = 2; col = 0; w = 1; h = 1;
129 	Pad[n] = ui_add_gadget_button( wnd, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
130 	Pad[n]->canvas->cv_font = ui_small_font;
131 	n=9; row = 2; col = 1; w = 1; h = 1;
132 	Pad[n] = ui_add_gadget_button( wnd, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
133 	Pad[n]->canvas->cv_font = ui_small_font;
134 	n=10; row = 2; col = 2; w = 1; h = 1;
135 	Pad[n] = ui_add_gadget_button( wnd, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
136 	Pad[n]->canvas->cv_font = ui_small_font;
137 	n=11; row = 3; col = 0; w = 1; h = 1;
138 	Pad[n] = ui_add_gadget_button( wnd, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
139 	Pad[n]->canvas->cv_font = ui_small_font;
140 	n=12; row = 3; col = 1; w = 1; h = 1;
141 	Pad[n] = ui_add_gadget_button( wnd, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
142 	Pad[n]->canvas->cv_font = ui_small_font;
143 	n=13; row = 3; col = 2; w = 1; h = 1;
144 	Pad[n] = ui_add_gadget_button( wnd, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
145 	Pad[n]->canvas->cv_font = ui_small_font;
146 	n=14; row = 3; col = 3; w = 1; h = 2;
147 	Pad[n] = ui_add_gadget_button( wnd, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
148 	Pad[n]->canvas->cv_font = ui_small_font;
149 	n=15; row = 4; col = 0; w = 2; h = 1;
150 	Pad[n] = ui_add_gadget_button( wnd, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
151 	Pad[n]->canvas->cv_font = ui_small_font;
152 	n=16; row = 4; col = 2; w = 1; h = 1;
153 	Pad[n] = ui_add_gadget_button( wnd, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
154 	Pad[n]->canvas->cv_font = ui_small_font;
155 
156 	HotKey[0] = KEY_CTRLED + KEY_NUMLOCK;
157 	HotKey[1] = KEY_CTRLED + KEY_PADDIVIDE;
158 	HotKey[2] = KEY_CTRLED + KEY_PADMULTIPLY;
159 	HotKey[3] = KEY_CTRLED + KEY_PADMINUS;
160 	HotKey[4] = KEY_CTRLED + KEY_PAD7;
161 	HotKey[5] = KEY_CTRLED + KEY_PAD8;
162 	HotKey[6] = KEY_CTRLED + KEY_PAD9;
163 	HotKey[7] = KEY_CTRLED + KEY_PADPLUS;
164 	HotKey[8] = KEY_CTRLED + KEY_PAD4;
165 	HotKey[9] = KEY_CTRLED + KEY_PAD5;
166 	HotKey[10] = KEY_CTRLED + KEY_PAD6;
167 	HotKey[11] = KEY_CTRLED + KEY_PAD1;
168 	HotKey[12] = KEY_CTRLED + KEY_PAD2;
169 	HotKey[13] = KEY_CTRLED + KEY_PAD3;
170 	HotKey[14] = KEY_CTRLED + KEY_PADENTER;
171 	HotKey[15] = KEY_CTRLED + KEY_PAD0;
172 	HotKey[16] = KEY_CTRLED + KEY_PADPERIOD;
173 
174 	HotKey1[0] = KEY_SHIFTED + KEY_CTRLED + KEY_NUMLOCK;
175 	HotKey1[1] = KEY_SHIFTED + KEY_CTRLED + KEY_PADDIVIDE;
176 	HotKey1[2] = KEY_SHIFTED + KEY_CTRLED + KEY_PADMULTIPLY;
177 	HotKey1[3] = KEY_SHIFTED + KEY_CTRLED + KEY_PADMINUS;
178 	HotKey1[4] = KEY_SHIFTED + KEY_CTRLED + KEY_PAD7;
179 	HotKey1[5] = KEY_SHIFTED + KEY_CTRLED + KEY_PAD8;
180 	HotKey1[6] = KEY_SHIFTED + KEY_CTRLED + KEY_PAD9;
181 	HotKey1[7] = KEY_SHIFTED + KEY_CTRLED + KEY_PADPLUS;
182 	HotKey1[8] = KEY_SHIFTED + KEY_CTRLED + KEY_PAD4;
183 	HotKey1[9] = KEY_SHIFTED + KEY_CTRLED + KEY_PAD5;
184 	HotKey1[10] = KEY_SHIFTED + KEY_CTRLED + KEY_PAD6;
185 	HotKey1[11] = KEY_SHIFTED + KEY_CTRLED + KEY_PAD1;
186 	HotKey1[12] = KEY_SHIFTED + KEY_CTRLED + KEY_PAD2;
187 	HotKey1[13] = KEY_SHIFTED + KEY_CTRLED + KEY_PAD3;
188 	HotKey1[14] = KEY_SHIFTED + KEY_CTRLED + KEY_PADENTER;
189 	HotKey1[15] = KEY_SHIFTED + KEY_CTRLED + KEY_PAD0;
190 	HotKey1[16] = KEY_SHIFTED + KEY_CTRLED + KEY_PADPERIOD;
191 
192 	active_pad = -1;
193 
194 }
195 
196 
ui_pad_deactivate()197 void ui_pad_deactivate()
198 {
199 	int i;
200 
201 	for (i=0; i<17; i++ )
202 	{
203 		Pad[i]->text = NULL;
204 	}
205 }
206 
ui_pad_set_active(int n)207 static void ui_pad_set_active( int n )
208 {
209 	int np;
210 	char * name;
211 	int i, j;
212 
213 
214 
215 	gr_set_current_canvas( NULL );
216 	gr_setcolor( CWHITE );
217 	gr_urect( desc_x, desc_y, desc_x+ 56*4-1, desc_y+15 );
218 	gr_set_fontcolor( CBLACK, CWHITE );
219 	gr_ustring( desc_x, desc_y, KeyPad[n]->description );
220 
221 	for (i=0; i<17; i++ )
222 	{
223 		Pad[i]->text = KeyPad[n]->buttontext[i];
224 		Pad[i]->status = 1;
225 		Pad[i]->user_function = NULL;
226 		Pad[i]->dim_if_no_function = 1;
227 		Pad[i]->hotkey = -1;
228 
229 		for (j=0; j< KeyPad[n]->numkeys; j++ )
230 		{
231 			if (HotKey[i] == KeyPad[n]->keycode[j] )
232 			{
233 				Pad[i]->hotkey =  HotKey[i];
234 				Pad[i]->user_function = func_nget( KeyPad[n]->function_number[j], &np, &name );
235 			}
236 			if (HotKey1[i] == KeyPad[n]->keycode[j] )
237 			{
238 				Pad[i]->hotkey1 =  HotKey1[i];
239 				Pad[i]->user_function1 = func_nget( KeyPad[n]->function_number[j], &np, &name );
240 			}
241 		}
242 	}
243 
244 	active_pad = n;
245 }
246 
ui_pad_goto(int n)247 void ui_pad_goto(int n)
248 {
249 	if ( KeyPad[n] != NULL )
250 		ui_pad_set_active(n);
251 }
252 
ui_pad_goto_next()253 void ui_pad_goto_next()
254 {
255 	int i, si;
256 
257 	i = active_pad + 1;
258 	si = i;
259 
260 	while( KeyPad[i]==NULL )
261 	{
262 		i++;
263 		if (i >= MAX_NUM_PADS)
264 			i = 0;
265 		if (i == si )
266 			break;
267 	}
268 	ui_pad_set_active(i);
269 }
270 
ui_pad_goto_prev()271 void ui_pad_goto_prev()
272 {
273 	int i, si;
274 
275 	if (active_pad == -1 )
276 		active_pad = MAX_NUM_PADS;
277 
278 	i = active_pad - 1;
279 	if (i<0) i= MAX_NUM_PADS - 1;
280 	si = i;
281 
282 	while( KeyPad[i]==NULL )
283 	{
284 		i--;
285 		if (i < 0)
286 			i = MAX_NUM_PADS-1;
287 		if (i == active_pad )
288 			break;
289 	}
290 	ui_pad_set_active(i);
291 }
292 
ui_pad_read(int n,char * filename)293 void ui_pad_read( int n, char * filename )
294 {
295 	char * ptr;
296 	char buffer[100];
297 	char text[100];
298 	FILE * infile;
299 	int linenumber = 0;
300 	int i;
301 	int keycode, functionnumber;
302 
303 	infile = fopen( filename, "rt" );
304 	if (!infile) {
305 		Warning( "Couldn't find %s", filename );
306 		return;
307 	}
308 
309 	MALLOC( KeyPad[n], UI_KEYPAD, 1 );
310 
311 	for (i=0; i < 17; i++ ) {
312 		MALLOC( KeyPad[n]->buttontext[i], char, 100 );
313 	}
314 
315 	KeyPad[n]->numkeys = 0;
316 
317 	for (i=0; i<100; i++ )
318 	{
319 		KeyPad[n]->keycode[i] = -1;
320 		KeyPad[n]->function_number[i] = 0;
321 	}
322 
323 	while ( linenumber < 22)
324 	{
325 		fgets( buffer, 100, infile );
326 		REMOVE_EOL( buffer );
327 
328 		switch( linenumber+1 )
329 		{
330 		case 1:
331 			strncpy( KeyPad[n]->description, buffer, 100 );
332 			break;
333 		//===================== ROW 0 ==============================
334 		case 3:
335 			LineParse( 1, text, buffer );
336 			sprintf( KeyPad[n]->buttontext[0], "%s\n", text );
337 			LineParse( 2, text, buffer );
338 			sprintf( KeyPad[n]->buttontext[1], "%s\n", text );
339 			LineParse( 3, text, buffer );
340 			sprintf( KeyPad[n]->buttontext[2], "%s\n", text );
341 			LineParse( 4, text, buffer );
342 			sprintf( KeyPad[n]->buttontext[3], "%s\n", text );
343 			break;
344 		case 4:
345 			LineParse( 1, text, buffer );
346 			sprintf( KeyPad[n]->buttontext[0], "%s%s\n", KeyPad[n]->buttontext[0],text );
347 			LineParse( 2, text, buffer );
348 			sprintf( KeyPad[n]->buttontext[1], "%s%s\n", KeyPad[n]->buttontext[1],text );
349 			LineParse( 3, text, buffer );
350 			sprintf( KeyPad[n]->buttontext[2], "%s%s\n", KeyPad[n]->buttontext[2],text );
351 			LineParse( 4, text, buffer );
352 			sprintf( KeyPad[n]->buttontext[3], "%s%s\n", KeyPad[n]->buttontext[3],text );
353 			break;
354 		case 5:
355 			LineParse( 1, text, buffer );
356 			sprintf( KeyPad[n]->buttontext[0], "%s%s", KeyPad[n]->buttontext[0],text );
357 			LineParse( 2, text, buffer );
358 			sprintf( KeyPad[n]->buttontext[1], "%s%s", KeyPad[n]->buttontext[1],text );
359 			LineParse( 3, text, buffer );
360 			sprintf( KeyPad[n]->buttontext[2], "%s%s", KeyPad[n]->buttontext[2],text );
361 			LineParse( 4, text, buffer );
362 			sprintf( KeyPad[n]->buttontext[3], "%s%s", KeyPad[n]->buttontext[3],text );
363 			break;
364 		//===================== ROW 1 ==============================
365 		case 7:
366 			LineParse( 1, text, buffer );
367 			sprintf( KeyPad[n]->buttontext[4], "%s\n", text );
368 			LineParse( 2, text, buffer );
369 			sprintf( KeyPad[n]->buttontext[5], "%s\n", text );
370 			LineParse( 3, text, buffer);
371 			sprintf( KeyPad[n]->buttontext[6], "%s\n", text );
372 			LineParse( 4, text, buffer );
373 			sprintf( KeyPad[n]->buttontext[7], "%s\n", text );
374 			break;
375 		case 8:
376 			LineParse( 1, text, buffer );
377 			sprintf( KeyPad[n]->buttontext[4], "%s%s\n", KeyPad[n]->buttontext[4],text );
378 			LineParse( 2, text, buffer );
379 			sprintf( KeyPad[n]->buttontext[5], "%s%s\n", KeyPad[n]->buttontext[5],text );
380 			LineParse( 3, text, buffer );
381 			sprintf( KeyPad[n]->buttontext[6], "%s%s\n", KeyPad[n]->buttontext[6],text );
382 			LineParse( 4, text, buffer );
383 			sprintf( KeyPad[n]->buttontext[7], "%s%s\n", KeyPad[n]->buttontext[7],text );
384 			break;
385 		case 9:
386 			LineParse( 1, text, buffer );
387 			sprintf( KeyPad[n]->buttontext[4], "%s%s", KeyPad[n]->buttontext[4],text );
388 			LineParse( 2, text, buffer );
389 			sprintf( KeyPad[n]->buttontext[5], "%s%s", KeyPad[n]->buttontext[5],text );
390 			LineParse( 3, text, buffer );
391 			sprintf( KeyPad[n]->buttontext[6], "%s%s", KeyPad[n]->buttontext[6],text );
392 			LineParse( 4, text, buffer );
393 			sprintf( KeyPad[n]->buttontext[7], "%s%s\n", KeyPad[n]->buttontext[7],text );
394 			break;
395 		case 10:
396 			ptr = strrchr( buffer, 179 );
397 			*ptr = 0;
398 			ptr = strrchr( buffer, 180 );	ptr++;
399 			sprintf( KeyPad[n]->buttontext[7], "%s%s\n", KeyPad[n]->buttontext[7],ptr );
400 			break;
401 		//======================= ROW 2 ==============================
402 		case 11:
403 			LineParse( 1, text, buffer );
404 			sprintf( KeyPad[n]->buttontext[8], "%s\n", text );
405 			LineParse( 2, text, buffer );
406 			sprintf( KeyPad[n]->buttontext[9], "%s\n", text );
407 			LineParse( 3, text, buffer);
408 			sprintf( KeyPad[n]->buttontext[10], "%s\n", text );
409 			LineParse( 4, text, buffer );
410 			sprintf( KeyPad[n]->buttontext[7], "%s%s\n", KeyPad[n]->buttontext[7],text );
411 			break;
412 		case 12:
413 			LineParse( 1, text, buffer );
414 			sprintf( KeyPad[n]->buttontext[8], "%s%s\n", KeyPad[n]->buttontext[8],text );
415 			LineParse( 2, text, buffer );
416 			sprintf( KeyPad[n]->buttontext[9], "%s%s\n", KeyPad[n]->buttontext[9],text );
417 			LineParse( 3, text, buffer );
418 			sprintf( KeyPad[n]->buttontext[10], "%s%s\n", KeyPad[n]->buttontext[10],text );
419 			LineParse( 4, text, buffer );
420 			sprintf( KeyPad[n]->buttontext[7], "%s%s\n", KeyPad[n]->buttontext[7],text );
421 			break;
422 		case 13:
423 			LineParse( 1, text, buffer );
424 			sprintf( KeyPad[n]->buttontext[8], "%s%s", KeyPad[n]->buttontext[8],text );
425 			LineParse( 2, text, buffer );
426 			sprintf( KeyPad[n]->buttontext[9], "%s%s", KeyPad[n]->buttontext[9],text );
427 			LineParse( 3, text, buffer );
428 			sprintf( KeyPad[n]->buttontext[10], "%s%s", KeyPad[n]->buttontext[10],text );
429 			LineParse( 4, text, buffer );
430 			sprintf( KeyPad[n]->buttontext[7], "%s%s", KeyPad[n]->buttontext[7],text );
431 			break;
432 		// ====================== ROW 3 =========================
433 		case 15:
434 			LineParse( 1, text, buffer );
435 			sprintf( KeyPad[n]->buttontext[11], "%s\n", text );
436 			LineParse( 2, text, buffer );
437 			sprintf( KeyPad[n]->buttontext[12], "%s\n", text );
438 			LineParse( 3, text, buffer);
439 			sprintf( KeyPad[n]->buttontext[13], "%s\n", text );
440 			LineParse( 4, text, buffer );
441 			sprintf( KeyPad[n]->buttontext[14], "%s\n", text );
442 			break;
443 		case 16:
444 			LineParse( 1, text, buffer );
445 			sprintf( KeyPad[n]->buttontext[11], "%s%s\n", KeyPad[n]->buttontext[11],text );
446 			LineParse( 2, text, buffer );
447 			sprintf( KeyPad[n]->buttontext[12], "%s%s\n", KeyPad[n]->buttontext[12],text );
448 			LineParse( 3, text, buffer );
449 			sprintf( KeyPad[n]->buttontext[13], "%s%s\n", KeyPad[n]->buttontext[13],text );
450 			LineParse( 4, text, buffer );
451 			sprintf( KeyPad[n]->buttontext[14], "%s%s\n", KeyPad[n]->buttontext[14],text );
452 			break;
453 		case 17:
454 			LineParse( 1, text, buffer );
455 			sprintf( KeyPad[n]->buttontext[11], "%s%s", KeyPad[n]->buttontext[11],text );
456 			LineParse( 2, text, buffer );
457 			sprintf( KeyPad[n]->buttontext[12], "%s%s", KeyPad[n]->buttontext[12],text );
458 			LineParse( 3, text, buffer );
459 			sprintf( KeyPad[n]->buttontext[13], "%s%s", KeyPad[n]->buttontext[13],text );
460 			LineParse( 4, text, buffer );
461 			sprintf( KeyPad[n]->buttontext[14], "%s%s\n", KeyPad[n]->buttontext[14],text );
462 			break;
463 		case 18:
464 			ptr = strrchr( buffer, 179 );
465 			*ptr = 0;
466 			ptr = strrchr( buffer, 180 ); ptr++;
467 			sprintf( KeyPad[n]->buttontext[14], "%s%s\n", KeyPad[n]->buttontext[14], ptr );
468 			break;
469 		//======================= ROW 4 =========================
470 		case 19:
471 			LineParse( 1, text, buffer );
472 			sprintf( KeyPad[n]->buttontext[15], "%s\n", text );
473 			LineParse( 2, text, buffer );
474 			sprintf( KeyPad[n]->buttontext[16], "%s\n", text );
475 			LineParse( 3, text, buffer );
476 			sprintf( KeyPad[n]->buttontext[14], "%s%s\n", KeyPad[n]->buttontext[14],text );
477 			break;
478 		case 20:
479 			LineParse( 1, text, buffer );
480 			sprintf( KeyPad[n]->buttontext[15], "%s%s\n", KeyPad[n]->buttontext[15],text );
481 			LineParse( 2, text, buffer );
482 			sprintf( KeyPad[n]->buttontext[16], "%s%s\n", KeyPad[n]->buttontext[16],text );
483 			LineParse( 3, text, buffer );
484 			sprintf( KeyPad[n]->buttontext[14], "%s%s\n", KeyPad[n]->buttontext[14],text );
485 			break;
486 		case 21:
487 			LineParse( 1, text, buffer );
488 			sprintf( KeyPad[n]->buttontext[15], "%s%s", KeyPad[n]->buttontext[15],text );
489 			LineParse( 2, text, buffer );
490 			sprintf( KeyPad[n]->buttontext[16], "%s%s", KeyPad[n]->buttontext[16],text );
491 			LineParse( 3, text, buffer );
492 			sprintf( KeyPad[n]->buttontext[14], "%s%s", KeyPad[n]->buttontext[14],text );
493 			break;
494 		}
495 
496 		linenumber++;
497 	}
498 
499 	// Get the keycodes...
500 
501 	while (fscanf( infile, " %s %s ", text, buffer )!=EOF)
502 	{
503 		keycode = DecodeKeyText(text);
504 		functionnumber = func_get_index(buffer);
505 		if (functionnumber==-1)
506 		{
507 			Error( "Unknown function, %s, in %s\n", buffer, filename );
508 		} else if (keycode==-1)
509 		{
510 			Error( "Unknown keystroke, %s, in %s\n", text, filename );
511 			//MessageBox( -2, -2, 1, buffer, "Ok" );
512 
513 		} else {
514 			KeyPad[n]->keycode[KeyPad[n]->numkeys] = keycode;
515 			KeyPad[n]->function_number[KeyPad[n]->numkeys] = functionnumber;
516 			KeyPad[n]->numkeys++;
517 		}
518 	}
519 
520 	fclose(infile);
521 
522 }
523 
524 
525 
526 
527 
528 
529 
530 
531 
532 
533 
534 
535 
536 
537 /*
538 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
539 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
540 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
541 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
542 IN USING, DISPLAYING,  AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
543 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
544 FREE PURPOSES.  IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
545 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES.  THE END-USER UNDERSTANDS
546 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
547 COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
548 */
549 
550