summaryrefslogtreecommitdiff
path: root/apps/menu.c
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2005-09-01 08:04:37 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2005-09-01 08:04:37 +0000
commit6c2af7c2aa8afde380b5a5f7c606c49dd38bef18 (patch)
treeb310ecf6d3f9850d322bff9fa0d4b0f8dd3107fb /apps/menu.c
parent977aa614ba4d6a5515a8b0bb8353772f7e883397 (diff)
downloadrockbox-6c2af7c2aa8afde380b5a5f7c606c49dd38bef18.zip
rockbox-6c2af7c2aa8afde380b5a5f7c606c49dd38bef18.tar.gz
rockbox-6c2af7c2aa8afde380b5a5f7c606c49dd38bef18.tar.bz2
rockbox-6c2af7c2aa8afde380b5a5f7c606c49dd38bef18.tar.xz
On popular demand, the arrow cursor is reintroduced
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7438 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/menu.c')
-rw-r--r--apps/menu.c45
1 files changed, 35 insertions, 10 deletions
diff --git a/apps/menu.c b/apps/menu.c
index 3b0ee4d..ad22047 100644
--- a/apps/menu.c
+++ b/apps/menu.c
@@ -59,7 +59,8 @@ struct menu {
/* pixel margins */
#define MARGIN_X (global_settings.scrollbar && \
- menu_lines < menus[m].itemcount ? SCROLLBAR_WIDTH : 0)
+ 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 */
@@ -72,6 +73,7 @@ struct menu {
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 (global_settings.invert_cursor ? 0 : 4)
#define SCROLLBAR_X 0
#define SCROLLBAR_Y lcd_getymargin()
@@ -93,19 +95,44 @@ struct menu {
static struct menu menus[MAX_MENUS];
static bool inuse[MAX_MENUS] = { false };
-#ifdef HAVE_LCD_CHARCELLS
/* count in letter positions, NOT pixels */
void put_cursorxy(int x, int y, bool on)
{
+#ifdef HAVE_LCD_BITMAP
+ int fh, fw;
+ int xpos, ypos;
+
+ /* check here instead of at every call (ugly, but cheap) */
+ if (global_settings.invert_cursor)
+ return;
+
+ lcd_getstringsize("A", &fw, &fh);
+ xpos = x*6;
+ ypos = y*fh + lcd_getymargin();
+ if ( fh > 8 )
+ ypos += (fh - 8) / 2;
+#endif
+
/* place the cursor */
if(on) {
+#ifdef HAVE_LCD_BITMAP
+ lcd_mono_bitmap(bitmap_icons_6x8[Icon_Cursor], xpos, ypos, 4, 8);
+#else
lcd_putc(x, y, CURSOR_CHAR);
+#endif
}
else {
+#if defined(HAVE_LCD_BITMAP)
+ /* I use xy here since it needs to disregard the margins */
+ lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
+ lcd_fillrect (xpos, ypos, 4, 8);
+ lcd_set_drawmode(DRMODE_SOLID);
+#else
lcd_putc(x, y, ' ');
+#endif
}
}
-#endif
+
void menu_draw(int m)
{
int i = 0;
@@ -153,20 +180,18 @@ void menu_draw(int m)
/* We want to scroll the line where the cursor is */
if((menus[m].cursor - menus[m].top)==(i-menus[m].top))
#ifdef HAVE_LCD_BITMAP
- lcd_puts_scroll_style(LINE_X, i-menus[m].top,
- P2STR(menus[m].items[i].desc), STYLE_INVERT);
-#else
- lcd_puts_scroll(LINE_X, i-menus[m].top,
- P2STR(menus[m].items[i].desc));
+ if (global_settings.invert_cursor)
+ lcd_puts_scroll_style(LINE_X, i-menus[m].top,
+ P2STR(menus[m].items[i].desc), STYLE_INVERT);
+ else
#endif
+ lcd_puts_scroll(LINE_X, i-menus[m].top, P2STR(menus[m].items[i].desc));
else
lcd_puts(LINE_X, i-menus[m].top, P2STR(menus[m].items[i].desc));
}
-#ifdef HAVE_LCD_CHARCELLS
/* place the cursor */
put_cursorxy(CURSOR_X, menus[m].cursor - menus[m].top, true);
-#endif
#ifdef HAVE_LCD_BITMAP
if (global_settings.scrollbar && menus[m].itemcount > menu_lines)