summaryrefslogtreecommitdiff
path: root/apps/recorder
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2004-09-19 21:58:37 +0000
committerBjörn Stenberg <bjorn@haxx.se>2004-09-19 21:58:37 +0000
commit6c33c51a4ca9907d23e3154d956fd6781122f492 (patch)
treef0e598efaf064bb72c33c0a8a2edba4cf9ebb13c /apps/recorder
parent17f54a40f100a3343a15a431d235699024aa76c8 (diff)
downloadrockbox-6c33c51a4ca9907d23e3154d956fd6781122f492.tar.gz
rockbox-6c33c51a4ca9907d23e3154d956fd6781122f492.zip
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.c13
-rw-r--r--apps/recorder/radio.c13
-rw-r--r--apps/recorder/recording.c10
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 @@
33#define KEYBOARD_LINES 4 33#define KEYBOARD_LINES 4
34#define KEYBOARD_PAGES 3 34#define KEYBOARD_PAGES 3
35 35
36#ifdef HAVE_RECORDER_KEYPAD
36static void kbd_setupkeys(const char* line[KEYBOARD_LINES], int page) 37static void kbd_setupkeys(const char* line[KEYBOARD_LINES], int page)
37{ 38{
38 switch (page) { 39 switch (page) {
@@ -58,6 +59,7 @@ static void kbd_setupkeys(const char* line[KEYBOARD_LINES], int page)
58 break; 59 break;
59 } 60 }
60} 61}
62#endif
61 63
62/* helper function to spell a char if voice UI is enabled */ 64/* helper function to spell a char if voice UI is enabled */
63void kbd_spellchar(char c) 65void kbd_spellchar(char c)
@@ -75,6 +77,12 @@ void kbd_spellchar(char c)
75 77
76int kbd_input(char* text, int buflen) 78int kbd_input(char* text, int buflen)
77{ 79{
80#ifndef HAVE_RECORDER_KEYPAD
81 (void)text;
82 (void)buflen;
83 splash(HZ*2, true, "Keyboard not implemented yet");
84 return 0;
85#else
78 bool done = false; 86 bool done = false;
79 int page = 0; 87 int page = 0;
80 88
@@ -240,7 +248,6 @@ int kbd_input(char* text, int buflen)
240 kbd_spellchar(line[y][x]); 248 kbd_spellchar(line[y][x]);
241 break; 249 break;
242 250
243#if (BUTTON_UP != BUTTON_PLAY) /* FixMe, this is just to make the Ondio compile */
244 case BUTTON_UP: 251 case BUTTON_UP:
245 case BUTTON_UP | BUTTON_REPEAT: 252 case BUTTON_UP | BUTTON_REPEAT:
246 if (y) 253 if (y)
@@ -249,7 +256,7 @@ int kbd_input(char* text, int buflen)
249 y = KEYBOARD_LINES - 1; 256 y = KEYBOARD_LINES - 1;
250 kbd_spellchar(line[y][x]); 257 kbd_spellchar(line[y][x]);
251 break; 258 break;
252#endif 259
253 case BUTTON_F3: 260 case BUTTON_F3:
254 case BUTTON_F3 | BUTTON_REPEAT: 261 case BUTTON_F3 | BUTTON_REPEAT:
255 /* backspace */ 262 /* backspace */
@@ -326,5 +333,7 @@ int kbd_input(char* text, int buflen)
326 } 333 }
327 } 334 }
328 lcd_setfont(FONT_UI); 335 lcd_setfont(FONT_UI);
336
329 return 0; 337 return 0;
338#endif /* ONDIO */
330} 339}
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)
167 167
168bool radio_screen(void) 168bool radio_screen(void)
169{ 169{
170#ifndef HAVE_RECORDER_KEYPAD
171 splash(HZ*2, true, "Radio not supported yet");
172 return false;
173#else
170 char buf[MAX_PATH]; 174 char buf[MAX_PATH];
171 bool done = false; 175 bool done = false;
172 int button; 176 int button;
@@ -554,6 +558,7 @@ bool radio_screen(void)
554 } 558 }
555#endif 559#endif
556 return have_recorded; 560 return have_recorded;
561#endif /* ONDIO */
557} 562}
558 563
559void radio_save_presets(void) 564void radio_save_presets(void)
@@ -663,12 +668,14 @@ static bool radio_add_preset(void)
663static int handle_radio_presets_menu_cb(int key, int m) 668static int handle_radio_presets_menu_cb(int key, int m)
664{ 669{
665 (void)m; 670 (void)m;
671#ifdef HAVE_RECORDER_KEYPAD
666 switch(key) 672 switch(key)
667 { 673 {
668 case BUTTON_F3: 674 case BUTTON_F3:
669 key = BUTTON_LEFT; /* Fake an exit */ 675 key = BUTTON_LEFT; /* Fake an exit */
670 break; 676 break;
671 } 677 }
678#endif
672 return key; 679 return key;
673} 680}
674 681
@@ -725,6 +732,11 @@ bool handle_radio_presets_menu(void)
725 732
726int handle_radio_presets_cb(int key, int m) 733int handle_radio_presets_cb(int key, int m)
727{ 734{
735#ifdef HAVE_ONDIO_KEYPAD
736 (void)key;
737 (void)m;
738 return BUTTON_NONE;
739#else
728 bool ret; 740 bool ret;
729 741
730 switch(key) 742 switch(key)
@@ -750,6 +762,7 @@ int handle_radio_presets_cb(int key, int m)
750 break; 762 break;
751 } 763 }
752 return key; 764 return key;
765#endif
753} 766}
754 767
755bool handle_radio_presets(void) 768bool 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)
166 166
167bool recording_screen(void) 167bool recording_screen(void)
168{ 168{
169#ifndef HAVE_RECORDING_KEYPAD
170 splash(HZ*2, true, "Recording not supported yet");
171 return false;
172#else
169 int button; 173 int button;
170 bool done = false; 174 bool done = false;
171 char buf[32]; 175 char buf[32];
@@ -280,13 +284,12 @@ bool recording_screen(void)
280 } 284 }
281 break; 285 break;
282 286
283#if (BUTTON_UP != BUTTON_PLAY) /* FixMe, this is just to make the Ondio compile */
284 case BUTTON_UP: 287 case BUTTON_UP:
285 cursor--; 288 cursor--;
286 adjust_cursor(); 289 adjust_cursor();
287 update_countdown = 1; /* Update immediately */ 290 update_countdown = 1; /* Update immediately */
288 break; 291 break;
289#endif 292
290 case BUTTON_DOWN: 293 case BUTTON_DOWN:
291 cursor++; 294 cursor++;
292 adjust_cursor(); 295 adjust_cursor();
@@ -619,8 +622,10 @@ bool recording_screen(void)
619 reload_directory(); 622 reload_directory();
620 623
621 return been_in_usb_mode; 624 return been_in_usb_mode;
625#endif
622} 626}
623 627
628#ifdef HAVE_RECORDER_KEYPAD
624bool f2_rec_screen(void) 629bool f2_rec_screen(void)
625{ 630{
626 bool exit = false; 631 bool exit = false;
@@ -813,3 +818,4 @@ bool f3_rec_screen(void)
813 818
814 return false; 819 return false;
815} 820}
821#endif