summaryrefslogtreecommitdiff
path: root/apps/menu.c
diff options
context:
space:
mode:
authorMarkus Braun <markus.braun@krawel.de>2002-08-20 19:37:00 +0000
committerMarkus Braun <markus.braun@krawel.de>2002-08-20 19:37:00 +0000
commit5e4c1d2ad8278ea3787766c506dc5997d96b9386 (patch)
treeb873f7f2bf3a95b222652a32cb225375c8b800aa /apps/menu.c
parenteef970428be36d2eda5a4db1923a4cc474b94a0b (diff)
downloadrockbox-5e4c1d2ad8278ea3787766c506dc5997d96b9386.tar.gz
rockbox-5e4c1d2ad8278ea3787766c506dc5997d96b9386.zip
enabled status bar in menus on recorders
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1822 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/menu.c')
-rw-r--r--apps/menu.c47
1 files changed, 39 insertions, 8 deletions
diff --git a/apps/menu.c b/apps/menu.c
index 4be4e78e87..93e8394011 100644
--- a/apps/menu.c
+++ b/apps/menu.c
@@ -23,13 +23,15 @@
23#include "kernel.h" 23#include "kernel.h"
24#include "debug.h" 24#include "debug.h"
25#include "panic.h" 25#include "panic.h"
26 26#include "settings.h"
27#include "status.h"
27#ifdef HAVE_LCD_BITMAP 28#ifdef HAVE_LCD_BITMAP
28#include "icons.h" 29#include "icons.h"
29#endif 30#endif
30#ifdef LOADABLE_FONTS 31#ifdef LOADABLE_FONTS
31#include "ajf.h" 32#include "ajf.h"
32#endif 33#endif
34
33struct menu { 35struct menu {
34 int top; 36 int top;
35 int cursor; 37 int cursor;
@@ -40,7 +42,9 @@ struct menu {
40#define MAX_MENUS 4 42#define MAX_MENUS 4
41 43
42#ifdef HAVE_LCD_BITMAP 44#ifdef HAVE_LCD_BITMAP
43#define MENU_LINES 8 45#define LINE_Y (global_settings.statusbar ? 1 : 0) /* Y position the entry-list starts at */
46#define LINE_HEIGTH 8 /* pixels for each text line */
47#define MENU_LINES (LCD_HEIGHT / LINE_HEIGTH - LINE_Y)
44#else 48#else
45#define MENU_LINES 2 49#define MENU_LINES 2
46#endif 50#endif
@@ -71,7 +75,7 @@ void put_cursorxy(int x, int y, bool on)
71 if(on) { 75 if(on) {
72#ifdef HAVE_LCD_BITMAP 76#ifdef HAVE_LCD_BITMAP
73 lcd_bitmap ( bitmap_icons_6x8[Cursor], 77 lcd_bitmap ( bitmap_icons_6x8[Cursor],
74 x*6, y*fh, 4, 8, true); 78 x*6, y*fh + lcd_getymargin(), 4, 8, true);
75#elif defined(SIMULATOR) 79#elif defined(SIMULATOR)
76 /* player simulator */ 80 /* player simulator */
77 unsigned char cursor[] = { 0x7f, 0x3e, 0x1c, 0x08 }; 81 unsigned char cursor[] = { 0x7f, 0x3e, 0x1c, 0x08 };
@@ -83,7 +87,7 @@ void put_cursorxy(int x, int y, bool on)
83 else { 87 else {
84#if defined(HAVE_LCD_BITMAP) 88#if defined(HAVE_LCD_BITMAP)
85 /* I use xy here since it needs to disregard the margins */ 89 /* I use xy here since it needs to disregard the margins */
86 lcd_clearrect (x*6, y*fh, 4, 8); 90 lcd_clearrect (x*6, y*fh + lcd_getymargin(), 4, 8);
87#elif defined(SIMULATOR) 91#elif defined(SIMULATOR)
88 /* player simulator in action */ 92 /* player simulator in action */
89 lcd_clearrect (x*6, 12+y*16, 4, 8); 93 lcd_clearrect (x*6, 12+y*16, 4, 8);
@@ -101,7 +105,10 @@ static void menu_draw(int m)
101 int fh; 105 int fh;
102 unsigned char* font = lcd_getcurrentldfont(); 106 unsigned char* font = lcd_getcurrentldfont();
103 fh = ajf_get_fontheight(font); 107 fh = ajf_get_fontheight(font);
104 menu_lines = LCD_HEIGHT/fh; 108 if (global_settings.statusbar)
109 menu_lines = (LCD_HEIGHT - STATUSBAR_HEIGHT) / fh;
110 else
111 menu_lines = LCD_HEIGHT/fh;
105#else 112#else
106 int menu_lines = MENU_LINES; 113 int menu_lines = MENU_LINES;
107#endif 114#endif
@@ -109,9 +116,16 @@ static void menu_draw(int m)
109 lcd_clear_display(); 116 lcd_clear_display();
110 lcd_stop_scroll(); 117 lcd_stop_scroll();
111#ifdef HAVE_LCD_BITMAP 118#ifdef HAVE_LCD_BITMAP
112 lcd_setmargins(0,0); 119 if(global_settings.statusbar)
120 lcd_setmargins(0, STATUSBAR_HEIGHT);
121 else
122 lcd_setmargins(0, 0);
113 lcd_setfont(0); 123 lcd_setfont(0);
114#endif 124#endif
125 /* correct cursor pos if out of screen */
126 if (menus[m].cursor - menus[m].top >= menu_lines)
127 menus[m].top++;
128
115 for (i = menus[m].top; 129 for (i = menus[m].top;
116 (i < menus[m].itemcount) && (i<menus[m].top+menu_lines); 130 (i < menus[m].itemcount) && (i<menus[m].top+menu_lines);
117 i++) { 131 i++) {
@@ -123,6 +137,9 @@ static void menu_draw(int m)
123 137
124 /* place the cursor */ 138 /* place the cursor */
125 put_cursorxy(0, menus[m].cursor - menus[m].top, true); 139 put_cursorxy(0, menus[m].cursor - menus[m].top, true);
140#ifdef HAVE_LCD_BITMAP
141 status_draw();
142#endif
126 lcd_update(); 143 lcd_update();
127} 144}
128 145
@@ -138,7 +155,10 @@ static void put_cursor(int m, int target)
138 int fh; 155 int fh;
139 unsigned char* font = lcd_getcurrentldfont(); 156 unsigned char* font = lcd_getcurrentldfont();
140 fh = ajf_get_fontheight(font); 157 fh = ajf_get_fontheight(font);
141 menu_lines = LCD_HEIGHT/fh; 158 if (global_settings.statusbar)
159 menu_lines = (LCD_HEIGHT-STATUSBAR_HEIGHT)/fh;
160 else
161 menu_lines = LCD_HEIGHT/fh;
142#else 162#else
143 int menu_lines = MENU_LINES; 163 int menu_lines = MENU_LINES;
144#endif 164#endif
@@ -196,7 +216,7 @@ void menu_run(int m)
196 menu_draw(m); 216 menu_draw(m);
197 217
198 while(1) { 218 while(1) {
199 switch( button_get(true) ) { 219 switch( button_get_w_tmo(HZ/2) ) {
200#ifdef HAVE_RECORDER_KEYPAD 220#ifdef HAVE_RECORDER_KEYPAD
201 case BUTTON_UP: 221 case BUTTON_UP:
202 case BUTTON_UP | BUTTON_REPEAT: 222 case BUTTON_UP | BUTTON_REPEAT:
@@ -247,10 +267,21 @@ void menu_run(int m)
247 lcd_stop_scroll(); 267 lcd_stop_scroll();
248 return; 268 return;
249 269
270#ifdef HAVE_RECORDER_KEYPAD
271 case BUTTON_F3:
272#ifdef HAVE_LCD_BITMAP
273 global_settings.statusbar = !global_settings.statusbar;
274 settings_save();
275 menu_draw(m);
276#endif
277 break;
278#endif
279
250 default: 280 default:
251 break; 281 break;
252 } 282 }
253 283
284 status_draw();
254 lcd_update(); 285 lcd_update();
255 } 286 }
256} 287}