Index: apps/menu.c
===================================================================
RCS file: /cvsroot/rockbox/apps/menu.c,v
retrieving revision 1.34
diff -u -b -r1.34 menu.c
--- apps/menu.c	23 Aug 2002 12:57:00 -0000	1.34
+++ apps/menu.c	29 Aug 2002 13:04:04 -0000
@@ -26,9 +26,9 @@
 #include "panic.h"
 #include "settings.h"
 #include "status.h"
-#ifdef HAVE_LCD_BITMAP
 #include "icons.h"
-#endif
+#include "widgets.h"
+
 #ifdef LOADABLE_FONTS
 #include "ajf.h"
 #endif
@@ -43,12 +43,37 @@
 #define MAX_MENUS 4
 
 #ifdef HAVE_LCD_BITMAP
+
+#define MARGIN_X    (global_settings.scrollbar ? SCROLLBAR_WIDTH : 0) + CURSOR_WIDTH /* X pixel margin */
+#define MARGIN_Y    (global_settings.statusbar ? STATUSBAR_HEIGHT : 0)  /* Y pixel margin */
+
+#define LINE_X      0 /* X position the entry-list starts at */
 #define LINE_Y      (global_settings.statusbar ? 1 : 0) /* Y position the entry-list starts at */
 #define LINE_HEIGTH 8 /* pixels for each text line */
+
 #define MENU_LINES  (LCD_HEIGHT / LINE_HEIGTH - LINE_Y)
-#else
+
+#define CURSOR_X    (global_settings.scrollbar ? 1 : 0)
+#define CURSOR_Y    0 /* the cursor is not positioned in regard to
+                         the margins, so this is the amount of lines
+                         we add to the cursor Y position to position
+                         it on a line */
+#define CURSOR_WIDTH  4
+
+#define SCROLLBAR_X      0
+#define SCROLLBAR_Y      lcd_getymargin()
+#define SCROLLBAR_WIDTH  6
+
+#else /* HAVE_LCD_BITMAP */
+
+#define LINE_X      0 /* X position the entry-list starts at */
+
 #define MENU_LINES 2
-#endif
+
+#define CURSOR_X    0
+#define CURSOR_Y    0 /* not really used for players */
+
+#endif /* HAVE_LCD_BITMAP */
 
 #ifdef HAVE_NEW_CHARCELL_LCD
 #define CURSOR_CHAR "\x7e"
@@ -117,10 +142,7 @@
     lcd_scroll_pause();  /* halt scroll first... */
     lcd_clear_display(); /* ...then clean the screen */
 #ifdef HAVE_LCD_BITMAP
-    if(global_settings.statusbar)
-        lcd_setmargins(0, STATUSBAR_HEIGHT);
-    else
-        lcd_setmargins(0, 0);
+    lcd_setmargins(MARGIN_X,MARGIN_Y); /* leave room for cursor and icon */
     lcd_setfont(0);
 #endif
     /* correct cursor pos if out of screen */
@@ -131,16 +153,20 @@
          (i < menus[m].itemcount) && (i<menus[m].top+menu_lines);
          i++) {
         if((menus[m].cursor - menus[m].top)==(i-menus[m].top))
-            lcd_puts_scroll(1, i-menus[m].top, menus[m].items[i].desc);
+            lcd_puts_scroll(LINE_X, i-menus[m].top, menus[m].items[i].desc);
         else
-            lcd_puts(1, i-menus[m].top, menus[m].items[i].desc);
+            lcd_puts(LINE_X, i-menus[m].top, menus[m].items[i].desc);
     }
 
     /* place the cursor */
-    put_cursorxy(0, menus[m].cursor - menus[m].top, true);
+    put_cursorxy(CURSOR_X, menus[m].cursor - menus[m].top, true);
 #ifdef HAVE_LCD_BITMAP
-    status_draw();
+    if (global_settings.scrollbar) 
+        scrollbar(SCROLLBAR_X, SCROLLBAR_Y, SCROLLBAR_WIDTH - 1,
+                  LCD_HEIGHT - SCROLLBAR_Y, menus[m].itemcount, menus[m].top,
+                  menus[m].top + menu_lines, VERTICAL);
 #endif
+    status_draw();
     lcd_update();
 }
 
@@ -163,7 +189,7 @@
 #else
     int menu_lines = MENU_LINES;
 #endif
-    put_cursorxy(0, menus[m].cursor - menus[m].top, false);
+    put_cursorxy(CURSOR_X, menus[m].cursor - menus[m].top, false);
     menus[m].cursor = target;
     menu_draw(m);
 
@@ -179,7 +205,7 @@
     }
 
     if (do_update) {
-        put_cursorxy(0, menus[m].cursor - menus[m].top, true); 
+        put_cursorxy(CURSOR_X, menus[m].cursor - menus[m].top, true); 
         lcd_update();
     }
 
@@ -282,12 +308,18 @@
                 return result;
 
 #ifdef HAVE_RECORDER_KEYPAD
-            case BUTTON_F3:
+            case BUTTON_F3: {
 #ifdef HAVE_LCD_BITMAP
-                global_settings.statusbar = !global_settings.statusbar;
+                  unsigned char state;
+                  state = global_settings.statusbar << 1 | global_settings.scrollbar;
+                  state = (state + 1) % 4;
+                  global_settings.statusbar = state >> 1;
+                  global_settings.scrollbar = state & 0x1;
                 settings_save();
+
                 menu_draw(m);
 #endif
+                }
                 break;
 #endif
 
Index: apps/settings.c
===================================================================
RCS file: /cvsroot/rockbox/apps/settings.c,v
retrieving revision 1.41
diff -u -b -r1.41 settings.c
--- apps/settings.c	29 Aug 2002 04:50:39 -0000	1.41
+++ apps/settings.c	29 Aug 2002 13:04:04 -0000
@@ -261,7 +261,8 @@
          ((global_settings.sort_case & 1) << 2) |
          ((global_settings.discharge & 1) << 3) |
          ((global_settings.statusbar & 1) << 4) |
-         ((global_settings.show_hidden_files & 1) << 5));
+         ((global_settings.show_hidden_files & 1) << 5) |
+         ((global_settings.scrollbar & 1) << 6));
 
     config_block[0xf] = (unsigned char)
         ((global_settings.scroll_speed << 3) |
@@ -349,6 +350,7 @@
             global_settings.discharge = (config_block[0xe] >> 3) & 1;
             global_settings.statusbar = (config_block[0xe] >> 4) & 1;
             global_settings.show_hidden_files = (config_block[0xe] >> 5) & 1;
+            global_settings.scrollbar = (config_block[0xe] >> 6) & 1;
         }
         
         c = config_block[0xf] >> 3;
@@ -413,6 +415,7 @@
     global_settings.mp3filter   = true;
     global_settings.sort_case   = false;
     global_settings.statusbar   = true;
+    global_settings.scrollbar   = true;
     global_settings.loop_playlist = true;
     global_settings.playlist_shuffle = false;
     global_settings.discharge    = 0;
Index: apps/settings.h
===================================================================
RCS file: /cvsroot/rockbox/apps/settings.h,v
retrieving revision 1.30
diff -u -b -r1.30 settings.h
--- apps/settings.h	29 Aug 2002 04:50:39 -0000	1.30
+++ apps/settings.h	29 Aug 2002 13:04:04 -0000
@@ -72,6 +72,9 @@
     /* show status bar */
     bool statusbar;    /* 0=hide, 1=show */
 
+    /* show scroll bar */
+    bool scrollbar;    /* 0=hide, 1=show */
+
     /* Hidden and dotfile settings */
     bool show_hidden_files; /* 1=show dotfiles/hidden,
                                0=hide dotfiles/hidden */
Index: apps/tree.c
===================================================================
RCS file: /cvsroot/rockbox/apps/tree.c,v
retrieving revision 1.104
diff -u -b -r1.104 tree.c
--- apps/tree.c	28 Aug 2002 14:03:55 -0000	1.104
+++ apps/tree.c	29 Aug 2002 13:04:04 -0000
@@ -40,10 +40,8 @@
 #include "status.h"
 #include "debug.h"
 #include "ata.h"
-
-#ifdef HAVE_LCD_BITMAP
 #include "icons.h"
-#endif
+#include "widgets.h"
 
 #ifdef LOADABLE_FONTS
 #include "ajf.h"
@@ -73,16 +71,25 @@
 #define TREE_MAX_ON_SCREEN   ((LCD_HEIGHT-MARGIN_Y)/LINE_HEIGTH)
 #define TREE_MAX_LEN_DISPLAY 16 /* max length that fits on screen */
  
+#define MARGIN_X      (global_settings.scrollbar ? SCROLLBAR_WIDTH : 0) + CURSOR_WIDTH + ICON_WIDTH /* X pixel margin */
 #define MARGIN_Y      (global_settings.statusbar ? STATUSBAR_HEIGHT : 0)  /* Y pixel margin */
-#define MARGIN_X      10 /* X pixel margin */
-#define LINE_Y      (global_settings.statusbar ? 1 : 0) /* Y position the entry-list starts at */
+
 #define LINE_X      0 /* X position the entry-list starts at */
+#define LINE_Y      (global_settings.statusbar ? 1 : 0) /* Y position the entry-list starts at */
 #define LINE_HEIGTH 8 /* pixels for each text line */
 
+#define CURSOR_X    (global_settings.scrollbar ? 1 : 0)
 #define CURSOR_Y    0 /* the cursor is not positioned in regard to
                          the margins, so this is the amount of lines
                          we add to the cursor Y position to position
                          it on a line */
+#define CURSOR_WIDTH  4
+
+#define ICON_WIDTH    6
+
+#define SCROLLBAR_X      0
+#define SCROLLBAR_Y      lcd_getymargin()
+#define SCROLLBAR_WIDTH  6
 
 extern unsigned char bitmap_icons_6x8[LastIcon][6];
 
@@ -90,9 +97,10 @@
 
 #define TREE_MAX_ON_SCREEN   2
 #define TREE_MAX_LEN_DISPLAY 11 /* max length that fits on screen */
-#define LINE_Y      0 /* Y position the entry-list starts at */
 #define LINE_X      1 /* X position the entry-list starts at */
+#define LINE_Y      0 /* Y position the entry-list starts at */
 
+#define CURSOR_X    0
 #define CURSOR_Y    0 /* not really used for players */
 
 #endif /* HAVE_LCD_BITMAP */
@@ -290,7 +298,7 @@
 
         if (icon_type)
             lcd_bitmap(bitmap_icons_6x8[icon_type], 
-                       4, MARGIN_Y+(i-start)*line_height, 6, 8, true);
+                       CURSOR_X * 6 + CURSOR_WIDTH, MARGIN_Y+(i-start)*line_height, 6, 8, true);
 #endif
 
 
@@ -307,6 +315,12 @@
             lcd_puts(LINE_X, i-start, dircache[i].name);
     }
 
+#ifdef HAVE_LCD_BITMAP
+    if (global_settings.scrollbar) 
+        scrollbar(SCROLLBAR_X, SCROLLBAR_Y, SCROLLBAR_WIDTH - 1,
+                  LCD_HEIGHT - SCROLLBAR_Y, filesindir, start,
+                  start + tree_max_on_screen, VERTICAL);
+#endif
     status_draw();
     return filesindir;
 }
@@ -445,7 +459,7 @@
     if (numentries == -1) 
         return -1;  /* root is not a directory */
 
-    put_cursorxy(0, CURSOR_Y + dircursor, true);
+    put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true);
 
     while(1) {
         bool restore = false;
@@ -577,29 +591,29 @@
             case BUTTON_VOL_UP:
                 if(filesindir) {
                     if(dircursor) {
-                        put_cursorxy(0, CURSOR_Y + dircursor, false);
+                        put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, false);
                         dircursor--;
-                        put_cursorxy(0, CURSOR_Y + dircursor, true);
+                        put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true);
                     }
                     else {
                         if (start) {
                             start--;
                             numentries = showdir(currdir, start);
-                            put_cursorxy(0, CURSOR_Y + dircursor, true);
+                            put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true);
                         }
                         else {
                             if (numentries < tree_max_on_screen) {
-                                put_cursorxy(0, CURSOR_Y + dircursor,
+                                put_cursorxy(CURSOR_X, CURSOR_Y + dircursor,
                                              false);
                                 dircursor = numentries - 1;
-                                put_cursorxy(0, CURSOR_Y + dircursor,
+                                put_cursorxy(CURSOR_X, CURSOR_Y + dircursor,
                                              true);
                             }
                             else {
                                 start = numentries - tree_max_on_screen;
                                 dircursor = tree_max_on_screen - 1;
                                 numentries = showdir(currdir, start);
-                                put_cursorxy(0, CURSOR_Y +
+                                put_cursorxy(CURSOR_X, CURSOR_Y +
                                              tree_max_on_screen - 1, true);
                             }
                         }
@@ -615,28 +629,28 @@
                 {
                     if (dircursor + start + 1 < numentries ) {
                         if(dircursor+1 < tree_max_on_screen) {
-                            put_cursorxy(0, CURSOR_Y + dircursor,
+                            put_cursorxy(CURSOR_X, CURSOR_Y + dircursor,
                                          false);
                             dircursor++;
-                            put_cursorxy(0, CURSOR_Y + dircursor, true);
+                            put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true);
                         } 
                         else {
                             start++;
                             numentries = showdir(currdir, start);
-                            put_cursorxy(0, CURSOR_Y + dircursor, true);
+                            put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true);
                         }
                     }
                     else {
                         if(numentries < tree_max_on_screen) {
-                            put_cursorxy(0, CURSOR_Y + dircursor,
+                            put_cursorxy(CURSOR_X, CURSOR_Y + dircursor,
                                          false);
                             start = dircursor = 0;
-                            put_cursorxy(0, CURSOR_Y + dircursor, true);
+                            put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true);
                         } 
                         else {
                             start = dircursor = 0;
                             numentries = showdir(currdir, start);
-                            put_cursorxy(0, CURSOR_Y + dircursor, true);
+                            put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true);
                         }
                     }
                     lcd_update();
@@ -680,9 +694,13 @@
                 break;
 
 #ifdef HAVE_RECORDER_KEYPAD
-            case BUTTON_F3:
+            case BUTTON_F3: {
 #ifdef HAVE_LCD_BITMAP
-                global_settings.statusbar = !global_settings.statusbar;
+                  unsigned char state;
+                  state = global_settings.statusbar << 1 | global_settings.scrollbar;
+                  state = (state + 1) % 4;
+                  global_settings.statusbar = state >> 1;
+                  global_settings.scrollbar = state & 0x1;
                 settings_save();
 #ifdef LOADABLE_FONTS
                 tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh;
@@ -691,6 +709,7 @@
 #endif
                 restore = true;
 #endif
+                }
                 break;
 #endif
 
@@ -733,7 +752,7 @@
                 dircursor--;
             }
             numentries = showdir(currdir, start);
-            put_cursorxy(0, CURSOR_Y + dircursor, true);
+            put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true);
         }
 
         if ( numentries ) {

