summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorHardeep Sidhu <dyp@pobox.com>2002-09-09 17:32:15 +0000
committerHardeep Sidhu <dyp@pobox.com>2002-09-09 17:32:15 +0000
commitddfa4cb0e566f1abc91eb963de22aebc58551743 (patch)
treecc4cbd1df8ed2fa7c42eda4a2c2b4537ae317ec7 /apps
parent73f6abebc0bcba03fe2a8f9b3b22bb60a2108e30 (diff)
downloadrockbox-ddfa4cb0e566f1abc91eb963de22aebc58551743.tar.gz
rockbox-ddfa4cb0e566f1abc91eb963de22aebc58551743.zip
Go to current song (instead of root) when exiting wps after resume and browse current enabled. Also, if current file is at end of directory listing, show more files on the screen when exiting wps.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2247 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/tree.c35
1 files changed, 28 insertions, 7 deletions
diff --git a/apps/tree.c b/apps/tree.c
index b46835eb0c..47853f03c9 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -303,16 +303,33 @@ static int showdir(char *path, int start)
if (start == -1)
{
+ int diff_files;
+
/* use lastfile to determine start (default=0) */
- start = dirstart = 0;
+ start = 0;
+
for (i=0; i<filesindir; i++)
{
if (!strcasecmp(dircache[i].name, lastfile))
{
- start = dirstart = i;
+ start = i;
break;
}
}
+
+ diff_files = filesindir - start;
+ if (diff_files < tree_max_on_screen)
+ {
+ int oldstart = start;
+
+ start -= (tree_max_on_screen - diff_files);
+ if (start < 0)
+ start = 0;
+
+ dircursor = oldstart - start;
+ }
+
+ dirstart = start;
}
lcd_stop_scroll();
@@ -482,6 +499,9 @@ void start_resume(void)
if (showdir(global_settings.resume_file, 0) < 0 )
return;
+
+ lastdir[0] = '\0';
+
build_playlist(global_settings.resume_index);
play_list(global_settings.resume_file,
NULL,
@@ -562,17 +582,18 @@ bool dirbrowse(char *root)
tree_max_on_screen = TREE_MAX_ON_SCREEN;
#endif
- start_resume();
- button_set_release(RELEASE_MASK);
-
dircursor=0;
dirstart=0;
dirlevel=0;
memcpy(currdir,root,sizeof(currdir));
- numentries = showdir(root, dirstart);
+
+ start_resume();
+ button_set_release(RELEASE_MASK);
+
+ numentries = showdir(currdir, dirstart);
if (numentries == -1)
- return -1; /* root is not a directory */
+ return -1; /* currdir is not a directory */
put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true);