Fix FS#6716 - make it easier to follow the selected file going in and
out of the trees git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12638 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
38be0e65d3
commit
1b07ed05a4
3 changed files with 20 additions and 5 deletions
|
@ -88,10 +88,10 @@ static int browser(void* param)
|
|||
last_screen == GO_TO_WPS && audio_status() &&
|
||||
wps_state.current_track_path[0] != '\0')
|
||||
{
|
||||
snprintf(folder, MAX_PATH, "%s", wps_state.current_track_path);
|
||||
strcpy(folder, wps_state.current_track_path);
|
||||
}
|
||||
else
|
||||
snprintf(folder, MAX_PATH, "%s/", last_folder);
|
||||
strcpy(folder, last_folder);
|
||||
break;
|
||||
case GO_TO_DBBROWSER:
|
||||
if ((last_screen != GO_TO_ROOT) && !tagcache_is_usable())
|
||||
|
@ -111,7 +111,7 @@ static int browser(void* param)
|
|||
switch ((intptr_t)param)
|
||||
{
|
||||
case GO_TO_FILEBROWSER:
|
||||
strcpy(last_folder, tc->currdir);
|
||||
get_current_file(last_folder, MAX_PATH);
|
||||
break;
|
||||
case GO_TO_DBBROWSER:
|
||||
last_db_dirlevel = tc->dirlevel;
|
||||
|
|
18
apps/tree.c
18
apps/tree.c
|
@ -474,6 +474,21 @@ void reload_directory(void)
|
|||
reload_dir = true;
|
||||
}
|
||||
|
||||
void get_current_file(char* buffer, int buffer_len)
|
||||
{
|
||||
#ifdef HAVE_TAGCACHE
|
||||
/* in ID3DB mode it is a bad idea to call this function */
|
||||
/* (only happens with `follow playlist') */
|
||||
if( *tc.dirfilter == SHOW_ID3DB )
|
||||
return;
|
||||
#endif
|
||||
|
||||
struct entry* dc = tc.dircache;
|
||||
struct entry* e = &dc[tc.selected_item];
|
||||
snprintf(buffer, buffer_len, "%s/%s", getcwd(NULL,0),
|
||||
e->name);
|
||||
}
|
||||
|
||||
/* Selects a file and update tree context properly */
|
||||
void set_current_file(char *path)
|
||||
{
|
||||
|
@ -505,8 +520,6 @@ void set_current_file(char *path)
|
|||
|
||||
strcpy(lastfile, name);
|
||||
|
||||
/* undefined item selected */
|
||||
tc.selected_item = -1;
|
||||
|
||||
/* If we changed dir we must recalculate the dirlevel
|
||||
and adjust the selected history properly */
|
||||
|
@ -1153,6 +1166,7 @@ int rockbox_browse(const char *root, int dirfilter)
|
|||
int last_context;
|
||||
|
||||
backup = tc;
|
||||
tc.selected_item = 0;
|
||||
tc.dirlevel = 0;
|
||||
memcpy(tc.currdir, root, sizeof(tc.currdir));
|
||||
start_wps = false;
|
||||
|
|
|
@ -100,6 +100,7 @@ struct tree_context {
|
|||
void tree_get_filetypes(const struct filetype**, int*);
|
||||
void tree_init(void);
|
||||
void browse_root(void);
|
||||
void get_current_file(char* buffer, int buffer_len);
|
||||
void set_current_file(char *path);
|
||||
int rockbox_browse(const char *root, int dirfilter);
|
||||
bool create_playlist(void);
|
||||
|
|
Loading…
Reference in a new issue