--- tree.c.orig Fri Aug 30 01:25:18 2002 +++ tree.c Fri Aug 30 01:21:14 2002 @@ -104,14 +104,14 @@ #define TREE_EXIT BUTTON_LEFT #define TREE_ENTER BUTTON_RIGHT #define TREE_MENU BUTTON_F1 -#define RELEASE_MASK (BUTTON_OFF) +#define RELEASE_MASK (BUTTON_OFF | TREE_MENU) #else #define TREE_NEXT BUTTON_RIGHT #define TREE_PREV BUTTON_LEFT #define TREE_EXIT BUTTON_STOP #define TREE_ENTER BUTTON_PLAY #define TREE_MENU BUTTON_MENU -#define RELEASE_MASK (BUTTON_STOP) +#define RELEASE_MASK (BUTTON_STOP | TREE_MENU) #endif /* HAVE_RECORDER_KEYPAD */ #define TREE_ATTR_M3U 0x80 /* unused by FAT attributes */ @@ -123,8 +123,6 @@ int start=start_index; int pl_file_idx; - playlist_clear(); - pl_file_idx = playlist_newdir(dir); if (pl_file_idx >= 0) { /* successfully created new directory entry*/ @@ -404,6 +402,7 @@ if (showdir(global_settings.resume_file, 0) < 0 ) return; + playlist_clear(); build_playlist(global_settings.resume_file, global_settings.resume_index); play_list(global_settings.resume_index, @@ -418,6 +417,9 @@ } } +static bool menu_button_is_down = false; +static bool menu_button_used = false; + bool dirbrowse(char *root) { int numentries=0; @@ -498,6 +500,7 @@ case TREE_ENTER: + case BUTTON_PLAY | TREE_MENU: #ifdef HAVE_RECORDER_KEYPAD case BUTTON_PLAY: #endif @@ -525,6 +528,14 @@ lcd_stop_scroll(); if(dircache[dircursor+start].attr & TREE_ATTR_M3U ) { + if (menu_button_is_down) { + /* Add playlist to currently playing playlist */ + load_playlist(currdir, + dircache[dircursor+start].name, + false); + menu_button_used = true; + break; + } else { if ( global_settings.resume ) snprintf(global_settings.resume_file, MAX_PATH, "%s/%s", @@ -538,16 +549,26 @@ 0, seed ); start_index = 0; } + } else if (dircache[dircursor+start].attr & TREE_ATTR_MPA ) { + if (menu_button_is_down) { + /* Add mp3 files in curr dir to playlist */ + build_playlist(currdir, + dircursor+start); + menu_button_used = true; + break; + } else { if ( global_settings.resume ) strncpy(global_settings.resume_file, currdir, MAX_PATH); + playlist_clear(); start_index = build_playlist(currdir, dircursor+start); - /* it is important that we get back the index in the (shuffled) list and store that */ - start_index = play_list(start_index, false, 0, seed); + start_index = play_list(start_index, false, + 0, seed); + } } else break; @@ -650,7 +671,13 @@ } break; - case TREE_MENU: { + case TREE_MENU | BUTTON_REL: { + menu_button_is_down = false; + if (menu_button_used) { + lcd_icon(ICON_PARAM, false); + break; + } + menu_button_used = true; bool lastfilter = global_settings.mp3filter; bool lastsortcase = global_settings.sort_case; bool show_hidden_files = global_settings.show_hidden_files; @@ -668,6 +695,12 @@ break; } + case TREE_MENU: + lcd_icon(ICON_PARAM, true); + menu_button_is_down = true; + menu_button_used = false; + break; + case BUTTON_ON: if (mpeg_is_playing()) {