From 8fb7312650d549e200cf725a8f3863157bb5f839 Mon Sep 17 00:00:00 2001 From: Björn Stenberg Date: Tue, 24 Sep 2002 19:41:23 +0000 Subject: Only show scrollbar when needed. (Björn Fischer) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2406 a1c6a512-1295-4272-9138-f99709370657 --- apps/menu.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'apps/menu.c') diff --git a/apps/menu.c b/apps/menu.c index 96b0bfdf02..a0102c0ecb 100644 --- a/apps/menu.c +++ b/apps/menu.c @@ -47,22 +47,22 @@ struct menu { #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 */ - -//FIXME remove -#define LINE_HEIGTH 8 /* pixels for each text line */ -//FIXME remove -#define MENU_LINES (LCD_HEIGHT / LINE_HEIGTH - LINE_Y) - -#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 */ +/* pixel margins */ +#define MARGIN_X (global_settings.scrollbar && \ + menu_lines < menus[m].itemcount ? SCROLLBAR_WIDTH : 0) +\ + CURSOR_WIDTH +#define MARGIN_Y (global_settings.statusbar ? STATUSBAR_HEIGHT : 0) + +/* position the entry-list starts at */ +#define LINE_X 0 +#define LINE_Y (global_settings.statusbar ? 1 : 0) + +#define CURSOR_X (global_settings.scrollbar && \ + menu_lines < menus[m].itemcount ? 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 @@ -165,7 +165,7 @@ static void menu_draw(int m) /* place the cursor */ put_cursorxy(CURSOR_X, menus[m].cursor - menus[m].top, true); #ifdef HAVE_LCD_BITMAP - if (global_settings.scrollbar) + if (global_settings.scrollbar && menus[m].itemcount > menu_lines) scrollbar(SCROLLBAR_X, SCROLLBAR_Y, SCROLLBAR_WIDTH - 1, LCD_HEIGHT - SCROLLBAR_Y, menus[m].itemcount, menus[m].top, menus[m].top + menu_lines, VERTICAL); -- cgit v1.2.3