summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2003-12-12 13:34:27 +0000
committerDaniel Stenberg <daniel@haxx.se>2003-12-12 13:34:27 +0000
commit8e43ccbec69cb5fc1db2b5e65ffd48e00bd308e5 (patch)
tree1827ad626e8bd7bd691f359045ba978b1a236f25
parentca710622210c6832ca8402472c1023538aff41a8 (diff)
downloadrockbox-8e43ccbec69cb5fc1db2b5e65ffd48e00bd308e5.tar.gz
rockbox-8e43ccbec69cb5fc1db2b5e65ffd48e00bd308e5.zip
Initial suppport for building Rockbox for Neo. The Neo has a different
key layout so we need to check for this. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4138 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/debug_menu.c8
-rw-r--r--apps/main.c2
-rw-r--r--apps/main_menu.c2
-rw-r--r--apps/player/keyboard.c2
-rw-r--r--apps/playlist.c6
-rw-r--r--apps/screens.c8
-rw-r--r--apps/sleeptimer.c2
-rw-r--r--apps/tree.c128
-rw-r--r--apps/wps-display.c6
-rw-r--r--apps/wps.c36
10 files changed, 130 insertions, 70 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 5f9c1a7bf9..65a641c1a1 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -85,7 +85,9 @@ bool dbg_os(void)
85 85
86 switch(button) 86 switch(button)
87 { 87 {
88#ifdef BUTTON_OFF
88 case BUTTON_OFF: 89 case BUTTON_OFF:
90#endif
89 case BUTTON_LEFT: 91 case BUTTON_LEFT:
90 return false; 92 return false;
91 } 93 }
@@ -1194,9 +1196,9 @@ static bool view_runtime(void)
1194 /* Wait for a key to be pushed */ 1196 /* Wait for a key to be pushed */
1195 key = button_get_w_tmo(HZ); 1197 key = button_get_w_tmo(HZ);
1196 switch(key) { 1198 switch(key) {
1197#ifdef HAVE_PLAYER_KEYPAD 1199#if defined(HAVE_PLAYER_KEYPAD) || defined(HAVE_NEO_KEYPAD)
1198 case BUTTON_STOP | BUTTON_REL: 1200 case BUTTON_STOP | BUTTON_REL:
1199#else 1201#elif HAVE_RECORDER_KEYPAD
1200 case BUTTON_OFF | BUTTON_REL: 1202 case BUTTON_OFF | BUTTON_REL:
1201#endif 1203#endif
1202 done = true; 1204 done = true;
@@ -1301,7 +1303,7 @@ static bool dbg_disk_info(void)
1301 /* Wait for a key to be pushed */ 1303 /* Wait for a key to be pushed */
1302 key = button_get_w_tmo(HZ*5); 1304 key = button_get_w_tmo(HZ*5);
1303 switch(key) { 1305 switch(key) {
1304#ifdef HAVE_PLAYER_KEYPAD 1306#if defined(HAVE_PLAYER_KEYPAD) || defined(HAVE_NEO_KEYPAD)
1305 case BUTTON_STOP | BUTTON_REL: 1307 case BUTTON_STOP | BUTTON_REL:
1306#else 1308#else
1307 case BUTTON_OFF | BUTTON_REL: 1309 case BUTTON_OFF | BUTTON_REL:
diff --git a/apps/main.c b/apps/main.c
index 64c79b6e03..7f47140aca 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -138,6 +138,7 @@ void init(void)
138 138
139 powermgmt_init(); 139 powermgmt_init();
140 140
141#ifdef HAVE_BATTERIES
141 if (coldstart && charger_inserted()) 142 if (coldstart && charger_inserted())
142 { 143 {
143 rc = charging_screen(); /* display a "charging" screen */ 144 rc = charging_screen(); /* display a "charging" screen */
@@ -145,6 +146,7 @@ void init(void)
145 power_off(); 146 power_off();
146 /* "On" pressed or USB connected: proceed */ 147 /* "On" pressed or USB connected: proceed */
147 } 148 }
149#endif
148 150
149 rc = ata_init(); 151 rc = ata_init();
150 if(rc) 152 if(rc)
diff --git a/apps/main_menu.c b/apps/main_menu.c
index db70d0f70b..8a657f90f6 100644
--- a/apps/main_menu.c
+++ b/apps/main_menu.c
@@ -218,7 +218,7 @@ bool show_info(void)
218 /* Wait for a key to be pushed */ 218 /* Wait for a key to be pushed */
219 key = button_get_w_tmo(HZ*5); 219 key = button_get_w_tmo(HZ*5);
220 switch(key) { 220 switch(key) {
221#ifdef HAVE_PLAYER_KEYPAD 221#if defined(HAVE_PLAYER_KEYPAD) || defined(HAVE_NEO_KEYPAD)
222 case BUTTON_STOP | BUTTON_REL: 222 case BUTTON_STOP | BUTTON_REL:
223#else 223#else
224 case BUTTON_LEFT | BUTTON_REL: 224 case BUTTON_LEFT | BUTTON_REL:
diff --git a/apps/player/keyboard.c b/apps/player/keyboard.c
index a44bdd46d7..9c857765b5 100644
--- a/apps/player/keyboard.c
+++ b/apps/player/keyboard.c
@@ -29,7 +29,7 @@
29 29
30#define KEYBOARD_PAGES 3 30#define KEYBOARD_PAGES 3
31 31
32unsigned short *lcd_ascii; 32extern unsigned short *lcd_ascii;
33 33
34static unsigned short* kbd_setupkeys(int page, int* len) 34static unsigned short* kbd_setupkeys(int page, int* len)
35{ 35{
diff --git a/apps/playlist.c b/apps/playlist.c
index 1ededb2ba9..31e3040b60 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -453,7 +453,7 @@ static int add_directory_to_playlist(char *dirname, int *position, bool queue,
453 for (i=0; i<num_files; i++) 453 for (i=0; i<num_files; i++)
454 { 454 {
455 /* user abort */ 455 /* user abort */
456#ifdef HAVE_PLAYER_KEYPAD 456#if defined(HAVE_PLAYER_KEYPAD) || defined(HAVE_NEO_KEYPAD)
457 if (button_get(false) == BUTTON_STOP) 457 if (button_get(false) == BUTTON_STOP)
458#else 458#else
459 if (button_get(false) == BUTTON_OFF) 459 if (button_get(false) == BUTTON_OFF)
@@ -1553,7 +1553,7 @@ int playlist_insert_playlist(char *filename, int position, bool queue)
1553 while ((max = read_line(fd, temp_buf, sizeof(temp_buf))) > 0) 1553 while ((max = read_line(fd, temp_buf, sizeof(temp_buf))) > 0)
1554 { 1554 {
1555 /* user abort */ 1555 /* user abort */
1556#ifdef HAVE_PLAYER_KEYPAD 1556#if defined(HAVE_PLAYER_KEYPAD) || defined(HAVE_NEO_KEYPAD)
1557 if (button_get(false) == BUTTON_STOP) 1557 if (button_get(false) == BUTTON_STOP)
1558#else 1558#else
1559 if (button_get(false) == BUTTON_OFF) 1559 if (button_get(false) == BUTTON_OFF)
@@ -2019,7 +2019,7 @@ int playlist_save(char *filename)
2019 int seek; 2019 int seek;
2020 2020
2021 /* user abort */ 2021 /* user abort */
2022#ifdef HAVE_PLAYER_KEYPAD 2022#if defined(HAVE_PLAYER_KEYPAD) || defined(HAVE_NEO_KEYPAD)
2023 if (button_get(false) == BUTTON_STOP) 2023 if (button_get(false) == BUTTON_STOP)
2024#else 2024#else
2025 if (button_get(false) == BUTTON_OFF) 2025 if (button_get(false) == BUTTON_OFF)
diff --git a/apps/screens.c b/apps/screens.c
index 319c0eabd1..2e5f44c2ab 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -103,6 +103,9 @@ void usb_display_info(void)
103 103
104void usb_screen(void) 104void usb_screen(void)
105{ 105{
106#ifdef USB_NONE
107 /* nothing here! */
108#else
106#ifndef SIMULATOR 109#ifndef SIMULATOR
107 backlight_on(); 110 backlight_on();
108 usb_acknowledge(SYS_USB_CONNECTED_ACK); 111 usb_acknowledge(SYS_USB_CONNECTED_ACK);
@@ -118,6 +121,7 @@ void usb_screen(void)
118 121
119 backlight_on(); 122 backlight_on();
120#endif 123#endif
124#endif /* USB_NONE */
121} 125}
122 126
123 127
@@ -230,7 +234,7 @@ void charging_display_info(bool animate)
230} 234}
231#endif 235#endif
232 236
233 237#ifdef HAVE_BATTERIES
234/* blocks while charging, returns on event: 238/* blocks while charging, returns on event:
235 1 if charger cable was removed 239 1 if charger cable was removed
236 2 if Off/Stop key was pressed 240 2 if Off/Stop key was pressed
@@ -279,7 +283,7 @@ int charging_screen(void)
279 283
280 return rc; 284 return rc;
281} 285}
282 286#endif /* HAVE_BATTERIES */
283 287
284 288
285#ifdef HAVE_RECORDER_KEYPAD 289#ifdef HAVE_RECORDER_KEYPAD
diff --git a/apps/sleeptimer.c b/apps/sleeptimer.c
index fb7630a241..15a2f7c656 100644
--- a/apps/sleeptimer.c
+++ b/apps/sleeptimer.c
@@ -92,7 +92,7 @@ bool sleeptimer_screen(void)
92 done = true; 92 done = true;
93 break; 93 break;
94 94
95#ifdef HAVE_PLAYER_KEYPAD 95#if defined(HAVE_PLAYER_KEYPAD) || defined(HAVE_NEO_KEYPAD)
96 case BUTTON_RIGHT: 96 case BUTTON_RIGHT:
97#else 97#else
98 case BUTTON_UP: 98 case BUTTON_UP:
diff --git a/apps/tree.c b/apps/tree.c
index a173b9095a..62b9ce289f 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -67,7 +67,7 @@ static struct
67 char* extension; /* extension for which the file type is recognized */ 67 char* extension; /* extension for which the file type is recognized */
68 int tree_attr; /* which identifier */ 68 int tree_attr; /* which identifier */
69 int icon; /* the icon which shall be used for it, -1 if unknown */ 69 int icon; /* the icon which shall be used for it, -1 if unknown */
70 /* To have it extendable, there could be more useful stuff in here, 70 /* To have it extendable, there could be more useful stuff in here,
71 like handler functions, plugin name, etc. */ 71 like handler functions, plugin name, etc. */
72} filetypes[] = { 72} filetypes[] = {
73 { ".mp3", TREE_ATTR_MPA, File }, 73 { ".mp3", TREE_ATTR_MPA, File },
@@ -140,7 +140,7 @@ void browse_root(void)
140#define MARGIN_Y (global_settings.statusbar ? STATUSBAR_HEIGHT : 0) 140#define MARGIN_Y (global_settings.statusbar ? STATUSBAR_HEIGHT : 0)
141 141
142/* position the entry-list starts at */ 142/* position the entry-list starts at */
143#define LINE_X 0 143#define LINE_X 0
144#define LINE_Y (global_settings.statusbar ? 1 : 0) 144#define LINE_Y (global_settings.statusbar ? 1 : 0)
145 145
146#define CURSOR_X (global_settings.scrollbar && \ 146#define CURSOR_X (global_settings.scrollbar && \
@@ -213,13 +213,13 @@ static int compare(const void* p1, const void* p2)
213{ 213{
214 struct entry* e1 = (struct entry*)p1; 214 struct entry* e1 = (struct entry*)p1;
215 struct entry* e2 = (struct entry*)p2; 215 struct entry* e2 = (struct entry*)p2;
216 216
217 if (( e1->attr & ATTR_DIRECTORY ) == ( e2->attr & ATTR_DIRECTORY )) 217 if (( e1->attr & ATTR_DIRECTORY ) == ( e2->attr & ATTR_DIRECTORY ))
218 if (global_settings.sort_case) 218 if (global_settings.sort_case)
219 return strncmp(e1->name, e2->name, MAX_PATH); 219 return strncmp(e1->name, e2->name, MAX_PATH);
220 else 220 else
221 return strncasecmp(e1->name, e2->name, MAX_PATH); 221 return strncasecmp(e1->name, e2->name, MAX_PATH);
222 else 222 else
223 return ( e2->attr & ATTR_DIRECTORY ) - ( e1->attr & ATTR_DIRECTORY ); 223 return ( e2->attr & ATTR_DIRECTORY ) - ( e1->attr & ATTR_DIRECTORY );
224} 224}
225 225
@@ -234,7 +234,7 @@ static void showfileline(int line, int direntry, bool scroll, int *dirfilter)
234#endif 234#endif
235 235
236 /* if any file filter is on, strip the extension */ 236 /* if any file filter is on, strip the extension */
237 if (*dirfilter != SHOW_ALL && 237 if (*dirfilter != SHOW_ALL &&
238 !(dircache[direntry].attr & ATTR_DIRECTORY)) 238 !(dircache[direntry].attr & ATTR_DIRECTORY))
239 { 239 {
240 char* dotpos = strrchr(name, '.'); 240 char* dotpos = strrchr(name, '.');
@@ -277,35 +277,35 @@ struct entry* load_and_sort_directory(char *dirname, int *dirfilter,
277 DIR *dir = opendir(dirname); 277 DIR *dir = opendir(dirname);
278 if(!dir) 278 if(!dir)
279 return NULL; /* not a directory */ 279 return NULL; /* not a directory */
280 280
281 name_buffer_length = 0; 281 name_buffer_length = 0;
282 *buffer_full = false; 282 *buffer_full = false;
283 283
284 for ( i=0; i < max_files_in_dir; i++ ) { 284 for ( i=0; i < max_files_in_dir; i++ ) {
285 int len; 285 int len;
286 struct dirent *entry = readdir(dir); 286 struct dirent *entry = readdir(dir);
287 struct entry* dptr = &dircache[i]; 287 struct entry* dptr = &dircache[i];
288 if (!entry) 288 if (!entry)
289 break; 289 break;
290 290
291 len = strlen(entry->d_name); 291 len = strlen(entry->d_name);
292 292
293 /* skip directories . and .. */ 293 /* skip directories . and .. */
294 if ((entry->attribute & ATTR_DIRECTORY) && 294 if ((entry->attribute & ATTR_DIRECTORY) &&
295 (((len == 1) && 295 (((len == 1) &&
296 (!strncmp(entry->d_name, ".", 1))) || 296 (!strncmp(entry->d_name, ".", 1))) ||
297 ((len == 2) && 297 ((len == 2) &&
298 (!strncmp(entry->d_name, "..", 2))))) { 298 (!strncmp(entry->d_name, "..", 2))))) {
299 i--; 299 i--;
300 continue; 300 continue;
301 } 301 }
302 302
303 /* Skip FAT volume ID */ 303 /* Skip FAT volume ID */
304 if (entry->attribute & ATTR_VOLUME_ID) { 304 if (entry->attribute & ATTR_VOLUME_ID) {
305 i--; 305 i--;
306 continue; 306 continue;
307 } 307 }
308 308
309 /* filter out dotfiles and hidden files */ 309 /* filter out dotfiles and hidden files */
310 if (*dirfilter != SHOW_ALL && 310 if (*dirfilter != SHOW_ALL &&
311 ((entry->d_name[0]=='.') || 311 ((entry->d_name[0]=='.') ||
@@ -313,11 +313,11 @@ struct entry* load_and_sort_directory(char *dirname, int *dirfilter,
313 i--; 313 i--;
314 continue; 314 continue;
315 } 315 }
316 316
317 dptr->attr = entry->attribute; 317 dptr->attr = entry->attribute;
318 318
319 /* check for known file types */ 319 /* check for known file types */
320 if ( !(dptr->attr & ATTR_DIRECTORY) && (len > 4) ) 320 if ( !(dptr->attr & ATTR_DIRECTORY) && (len > 4) )
321 { 321 {
322 unsigned j; 322 unsigned j;
323 for (j=0; j<sizeof(filetypes)/sizeof(*filetypes); j++) 323 for (j=0; j<sizeof(filetypes)/sizeof(*filetypes); j++)
@@ -361,7 +361,7 @@ struct entry* load_and_sort_directory(char *dirname, int *dirfilter,
361 i--; 361 i--;
362 continue; 362 continue;
363 } 363 }
364 364
365 if (len > name_buffer_size - name_buffer_length - 1) { 365 if (len > name_buffer_size - name_buffer_length - 1) {
366 /* Tell the world that we ran out of buffer space */ 366 /* Tell the world that we ran out of buffer space */
367 *buffer_full = true; 367 *buffer_full = true;
@@ -514,8 +514,8 @@ static int showdir(char *path, int start, int *dirfilter)
514 int offset=0; 514 int offset=0;
515 if ( line_height > 8 ) 515 if ( line_height > 8 )
516 offset = (line_height - 8) / 2; 516 offset = (line_height - 8) / 2;
517 lcd_bitmap(bitmap_icons_6x8[icon_type], 517 lcd_bitmap(bitmap_icons_6x8[icon_type],
518 CURSOR_X * 6 + CURSOR_WIDTH, 518 CURSOR_X * 6 + CURSOR_WIDTH,
519 MARGIN_Y+(i-start)*line_height + offset, 519 MARGIN_Y+(i-start)*line_height + offset,
520 6, 8, true); 520 6, 8, true);
521#else 521#else
@@ -527,7 +527,7 @@ static int showdir(char *path, int start, int *dirfilter)
527 } 527 }
528 528
529#ifdef HAVE_LCD_BITMAP 529#ifdef HAVE_LCD_BITMAP
530 if (global_settings.scrollbar && (filesindir > tree_max_on_screen)) 530 if (global_settings.scrollbar && (filesindir > tree_max_on_screen))
531 scrollbar(SCROLLBAR_X, SCROLLBAR_Y, SCROLLBAR_WIDTH - 1, 531 scrollbar(SCROLLBAR_X, SCROLLBAR_Y, SCROLLBAR_WIDTH - 1,
532 LCD_HEIGHT - SCROLLBAR_Y, filesindir, start, 532 LCD_HEIGHT - SCROLLBAR_Y, filesindir, start,
533 start + tree_max_on_screen, VERTICAL); 533 start + tree_max_on_screen, VERTICAL);
@@ -539,7 +539,7 @@ static int showdir(char *path, int start, int *dirfilter)
539static bool ask_resume(bool ask_once) 539static bool ask_resume(bool ask_once)
540{ 540{
541 bool stop = false; 541 bool stop = false;
542 542
543#ifdef HAVE_LCD_CHARCELLS 543#ifdef HAVE_LCD_CHARCELLS
544 lcd_double_height(false); 544 lcd_double_height(false);
545#endif 545#endif
@@ -562,16 +562,20 @@ static bool ask_resume(bool ask_once)
562 while (!stop) { 562 while (!stop) {
563 switch (button_get(true)) { 563 switch (button_get(true)) {
564 case BUTTON_PLAY: 564 case BUTTON_PLAY:
565#ifdef BUTTON_RC_PLAY
565 case BUTTON_RC_PLAY: 566 case BUTTON_RC_PLAY:
567#endif
566 return true; 568 return true;
567 569
570#ifdef BUTTON_ON
568 /* ignore the ON button, since it might 571 /* ignore the ON button, since it might
569 still be pressed since booting */ 572 still be pressed since booting */
570 case BUTTON_ON: 573 case BUTTON_ON:
571 case BUTTON_ON | BUTTON_REL: 574 case BUTTON_ON | BUTTON_REL:
572 case BUTTON_ON | BUTTON_REPEAT: 575 case BUTTON_ON | BUTTON_REPEAT:
573 break; 576 break;
574 577#endif
578
575 case SYS_USB_CONNECTED: 579 case SYS_USB_CONNECTED:
576 usb_screen(); 580 usb_screen();
577 stop = true; 581 stop = true;
@@ -600,7 +604,7 @@ void resume_directory(char *dir)
600 &buffer_full)) 604 &buffer_full))
601 return; 605 return;
602 lastdir[0] = 0; 606 lastdir[0] = 0;
603 607
604 build_playlist(0); 608 build_playlist(0);
605} 609}
606 610
@@ -635,7 +639,7 @@ static void start_resume(bool ask_once)
635 639
636 if (!ask_resume(ask_once)) 640 if (!ask_resume(ask_once))
637 return; 641 return;
638 642
639 if (playlist_resume() != -1) 643 if (playlist_resume() != -1)
640 { 644 {
641 playlist_start(global_settings.resume_index, 645 playlist_start(global_settings.resume_index,
@@ -680,7 +684,7 @@ void set_current_file(char *path)
680 dirlevel = 0; 684 dirlevel = 0;
681 dirpos[dirlevel] = -1; 685 dirpos[dirlevel] = -1;
682 cursorpos[dirlevel] = 0; 686 cursorpos[dirlevel] = 0;
683 687
684 /* use '/' to calculate dirlevel */ 688 /* use '/' to calculate dirlevel */
685 for (i=1; i<strlen(path)+1; i++) 689 for (i=1; i<strlen(path)+1; i++)
686 { 690 {
@@ -711,9 +715,13 @@ static bool handle_on(int *ds, int *dc, int numentries, int tree_max_on_screen,
711 while (!exit) { 715 while (!exit) {
712 switch (button_get(true)) { 716 switch (button_get(true)) {
713 case TREE_PREV: 717 case TREE_PREV:
718#ifdef BUTTON_RC_LEFT
714 case BUTTON_RC_LEFT: 719 case BUTTON_RC_LEFT:
720#endif
721#ifdef BUTTON_ON
715 case BUTTON_ON | TREE_PREV: 722 case BUTTON_ON | TREE_PREV:
716 case BUTTON_ON | TREE_PREV | BUTTON_REPEAT: 723 case BUTTON_ON | TREE_PREV | BUTTON_REPEAT:
724#endif
717 used = true; 725 used = true;
718 if ( dirstart ) { 726 if ( dirstart ) {
719 dirstart -= tree_max_on_screen; 727 dirstart -= tree_max_on_screen;
@@ -723,15 +731,19 @@ static bool handle_on(int *ds, int *dc, int numentries, int tree_max_on_screen,
723 else 731 else
724 dircursor = 0; 732 dircursor = 0;
725 break; 733 break;
726 734
727 case TREE_NEXT: 735 case TREE_NEXT:
736#ifdef BUTTON_RC_RIGHT
728 case BUTTON_RC_RIGHT: 737 case BUTTON_RC_RIGHT:
738#endif
739#ifdef BUTTON_ON
729 case BUTTON_ON | TREE_NEXT: 740 case BUTTON_ON | TREE_NEXT:
730 case BUTTON_ON | TREE_NEXT | BUTTON_REPEAT: 741 case BUTTON_ON | TREE_NEXT | BUTTON_REPEAT:
742#endif
731 used = true; 743 used = true;
732 if ( dirstart < numentries - tree_max_on_screen ) { 744 if ( dirstart < numentries - tree_max_on_screen ) {
733 dirstart += tree_max_on_screen; 745 dirstart += tree_max_on_screen;
734 if ( dirstart > 746 if ( dirstart >
735 numentries - tree_max_on_screen ) 747 numentries - tree_max_on_screen )
736 dirstart = numentries - tree_max_on_screen; 748 dirstart = numentries - tree_max_on_screen;
737 } 749 }
@@ -741,8 +753,13 @@ static bool handle_on(int *ds, int *dc, int numentries, int tree_max_on_screen,
741 753
742 754
743 case BUTTON_PLAY: 755 case BUTTON_PLAY:
756#ifdef BUTTON_RC_PLAY
744 case BUTTON_RC_PLAY: 757 case BUTTON_RC_PLAY:
745 case BUTTON_ON | BUTTON_PLAY: { 758#endif
759#ifdef BUTTON_ON
760 case BUTTON_ON | BUTTON_PLAY:
761#endif
762 {
746 int onplay_result; 763 int onplay_result;
747 764
748 if (currdir[1]) 765 if (currdir[1])
@@ -768,12 +785,14 @@ static bool handle_on(int *ds, int *dc, int numentries, int tree_max_on_screen,
768 } 785 }
769 exit = true; 786 exit = true;
770 break; 787 break;
771 } 788 }
789#ifdef BUTTON_ON
772 case BUTTON_ON | BUTTON_REL: 790 case BUTTON_ON | BUTTON_REL:
773 case BUTTON_ON | TREE_PREV | BUTTON_REL: 791 case BUTTON_ON | TREE_PREV | BUTTON_REL:
774 case BUTTON_ON | TREE_NEXT | BUTTON_REL: 792 case BUTTON_ON | TREE_NEXT | BUTTON_REL:
775 exit = true; 793 exit = true;
776 break; 794 break;
795#endif
777 } 796 }
778 if ( used && !exit ) { 797 if ( used && !exit ) {
779#ifdef HAVE_LCD_BITMAP 798#ifdef HAVE_LCD_BITMAP
@@ -834,15 +853,15 @@ static bool dirbrowse(char *root, int *dirfilter)
834 start_resume(true); 853 start_resume(true);
835 854
836 numentries = showdir(currdir, dirstart, dirfilter); 855 numentries = showdir(currdir, dirstart, dirfilter);
837 if (numentries == -1) 856 if (numentries == -1)
838 return false; /* currdir is not a directory */ 857 return false; /* currdir is not a directory */
839 858
840 if (*dirfilter > NUM_FILTER_MODES && numentries==0) 859 if (*dirfilter > NUM_FILTER_MODES && numentries==0)
841 { 860 {
842 splash(HZ*2, 0, true, str(LANG_NO_FILES)); 861 splash(HZ*2, 0, true, str(LANG_NO_FILES));
843 return false; /* No files found for rockbox_browser() */ 862 return false; /* No files found for rockbox_browser() */
844 } 863 }
845 864
846 update_all = true; 865 update_all = true;
847 866
848 put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true); 867 put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true);
@@ -873,7 +892,9 @@ static bool dirbrowse(char *root, int *dirfilter)
873 892
874 switch ( button ) { 893 switch ( button ) {
875 case TREE_EXIT: 894 case TREE_EXIT:
895#ifdef BUTTON_RC_STOP
876 case BUTTON_RC_STOP: 896 case BUTTON_RC_STOP:
897#endif
877#ifdef HAVE_RECORDER_KEYPAD 898#ifdef HAVE_RECORDER_KEYPAD
878 case BUTTON_LEFT | BUTTON_REPEAT: 899 case BUTTON_LEFT | BUTTON_REPEAT:
879#endif 900#endif
@@ -918,7 +939,7 @@ static bool dirbrowse(char *root, int *dirfilter)
918#endif 939#endif
919 settings_save(); 940 settings_save();
920 break; 941 break;
921 942
922#ifdef HAVE_RECORDER_KEYPAD 943#ifdef HAVE_RECORDER_KEYPAD
923 case BUTTON_OFF | BUTTON_REPEAT: 944 case BUTTON_OFF | BUTTON_REPEAT:
924#else 945#else
@@ -932,10 +953,12 @@ static bool dirbrowse(char *root, int *dirfilter)
932 953
933 case TREE_ENTER: 954 case TREE_ENTER:
934 case TREE_ENTER | BUTTON_REPEAT: 955 case TREE_ENTER | BUTTON_REPEAT:
956#ifdef BUTTON_RC_PLAY
935 case BUTTON_RC_PLAY: 957 case BUTTON_RC_PLAY:
958#endif
936#ifdef HAVE_RECORDER_KEYPAD 959#ifdef HAVE_RECORDER_KEYPAD
937 case BUTTON_PLAY: 960 case BUTTON_PLAY:
938 case BUTTON_PLAY | BUTTON_REPEAT: 961 case BUTTON_PLAY | BUTTON_REPEAT:
939#endif 962#endif
940 if ( !numentries ) 963 if ( !numentries )
941 break; 964 break;
@@ -971,7 +994,7 @@ static bool dirbrowse(char *root, int *dirfilter)
971 play = true; 994 play = true;
972 } 995 }
973 break; 996 break;
974 997
975 case TREE_ATTR_MPA: 998 case TREE_ATTR_MPA:
976 if (playlist_create(currdir, NULL) != -1) 999 if (playlist_create(currdir, NULL) != -1)
977 { 1000 {
@@ -981,14 +1004,14 @@ static bool dirbrowse(char *root, int *dirfilter)
981 { 1004 {
982 start_index = 1005 start_index =
983 playlist_shuffle(seed,start_index); 1006 playlist_shuffle(seed,start_index);
984 1007
985 /* when shuffling dir.: play all files 1008 /* when shuffling dir.: play all files
986 even if the file selected by user is 1009 even if the file selected by user is
987 not the first one */ 1010 not the first one */
988 if (!global_settings.play_selected) 1011 if (!global_settings.play_selected)
989 start_index = 0; 1012 start_index = 0;
990 } 1013 }
991 1014
992 playlist_start(start_index, 0); 1015 playlist_start(start_index, 0);
993 play = true; 1016 play = true;
994 } 1017 }
@@ -1015,7 +1038,7 @@ static bool dirbrowse(char *root, int *dirfilter)
1015 lcd_getstringsize("A", &fw, &fh); 1038 lcd_getstringsize("A", &fw, &fh);
1016 tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh; 1039 tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh;
1017 /* make sure cursor is on screen */ 1040 /* make sure cursor is on screen */
1018 while ( dircursor > tree_max_on_screen ) 1041 while ( dircursor > tree_max_on_screen )
1019 { 1042 {
1020 dircursor--; 1043 dircursor--;
1021 dirstart++; 1044 dirstart++;
@@ -1043,7 +1066,7 @@ static bool dirbrowse(char *root, int *dirfilter)
1043 /* chip-8 game */ 1066 /* chip-8 game */
1044 case TREE_ATTR_CH8: 1067 case TREE_ATTR_CH8:
1045 plugin_load("/.rockbox/rocks/chip8.rock",buf); 1068 plugin_load("/.rockbox/rocks/chip8.rock",buf);
1046 break; 1069 break;
1047 1070
1048 case TREE_ATTR_FONT: 1071 case TREE_ATTR_FONT:
1049 font_load(buf); 1072 font_load(buf);
@@ -1070,7 +1093,7 @@ static bool dirbrowse(char *root, int *dirfilter)
1070 /* ucl flash file */ 1093 /* ucl flash file */
1071 case TREE_ATTR_UCL: 1094 case TREE_ATTR_UCL:
1072 plugin_load("/.rockbox/rocks/rockbox_flash.rock",buf); 1095 plugin_load("/.rockbox/rocks/rockbox_flash.rock",buf);
1073 break; 1096 break;
1074#endif 1097#endif
1075 1098
1076 /* plugin file */ 1099 /* plugin file */
@@ -1109,7 +1132,9 @@ static bool dirbrowse(char *root, int *dirfilter)
1109 1132
1110 case TREE_PREV: 1133 case TREE_PREV:
1111 case TREE_PREV | BUTTON_REPEAT: 1134 case TREE_PREV | BUTTON_REPEAT:
1135#ifdef BUTTON_RC_LEFT
1112 case BUTTON_RC_LEFT: 1136 case BUTTON_RC_LEFT:
1137#endif
1113 if(filesindir) { 1138 if(filesindir) {
1114 if(dircursor) { 1139 if(dircursor) {
1115 put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, false); 1140 put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, false);
@@ -1147,7 +1172,9 @@ static bool dirbrowse(char *root, int *dirfilter)
1147 1172
1148 case TREE_NEXT: 1173 case TREE_NEXT:
1149 case TREE_NEXT | BUTTON_REPEAT: 1174 case TREE_NEXT | BUTTON_REPEAT:
1175#ifdef BUTTON_RC_RIGHT
1150 case BUTTON_RC_RIGHT: 1176 case BUTTON_RC_RIGHT:
1177#endif
1151 if(filesindir) 1178 if(filesindir)
1152 { 1179 {
1153 if (dircursor + dirstart + 1 < numentries ) { 1180 if (dircursor + dirstart + 1 < numentries ) {
@@ -1155,7 +1182,7 @@ static bool dirbrowse(char *root, int *dirfilter)
1155 put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, false); 1182 put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, false);
1156 dircursor++; 1183 dircursor++;
1157 put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true); 1184 put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true);
1158 } 1185 }
1159 else { 1186 else {
1160 dirstart++; 1187 dirstart++;
1161 numentries = showdir(currdir, dirstart, dirfilter); 1188 numentries = showdir(currdir, dirstart, dirfilter);
@@ -1168,7 +1195,7 @@ static bool dirbrowse(char *root, int *dirfilter)
1168 put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, false); 1195 put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, false);
1169 dirstart = dircursor = 0; 1196 dirstart = dircursor = 0;
1170 put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true); 1197 put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true);
1171 } 1198 }
1172 else { 1199 else {
1173 dirstart = dircursor = 0; 1200 dirstart = dircursor = 0;
1174 numentries = showdir(currdir, dirstart, dirfilter); 1201 numentries = showdir(currdir, dirstart, dirfilter);
@@ -1190,6 +1217,8 @@ static bool dirbrowse(char *root, int *dirfilter)
1190 } 1217 }
1191 break; 1218 break;
1192 1219
1220#ifdef BUTTON_ON /* I bet the folks without ON-button want this to
1221 work on a different button */
1193 case BUTTON_ON: 1222 case BUTTON_ON:
1194 if (handle_on(&dirstart, &dircursor, numentries, 1223 if (handle_on(&dirstart, &dircursor, numentries,
1195 tree_max_on_screen, dirfilter)) 1224 tree_max_on_screen, dirfilter))
@@ -1216,6 +1245,7 @@ static bool dirbrowse(char *root, int *dirfilter)
1216 } 1245 }
1217 } 1246 }
1218 break; 1247 break;
1248#endif
1219 1249
1220#ifdef HAVE_RECORDER_KEYPAD 1250#ifdef HAVE_RECORDER_KEYPAD
1221 case BUTTON_F2: 1251 case BUTTON_F2:
@@ -1254,7 +1284,7 @@ static bool dirbrowse(char *root, int *dirfilter)
1254 1284
1255 if ( button ) 1285 if ( button )
1256 ata_spin(); 1286 ata_spin();
1257 1287
1258 /* do we need to rescan dir? */ 1288 /* do we need to rescan dir? */
1259 if (reload_dir || reload_root || 1289 if (reload_dir || reload_root ||
1260 lastfilter != *dirfilter || 1290 lastfilter != *dirfilter ||
@@ -1298,7 +1328,7 @@ static bool dirbrowse(char *root, int *dirfilter)
1298 numentries = showdir(currdir, dirstart, dirfilter); 1328 numentries = showdir(currdir, dirstart, dirfilter);
1299 update_all = true; 1329 update_all = true;
1300 put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true); 1330 put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true);
1301 1331
1302 need_update = true; 1332 need_update = true;
1303 reload_dir = false; 1333 reload_dir = false;
1304 } 1334 }
@@ -1340,15 +1370,15 @@ static bool add_dir(char* dirname, int fd)
1340 bool abort = false; 1370 bool abort = false;
1341 char buf[MAX_PATH/2]; /* saving a little stack... */ 1371 char buf[MAX_PATH/2]; /* saving a little stack... */
1342 DIR* dir; 1372 DIR* dir;
1343 1373
1344 /* check for user abort */ 1374 /* check for user abort */
1345#ifdef HAVE_PLAYER_KEYPAD 1375#ifdef BUTTON_STOP
1346 if (button_get(false) == BUTTON_STOP) 1376 if (button_get(false) == BUTTON_STOP)
1347#else 1377#else
1348 if (button_get(false) == BUTTON_OFF) 1378 if (button_get(false) == BUTTON_OFF)
1349#endif 1379#endif
1350 return true; 1380 return true;
1351 1381
1352 dir = opendir(dirname); 1382 dir = opendir(dirname);
1353 if(!dir) 1383 if(!dir)
1354 return true; 1384 return true;
@@ -1431,7 +1461,7 @@ bool create_playlist(void)
1431 add_dir(currdir[1] ? currdir : "/", fd); 1461 add_dir(currdir[1] ? currdir : "/", fd);
1432 close(fd); 1462 close(fd);
1433 sleep(HZ); 1463 sleep(HZ);
1434 1464
1435 return true; 1465 return true;
1436} 1466}
1437 1467
@@ -1465,7 +1495,7 @@ void tree_init(void)
1465 use it until the next reboot. */ 1495 use it until the next reboot. */
1466 max_files_in_dir = global_settings.max_files_in_dir; 1496 max_files_in_dir = global_settings.max_files_in_dir;
1467 name_buffer_size = AVERAGE_FILENAME_LENGTH * max_files_in_dir; 1497 name_buffer_size = AVERAGE_FILENAME_LENGTH * max_files_in_dir;
1468 1498
1469 name_buffer = buffer_alloc(name_buffer_size); 1499 name_buffer = buffer_alloc(name_buffer_size);
1470 dircache = buffer_alloc(max_files_in_dir * sizeof(struct entry)); 1500 dircache = buffer_alloc(max_files_in_dir * sizeof(struct entry));
1471} 1501}
diff --git a/apps/wps-display.c b/apps/wps-display.c
index 846cea20d9..68d3eb531d 100644
--- a/apps/wps-display.c
+++ b/apps/wps-display.c
@@ -414,6 +414,7 @@ static char* get_tag(struct mp3entry* id3,
414#endif 414#endif
415 case 'f': /* full-line progress bar */ 415 case 'f': /* full-line progress bar */
416#ifdef HAVE_LCD_CHARCELLS 416#ifdef HAVE_LCD_CHARCELLS
417#ifndef HAVE_NEO_LCD
417 if(has_new_lcd()) { 418 if(has_new_lcd()) {
418 *flags |= WPS_REFRESH_PLAYER_PROGRESS; 419 *flags |= WPS_REFRESH_PLAYER_PROGRESS;
419 *flags |= WPS_REFRESH_DYNAMIC; 420 *flags |= WPS_REFRESH_DYNAMIC;
@@ -421,7 +422,10 @@ static char* get_tag(struct mp3entry* id3,
421 /* we need 11 characters (full line) for 422 /* we need 11 characters (full line) for
422 progress-bar */ 423 progress-bar */
423 snprintf(buf, buf_size, " "); 424 snprintf(buf, buf_size, " ");
424 } else { 425 }
426 else
427#endif /* HAVE_NEO_LCD */
428 {
425 /* Tell the user if we have an OldPlayer */ 429 /* Tell the user if we have an OldPlayer */
426 snprintf(buf, buf_size, " <Old LCD> "); 430 snprintf(buf, buf_size, " <Old LCD> ");
427 } 431 }
diff --git a/apps/wps.c b/apps/wps.c
index a39f2ba30c..10cc0c00fb 100644
--- a/apps/wps.c
+++ b/apps/wps.c
@@ -53,7 +53,7 @@ static bool paused = false;
53static struct mp3entry* id3 = NULL; 53static struct mp3entry* id3 = NULL;
54static char current_track_path[MAX_PATH+1]; 54static char current_track_path[MAX_PATH+1];
55 55
56#ifdef HAVE_PLAYER_KEYPAD 56#if defined(HAVE_PLAYER_KEYPAD) || defined(HAVE_NEO_KEYPAD)
57void player_change_volume(int button) 57void player_change_volume(int button)
58{ 58{
59 bool exit = false; 59 bool exit = false;
@@ -278,7 +278,7 @@ bool browse_id3(void)
278 case BUTTON_REPEAT: 278 case BUTTON_REPEAT:
279 break; 279 break;
280 280
281#ifdef HAVE_PLAYER_KEYPAD 281#ifdef BUTTON_STOP
282 case BUTTON_STOP: 282 case BUTTON_STOP:
283#else 283#else
284 case BUTTON_OFF: 284 case BUTTON_OFF:
@@ -506,7 +506,7 @@ static bool menu(void)
506 break; 506 break;
507 507
508 /* mute */ 508 /* mute */
509#ifdef HAVE_PLAYER_KEYPAD 509#ifdef BUTTON_MENU
510 case BUTTON_MENU | BUTTON_PLAY: 510 case BUTTON_MENU | BUTTON_PLAY:
511#else 511#else
512 case BUTTON_F1 | BUTTON_PLAY: 512 case BUTTON_F1 | BUTTON_PLAY:
@@ -534,7 +534,7 @@ static bool menu(void)
534 while (button_get(false)); /* clear button queue */ 534 while (button_get(false)); /* clear button queue */
535 break; 535 break;
536 536
537#ifdef HAVE_PLAYER_KEYPAD 537#ifdef BUTTON_MENU
538 /* change volume */ 538 /* change volume */
539 case BUTTON_MENU | BUTTON_LEFT: 539 case BUTTON_MENU | BUTTON_LEFT:
540 case BUTTON_MENU | BUTTON_LEFT | BUTTON_REPEAT: 540 case BUTTON_MENU | BUTTON_LEFT | BUTTON_REPEAT:
@@ -545,9 +545,11 @@ static bool menu(void)
545 break; 545 break;
546 546
547 /* show id3 tags */ 547 /* show id3 tags */
548#ifdef BUTTON_ON
548 case BUTTON_MENU | BUTTON_ON: 549 case BUTTON_MENU | BUTTON_ON:
549 status_set_param(true); 550 status_set_param(true);
550 status_set_audio(true); 551 status_set_audio(true);
552#endif
551#else 553#else
552 case BUTTON_F1 | BUTTON_ON: 554 case BUTTON_F1 | BUTTON_ON:
553#endif 555#endif
@@ -742,8 +744,11 @@ int wps_show(void)
742 ! ((button & BUTTON_MENU) || 744 ! ((button & BUTTON_MENU) ||
743#endif 745#endif
744 (button == BUTTON_NONE) || 746 (button == BUTTON_NONE) ||
745 (button == SYS_USB_CONNECTED) || 747 (button == SYS_USB_CONNECTED)
746 (button & BUTTON_REMOTE))) 748#ifdef BUTTON_REMOTE
749 || (button & BUTTON_REMOTE)
750#endif
751 ))
747 { 752 {
748 while (button_get(false)); /* clear button queue */ 753 while (button_get(false)); /* clear button queue */
749 display_keylock_text(true); 754 display_keylock_text(true);
@@ -759,6 +764,7 @@ int wps_show(void)
759 764
760 switch(button) 765 switch(button)
761 { 766 {
767#ifdef BUTTON_ON
762 case BUTTON_ON: 768 case BUTTON_ON:
763#ifdef HAVE_RECORDER_KEYPAD 769#ifdef HAVE_RECORDER_KEYPAD
764 switch (on_screen()) { 770 switch (on_screen()) {
@@ -795,10 +801,12 @@ int wps_show(void)
795 } 801 }
796 break; 802 break;
797#endif 803#endif
798 804#endif /* BUTTON_ON */
799 /* play/pause */ 805 /* play/pause */
800 case BUTTON_PLAY: 806 case BUTTON_PLAY:
807#ifdef BUTTON_RC_PLAY
801 case BUTTON_RC_PLAY: 808 case BUTTON_RC_PLAY:
809#endif
802 if ( paused ) 810 if ( paused )
803 { 811 {
804 paused = false; 812 paused = false;
@@ -830,7 +838,9 @@ int wps_show(void)
830 case BUTTON_UP: 838 case BUTTON_UP:
831 case BUTTON_UP | BUTTON_REPEAT: 839 case BUTTON_UP | BUTTON_REPEAT:
832#endif 840#endif
841#ifdef BUTTON_RC_VOL_UP
833 case BUTTON_RC_VOL_UP: 842 case BUTTON_RC_VOL_UP:
843#endif
834 global_settings.volume++; 844 global_settings.volume++;
835 if(global_settings.volume > mpeg_sound_max(SOUND_VOLUME)) 845 if(global_settings.volume > mpeg_sound_max(SOUND_VOLUME))
836 global_settings.volume = mpeg_sound_max(SOUND_VOLUME); 846 global_settings.volume = mpeg_sound_max(SOUND_VOLUME);
@@ -844,7 +854,9 @@ int wps_show(void)
844 case BUTTON_DOWN: 854 case BUTTON_DOWN:
845 case BUTTON_DOWN | BUTTON_REPEAT: 855 case BUTTON_DOWN | BUTTON_REPEAT:
846#endif 856#endif
857#ifdef BUTTON_RC_VOL_DOWN
847 case BUTTON_RC_VOL_DOWN: 858 case BUTTON_RC_VOL_DOWN:
859#endif
848 global_settings.volume--; 860 global_settings.volume--;
849 if(global_settings.volume < mpeg_sound_min(SOUND_VOLUME)) 861 if(global_settings.volume < mpeg_sound_min(SOUND_VOLUME))
850 global_settings.volume = mpeg_sound_min(SOUND_VOLUME); 862 global_settings.volume = mpeg_sound_min(SOUND_VOLUME);
@@ -860,7 +872,9 @@ int wps_show(void)
860 break; 872 break;
861 873
862 /* prev / restart */ 874 /* prev / restart */
875#ifdef BUTTON_RC_LEFT
863 case BUTTON_RC_LEFT: 876 case BUTTON_RC_LEFT:
877#endif
864 case BUTTON_LEFT | BUTTON_REL: 878 case BUTTON_LEFT | BUTTON_REL:
865#ifdef HAVE_RECORDER_KEYPAD 879#ifdef HAVE_RECORDER_KEYPAD
866 if ((button == (BUTTON_LEFT | BUTTON_REL)) && 880 if ((button == (BUTTON_LEFT | BUTTON_REL)) &&
@@ -882,7 +896,9 @@ int wps_show(void)
882 break; 896 break;
883 897
884 /* next */ 898 /* next */
899#ifdef BUTTON_RC_RIGHT
885 case BUTTON_RC_RIGHT: 900 case BUTTON_RC_RIGHT:
901#endif
886 case BUTTON_RIGHT | BUTTON_REL: 902 case BUTTON_RIGHT | BUTTON_REL:
887#ifdef HAVE_RECORDER_KEYPAD 903#ifdef HAVE_RECORDER_KEYPAD
888 if ((button == (BUTTON_RIGHT | BUTTON_REL)) && 904 if ((button == (BUTTON_RIGHT | BUTTON_REL)) &&
@@ -893,7 +909,7 @@ int wps_show(void)
893 break; 909 break;
894 910
895 /* menu key functions */ 911 /* menu key functions */
896#ifdef HAVE_PLAYER_KEYPAD 912#ifdef BUTTON_MENU
897 case BUTTON_MENU: 913 case BUTTON_MENU:
898#else 914#else
899 case BUTTON_F1: 915 case BUTTON_F1:
@@ -922,8 +938,10 @@ int wps_show(void)
922#endif 938#endif
923 939
924 /* stop and exit wps */ 940 /* stop and exit wps */
941#ifdef BUTTON_RC_STOP
925 case BUTTON_RC_STOP: 942 case BUTTON_RC_STOP:
926#ifdef HAVE_RECORDER_KEYPAD 943#endif
944#ifdef BUTTON_OFF
927 case BUTTON_OFF: 945 case BUTTON_OFF:
928#else 946#else
929 case BUTTON_STOP | BUTTON_REL: 947 case BUTTON_STOP | BUTTON_REL: