2 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
3 SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
4 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
5 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
6 IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
7 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
8 FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
9 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
10 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
11 COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
34 #define MAX_NUM_PADS 20
36 static UI_GADGET_BUTTON * Pad[17];
37 static UI_KEYPAD * KeyPad[MAX_NUM_PADS];
38 static int active_pad;
40 static int desc_x, desc_y;
42 static int HotKey[17];
43 static int HotKey1[17];
45 #define REMOVE_EOL(s) (*(strstr( (s), "\n" ))='\0')
47 int ui_pad_get_current()
56 for (i=0; i< MAX_NUM_PADS; i++ )
66 for (i=0; i< MAX_NUM_PADS; i++ )
70 d_free(KeyPad[i]->buttontext[j]);
78 void LineParse( int n, char * dest, char * source )
80 int i = 0, j=0, cn = 0;
82 // Go to the n'th line
84 if ((unsigned char) source[i++] == 179)
87 // Read up until the next comma
88 while ((unsigned char) source[i] != 179)
90 dest[j] = source[i++];
98 void ui_pad_activate( UI_WINDOW * wnd, int x, int y )
105 gr_set_current_canvas( wnd->canvas );
106 ui_draw_box_in( x, y, x+(bw*4)+10 + 200, y+(bh*5)+45 );
114 n=0; row = 0; col = 0; w = 1; h = 1;
115 Pad[n] = ui_add_gadget_button( wnd, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
116 Pad[n]->canvas->cv_font = ui_small_font;
117 n=1; row = 0; col = 1; w = 1; h = 1;
118 Pad[n] = ui_add_gadget_button( wnd, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
119 Pad[n]->canvas->cv_font = ui_small_font;
120 n=2; row = 0; col = 2; w = 1; h = 1;
121 Pad[n] = ui_add_gadget_button( wnd, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
122 Pad[n]->canvas->cv_font = ui_small_font;
123 n=3; row = 0; col = 3; w = 1; h = 1;
124 Pad[n] = ui_add_gadget_button( wnd, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
125 Pad[n]->canvas->cv_font = ui_small_font;
126 n=4; row = 1; col = 0; w = 1; h = 1;
127 Pad[n] = ui_add_gadget_button( wnd, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
128 Pad[n]->canvas->cv_font = ui_small_font;
129 n=5; row = 1; col = 1; w = 1; h = 1;
130 Pad[n] = ui_add_gadget_button( wnd, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
131 Pad[n]->canvas->cv_font = ui_small_font;
132 n=6; row = 1; col = 2; w = 1; h = 1;
133 Pad[n] = ui_add_gadget_button( wnd, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
134 Pad[n]->canvas->cv_font = ui_small_font;
135 n=7; row = 1; col = 3; w = 1; h = 2;
136 Pad[n] = ui_add_gadget_button( wnd, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
137 Pad[n]->canvas->cv_font = ui_small_font;
138 n=8; row = 2; col = 0; w = 1; h = 1;
139 Pad[n] = ui_add_gadget_button( wnd, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
140 Pad[n]->canvas->cv_font = ui_small_font;
141 n=9; row = 2; col = 1; w = 1; h = 1;
142 Pad[n] = ui_add_gadget_button( wnd, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
143 Pad[n]->canvas->cv_font = ui_small_font;
144 n=10; row = 2; col = 2; w = 1; h = 1;
145 Pad[n] = ui_add_gadget_button( wnd, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
146 Pad[n]->canvas->cv_font = ui_small_font;
147 n=11; row = 3; col = 0; w = 1; h = 1;
148 Pad[n] = ui_add_gadget_button( wnd, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
149 Pad[n]->canvas->cv_font = ui_small_font;
150 n=12; row = 3; col = 1; w = 1; h = 1;
151 Pad[n] = ui_add_gadget_button( wnd, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
152 Pad[n]->canvas->cv_font = ui_small_font;
153 n=13; row = 3; col = 2; w = 1; h = 1;
154 Pad[n] = ui_add_gadget_button( wnd, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
155 Pad[n]->canvas->cv_font = ui_small_font;
156 n=14; row = 3; col = 3; w = 1; h = 2;
157 Pad[n] = ui_add_gadget_button( wnd, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
158 Pad[n]->canvas->cv_font = ui_small_font;
159 n=15; row = 4; col = 0; w = 2; h = 1;
160 Pad[n] = ui_add_gadget_button( wnd, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
161 Pad[n]->canvas->cv_font = ui_small_font;
162 n=16; row = 4; col = 2; w = 1; h = 1;
163 Pad[n] = ui_add_gadget_button( wnd, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
164 Pad[n]->canvas->cv_font = ui_small_font;
166 HotKey[0] = KEY_CTRLED + KEY_NUMLOCK;
167 HotKey[1] = KEY_CTRLED + KEY_PADDIVIDE;
168 HotKey[2] = KEY_CTRLED + KEY_PADMULTIPLY;
169 HotKey[3] = KEY_CTRLED + KEY_PADMINUS;
170 HotKey[4] = KEY_CTRLED + KEY_PAD7;
171 HotKey[5] = KEY_CTRLED + KEY_PAD8;
172 HotKey[6] = KEY_CTRLED + KEY_PAD9;
173 HotKey[7] = KEY_CTRLED + KEY_PADPLUS;
174 HotKey[8] = KEY_CTRLED + KEY_PAD4;
175 HotKey[9] = KEY_CTRLED + KEY_PAD5;
176 HotKey[10] = KEY_CTRLED + KEY_PAD6;
177 HotKey[11] = KEY_CTRLED + KEY_PAD1;
178 HotKey[12] = KEY_CTRLED + KEY_PAD2;
179 HotKey[13] = KEY_CTRLED + KEY_PAD3;
180 HotKey[14] = KEY_CTRLED + KEY_PADENTER;
181 HotKey[15] = KEY_CTRLED + KEY_PAD0;
182 HotKey[16] = KEY_CTRLED + KEY_PADPERIOD;
184 HotKey1[0] = KEY_SHIFTED + KEY_CTRLED + KEY_NUMLOCK;
185 HotKey1[1] = KEY_SHIFTED + KEY_CTRLED + KEY_PADDIVIDE;
186 HotKey1[2] = KEY_SHIFTED + KEY_CTRLED + KEY_PADMULTIPLY;
187 HotKey1[3] = KEY_SHIFTED + KEY_CTRLED + KEY_PADMINUS;
188 HotKey1[4] = KEY_SHIFTED + KEY_CTRLED + KEY_PAD7;
189 HotKey1[5] = KEY_SHIFTED + KEY_CTRLED + KEY_PAD8;
190 HotKey1[6] = KEY_SHIFTED + KEY_CTRLED + KEY_PAD9;
191 HotKey1[7] = KEY_SHIFTED + KEY_CTRLED + KEY_PADPLUS;
192 HotKey1[8] = KEY_SHIFTED + KEY_CTRLED + KEY_PAD4;
193 HotKey1[9] = KEY_SHIFTED + KEY_CTRLED + KEY_PAD5;
194 HotKey1[10] = KEY_SHIFTED + KEY_CTRLED + KEY_PAD6;
195 HotKey1[11] = KEY_SHIFTED + KEY_CTRLED + KEY_PAD1;
196 HotKey1[12] = KEY_SHIFTED + KEY_CTRLED + KEY_PAD2;
197 HotKey1[13] = KEY_SHIFTED + KEY_CTRLED + KEY_PAD3;
198 HotKey1[14] = KEY_SHIFTED + KEY_CTRLED + KEY_PADENTER;
199 HotKey1[15] = KEY_SHIFTED + KEY_CTRLED + KEY_PAD0;
200 HotKey1[16] = KEY_SHIFTED + KEY_CTRLED + KEY_PADPERIOD;
207 void ui_pad_deactivate()
211 for (i=0; i<17; i++ )
217 static void ui_pad_set_active( int n )
225 gr_set_current_canvas( NULL );
226 gr_setcolor( CWHITE );
227 gr_urect( desc_x, desc_y, desc_x+ 56*4-1, desc_y+15 );
228 gr_set_fontcolor( CBLACK, CWHITE );
229 gr_ustring( desc_x, desc_y, KeyPad[n]->description );
231 for (i=0; i<17; i++ )
233 Pad[i]->text = KeyPad[n]->buttontext[i];
235 Pad[i]->user_function = NULL;
236 Pad[i]->dim_if_no_function = 1;
239 for (j=0; j< KeyPad[n]->numkeys; j++ )
241 if (HotKey[i] == KeyPad[n]->keycode[j] )
243 Pad[i]->hotkey = HotKey[i];
244 Pad[i]->user_function = func_nget( KeyPad[n]->function_number[j], &np, &name );
246 if (HotKey1[i] == KeyPad[n]->keycode[j] )
248 Pad[i]->hotkey1 = HotKey1[i];
249 Pad[i]->user_function1 = func_nget( KeyPad[n]->function_number[j], &np, &name );
257 void ui_pad_goto(int n)
259 if ( KeyPad[n] != NULL )
260 ui_pad_set_active(n);
263 void ui_pad_goto_next()
270 while( KeyPad[i]==NULL )
273 if (i >= MAX_NUM_PADS)
278 ui_pad_set_active(i);
281 void ui_pad_goto_prev()
285 if (active_pad == -1 )
286 active_pad = MAX_NUM_PADS;
289 if (i<0) i= MAX_NUM_PADS - 1;
292 while( KeyPad[i]==NULL )
297 if (i == active_pad )
300 ui_pad_set_active(i);
303 void ui_pad_read( int n, char * filename )
308 char line_buffer[200];
312 int keycode, functionnumber;
314 infile = cfopen( filename, "rt" );
316 Warning( "Couldn't find %s", filename );
320 MALLOC( KeyPad[n], UI_KEYPAD, 1 );
322 #define BUTTONTEXT_SIZE 100
323 for (i=0; i < 17; i++ ) {
324 MALLOC( KeyPad[n]->buttontext[i], char, BUTTONTEXT_SIZE );
327 KeyPad[n]->numkeys = 0;
329 for (i=0; i<100; i++ )
331 KeyPad[n]->keycode[i] = -1;
332 KeyPad[n]->function_number[i] = 0;
335 while ( linenumber < 22)
337 cfgets( buffer, 100, infile );
339 switch( linenumber+1 )
342 strncpy( KeyPad[n]->description, buffer, 100 );
344 //===================== ROW 0 ==============================
346 LineParse( 1, text, buffer );
347 sprintf( KeyPad[n]->buttontext[0], "%s\n", text );
348 LineParse( 2, text, buffer );
349 sprintf( KeyPad[n]->buttontext[1], "%s\n", text );
350 LineParse( 3, text, buffer );
351 sprintf( KeyPad[n]->buttontext[2], "%s\n", text );
352 LineParse( 4, text, buffer );
353 sprintf( KeyPad[n]->buttontext[3], "%s\n", text );
356 LineParse( 1, text, buffer );
357 strncat( KeyPad[n]->buttontext[0], text, BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[0])-1 );
358 strncat( KeyPad[n]->buttontext[0], "\n", BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[0])-1 );
359 LineParse( 2, text, buffer );
360 strncat( KeyPad[n]->buttontext[1], text, BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[1])-1 );
361 strncat( KeyPad[n]->buttontext[1], "\n", BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[1])-1 );
362 LineParse( 3, text, buffer );
363 strncat( KeyPad[n]->buttontext[2], text, BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[2])-1 );
364 strncat( KeyPad[n]->buttontext[2], "\n", BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[2])-1 );
365 LineParse( 4, text, buffer );
366 strncat( KeyPad[n]->buttontext[3], text, BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[3])-1 );
367 strncat( KeyPad[n]->buttontext[3], "\n", BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[3])-1 );
370 LineParse( 1, text, buffer );
371 strncat( KeyPad[n]->buttontext[0], text, BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[0])-1 );
372 LineParse( 2, text, buffer );
373 strncat( KeyPad[n]->buttontext[1], text, BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[1])-1 );
374 LineParse( 3, text, buffer );
375 strncat( KeyPad[n]->buttontext[2], text, BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[2])-1 );
376 LineParse( 4, text, buffer );
377 strncat( KeyPad[n]->buttontext[3], text, BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[3])-1 );
379 //===================== ROW 1 ==============================
381 LineParse( 1, text, buffer );
382 sprintf( KeyPad[n]->buttontext[4], "%s\n", text );
383 LineParse( 2, text, buffer );
384 sprintf( KeyPad[n]->buttontext[5], "%s\n", text );
385 LineParse( 3, text, buffer);
386 sprintf( KeyPad[n]->buttontext[6], "%s\n", text );
387 LineParse( 4, text, buffer );
388 sprintf( KeyPad[n]->buttontext[7], "%s\n", text );
391 LineParse( 1, text, buffer );
392 strncat( KeyPad[n]->buttontext[4], text, BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[4])-1 );
393 strncat( KeyPad[n]->buttontext[4], "\n", BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[4])-1 );
394 LineParse( 2, text, buffer );
395 strncat( KeyPad[n]->buttontext[5], text, BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[5])-1 );
396 strncat( KeyPad[n]->buttontext[5], "\n", BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[5])-1 );
397 LineParse( 3, text, buffer );
398 strncat( KeyPad[n]->buttontext[6], text, BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[6])-1 );
399 strncat( KeyPad[n]->buttontext[6], "\n", BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[6])-1 );
400 LineParse( 4, text, buffer );
401 strncat( KeyPad[n]->buttontext[7], text, BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[7])-1 );
402 strncat( KeyPad[n]->buttontext[7], "\n", BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[7])-1 );
405 LineParse( 1, text, buffer );
406 strncat( KeyPad[n]->buttontext[4], text, BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[4])-1 );
407 LineParse( 2, text, buffer );
408 strncat( KeyPad[n]->buttontext[5], text, BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[5])-1 );
409 LineParse( 3, text, buffer );
410 strncat( KeyPad[n]->buttontext[6], text, BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[6])-1 );
411 LineParse( 4, text, buffer );
412 strncat( KeyPad[n]->buttontext[7], text, BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[7])-1 );
415 ptr = strrchr( buffer, (char) 179 );
417 ptr = strrchr( buffer, (char) 180 ); ptr++;
418 strncat( KeyPad[n]->buttontext[7], ptr, BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[7])-1 );
419 strncat( KeyPad[n]->buttontext[7], "\n", BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[7])-1 );
421 //======================= ROW 2 ==============================
423 LineParse( 1, text, buffer );
424 sprintf( KeyPad[n]->buttontext[8], "%s\n", text );
425 LineParse( 2, text, buffer );
426 sprintf( KeyPad[n]->buttontext[9], "%s\n", text );
427 LineParse( 3, text, buffer);
428 sprintf( KeyPad[n]->buttontext[10], "%s\n", text );
429 LineParse( 4, text, buffer );
430 strncat( KeyPad[n]->buttontext[7], text, BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[7])-1 );
431 strncat( KeyPad[n]->buttontext[7], "\n", BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[7])-1 );
434 LineParse( 1, text, buffer );
435 strncat( KeyPad[n]->buttontext[8], text, BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[8])-1 );
436 strncat( KeyPad[n]->buttontext[8], "\n", BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[8])-1 );
437 LineParse( 2, text, buffer );
438 strncat( KeyPad[n]->buttontext[9], text, BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[9])-1 );
439 strncat( KeyPad[n]->buttontext[9], "\n", BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[9])-1 );
440 LineParse( 3, text, buffer );
441 strncat( KeyPad[n]->buttontext[10], text, BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[10])-1 );
442 strncat( KeyPad[n]->buttontext[10], "\n", BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[10])-1 );
443 LineParse( 4, text, buffer );
444 strncat( KeyPad[n]->buttontext[7], text, BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[7])-1 );
445 strncat( KeyPad[n]->buttontext[7], "\n", BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[7])-1 );
448 LineParse( 1, text, buffer );
449 strncat( KeyPad[n]->buttontext[8], text, BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[8])-1 );
450 LineParse( 2, text, buffer );
451 strncat( KeyPad[n]->buttontext[9], text, BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[9])-1 );
452 LineParse( 3, text, buffer );
453 strncat( KeyPad[n]->buttontext[10], text, BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[10])-1 );
454 LineParse( 4, text, buffer );
455 strncat( KeyPad[n]->buttontext[7], text, BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[7])-1 );
457 // ====================== ROW 3 =========================
459 LineParse( 1, text, buffer );
460 sprintf( KeyPad[n]->buttontext[11], "%s\n", text );
461 LineParse( 2, text, buffer );
462 sprintf( KeyPad[n]->buttontext[12], "%s\n", text );
463 LineParse( 3, text, buffer);
464 sprintf( KeyPad[n]->buttontext[13], "%s\n", text );
465 LineParse( 4, text, buffer );
466 sprintf( KeyPad[n]->buttontext[14], "%s\n", text );
469 LineParse( 1, text, buffer );
470 strncat( KeyPad[n]->buttontext[11], text, BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[11])-1 );
471 strncat( KeyPad[n]->buttontext[11], "\n", BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[11])-1 );
472 LineParse( 2, text, buffer );
473 strncat( KeyPad[n]->buttontext[12], text, BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[12])-1 );
474 strncat( KeyPad[n]->buttontext[12], "\n", BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[12])-1 );
475 LineParse( 3, text, buffer );
476 strncat( KeyPad[n]->buttontext[13], text, BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[13])-1 );
477 strncat( KeyPad[n]->buttontext[13], "\n", BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[13])-1 );
478 LineParse( 4, text, buffer );
479 strncat( KeyPad[n]->buttontext[14], text, BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[14])-1 );
480 strncat( KeyPad[n]->buttontext[14], "\n", BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[14])-1 );
483 LineParse( 1, text, buffer );
484 strncat( KeyPad[n]->buttontext[11], text, BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[11])-1 );
485 LineParse( 2, text, buffer );
486 strncat( KeyPad[n]->buttontext[12], text, BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[12])-1 );
487 LineParse( 3, text, buffer );
488 strncat( KeyPad[n]->buttontext[13], text, BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[13])-1 );
489 LineParse( 4, text, buffer );
490 strncat( KeyPad[n]->buttontext[14], text, BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[14])-1 );
493 ptr = strrchr( buffer, (char) 179 );
495 ptr = strrchr( buffer, (char) 180 ); ptr++;
496 strncat( KeyPad[n]->buttontext[14], ptr, BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[14])-1 );
497 strncat( KeyPad[n]->buttontext[14], "\n", BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[14])-1 );
499 //======================= ROW 4 =========================
501 LineParse( 1, text, buffer );
502 sprintf( KeyPad[n]->buttontext[15], "%s\n", text );
503 LineParse( 2, text, buffer );
504 sprintf( KeyPad[n]->buttontext[16], "%s\n", text );
505 LineParse( 3, text, buffer );
506 strncat( KeyPad[n]->buttontext[14], text, BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[14])-1 );
507 strncat( KeyPad[n]->buttontext[14], "\n", BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[14])-1 );
510 LineParse( 1, text, buffer );
511 strncat( KeyPad[n]->buttontext[15], text, BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[15])-1 );
512 strncat( KeyPad[n]->buttontext[15], "\n", BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[15])-1 );
513 LineParse( 2, text, buffer );
514 strncat( KeyPad[n]->buttontext[16], text, BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[16])-1 );
515 strncat( KeyPad[n]->buttontext[16], "\n", BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[16])-1 );
516 LineParse( 3, text, buffer );
517 strncat( KeyPad[n]->buttontext[14], text, BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[14])-1 );
518 strncat( KeyPad[n]->buttontext[14], "\n", BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[14])-1 );
521 LineParse( 1, text, buffer );
522 strncat( KeyPad[n]->buttontext[15], text, BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[15])-1 );
523 LineParse( 2, text, buffer );
524 strncat( KeyPad[n]->buttontext[16], text, BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[16])-1 );
525 LineParse( 3, text, buffer );
526 strncat( KeyPad[n]->buttontext[14], text, BUTTONTEXT_SIZE-strlen(KeyPad[n]->buttontext[14])-1 );
533 // Get the keycodes...
535 while (cfgets(line_buffer, 200, infile))
537 sscanf(line_buffer, " %s %s ", text, buffer);
538 keycode = DecodeKeyText(text);
539 functionnumber = func_get_index(buffer);
540 if (functionnumber==-1)
542 Error( "Unknown function, %s, in %s\n", buffer, filename );
543 } else if (keycode==-1)
545 Error( "Unknown keystroke, %s, in %s\n", text, filename );
546 //ui_messagebox( -2, -2, 1, buffer, "Ok" );
549 KeyPad[n]->keycode[KeyPad[n]->numkeys] = keycode;
550 KeyPad[n]->function_number[KeyPad[n]->numkeys] = functionnumber;
551 KeyPad[n]->numkeys++;