CVSROOT: anonymous@cvs.r
cvs diff tree.c (in directory D:\arch\apps\)
Index: tree.c
===================================================================
RCS file: /cvsroot/rockbox/apps/tree.c,v
retrieving revision 1.118
diff -r1.118 tree.c
177c177
< static int showdir(char *path, int start)
---
> static int showdir(char *path, int start, int dircursor )
183c183
<     int i;
---
>     int i,j;
307c307
<     for ( i=start; i < start+tree_max_on_screen; i++ ) {
---
>     for ( j=start; j < start+tree_max_on_screen; j++ ) {
310,311c310,318
<         if ( i >= filesindir )
<             break;
---
>         i=j;
> 	  if ( j>=filesindir ) {
> 		if ( filesindir < tree_max_on_screen ) {
> 			break ;
> 			}
> 		else {
> 			i=j - filesindir; 
> 			}
> 		}
348c355
<                        MARGIN_Y+(i-start)*line_height, 6, 8, true);
---
>                        MARGIN_Y+(j-start)*line_height, 6, 8, true);
350,351c357,358
<             lcd_define_pattern((i-start)*8,tree_icons_5x7[icon_type],8);
<             lcd_putc(LINE_X-1, i-start, i-start);
---
>             lcd_define_pattern((j-start)*8,tree_icons_5x7[icon_type],8);
>             lcd_putc(LINE_X-1, j-start, j-start);
361c368
<             lcd_puts(LINE_X, i-start, dircache[i].name);
---
>             lcd_puts(LINE_X, j-start, dircache[i].name);
365c372
<             lcd_puts(LINE_X, i-start, dircache[i].name);
---
>             lcd_puts(LINE_X, j-start, dircache[i].name);
369,372c376,387
<     if (global_settings.scrollbar) 
<         scrollbar(SCROLLBAR_X, SCROLLBAR_Y, SCROLLBAR_WIDTH - 1,
<                   LCD_HEIGHT - SCROLLBAR_Y, filesindir, start,
<                   start + tree_max_on_screen, VERTICAL);
---
>     if (global_settings.scrollbar) {
> 		if ( (start + dircursor) < filesindir ) {
> 		        scrollbar(SCROLLBAR_X, SCROLLBAR_Y, SCROLLBAR_WIDTH - 1,
>                   LCD_HEIGHT - SCROLLBAR_Y, filesindir, start+dircursor,
>                    start+dircursor+1, VERTICAL);
> 		}
> 		else {
> 		        scrollbar(SCROLLBAR_X, SCROLLBAR_Y, SCROLLBAR_WIDTH - 1,
>                   LCD_HEIGHT - SCROLLBAR_Y, filesindir, start+dircursor-filesindir,
>                    start+dircursor-filesindir+1, VERTICAL);
> 			}
> 	}
462c477
<             if (showdir(global_settings.resume_file, 0) < 0 )
---
>             if (showdir(global_settings.resume_file, 0,0) < 0 )
510c525
<     numentries = showdir(root, start);
---
>     numentries = showdir(root, start,dircursor);
517c532,541
<         struct entry* file = &dircache[dircursor+start];
---
>         struct entry* file ;
> 
> 	  if ( (dircursor + start ) < numentries) {
> 		file = &dircache[dircursor+start];
> 		}
> 	  else {
> 		file = &dircache[dircursor+start-numentries];
> 		}
> 
> 	
674a699
>                         numentries = showdir(currdir, start, dircursor);
680c705
<                             numentries = showdir(currdir, start);
---
>                             numentries = showdir(currdir, start,dircursor);
687a713
> 					  numentries = showdir(currdir, start, dircursor);
692,694c718,720
<                                 start = numentries - tree_max_on_screen;
<                                 dircursor = tree_max_on_screen - 1;
<                                 numentries = showdir(currdir, start);
---
>                                 start = numentries - 1;
>                                 
>                                 numentries = showdir(currdir, start, dircursor);
696c722
<                                              tree_max_on_screen - 1, true);
---
>                                              dircursor, true);
709c735
<                     if (dircursor + start + 1 < numentries ) {
---
>                     
711,734c737,768
<                             put_cursorxy(CURSOR_X, CURSOR_Y + dircursor,
<                                          false);
<                             dircursor++;
<                             put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true);
<                         } 
<                         else {
<                             start++;
<                             numentries = showdir(currdir, start);
<                             put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true);
<                         }
<                     }
<                     else {
<                         if(numentries < tree_max_on_screen) {
<                             put_cursorxy(CURSOR_X, CURSOR_Y + dircursor,
<                                          false);
<                             start = dircursor = 0;
<                             put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true);
<                         } 
<                         else {
<                             start = dircursor = 0;
<                             numentries = showdir(currdir, start);
<                             put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true);
<                         }
<                     }
---
> 					if(numentries <= tree_max_on_screen) {
>                             		put_cursorxy(CURSOR_X, CURSOR_Y + dircursor,
>                                     		     false);
> 						if ( (dircursor+1) < numentries ) {
> 							dircursor++;
> 							}
> 						else {
> 							dircursor = 0 ;
>                             		}
> 						numentries = showdir(currdir, start,dircursor);
>                             		put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true);
>                         		} 
>                         	else {
> 						put_cursorxy(CURSOR_X, CURSOR_Y + dircursor,
>                                     		     false);
>                             		dircursor++ ;
>                             		numentries = showdir(currdir, start,dircursor);
>                             		put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true);
>                         		}
> 					}
> 				else {
> 				    if ( (start+1) >= numentries ) {
> 						start=0;
> 						}
> 					else {
> 						start++;
> 						}
> 					numentries = showdir(currdir, start,dircursor);
>                             	put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true);
> 					}
> 			
>                       
830c864
<             numentries = showdir(currdir, start);
---
>             numentries = showdir(currdir, start,dircursor);
835a870
> 		if ( i>= numentries ) i = i - numentries;




