summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2002-05-31 07:19:38 +0000
committerBjörn Stenberg <bjorn@haxx.se>2002-05-31 07:19:38 +0000
commit2b203ca191f0c9f72449c9edf7ab14d82f76cff0 (patch)
tree583e50370d8115975817193c6659f8a3b9af5ae2 /apps
parentc3f95cdd75155279f52b8cac33fc97b37826ccb1 (diff)
downloadrockbox-2b203ca191f0c9f72449c9edf7ab14d82f76cff0.zip
rockbox-2b203ca191f0c9f72449c9edf7ab14d82f76cff0.tar.gz
rockbox-2b203ca191f0c9f72449c9edf7ab14d82f76cff0.tar.bz2
rockbox-2b203ca191f0c9f72449c9edf7ab14d82f76cff0.tar.xz
Remember cursor position instead of searching for it
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@840 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/tree.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/apps/tree.c b/apps/tree.c
index 10ad707..53a4054 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -165,6 +165,7 @@ bool dirbrowse(char *root)
int i;
int start=0;
int dirpos[MAX_DIR_LEVELS];
+ int cursorpos[MAX_DIR_LEVELS];
int dirlevel=0;
lcd_clear_display();
@@ -209,17 +210,13 @@ bool dirbrowse(char *root)
currdir[i-1]=0;
dirlevel--;
- if ( dirlevel < MAX_DIR_LEVELS )
+ if ( dirlevel < MAX_DIR_LEVELS ) {
start = dirpos[dirlevel];
+ dircursor = cursorpos[dirlevel];
+ }
else
- start = 0;
+ start = dircursor = 0;
numentries = showdir(currdir, start);
- dircursor=0;
- while ( (dircursor < TREE_MAX_ON_SCREEN) &&
- (strcmp(dircacheptr[dircursor+start]->name,buf)))
- dircursor++;
- if (dircursor==TREE_MAX_ON_SCREEN)
- dircursor=0;
lcd_puts(0, LINE_Y+dircursor, "-");
}
else
@@ -241,8 +238,10 @@ bool dirbrowse(char *root)
if (!dircacheptr[dircursor+start]->file) {
memcpy(currdir,buf,sizeof(currdir));
- if ( dirlevel < MAX_DIR_LEVELS )
- dirpos[dirlevel] = start+dircursor;
+ if ( dirlevel < MAX_DIR_LEVELS ) {
+ dirpos[dirlevel] = start;
+ cursorpos[dirlevel] = dircursor;
+ }
dirlevel++;
dircursor=0;
start=0;
@@ -315,12 +314,6 @@ bool dirbrowse(char *root)
lcd_setfont(0);
#endif
numentries = showdir(currdir, start);
- dircursor=0;
- while ( (dircursor < TREE_MAX_ON_SCREEN) &&
- (strcmp(dircacheptr[dircursor+start]->name,buf)))
- dircursor++;
- if (dircursor==TREE_MAX_ON_SCREEN)
- dircursor=0;
lcd_puts(0, LINE_Y+dircursor, "-");
break;