diff options
author | Björn Stenberg <bjorn@haxx.se> | 2002-09-24 19:41:23 +0000 |
---|---|---|
committer | Björn Stenberg <bjorn@haxx.se> | 2002-09-24 19:41:23 +0000 |
commit | 8fb7312650d549e200cf725a8f3863157bb5f839 (patch) | |
tree | 45f7f439b33706c8b61b361dd9936f382e06d9da /apps/menu.c | |
parent | a7dcf912e1be349da3dadeaf235ee4faf5e9dbaa (diff) | |
download | rockbox-8fb7312650d549e200cf725a8f3863157bb5f839.tar.gz rockbox-8fb7312650d549e200cf725a8f3863157bb5f839.zip |
Only show scrollbar when needed. (Björn Fischer)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2406 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/menu.c')
-rw-r--r-- | apps/menu.c | 34 |
1 files changed, 17 insertions, 17 deletions
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 { | |||
47 | 47 | ||
48 | #ifdef HAVE_LCD_BITMAP | 48 | #ifdef HAVE_LCD_BITMAP |
49 | 49 | ||
50 | #define MARGIN_X (global_settings.scrollbar ? SCROLLBAR_WIDTH : 0) + CURSOR_WIDTH /* X pixel margin */ | 50 | /* pixel margins */ |
51 | #define MARGIN_Y (global_settings.statusbar ? STATUSBAR_HEIGHT : 0) /* Y pixel margin */ | 51 | #define MARGIN_X (global_settings.scrollbar && \ |
52 | 52 | menu_lines < menus[m].itemcount ? SCROLLBAR_WIDTH : 0) +\ | |
53 | #define LINE_X 0 /* X position the entry-list starts at */ | 53 | CURSOR_WIDTH |
54 | #define LINE_Y (global_settings.statusbar ? 1 : 0) /* Y position the entry-list starts at */ | 54 | #define MARGIN_Y (global_settings.statusbar ? STATUSBAR_HEIGHT : 0) |
55 | 55 | ||
56 | //FIXME remove | 56 | /* position the entry-list starts at */ |
57 | #define LINE_HEIGTH 8 /* pixels for each text line */ | 57 | #define LINE_X 0 |
58 | //FIXME remove | 58 | #define LINE_Y (global_settings.statusbar ? 1 : 0) |
59 | #define MENU_LINES (LCD_HEIGHT / LINE_HEIGTH - LINE_Y) | 59 | |
60 | 60 | #define CURSOR_X (global_settings.scrollbar && \ | |
61 | #define CURSOR_X (global_settings.scrollbar ? 1 : 0) | 61 | menu_lines < menus[m].itemcount ? 1 : 0) |
62 | #define CURSOR_Y 0 /* the cursor is not positioned in regard to | 62 | #define CURSOR_Y 0 /* the cursor is not positioned in regard to |
63 | the margins, so this is the amount of lines | 63 | the margins, so this is the amount of lines |
64 | we add to the cursor Y position to position | 64 | we add to the cursor Y position to position |
65 | it on a line */ | 65 | it on a line */ |
66 | #define CURSOR_WIDTH 4 | 66 | #define CURSOR_WIDTH 4 |
67 | 67 | ||
68 | #define SCROLLBAR_X 0 | 68 | #define SCROLLBAR_X 0 |
@@ -165,7 +165,7 @@ static void menu_draw(int m) | |||
165 | /* place the cursor */ | 165 | /* place the cursor */ |
166 | put_cursorxy(CURSOR_X, menus[m].cursor - menus[m].top, true); | 166 | put_cursorxy(CURSOR_X, menus[m].cursor - menus[m].top, true); |
167 | #ifdef HAVE_LCD_BITMAP | 167 | #ifdef HAVE_LCD_BITMAP |
168 | if (global_settings.scrollbar) | 168 | if (global_settings.scrollbar && menus[m].itemcount > menu_lines) |
169 | scrollbar(SCROLLBAR_X, SCROLLBAR_Y, SCROLLBAR_WIDTH - 1, | 169 | scrollbar(SCROLLBAR_X, SCROLLBAR_Y, SCROLLBAR_WIDTH - 1, |
170 | LCD_HEIGHT - SCROLLBAR_Y, menus[m].itemcount, menus[m].top, | 170 | LCD_HEIGHT - SCROLLBAR_Y, menus[m].itemcount, menus[m].top, |
171 | menus[m].top + menu_lines, VERTICAL); | 171 | menus[m].top + menu_lines, VERTICAL); |