diff options
author | Björn Stenberg <bjorn@haxx.se> | 2004-09-19 21:58:37 +0000 |
---|---|---|
committer | Björn Stenberg <bjorn@haxx.se> | 2004-09-19 21:58:37 +0000 |
commit | 6c33c51a4ca9907d23e3154d956fd6781122f492 (patch) | |
tree | f0e598efaf064bb72c33c0a8a2edba4cf9ebb13c /apps/recorder | |
parent | 17f54a40f100a3343a15a431d235699024aa76c8 (diff) |
Redesigned the button handling. The code now uses symbolic function defines instead of checking for specific buttons. This makes it easier to add support for new devices with different button layouts.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5091 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/recorder')
-rw-r--r-- | apps/recorder/keyboard.c | 13 | ||||
-rw-r--r-- | apps/recorder/radio.c | 13 | ||||
-rw-r--r-- | apps/recorder/recording.c | 10 |
3 files changed, 32 insertions, 4 deletions
diff --git a/apps/recorder/keyboard.c b/apps/recorder/keyboard.c index 1c9ba7bed4..c1bd25e0aa 100644 --- a/apps/recorder/keyboard.c +++ b/apps/recorder/keyboard.c @@ -33,6 +33,7 @@ #define KEYBOARD_LINES 4 #define KEYBOARD_PAGES 3 +#ifdef HAVE_RECORDER_KEYPAD static void kbd_setupkeys(const char* line[KEYBOARD_LINES], int page) { switch (page) { @@ -58,6 +59,7 @@ static void kbd_setupkeys(const char* line[KEYBOARD_LINES], int page) break; } } +#endif /* helper function to spell a char if voice UI is enabled */ void kbd_spellchar(char c) @@ -75,6 +77,12 @@ void kbd_spellchar(char c) int kbd_input(char* text, int buflen) { +#ifndef HAVE_RECORDER_KEYPAD + (void)text; + (void)buflen; + splash(HZ*2, true, "Keyboard not implemented yet"); + return 0; +#else bool done = false; int page = 0; @@ -240,7 +248,6 @@ int kbd_input(char* text, int buflen) kbd_spellchar(line[y][x]); break; -#if (BUTTON_UP != BUTTON_PLAY) /* FixMe, this is just to make the Ondio compile */ case BUTTON_UP: case BUTTON_UP | BUTTON_REPEAT: if (y) @@ -249,7 +256,7 @@ int kbd_input(char* text, int buflen) y = KEYBOARD_LINES - 1; kbd_spellchar(line[y][x]); break; -#endif + case BUTTON_F3: case BUTTON_F3 | BUTTON_REPEAT: /* backspace */ @@ -326,5 +333,7 @@ int kbd_input(char* text, int buflen) } } lcd_setfont(FONT_UI); + return 0; +#endif /* ONDIO */ } diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c index 6b056dfe31..c163cc4552 100644 --- a/apps/recorder/radio.c +++ b/apps/recorder/radio.c @@ -167,6 +167,10 @@ static void remember_frequency(void) bool radio_screen(void) { +#ifndef HAVE_RECORDER_KEYPAD + splash(HZ*2, true, "Radio not supported yet"); + return false; +#else char buf[MAX_PATH]; bool done = false; int button; @@ -554,6 +558,7 @@ bool radio_screen(void) } #endif return have_recorded; +#endif /* ONDIO */ } void radio_save_presets(void) @@ -663,12 +668,14 @@ static bool radio_add_preset(void) static int handle_radio_presets_menu_cb(int key, int m) { (void)m; +#ifdef HAVE_RECORDER_KEYPAD switch(key) { case BUTTON_F3: key = BUTTON_LEFT; /* Fake an exit */ break; } +#endif return key; } @@ -725,6 +732,11 @@ bool handle_radio_presets_menu(void) int handle_radio_presets_cb(int key, int m) { +#ifdef HAVE_ONDIO_KEYPAD + (void)key; + (void)m; + return BUTTON_NONE; +#else bool ret; switch(key) @@ -750,6 +762,7 @@ int handle_radio_presets_cb(int key, int m) break; } return key; +#endif } bool handle_radio_presets(void) diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index 392f20d9ed..2c39c367b8 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c @@ -166,6 +166,10 @@ int rec_create_directory(void) bool recording_screen(void) { +#ifndef HAVE_RECORDING_KEYPAD + splash(HZ*2, true, "Recording not supported yet"); + return false; +#else int button; bool done = false; char buf[32]; @@ -280,13 +284,12 @@ bool recording_screen(void) } break; -#if (BUTTON_UP != BUTTON_PLAY) /* FixMe, this is just to make the Ondio compile */ case BUTTON_UP: cursor--; adjust_cursor(); update_countdown = 1; /* Update immediately */ break; -#endif + case BUTTON_DOWN: cursor++; adjust_cursor(); @@ -619,8 +622,10 @@ bool recording_screen(void) reload_directory(); return been_in_usb_mode; +#endif } +#ifdef HAVE_RECORDER_KEYPAD bool f2_rec_screen(void) { bool exit = false; @@ -813,3 +818,4 @@ bool f3_rec_screen(void) return false; } +#endif |