summaryrefslogtreecommitdiff
path: root/apps/screens.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/screens.c')
-rw-r--r--apps/screens.c86
1 files changed, 39 insertions, 47 deletions
diff --git a/apps/screens.c b/apps/screens.c
index 5a2b58e853..6d9f79e6a5 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -21,7 +21,7 @@
21#include <string.h> 21#include <string.h>
22#include <stdio.h> 22#include <stdio.h>
23#include "backlight.h" 23#include "backlight.h"
24#include "button.h" 24#include "action.h"
25#include "lcd.h" 25#include "lcd.h"
26#include "lang.h" 26#include "lang.h"
27#include "icons.h" 27#include "icons.h"
@@ -309,11 +309,7 @@ void charging_display_info(bool animate)
309 2 if Off/Stop key was pressed 309 2 if Off/Stop key was pressed
310 3 if On key was pressed 310 3 if On key was pressed
311 4 if USB was connected */ 311 4 if USB was connected */
312#if (CONFIG_KEYPAD==IPOD_3G_PAD) || (CONFIG_KEYPAD==IPOD_4G_PAD) 312
313# define CHARGE_SCREEN_RESUME BUTTON_SELECT
314#else
315# define CHARGE_SCREEN_RESUME BUTTON_ON
316#endif
317int charging_screen(void) 313int charging_screen(void)
318{ 314{
319 unsigned int button; 315 unsigned int button;
@@ -338,8 +334,8 @@ int charging_screen(void)
338 { 334 {
339 gui_syncstatusbar_draw(&statusbars, false); 335 gui_syncstatusbar_draw(&statusbars, false);
340 charging_display_info(true); 336 charging_display_info(true);
341 button = button_get_w_tmo(HZ/3); 337 button = get_action(CONTEXT_STD,HZ/3);
342 if (button == CHARGE_SCREEN_RESUME) 338 if (button == ACTION_STD_OK)
343 rc = 2; 339 rc = 2;
344 else if (usb_detect()) 340 else if (usb_detect())
345 rc = 3; 341 rc = 3;
@@ -350,6 +346,7 @@ int charging_screen(void)
350#ifdef HAVE_LCD_CHARCELLS 346#ifdef HAVE_LCD_CHARCELLS
351 logo_lock_patterns(false); 347 logo_lock_patterns(false);
352#endif 348#endif
349 action_signalscreenchange();
353 return rc; 350 return rc;
354} 351}
355#endif /* CONFIG_CHARGING && !HAVE_POWEROFF_WHILE_CHARGING */ 352#endif /* CONFIG_CHARGING && !HAVE_POWEROFF_WHILE_CHARGING */
@@ -423,15 +420,15 @@ bool pitch_screen(void)
423 { 420 {
424 pitch_screen_draw(pitch); 421 pitch_screen_draw(pitch);
425 422
426 button = button_get(true); 423 button = get_action(CONTEXT_SETTINGS,TIMEOUT_BLOCK);
427 switch (button) { 424 switch (button) {
428 case PITCH_UP: 425 case ACTION_SETTINGS_INC:
429 if ( pitch < 2000 ) 426 if ( pitch < 2000 )
430 pitch++; 427 pitch++;
431 sound_set_pitch(pitch); 428 sound_set_pitch(pitch);
432 break; 429 break;
433 430
434 case PITCH_UP | BUTTON_REPEAT: 431 case ACTION_SETTINGS_INCREPEAT:
435 if ( pitch < 1990 ) 432 if ( pitch < 1990 )
436 pitch += 10; 433 pitch += 10;
437 else 434 else
@@ -439,13 +436,13 @@ bool pitch_screen(void)
439 sound_set_pitch(pitch); 436 sound_set_pitch(pitch);
440 break; 437 break;
441 438
442 case PITCH_DOWN: 439 case ACTION_SETTINGS_DEC:
443 if ( pitch > 500 ) 440 if ( pitch > 500 )
444 pitch--; 441 pitch--;
445 sound_set_pitch(pitch); 442 sound_set_pitch(pitch);
446 break; 443 break;
447 444
448 case PITCH_DOWN | BUTTON_REPEAT: 445 case ACTION_SETTINGS_DECREPEAT:
449 if ( pitch > 510 ) 446 if ( pitch > 510 )
450 pitch -= 10; 447 pitch -= 10;
451 else 448 else
@@ -453,7 +450,7 @@ bool pitch_screen(void)
453 sound_set_pitch(pitch); 450 sound_set_pitch(pitch);
454 break; 451 break;
455 452
456 case PITCH_RIGHT: 453 case ACTION_STD_NEXT:
457 if ( pitch < 1980 ) 454 if ( pitch < 1980 )
458 { 455 {
459 pitch += 20; 456 pitch += 20;
@@ -461,15 +458,12 @@ bool pitch_screen(void)
461 458
462 pitch_screen_draw(pitch); 459 pitch_screen_draw(pitch);
463 460
464 while(button != (PITCH_RIGHT|BUTTON_REL))
465 button = button_get(true);
466
467 pitch -= 20; 461 pitch -= 20;
468 sound_set_pitch(pitch); 462 sound_set_pitch(pitch);
469 } 463 }
470 break; 464 break;
471 465
472 case PITCH_LEFT: 466 case ACTION_STD_PREV:
473 if ( pitch > 520 ) 467 if ( pitch > 520 )
474 { 468 {
475 pitch -= 20; 469 pitch -= 20;
@@ -477,20 +471,17 @@ bool pitch_screen(void)
477 471
478 pitch_screen_draw(pitch); 472 pitch_screen_draw(pitch);
479 473
480 while(button != (PITCH_LEFT|BUTTON_REL))
481 button = button_get(true);;
482
483 pitch += 20; 474 pitch += 20;
484 sound_set_pitch(pitch); 475 sound_set_pitch(pitch);
485 } 476 }
486 break; 477 break;
487 478
488 case PITCH_RESET: 479 case ACTION_STD_OK:
489 pitch = 1000; 480 pitch = 1000;
490 sound_set_pitch( pitch ); 481 sound_set_pitch( pitch );
491 break; 482 break;
492 483
493 case PITCH_EXIT: 484 case ACTION_STD_CANCEL:
494 exit = true; 485 exit = true;
495 break; 486 break;
496 487
@@ -504,6 +495,7 @@ bool pitch_screen(void)
504 pcmbuf_set_low_latency(false); 495 pcmbuf_set_low_latency(false);
505#endif 496#endif
506 lcd_setfont(FONT_UI); 497 lcd_setfont(FONT_UI);
498 action_signalscreenchange();
507 return 0; 499 return 0;
508} 500}
509#endif 501#endif
@@ -923,24 +915,22 @@ bool set_time_screen(const char* string, struct tm *tm)
923 say_time(cursorpos, tm); 915 say_time(cursorpos, tm);
924 } 916 }
925 917
926 button = button_get_w_tmo(HZ/2); 918 button = get_action(CONTEXT_SETTINGS,HZ/2);
927 switch ( button ) { 919 switch ( button ) {
928 case SETTINGS_PREV: 920 case ACTION_STD_PREV:
929 cursorpos = (cursorpos + 6 - 1) % 6; 921 cursorpos = (cursorpos + 6 - 1) % 6;
930 break; 922 break;
931 case SETTINGS_NEXT: 923 case ACTION_STD_NEXT:
932 cursorpos = (cursorpos + 6 + 1) % 6; 924 cursorpos = (cursorpos + 6 + 1) % 6;
933 break; 925 break;
934 case SETTINGS_INC: 926 case ACTION_SETTINGS_INC:
935 case SETTINGS_INC | BUTTON_REPEAT:
936 *valptr = (*valptr + steps - min + 1) % 927 *valptr = (*valptr + steps - min + 1) %
937 steps + min; 928 steps + min;
938 if(*valptr == 0) 929 if(*valptr == 0)
939 *valptr = min; 930 *valptr = min;
940 say_time(cursorpos, tm); 931 say_time(cursorpos, tm);
941 break; 932 break;
942 case SETTINGS_DEC: 933 case ACTION_SETTINGS_DEC:
943 case SETTINGS_DEC | BUTTON_REPEAT:
944 *valptr = (*valptr + steps - min - 1) % 934 *valptr = (*valptr + steps - min - 1) %
945 steps + min; 935 steps + min;
946 if(*valptr == 0) 936 if(*valptr == 0)
@@ -948,11 +938,11 @@ bool set_time_screen(const char* string, struct tm *tm)
948 say_time(cursorpos, tm); 938 say_time(cursorpos, tm);
949 break; 939 break;
950 940
951 case SETTINGS_ACCEPT: 941 case ACTION_STD_OK:
952 done = true; 942 done = true;
953 break; 943 break;
954 944
955 case SETTINGS_CANCEL: 945 case ACTION_STD_CANCEL:
956 done = true; 946 done = true;
957 tm->tm_year = -1; 947 tm->tm_year = -1;
958 break; 948 break;
@@ -963,7 +953,7 @@ bool set_time_screen(const char* string, struct tm *tm)
963 break; 953 break;
964 } 954 }
965 } 955 }
966 956 action_signalscreenchange();
967 lcd_set_drawmode(lastmode); 957 lcd_set_drawmode(lastmode);
968 return false; 958 return false;
969} 959}
@@ -981,10 +971,10 @@ bool shutdown_screen(void)
981 971
982 while(!done) 972 while(!done)
983 { 973 {
984 button = button_get_w_tmo(HZ*2); 974 button = get_action(CONTEXT_STD,HZ*2);
985 switch(button) 975 switch(button)
986 { 976 {
987 case BUTTON_OFF: 977 case ACTION_STD_CANCEL:
988 sys_poweroff(); 978 sys_poweroff();
989 break; 979 break;
990 980
@@ -998,11 +988,14 @@ bool shutdown_screen(void)
998 not have released the button yet. 988 not have released the button yet.
999 We also ignore REPEAT events, since we don't want to 989 We also ignore REPEAT events, since we don't want to
1000 remove the splash when the user holds OFF to shut down. */ 990 remove the splash when the user holds OFF to shut down. */
991 /* Is this still needed? commenting out so it compiles..
992 CHECK ME!!
1001 if(!(button & (BUTTON_REL | BUTTON_REPEAT))) 993 if(!(button & (BUTTON_REL | BUTTON_REPEAT)))
1002 done = true; 994 */ done = true;
1003 break; 995 break;
1004 } 996 }
1005 } 997 }
998 action_signalscreenchange();
1006 return false; 999 return false;
1007} 1000}
1008#endif 1001#endif
@@ -1123,9 +1116,12 @@ bool browse_id3(void)
1123 gui_synclist_set_nb_items(&id3_lists, ID3_ITEMS*2); 1116 gui_synclist_set_nb_items(&id3_lists, ID3_ITEMS*2);
1124 gui_synclist_draw(&id3_lists); 1117 gui_synclist_draw(&id3_lists);
1125 while (true) { 1118 while (true) {
1126 key = button_get_w_tmo(HZ/2); 1119 key = get_action(CONTEXT_STD,HZ/2);
1127 if(key!=BUTTON_NONE && !(key&BUTTON_REL) && !gui_synclist_do_button(&id3_lists, key)) 1120 if(key!=ACTION_NONE && /* !(key&BUTTON_REL) && ?? */ !gui_synclist_do_button(&id3_lists, key))
1121 {
1122 action_signalscreenchange();
1128 return(default_event_handler(key) == SYS_USB_CONNECTED); 1123 return(default_event_handler(key) == SYS_USB_CONNECTED);
1124 }
1129 gui_syncstatusbar_draw(&statusbars, false); 1125 gui_syncstatusbar_draw(&statusbars, false);
1130 } 1126 }
1131} 1127}
@@ -1147,29 +1143,24 @@ bool set_rating(void)
1147 snprintf(rating_text, sizeof(rating_text), "%d", id3->rating); 1143 snprintf(rating_text, sizeof(rating_text), "%d", id3->rating);
1148 lcd_puts(0, 1, (unsigned char *)rating_text); 1144 lcd_puts(0, 1, (unsigned char *)rating_text);
1149 lcd_update(); 1145 lcd_update();
1150 button = button_get(true); 1146 button = get_action(CONTEXT_SETTINGS,TIMEOUT_BLOCK);
1151 1147
1152 switch(button) 1148 switch(button)
1153 { 1149 {
1154 case SETTINGS_DEC: 1150 case ACTION_SETTINGS_DEC:
1155 if (id3->rating > 0) 1151 if (id3->rating > 0)
1156 id3->rating--; 1152 id3->rating--;
1157 else 1153 else
1158 id3->rating = 10; 1154 id3->rating = 10;
1159 break; 1155 break;
1160 1156
1161 case SETTINGS_INC: 1157 case ACTION_SETTINGS_INC:
1162 if (id3->rating < 10) 1158 if (id3->rating < 10)
1163 id3->rating++; 1159 id3->rating++;
1164 else 1160 else
1165 id3->rating = 0; 1161 id3->rating = 0;
1166 break; 1162 break;
1167 case SETTINGS_CANCEL: 1163 case ACTION_STD_CANCEL:
1168#ifdef SETTINGS_OK2
1169 case SETTINGS_OK2:
1170#endif
1171 /* eat release event */
1172 button_get(true);
1173 exit = true; 1164 exit = true;
1174 break; 1165 break;
1175 1166
@@ -1179,5 +1170,6 @@ bool set_rating(void)
1179 break; 1170 break;
1180 } 1171 }
1181 } 1172 }
1173 action_signalscreenchange();
1182 return false; 1174 return false;
1183} 1175}