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 30 Aug 2002 13:33:09 -0000 @@ -26,9 +26,12 @@ #include "panic.h" #include "settings.h" #include "status.h" + #ifdef HAVE_LCD_BITMAP #include "icons.h" +#include "widgets.h" #endif + #ifdef LOADABLE_FONTS #include "ajf.h" #endif @@ -43,12 +46,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 +145,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 +156,20 @@ (i < menus[m].itemcount) && (i> 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.42 diff -u -b -r1.42 settings.c --- apps/settings.c 30 Aug 2002 13:24:03 -0000 1.42 +++ apps/settings.c 30 Aug 2002 13:33:09 -0000 @@ -262,7 +262,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) | @@ -350,6 +351,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; @@ -414,6 +416,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.31 diff -u -b -r1.31 settings.h --- apps/settings.h 30 Aug 2002 13:24:03 -0000 1.31 +++ apps/settings.h 30 Aug 2002 13:33:09 -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 30 Aug 2002 13:33:09 -0000 @@ -43,6 +43,7 @@ #ifdef HAVE_LCD_BITMAP #include "icons.h" +#include "widgets.h" #endif #ifdef LOADABLE_FONTS @@ -73,16 +74,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 +100,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 +301,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 +318,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 +462,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; @@ -568,6 +585,11 @@ start = 0; global_settings.resume_index = -1; } +#ifdef LOADABLE_FONTS + tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh; +#else + tree_max_on_screen = TREE_MAX_ON_SCREEN; +#endif } restore = true; break; @@ -577,29 +599,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 +637,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(); @@ -675,14 +697,23 @@ dircursor = 0; start = 0; } +#ifdef LOADABLE_FONTS + tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh; +#else + tree_max_on_screen = TREE_MAX_ON_SCREEN; +#endif restore = true; } 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 +722,7 @@ #endif restore = true; #endif + } break; #endif @@ -733,7 +765,7 @@ dircursor--; } numentries = showdir(currdir, start); - put_cursorxy(0, CURSOR_Y + dircursor, true); + put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true); } if ( numentries ) { Index: apps/wps.c =================================================================== RCS file: /cvsroot/rockbox/apps/wps.c,v retrieving revision 1.124 diff -u -b -r1.124 wps.c --- apps/wps.c 30 Aug 2002 11:04:40 -0000 1.124 +++ apps/wps.c 30 Aug 2002 13:33:10 -0000 @@ -752,6 +752,13 @@ #endif if (menu()) return SYS_USB_CONNECTED; +#ifdef HAVE_LCD_BITMAP + if(global_settings.statusbar) + lcd_setmargins(0, STATUSBAR_HEIGHT); + else + lcd_setmargins(0, 0); +#endif + restore = true; break; /* toggle status bar */