1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Daniel Stenberg 2003-12-12 13:34:27 +00:00
parent ca71062221
commit 8e43ccbec6
10 changed files with 130 additions and 70 deletions

View file

@ -85,7 +85,9 @@ bool dbg_os(void)
switch(button) switch(button)
{ {
#ifdef BUTTON_OFF
case BUTTON_OFF: case BUTTON_OFF:
#endif
case BUTTON_LEFT: case BUTTON_LEFT:
return false; return false;
} }
@ -1194,9 +1196,9 @@ static bool view_runtime(void)
/* Wait for a key to be pushed */ /* Wait for a key to be pushed */
key = button_get_w_tmo(HZ); key = button_get_w_tmo(HZ);
switch(key) { switch(key) {
#ifdef HAVE_PLAYER_KEYPAD #if defined(HAVE_PLAYER_KEYPAD) || defined(HAVE_NEO_KEYPAD)
case BUTTON_STOP | BUTTON_REL: case BUTTON_STOP | BUTTON_REL:
#else #elif HAVE_RECORDER_KEYPAD
case BUTTON_OFF | BUTTON_REL: case BUTTON_OFF | BUTTON_REL:
#endif #endif
done = true; done = true;
@ -1301,7 +1303,7 @@ static bool dbg_disk_info(void)
/* Wait for a key to be pushed */ /* Wait for a key to be pushed */
key = button_get_w_tmo(HZ*5); key = button_get_w_tmo(HZ*5);
switch(key) { switch(key) {
#ifdef HAVE_PLAYER_KEYPAD #if defined(HAVE_PLAYER_KEYPAD) || defined(HAVE_NEO_KEYPAD)
case BUTTON_STOP | BUTTON_REL: case BUTTON_STOP | BUTTON_REL:
#else #else
case BUTTON_OFF | BUTTON_REL: case BUTTON_OFF | BUTTON_REL:

View file

@ -138,6 +138,7 @@ void init(void)
powermgmt_init(); powermgmt_init();
#ifdef HAVE_BATTERIES
if (coldstart && charger_inserted()) if (coldstart && charger_inserted())
{ {
rc = charging_screen(); /* display a "charging" screen */ rc = charging_screen(); /* display a "charging" screen */
@ -145,6 +146,7 @@ void init(void)
power_off(); power_off();
/* "On" pressed or USB connected: proceed */ /* "On" pressed or USB connected: proceed */
} }
#endif
rc = ata_init(); rc = ata_init();
if(rc) if(rc)

View file

@ -218,7 +218,7 @@ bool show_info(void)
/* Wait for a key to be pushed */ /* Wait for a key to be pushed */
key = button_get_w_tmo(HZ*5); key = button_get_w_tmo(HZ*5);
switch(key) { switch(key) {
#ifdef HAVE_PLAYER_KEYPAD #if defined(HAVE_PLAYER_KEYPAD) || defined(HAVE_NEO_KEYPAD)
case BUTTON_STOP | BUTTON_REL: case BUTTON_STOP | BUTTON_REL:
#else #else
case BUTTON_LEFT | BUTTON_REL: case BUTTON_LEFT | BUTTON_REL:

View file

@ -29,7 +29,7 @@
#define KEYBOARD_PAGES 3 #define KEYBOARD_PAGES 3
unsigned short *lcd_ascii; extern unsigned short *lcd_ascii;
static unsigned short* kbd_setupkeys(int page, int* len) static unsigned short* kbd_setupkeys(int page, int* len)
{ {

View file

@ -453,7 +453,7 @@ static int add_directory_to_playlist(char *dirname, int *position, bool queue,
for (i=0; i<num_files; i++) for (i=0; i<num_files; i++)
{ {
/* user abort */ /* user abort */
#ifdef HAVE_PLAYER_KEYPAD #if defined(HAVE_PLAYER_KEYPAD) || defined(HAVE_NEO_KEYPAD)
if (button_get(false) == BUTTON_STOP) if (button_get(false) == BUTTON_STOP)
#else #else
if (button_get(false) == BUTTON_OFF) if (button_get(false) == BUTTON_OFF)
@ -1553,7 +1553,7 @@ int playlist_insert_playlist(char *filename, int position, bool queue)
while ((max = read_line(fd, temp_buf, sizeof(temp_buf))) > 0) while ((max = read_line(fd, temp_buf, sizeof(temp_buf))) > 0)
{ {
/* user abort */ /* user abort */
#ifdef HAVE_PLAYER_KEYPAD #if defined(HAVE_PLAYER_KEYPAD) || defined(HAVE_NEO_KEYPAD)
if (button_get(false) == BUTTON_STOP) if (button_get(false) == BUTTON_STOP)
#else #else
if (button_get(false) == BUTTON_OFF) if (button_get(false) == BUTTON_OFF)
@ -2019,7 +2019,7 @@ int playlist_save(char *filename)
int seek; int seek;
/* user abort */ /* user abort */
#ifdef HAVE_PLAYER_KEYPAD #if defined(HAVE_PLAYER_KEYPAD) || defined(HAVE_NEO_KEYPAD)
if (button_get(false) == BUTTON_STOP) if (button_get(false) == BUTTON_STOP)
#else #else
if (button_get(false) == BUTTON_OFF) if (button_get(false) == BUTTON_OFF)

View file

@ -103,6 +103,9 @@ void usb_display_info(void)
void usb_screen(void) void usb_screen(void)
{ {
#ifdef USB_NONE
/* nothing here! */
#else
#ifndef SIMULATOR #ifndef SIMULATOR
backlight_on(); backlight_on();
usb_acknowledge(SYS_USB_CONNECTED_ACK); usb_acknowledge(SYS_USB_CONNECTED_ACK);
@ -118,6 +121,7 @@ void usb_screen(void)
backlight_on(); backlight_on();
#endif #endif
#endif /* USB_NONE */
} }
@ -230,7 +234,7 @@ void charging_display_info(bool animate)
} }
#endif #endif
#ifdef HAVE_BATTERIES
/* blocks while charging, returns on event: /* blocks while charging, returns on event:
1 if charger cable was removed 1 if charger cable was removed
2 if Off/Stop key was pressed 2 if Off/Stop key was pressed
@ -279,7 +283,7 @@ int charging_screen(void)
return rc; return rc;
} }
#endif /* HAVE_BATTERIES */
#ifdef HAVE_RECORDER_KEYPAD #ifdef HAVE_RECORDER_KEYPAD

View file

@ -92,7 +92,7 @@ bool sleeptimer_screen(void)
done = true; done = true;
break; break;
#ifdef HAVE_PLAYER_KEYPAD #if defined(HAVE_PLAYER_KEYPAD) || defined(HAVE_NEO_KEYPAD)
case BUTTON_RIGHT: case BUTTON_RIGHT:
#else #else
case BUTTON_UP: case BUTTON_UP:

View file

@ -67,7 +67,7 @@ static struct
char* extension; /* extension for which the file type is recognized */ char* extension; /* extension for which the file type is recognized */
int tree_attr; /* which identifier */ int tree_attr; /* which identifier */
int icon; /* the icon which shall be used for it, -1 if unknown */ int icon; /* the icon which shall be used for it, -1 if unknown */
/* To have it extendable, there could be more useful stuff in here, /* To have it extendable, there could be more useful stuff in here,
like handler functions, plugin name, etc. */ like handler functions, plugin name, etc. */
} filetypes[] = { } filetypes[] = {
{ ".mp3", TREE_ATTR_MPA, File }, { ".mp3", TREE_ATTR_MPA, File },
@ -140,7 +140,7 @@ void browse_root(void)
#define MARGIN_Y (global_settings.statusbar ? STATUSBAR_HEIGHT : 0) #define MARGIN_Y (global_settings.statusbar ? STATUSBAR_HEIGHT : 0)
/* position the entry-list starts at */ /* position the entry-list starts at */
#define LINE_X 0 #define LINE_X 0
#define LINE_Y (global_settings.statusbar ? 1 : 0) #define LINE_Y (global_settings.statusbar ? 1 : 0)
#define CURSOR_X (global_settings.scrollbar && \ #define CURSOR_X (global_settings.scrollbar && \
@ -213,13 +213,13 @@ static int compare(const void* p1, const void* p2)
{ {
struct entry* e1 = (struct entry*)p1; struct entry* e1 = (struct entry*)p1;
struct entry* e2 = (struct entry*)p2; struct entry* e2 = (struct entry*)p2;
if (( e1->attr & ATTR_DIRECTORY ) == ( e2->attr & ATTR_DIRECTORY )) if (( e1->attr & ATTR_DIRECTORY ) == ( e2->attr & ATTR_DIRECTORY ))
if (global_settings.sort_case) if (global_settings.sort_case)
return strncmp(e1->name, e2->name, MAX_PATH); return strncmp(e1->name, e2->name, MAX_PATH);
else else
return strncasecmp(e1->name, e2->name, MAX_PATH); return strncasecmp(e1->name, e2->name, MAX_PATH);
else else
return ( e2->attr & ATTR_DIRECTORY ) - ( e1->attr & ATTR_DIRECTORY ); return ( e2->attr & ATTR_DIRECTORY ) - ( e1->attr & ATTR_DIRECTORY );
} }
@ -234,7 +234,7 @@ static void showfileline(int line, int direntry, bool scroll, int *dirfilter)
#endif #endif
/* if any file filter is on, strip the extension */ /* if any file filter is on, strip the extension */
if (*dirfilter != SHOW_ALL && if (*dirfilter != SHOW_ALL &&
!(dircache[direntry].attr & ATTR_DIRECTORY)) !(dircache[direntry].attr & ATTR_DIRECTORY))
{ {
char* dotpos = strrchr(name, '.'); char* dotpos = strrchr(name, '.');
@ -277,35 +277,35 @@ struct entry* load_and_sort_directory(char *dirname, int *dirfilter,
DIR *dir = opendir(dirname); DIR *dir = opendir(dirname);
if(!dir) if(!dir)
return NULL; /* not a directory */ return NULL; /* not a directory */
name_buffer_length = 0; name_buffer_length = 0;
*buffer_full = false; *buffer_full = false;
for ( i=0; i < max_files_in_dir; i++ ) { for ( i=0; i < max_files_in_dir; i++ ) {
int len; int len;
struct dirent *entry = readdir(dir); struct dirent *entry = readdir(dir);
struct entry* dptr = &dircache[i]; struct entry* dptr = &dircache[i];
if (!entry) if (!entry)
break; break;
len = strlen(entry->d_name); len = strlen(entry->d_name);
/* skip directories . and .. */ /* skip directories . and .. */
if ((entry->attribute & ATTR_DIRECTORY) && if ((entry->attribute & ATTR_DIRECTORY) &&
(((len == 1) && (((len == 1) &&
(!strncmp(entry->d_name, ".", 1))) || (!strncmp(entry->d_name, ".", 1))) ||
((len == 2) && ((len == 2) &&
(!strncmp(entry->d_name, "..", 2))))) { (!strncmp(entry->d_name, "..", 2))))) {
i--; i--;
continue; continue;
} }
/* Skip FAT volume ID */ /* Skip FAT volume ID */
if (entry->attribute & ATTR_VOLUME_ID) { if (entry->attribute & ATTR_VOLUME_ID) {
i--; i--;
continue; continue;
} }
/* filter out dotfiles and hidden files */ /* filter out dotfiles and hidden files */
if (*dirfilter != SHOW_ALL && if (*dirfilter != SHOW_ALL &&
((entry->d_name[0]=='.') || ((entry->d_name[0]=='.') ||
@ -313,11 +313,11 @@ struct entry* load_and_sort_directory(char *dirname, int *dirfilter,
i--; i--;
continue; continue;
} }
dptr->attr = entry->attribute; dptr->attr = entry->attribute;
/* check for known file types */ /* check for known file types */
if ( !(dptr->attr & ATTR_DIRECTORY) && (len > 4) ) if ( !(dptr->attr & ATTR_DIRECTORY) && (len > 4) )
{ {
unsigned j; unsigned j;
for (j=0; j<sizeof(filetypes)/sizeof(*filetypes); j++) for (j=0; j<sizeof(filetypes)/sizeof(*filetypes); j++)
@ -361,7 +361,7 @@ struct entry* load_and_sort_directory(char *dirname, int *dirfilter,
i--; i--;
continue; continue;
} }
if (len > name_buffer_size - name_buffer_length - 1) { if (len > name_buffer_size - name_buffer_length - 1) {
/* Tell the world that we ran out of buffer space */ /* Tell the world that we ran out of buffer space */
*buffer_full = true; *buffer_full = true;
@ -514,8 +514,8 @@ static int showdir(char *path, int start, int *dirfilter)
int offset=0; int offset=0;
if ( line_height > 8 ) if ( line_height > 8 )
offset = (line_height - 8) / 2; offset = (line_height - 8) / 2;
lcd_bitmap(bitmap_icons_6x8[icon_type], lcd_bitmap(bitmap_icons_6x8[icon_type],
CURSOR_X * 6 + CURSOR_WIDTH, CURSOR_X * 6 + CURSOR_WIDTH,
MARGIN_Y+(i-start)*line_height + offset, MARGIN_Y+(i-start)*line_height + offset,
6, 8, true); 6, 8, true);
#else #else
@ -527,7 +527,7 @@ static int showdir(char *path, int start, int *dirfilter)
} }
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
if (global_settings.scrollbar && (filesindir > tree_max_on_screen)) if (global_settings.scrollbar && (filesindir > tree_max_on_screen))
scrollbar(SCROLLBAR_X, SCROLLBAR_Y, SCROLLBAR_WIDTH - 1, scrollbar(SCROLLBAR_X, SCROLLBAR_Y, SCROLLBAR_WIDTH - 1,
LCD_HEIGHT - SCROLLBAR_Y, filesindir, start, LCD_HEIGHT - SCROLLBAR_Y, filesindir, start,
start + tree_max_on_screen, VERTICAL); start + tree_max_on_screen, VERTICAL);
@ -539,7 +539,7 @@ static int showdir(char *path, int start, int *dirfilter)
static bool ask_resume(bool ask_once) static bool ask_resume(bool ask_once)
{ {
bool stop = false; bool stop = false;
#ifdef HAVE_LCD_CHARCELLS #ifdef HAVE_LCD_CHARCELLS
lcd_double_height(false); lcd_double_height(false);
#endif #endif
@ -562,16 +562,20 @@ static bool ask_resume(bool ask_once)
while (!stop) { while (!stop) {
switch (button_get(true)) { switch (button_get(true)) {
case BUTTON_PLAY: case BUTTON_PLAY:
#ifdef BUTTON_RC_PLAY
case BUTTON_RC_PLAY: case BUTTON_RC_PLAY:
#endif
return true; return true;
#ifdef BUTTON_ON
/* ignore the ON button, since it might /* ignore the ON button, since it might
still be pressed since booting */ still be pressed since booting */
case BUTTON_ON: case BUTTON_ON:
case BUTTON_ON | BUTTON_REL: case BUTTON_ON | BUTTON_REL:
case BUTTON_ON | BUTTON_REPEAT: case BUTTON_ON | BUTTON_REPEAT:
break; break;
#endif
case SYS_USB_CONNECTED: case SYS_USB_CONNECTED:
usb_screen(); usb_screen();
stop = true; stop = true;
@ -600,7 +604,7 @@ void resume_directory(char *dir)
&buffer_full)) &buffer_full))
return; return;
lastdir[0] = 0; lastdir[0] = 0;
build_playlist(0); build_playlist(0);
} }
@ -635,7 +639,7 @@ static void start_resume(bool ask_once)
if (!ask_resume(ask_once)) if (!ask_resume(ask_once))
return; return;
if (playlist_resume() != -1) if (playlist_resume() != -1)
{ {
playlist_start(global_settings.resume_index, playlist_start(global_settings.resume_index,
@ -680,7 +684,7 @@ void set_current_file(char *path)
dirlevel = 0; dirlevel = 0;
dirpos[dirlevel] = -1; dirpos[dirlevel] = -1;
cursorpos[dirlevel] = 0; cursorpos[dirlevel] = 0;
/* use '/' to calculate dirlevel */ /* use '/' to calculate dirlevel */
for (i=1; i<strlen(path)+1; i++) for (i=1; i<strlen(path)+1; i++)
{ {
@ -711,9 +715,13 @@ static bool handle_on(int *ds, int *dc, int numentries, int tree_max_on_screen,
while (!exit) { while (!exit) {
switch (button_get(true)) { switch (button_get(true)) {
case TREE_PREV: case TREE_PREV:
#ifdef BUTTON_RC_LEFT
case BUTTON_RC_LEFT: case BUTTON_RC_LEFT:
#endif
#ifdef BUTTON_ON
case BUTTON_ON | TREE_PREV: case BUTTON_ON | TREE_PREV:
case BUTTON_ON | TREE_PREV | BUTTON_REPEAT: case BUTTON_ON | TREE_PREV | BUTTON_REPEAT:
#endif
used = true; used = true;
if ( dirstart ) { if ( dirstart ) {
dirstart -= tree_max_on_screen; dirstart -= tree_max_on_screen;
@ -723,15 +731,19 @@ static bool handle_on(int *ds, int *dc, int numentries, int tree_max_on_screen,
else else
dircursor = 0; dircursor = 0;
break; break;
case TREE_NEXT: case TREE_NEXT:
#ifdef BUTTON_RC_RIGHT
case BUTTON_RC_RIGHT: case BUTTON_RC_RIGHT:
#endif
#ifdef BUTTON_ON
case BUTTON_ON | TREE_NEXT: case BUTTON_ON | TREE_NEXT:
case BUTTON_ON | TREE_NEXT | BUTTON_REPEAT: case BUTTON_ON | TREE_NEXT | BUTTON_REPEAT:
#endif
used = true; used = true;
if ( dirstart < numentries - tree_max_on_screen ) { if ( dirstart < numentries - tree_max_on_screen ) {
dirstart += tree_max_on_screen; dirstart += tree_max_on_screen;
if ( dirstart > if ( dirstart >
numentries - tree_max_on_screen ) numentries - tree_max_on_screen )
dirstart = numentries - tree_max_on_screen; dirstart = numentries - tree_max_on_screen;
} }
@ -741,8 +753,13 @@ static bool handle_on(int *ds, int *dc, int numentries, int tree_max_on_screen,
case BUTTON_PLAY: case BUTTON_PLAY:
#ifdef BUTTON_RC_PLAY
case BUTTON_RC_PLAY: case BUTTON_RC_PLAY:
case BUTTON_ON | BUTTON_PLAY: { #endif
#ifdef BUTTON_ON
case BUTTON_ON | BUTTON_PLAY:
#endif
{
int onplay_result; int onplay_result;
if (currdir[1]) if (currdir[1])
@ -768,12 +785,14 @@ static bool handle_on(int *ds, int *dc, int numentries, int tree_max_on_screen,
} }
exit = true; exit = true;
break; break;
} }
#ifdef BUTTON_ON
case BUTTON_ON | BUTTON_REL: case BUTTON_ON | BUTTON_REL:
case BUTTON_ON | TREE_PREV | BUTTON_REL: case BUTTON_ON | TREE_PREV | BUTTON_REL:
case BUTTON_ON | TREE_NEXT | BUTTON_REL: case BUTTON_ON | TREE_NEXT | BUTTON_REL:
exit = true; exit = true;
break; break;
#endif
} }
if ( used && !exit ) { if ( used && !exit ) {
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
@ -834,15 +853,15 @@ static bool dirbrowse(char *root, int *dirfilter)
start_resume(true); start_resume(true);
numentries = showdir(currdir, dirstart, dirfilter); numentries = showdir(currdir, dirstart, dirfilter);
if (numentries == -1) if (numentries == -1)
return false; /* currdir is not a directory */ return false; /* currdir is not a directory */
if (*dirfilter > NUM_FILTER_MODES && numentries==0) if (*dirfilter > NUM_FILTER_MODES && numentries==0)
{ {
splash(HZ*2, 0, true, str(LANG_NO_FILES)); splash(HZ*2, 0, true, str(LANG_NO_FILES));
return false; /* No files found for rockbox_browser() */ return false; /* No files found for rockbox_browser() */
} }
update_all = true; update_all = true;
put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true); put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true);
@ -873,7 +892,9 @@ static bool dirbrowse(char *root, int *dirfilter)
switch ( button ) { switch ( button ) {
case TREE_EXIT: case TREE_EXIT:
#ifdef BUTTON_RC_STOP
case BUTTON_RC_STOP: case BUTTON_RC_STOP:
#endif
#ifdef HAVE_RECORDER_KEYPAD #ifdef HAVE_RECORDER_KEYPAD
case BUTTON_LEFT | BUTTON_REPEAT: case BUTTON_LEFT | BUTTON_REPEAT:
#endif #endif
@ -918,7 +939,7 @@ static bool dirbrowse(char *root, int *dirfilter)
#endif #endif
settings_save(); settings_save();
break; break;
#ifdef HAVE_RECORDER_KEYPAD #ifdef HAVE_RECORDER_KEYPAD
case BUTTON_OFF | BUTTON_REPEAT: case BUTTON_OFF | BUTTON_REPEAT:
#else #else
@ -932,10 +953,12 @@ static bool dirbrowse(char *root, int *dirfilter)
case TREE_ENTER: case TREE_ENTER:
case TREE_ENTER | BUTTON_REPEAT: case TREE_ENTER | BUTTON_REPEAT:
#ifdef BUTTON_RC_PLAY
case BUTTON_RC_PLAY: case BUTTON_RC_PLAY:
#endif
#ifdef HAVE_RECORDER_KEYPAD #ifdef HAVE_RECORDER_KEYPAD
case BUTTON_PLAY: case BUTTON_PLAY:
case BUTTON_PLAY | BUTTON_REPEAT: case BUTTON_PLAY | BUTTON_REPEAT:
#endif #endif
if ( !numentries ) if ( !numentries )
break; break;
@ -971,7 +994,7 @@ static bool dirbrowse(char *root, int *dirfilter)
play = true; play = true;
} }
break; break;
case TREE_ATTR_MPA: case TREE_ATTR_MPA:
if (playlist_create(currdir, NULL) != -1) if (playlist_create(currdir, NULL) != -1)
{ {
@ -981,14 +1004,14 @@ static bool dirbrowse(char *root, int *dirfilter)
{ {
start_index = start_index =
playlist_shuffle(seed,start_index); playlist_shuffle(seed,start_index);
/* when shuffling dir.: play all files /* when shuffling dir.: play all files
even if the file selected by user is even if the file selected by user is
not the first one */ not the first one */
if (!global_settings.play_selected) if (!global_settings.play_selected)
start_index = 0; start_index = 0;
} }
playlist_start(start_index, 0); playlist_start(start_index, 0);
play = true; play = true;
} }
@ -1015,7 +1038,7 @@ static bool dirbrowse(char *root, int *dirfilter)
lcd_getstringsize("A", &fw, &fh); lcd_getstringsize("A", &fw, &fh);
tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh; tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh;
/* make sure cursor is on screen */ /* make sure cursor is on screen */
while ( dircursor > tree_max_on_screen ) while ( dircursor > tree_max_on_screen )
{ {
dircursor--; dircursor--;
dirstart++; dirstart++;
@ -1043,7 +1066,7 @@ static bool dirbrowse(char *root, int *dirfilter)
/* chip-8 game */ /* chip-8 game */
case TREE_ATTR_CH8: case TREE_ATTR_CH8:
plugin_load("/.rockbox/rocks/chip8.rock",buf); plugin_load("/.rockbox/rocks/chip8.rock",buf);
break; break;
case TREE_ATTR_FONT: case TREE_ATTR_FONT:
font_load(buf); font_load(buf);
@ -1070,7 +1093,7 @@ static bool dirbrowse(char *root, int *dirfilter)
/* ucl flash file */ /* ucl flash file */
case TREE_ATTR_UCL: case TREE_ATTR_UCL:
plugin_load("/.rockbox/rocks/rockbox_flash.rock",buf); plugin_load("/.rockbox/rocks/rockbox_flash.rock",buf);
break; break;
#endif #endif
/* plugin file */ /* plugin file */
@ -1109,7 +1132,9 @@ static bool dirbrowse(char *root, int *dirfilter)
case TREE_PREV: case TREE_PREV:
case TREE_PREV | BUTTON_REPEAT: case TREE_PREV | BUTTON_REPEAT:
#ifdef BUTTON_RC_LEFT
case BUTTON_RC_LEFT: case BUTTON_RC_LEFT:
#endif
if(filesindir) { if(filesindir) {
if(dircursor) { if(dircursor) {
put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, false); put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, false);
@ -1147,7 +1172,9 @@ static bool dirbrowse(char *root, int *dirfilter)
case TREE_NEXT: case TREE_NEXT:
case TREE_NEXT | BUTTON_REPEAT: case TREE_NEXT | BUTTON_REPEAT:
#ifdef BUTTON_RC_RIGHT
case BUTTON_RC_RIGHT: case BUTTON_RC_RIGHT:
#endif
if(filesindir) if(filesindir)
{ {
if (dircursor + dirstart + 1 < numentries ) { if (dircursor + dirstart + 1 < numentries ) {
@ -1155,7 +1182,7 @@ static bool dirbrowse(char *root, int *dirfilter)
put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, false); put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, false);
dircursor++; dircursor++;
put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true); put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true);
} }
else { else {
dirstart++; dirstart++;
numentries = showdir(currdir, dirstart, dirfilter); numentries = showdir(currdir, dirstart, dirfilter);
@ -1168,7 +1195,7 @@ static bool dirbrowse(char *root, int *dirfilter)
put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, false); put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, false);
dirstart = dircursor = 0; dirstart = dircursor = 0;
put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true); put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true);
} }
else { else {
dirstart = dircursor = 0; dirstart = dircursor = 0;
numentries = showdir(currdir, dirstart, dirfilter); numentries = showdir(currdir, dirstart, dirfilter);
@ -1190,6 +1217,8 @@ static bool dirbrowse(char *root, int *dirfilter)
} }
break; break;
#ifdef BUTTON_ON /* I bet the folks without ON-button want this to
work on a different button */
case BUTTON_ON: case BUTTON_ON:
if (handle_on(&dirstart, &dircursor, numentries, if (handle_on(&dirstart, &dircursor, numentries,
tree_max_on_screen, dirfilter)) tree_max_on_screen, dirfilter))
@ -1216,6 +1245,7 @@ static bool dirbrowse(char *root, int *dirfilter)
} }
} }
break; break;
#endif
#ifdef HAVE_RECORDER_KEYPAD #ifdef HAVE_RECORDER_KEYPAD
case BUTTON_F2: case BUTTON_F2:
@ -1254,7 +1284,7 @@ static bool dirbrowse(char *root, int *dirfilter)
if ( button ) if ( button )
ata_spin(); ata_spin();
/* do we need to rescan dir? */ /* do we need to rescan dir? */
if (reload_dir || reload_root || if (reload_dir || reload_root ||
lastfilter != *dirfilter || lastfilter != *dirfilter ||
@ -1298,7 +1328,7 @@ static bool dirbrowse(char *root, int *dirfilter)
numentries = showdir(currdir, dirstart, dirfilter); numentries = showdir(currdir, dirstart, dirfilter);
update_all = true; update_all = true;
put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true); put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true);
need_update = true; need_update = true;
reload_dir = false; reload_dir = false;
} }
@ -1340,15 +1370,15 @@ static bool add_dir(char* dirname, int fd)
bool abort = false; bool abort = false;
char buf[MAX_PATH/2]; /* saving a little stack... */ char buf[MAX_PATH/2]; /* saving a little stack... */
DIR* dir; DIR* dir;
/* check for user abort */ /* check for user abort */
#ifdef HAVE_PLAYER_KEYPAD #ifdef BUTTON_STOP
if (button_get(false) == BUTTON_STOP) if (button_get(false) == BUTTON_STOP)
#else #else
if (button_get(false) == BUTTON_OFF) if (button_get(false) == BUTTON_OFF)
#endif #endif
return true; return true;
dir = opendir(dirname); dir = opendir(dirname);
if(!dir) if(!dir)
return true; return true;
@ -1431,7 +1461,7 @@ bool create_playlist(void)
add_dir(currdir[1] ? currdir : "/", fd); add_dir(currdir[1] ? currdir : "/", fd);
close(fd); close(fd);
sleep(HZ); sleep(HZ);
return true; return true;
} }
@ -1465,7 +1495,7 @@ void tree_init(void)
use it until the next reboot. */ use it until the next reboot. */
max_files_in_dir = global_settings.max_files_in_dir; max_files_in_dir = global_settings.max_files_in_dir;
name_buffer_size = AVERAGE_FILENAME_LENGTH * max_files_in_dir; name_buffer_size = AVERAGE_FILENAME_LENGTH * max_files_in_dir;
name_buffer = buffer_alloc(name_buffer_size); name_buffer = buffer_alloc(name_buffer_size);
dircache = buffer_alloc(max_files_in_dir * sizeof(struct entry)); dircache = buffer_alloc(max_files_in_dir * sizeof(struct entry));
} }

View file

@ -414,6 +414,7 @@ static char* get_tag(struct mp3entry* id3,
#endif #endif
case 'f': /* full-line progress bar */ case 'f': /* full-line progress bar */
#ifdef HAVE_LCD_CHARCELLS #ifdef HAVE_LCD_CHARCELLS
#ifndef HAVE_NEO_LCD
if(has_new_lcd()) { if(has_new_lcd()) {
*flags |= WPS_REFRESH_PLAYER_PROGRESS; *flags |= WPS_REFRESH_PLAYER_PROGRESS;
*flags |= WPS_REFRESH_DYNAMIC; *flags |= WPS_REFRESH_DYNAMIC;
@ -421,7 +422,10 @@ static char* get_tag(struct mp3entry* id3,
/* we need 11 characters (full line) for /* we need 11 characters (full line) for
progress-bar */ progress-bar */
snprintf(buf, buf_size, " "); snprintf(buf, buf_size, " ");
} else { }
else
#endif /* HAVE_NEO_LCD */
{
/* Tell the user if we have an OldPlayer */ /* Tell the user if we have an OldPlayer */
snprintf(buf, buf_size, " <Old LCD> "); snprintf(buf, buf_size, " <Old LCD> ");
} }

View file

@ -53,7 +53,7 @@ static bool paused = false;
static struct mp3entry* id3 = NULL; static struct mp3entry* id3 = NULL;
static char current_track_path[MAX_PATH+1]; static char current_track_path[MAX_PATH+1];
#ifdef HAVE_PLAYER_KEYPAD #if defined(HAVE_PLAYER_KEYPAD) || defined(HAVE_NEO_KEYPAD)
void player_change_volume(int button) void player_change_volume(int button)
{ {
bool exit = false; bool exit = false;
@ -278,7 +278,7 @@ bool browse_id3(void)
case BUTTON_REPEAT: case BUTTON_REPEAT:
break; break;
#ifdef HAVE_PLAYER_KEYPAD #ifdef BUTTON_STOP
case BUTTON_STOP: case BUTTON_STOP:
#else #else
case BUTTON_OFF: case BUTTON_OFF:
@ -506,7 +506,7 @@ static bool menu(void)
break; break;
/* mute */ /* mute */
#ifdef HAVE_PLAYER_KEYPAD #ifdef BUTTON_MENU
case BUTTON_MENU | BUTTON_PLAY: case BUTTON_MENU | BUTTON_PLAY:
#else #else
case BUTTON_F1 | BUTTON_PLAY: case BUTTON_F1 | BUTTON_PLAY:
@ -534,7 +534,7 @@ static bool menu(void)
while (button_get(false)); /* clear button queue */ while (button_get(false)); /* clear button queue */
break; break;
#ifdef HAVE_PLAYER_KEYPAD #ifdef BUTTON_MENU
/* change volume */ /* change volume */
case BUTTON_MENU | BUTTON_LEFT: case BUTTON_MENU | BUTTON_LEFT:
case BUTTON_MENU | BUTTON_LEFT | BUTTON_REPEAT: case BUTTON_MENU | BUTTON_LEFT | BUTTON_REPEAT:
@ -545,9 +545,11 @@ static bool menu(void)
break; break;
/* show id3 tags */ /* show id3 tags */
#ifdef BUTTON_ON
case BUTTON_MENU | BUTTON_ON: case BUTTON_MENU | BUTTON_ON:
status_set_param(true); status_set_param(true);
status_set_audio(true); status_set_audio(true);
#endif
#else #else
case BUTTON_F1 | BUTTON_ON: case BUTTON_F1 | BUTTON_ON:
#endif #endif
@ -742,8 +744,11 @@ int wps_show(void)
! ((button & BUTTON_MENU) || ! ((button & BUTTON_MENU) ||
#endif #endif
(button == BUTTON_NONE) || (button == BUTTON_NONE) ||
(button == SYS_USB_CONNECTED) || (button == SYS_USB_CONNECTED)
(button & BUTTON_REMOTE))) #ifdef BUTTON_REMOTE
|| (button & BUTTON_REMOTE)
#endif
))
{ {
while (button_get(false)); /* clear button queue */ while (button_get(false)); /* clear button queue */
display_keylock_text(true); display_keylock_text(true);
@ -759,6 +764,7 @@ int wps_show(void)
switch(button) switch(button)
{ {
#ifdef BUTTON_ON
case BUTTON_ON: case BUTTON_ON:
#ifdef HAVE_RECORDER_KEYPAD #ifdef HAVE_RECORDER_KEYPAD
switch (on_screen()) { switch (on_screen()) {
@ -795,10 +801,12 @@ int wps_show(void)
} }
break; break;
#endif #endif
#endif /* BUTTON_ON */
/* play/pause */ /* play/pause */
case BUTTON_PLAY: case BUTTON_PLAY:
#ifdef BUTTON_RC_PLAY
case BUTTON_RC_PLAY: case BUTTON_RC_PLAY:
#endif
if ( paused ) if ( paused )
{ {
paused = false; paused = false;
@ -830,7 +838,9 @@ int wps_show(void)
case BUTTON_UP: case BUTTON_UP:
case BUTTON_UP | BUTTON_REPEAT: case BUTTON_UP | BUTTON_REPEAT:
#endif #endif
#ifdef BUTTON_RC_VOL_UP
case BUTTON_RC_VOL_UP: case BUTTON_RC_VOL_UP:
#endif
global_settings.volume++; global_settings.volume++;
if(global_settings.volume > mpeg_sound_max(SOUND_VOLUME)) if(global_settings.volume > mpeg_sound_max(SOUND_VOLUME))
global_settings.volume = mpeg_sound_max(SOUND_VOLUME); global_settings.volume = mpeg_sound_max(SOUND_VOLUME);
@ -844,7 +854,9 @@ int wps_show(void)
case BUTTON_DOWN: case BUTTON_DOWN:
case BUTTON_DOWN | BUTTON_REPEAT: case BUTTON_DOWN | BUTTON_REPEAT:
#endif #endif
#ifdef BUTTON_RC_VOL_DOWN
case BUTTON_RC_VOL_DOWN: case BUTTON_RC_VOL_DOWN:
#endif
global_settings.volume--; global_settings.volume--;
if(global_settings.volume < mpeg_sound_min(SOUND_VOLUME)) if(global_settings.volume < mpeg_sound_min(SOUND_VOLUME))
global_settings.volume = mpeg_sound_min(SOUND_VOLUME); global_settings.volume = mpeg_sound_min(SOUND_VOLUME);
@ -860,7 +872,9 @@ int wps_show(void)
break; break;
/* prev / restart */ /* prev / restart */
#ifdef BUTTON_RC_LEFT
case BUTTON_RC_LEFT: case BUTTON_RC_LEFT:
#endif
case BUTTON_LEFT | BUTTON_REL: case BUTTON_LEFT | BUTTON_REL:
#ifdef HAVE_RECORDER_KEYPAD #ifdef HAVE_RECORDER_KEYPAD
if ((button == (BUTTON_LEFT | BUTTON_REL)) && if ((button == (BUTTON_LEFT | BUTTON_REL)) &&
@ -882,7 +896,9 @@ int wps_show(void)
break; break;
/* next */ /* next */
#ifdef BUTTON_RC_RIGHT
case BUTTON_RC_RIGHT: case BUTTON_RC_RIGHT:
#endif
case BUTTON_RIGHT | BUTTON_REL: case BUTTON_RIGHT | BUTTON_REL:
#ifdef HAVE_RECORDER_KEYPAD #ifdef HAVE_RECORDER_KEYPAD
if ((button == (BUTTON_RIGHT | BUTTON_REL)) && if ((button == (BUTTON_RIGHT | BUTTON_REL)) &&
@ -893,7 +909,7 @@ int wps_show(void)
break; break;
/* menu key functions */ /* menu key functions */
#ifdef HAVE_PLAYER_KEYPAD #ifdef BUTTON_MENU
case BUTTON_MENU: case BUTTON_MENU:
#else #else
case BUTTON_F1: case BUTTON_F1:
@ -922,8 +938,10 @@ int wps_show(void)
#endif #endif
/* stop and exit wps */ /* stop and exit wps */
#ifdef BUTTON_RC_STOP
case BUTTON_RC_STOP: case BUTTON_RC_STOP:
#ifdef HAVE_RECORDER_KEYPAD #endif
#ifdef BUTTON_OFF
case BUTTON_OFF: case BUTTON_OFF:
#else #else
case BUTTON_STOP | BUTTON_REL: case BUTTON_STOP | BUTTON_REL: