Browse Source

Use getkey() and symbolic key names.

tags/v0.9.3
Michael Brown 18 years ago
parent
commit
f33a03c1e5
1 changed files with 8 additions and 6 deletions
  1. 8
    6
      src/hci/tui/settings_ui.c

+ 8
- 6
src/hci/tui/settings_ui.c View File

23
 #include <console.h>
23
 #include <console.h>
24
 #include <gpxe/settings.h>
24
 #include <gpxe/settings.h>
25
 #include <gpxe/editbox.h>
25
 #include <gpxe/editbox.h>
26
+#include <gpxe/keys.h>
26
 #include <gpxe/settings_ui.h>
27
 #include <gpxe/settings_ui.h>
27
 
28
 
28
 /** @file
29
 /** @file
345
 		draw_setting ( &widget );
346
 		draw_setting ( &widget );
346
 		color_set ( CPAIR_NORMAL, NULL );
347
 		color_set ( CPAIR_NORMAL, NULL );
347
 
348
 
348
-		key = getchar();
349
+		key = getkey();
349
 		if ( widget.editing ) {
350
 		if ( widget.editing ) {
350
 			key = edit_setting ( &widget, key );
351
 			key = edit_setting ( &widget, key );
351
 			switch ( key ) {
352
 			switch ( key ) {
352
-			case 0x0a: /* Enter */
353
+			case CR:
354
+			case LF:
353
 				if ( ( rc = save_setting ( &widget ) ) != 0 ) {
355
 				if ( ( rc = save_setting ( &widget ) ) != 0 ) {
354
 					alert ( " Could not set %s: %s ",
356
 					alert ( " Could not set %s: %s ",
355
 						widget.setting->name,
357
 						widget.setting->name,
356
 						strerror ( rc ) );
358
 						strerror ( rc ) );
357
 				}
359
 				}
358
 				/* Fall through */
360
 				/* Fall through */
359
-			case 0x03: /* Ctrl-C */
361
+			case CTRL_C:
360
 				load_setting ( &widget );
362
 				load_setting ( &widget );
361
 				break;
363
 				break;
362
 			default:
364
 			default:
366
 		} else {
368
 		} else {
367
 			next = current;
369
 			next = current;
368
 			switch ( key ) {
370
 			switch ( key ) {
369
-			case '+':
371
+			case KEY_DOWN:
370
 				if ( next < ( NUM_SETTINGS - 1 ) )
372
 				if ( next < ( NUM_SETTINGS - 1 ) )
371
 					next++;
373
 					next++;
372
 				break;
374
 				break;
373
-			case '-':
375
+			case KEY_UP:
374
 				if ( next > 0 )
376
 				if ( next > 0 )
375
 					next--;
377
 					next--;
376
 				break;
378
 				break;
377
-			case 0x13: /* Ctrl-S */
379
+			case CTRL_S:
378
 				if ( ( rc = nvo_save ( ugly_nvo_hack ) ) != 0){
380
 				if ( ( rc = nvo_save ( ugly_nvo_hack ) ) != 0){
379
 					alert ( " Could not save options: %s ",
381
 					alert ( " Could not save options: %s ",
380
 						strerror ( rc ) );
382
 						strerror ( rc ) );

Loading…
Cancel
Save