diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2004-07-26 16:06:59 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2004-07-26 16:06:59 +0000 |
commit | ade5d7b848bf9c0d46bb14c85528453f969c9429 (patch) | |
tree | 197aa919b9a3c2a89f77d12b01cc1c2c23f7e37f /apps/recorder | |
parent | 3d91885718a1fb9d6d55f07f67a9a1942a352c5e (diff) | |
download | rockbox-ade5d7b848bf9c0d46bb14c85528453f969c9429.tar.gz rockbox-ade5d7b848bf9c0d46bb14c85528453f969c9429.zip |
First step in revamping the USB event handling, paving the way for the upcoming SYS_POWER_OFF event
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4951 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/recorder')
-rw-r--r-- | apps/recorder/keyboard.c | 18 | ||||
-rw-r--r-- | apps/recorder/radio.c | 6 | ||||
-rw-r--r-- | apps/recorder/recording.c | 28 |
3 files changed, 35 insertions, 17 deletions
diff --git a/apps/recorder/keyboard.c b/apps/recorder/keyboard.c index 32a1d8b735..0331a5711d 100644 --- a/apps/recorder/keyboard.c +++ b/apps/recorder/keyboard.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include "status.h" | 28 | #include "status.h" |
29 | #include "talk.h" | 29 | #include "talk.h" |
30 | #include "settings.h" | 30 | #include "settings.h" |
31 | #include "misc.h" | ||
31 | 32 | ||
32 | #define KEYBOARD_LINES 4 | 33 | #define KEYBOARD_LINES 4 |
33 | #define KEYBOARD_PAGES 3 | 34 | #define KEYBOARD_PAGES 3 |
@@ -89,6 +90,7 @@ int kbd_input(char* text, int buflen) | |||
89 | char outline[256]; | 90 | char outline[256]; |
90 | char c = 0; | 91 | char c = 0; |
91 | struct font* font = font_get(FONT_SYSFIXED); | 92 | struct font* font = font_get(FONT_SYSFIXED); |
93 | int button; | ||
92 | 94 | ||
93 | lcd_setfont(FONT_SYSFIXED); | 95 | lcd_setfont(FONT_SYSFIXED); |
94 | font_w = font->maxwidth; | 96 | font_w = font->maxwidth; |
@@ -193,8 +195,9 @@ int kbd_input(char* text, int buflen) | |||
193 | 195 | ||
194 | /* The default action is to redraw */ | 196 | /* The default action is to redraw */ |
195 | redraw = true; | 197 | redraw = true; |
196 | 198 | ||
197 | switch ( button_get_w_tmo(HZ/2) ) { | 199 | button = button_get_w_tmo(HZ/2); |
200 | switch ( button ) { | ||
198 | 201 | ||
199 | case BUTTON_OFF: | 202 | case BUTTON_OFF: |
200 | /* abort */ | 203 | /* abort */ |
@@ -309,15 +312,16 @@ int kbd_input(char* text, int buflen) | |||
309 | kbd_spellchar(text[editpos]); | 312 | kbd_spellchar(text[editpos]); |
310 | break; | 313 | break; |
311 | 314 | ||
312 | case SYS_USB_CONNECTED: | ||
313 | usb_screen(); | ||
314 | lcd_setfont(FONT_SYSFIXED); | ||
315 | break; | ||
316 | |||
317 | case BUTTON_NONE: | 315 | case BUTTON_NONE: |
318 | status_draw(false); | 316 | status_draw(false); |
319 | redraw = false; | 317 | redraw = false; |
320 | break; | 318 | break; |
319 | |||
320 | default: | ||
321 | if(default_event_handler(button) == SYS_USB_CONNECTED) | ||
322 | lcd_setfont(FONT_SYSFIXED); | ||
323 | break; | ||
324 | |||
321 | } | 325 | } |
322 | } | 326 | } |
323 | lcd_setfont(FONT_UI); | 327 | lcd_setfont(FONT_UI); |
diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c index 36847236e1..e26ac5bdc8 100644 --- a/apps/recorder/radio.c +++ b/apps/recorder/radio.c | |||
@@ -416,13 +416,17 @@ bool radio_screen(void) | |||
416 | /* Only accept USB connection when not recording */ | 416 | /* Only accept USB connection when not recording */ |
417 | if(mpeg_status() != MPEG_STATUS_RECORD) | 417 | if(mpeg_status() != MPEG_STATUS_RECORD) |
418 | { | 418 | { |
419 | usb_screen(); | 419 | default_event_handler(SYS_USB_CONNECTED); |
420 | fmradio_set_status(0); | 420 | fmradio_set_status(0); |
421 | screen_freeze = true; /* Cosmetic: makes sure the | 421 | screen_freeze = true; /* Cosmetic: makes sure the |
422 | radio screen doesn't redraw */ | 422 | radio screen doesn't redraw */ |
423 | done = true; | 423 | done = true; |
424 | } | 424 | } |
425 | break; | 425 | break; |
426 | |||
427 | default: | ||
428 | default_event_handler(button); | ||
429 | break; | ||
426 | } | 430 | } |
427 | 431 | ||
428 | peak_meter_peek(); | 432 | peak_meter_peek(); |
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index a077c957a7..242351a0d6 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c | |||
@@ -437,11 +437,15 @@ bool recording_screen(void) | |||
437 | /* Only accept USB connection when not recording */ | 437 | /* Only accept USB connection when not recording */ |
438 | if(mpeg_status() != MPEG_STATUS_RECORD) | 438 | if(mpeg_status() != MPEG_STATUS_RECORD) |
439 | { | 439 | { |
440 | usb_screen(); | 440 | default_event_handler(SYS_USB_CONNECTED); |
441 | done = true; | 441 | done = true; |
442 | been_in_usb_mode = true; | 442 | been_in_usb_mode = true; |
443 | } | 443 | } |
444 | break; | 444 | break; |
445 | |||
446 | default: | ||
447 | default_event_handler(button); | ||
448 | break; | ||
445 | } | 449 | } |
446 | 450 | ||
447 | peak_meter_peek(); | 451 | peak_meter_peek(); |
@@ -622,6 +626,7 @@ bool f2_rec_screen(void) | |||
622 | bool used = false; | 626 | bool used = false; |
623 | int w, h; | 627 | int w, h; |
624 | char buf[32]; | 628 | char buf[32]; |
629 | int button; | ||
625 | 630 | ||
626 | lcd_setfont(FONT_SYSFIXED); | 631 | lcd_setfont(FONT_SYSFIXED); |
627 | lcd_getstringsize("A",&w,&h); | 632 | lcd_getstringsize("A",&w,&h); |
@@ -671,7 +676,8 @@ bool f2_rec_screen(void) | |||
671 | 676 | ||
672 | lcd_update(); | 677 | lcd_update(); |
673 | 678 | ||
674 | switch (button_get(true)) { | 679 | button = button_get(true); |
680 | switch (button) { | ||
675 | case BUTTON_LEFT: | 681 | case BUTTON_LEFT: |
676 | case BUTTON_F2 | BUTTON_LEFT: | 682 | case BUTTON_F2 | BUTTON_LEFT: |
677 | global_settings.rec_quality++; | 683 | global_settings.rec_quality++; |
@@ -706,9 +712,10 @@ bool f2_rec_screen(void) | |||
706 | used = true; | 712 | used = true; |
707 | break; | 713 | break; |
708 | 714 | ||
709 | case SYS_USB_CONNECTED: | 715 | default: |
710 | usb_screen(); | 716 | if(default_event_handler(button) == SYS_USB_CONNECTED) |
711 | return true; | 717 | return true; |
718 | break; | ||
712 | } | 719 | } |
713 | } | 720 | } |
714 | 721 | ||
@@ -735,6 +742,7 @@ bool f3_rec_screen(void) | |||
735 | bool exit = false; | 742 | bool exit = false; |
736 | bool used = false; | 743 | bool used = false; |
737 | int w, h; | 744 | int w, h; |
745 | int button; | ||
738 | char *src_str[] = | 746 | char *src_str[] = |
739 | { | 747 | { |
740 | str(LANG_RECORDING_SRC_MIC), | 748 | str(LANG_RECORDING_SRC_MIC), |
@@ -760,7 +768,8 @@ bool f3_rec_screen(void) | |||
760 | 768 | ||
761 | lcd_update(); | 769 | lcd_update(); |
762 | 770 | ||
763 | switch (button_get(true)) { | 771 | button = button_get(true); |
772 | switch (button) { | ||
764 | case BUTTON_LEFT: | 773 | case BUTTON_LEFT: |
765 | case BUTTON_F3 | BUTTON_LEFT: | 774 | case BUTTON_F3 | BUTTON_LEFT: |
766 | global_settings.rec_source++; | 775 | global_settings.rec_source++; |
@@ -779,9 +788,10 @@ bool f3_rec_screen(void) | |||
779 | used = true; | 788 | used = true; |
780 | break; | 789 | break; |
781 | 790 | ||
782 | case SYS_USB_CONNECTED: | 791 | default: |
783 | usb_screen(); | 792 | if(default_event_handler(button) == SYS_USB_CONNECTED) |
784 | return true; | 793 | return true; |
794 | break; | ||
785 | } | 795 | } |
786 | } | 796 | } |
787 | 797 | ||