diff options
author | Daniel Stenberg <daniel@haxx.se> | 2002-06-14 08:47:44 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2002-06-14 08:47:44 +0000 |
commit | bf603f98cbc9e7cb290771908112c3465580f7d1 (patch) | |
tree | 1921da055ed8bd7e2e6167a1cec12f155caa2ce6 /apps/menu.c | |
parent | 35facde5760ecba693b7dd40922efaa3f2a8c37e (diff) | |
download | rockbox-bf603f98cbc9e7cb290771908112c3465580f7d1.tar.gz rockbox-bf603f98cbc9e7cb290771908112c3465580f7d1.zip |
made to use the new cursor bitmap on the recorder, so put_cursorxy() is
now a better way to position the cursor
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@993 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/menu.c')
-rw-r--r-- | apps/menu.c | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/apps/menu.c b/apps/menu.c index b8c652c04a..c4ddd62db5 100644 --- a/apps/menu.c +++ b/apps/menu.c | |||
@@ -23,6 +23,10 @@ | |||
23 | #include "kernel.h" | 23 | #include "kernel.h" |
24 | #include "debug.h" | 24 | #include "debug.h" |
25 | 25 | ||
26 | #ifdef HAVE_LCD_BITMAP | ||
27 | #include "icons.h" | ||
28 | #endif | ||
29 | |||
26 | struct menu { | 30 | struct menu { |
27 | int top; | 31 | int top; |
28 | int cursor; | 32 | int cursor; |
@@ -38,19 +42,37 @@ struct menu { | |||
38 | #define MENU_LINES 2 | 42 | #define MENU_LINES 2 |
39 | #endif | 43 | #endif |
40 | 44 | ||
41 | #ifdef HAVE_LCD_BITMAP | ||
42 | #define CURSOR_CHAR "-" | ||
43 | #else | ||
44 | #ifdef HAVE_NEW_CHARCELL_LCD | 45 | #ifdef HAVE_NEW_CHARCELL_LCD |
45 | #define CURSOR_CHAR "\x7e" | 46 | #define CURSOR_CHAR "\x7e" |
46 | #else | 47 | #else |
47 | #define CURSOR_CHAR "\x89" | 48 | #define CURSOR_CHAR "\x89" |
48 | #endif | 49 | #endif |
49 | #endif | ||
50 | 50 | ||
51 | static struct menu menus[MAX_MENUS]; | 51 | static struct menu menus[MAX_MENUS]; |
52 | static bool inuse[MAX_MENUS] = { false }; | 52 | static bool inuse[MAX_MENUS] = { false }; |
53 | 53 | ||
54 | /* count in letter posistions, NOT pixels */ | ||
55 | void put_cursorxy(int x, int y, bool on) | ||
56 | { | ||
57 | /* place the cursor */ | ||
58 | if(on) { | ||
59 | #ifdef HAVE_LCD_BITMAP | ||
60 | lcd_bitmap ( bitmap_icons_6x8[Cursor], | ||
61 | x*6, y*8, 6, 8, true); | ||
62 | #else | ||
63 | lcd_puts(x, y, CURSOR_CHAR); | ||
64 | #endif | ||
65 | } | ||
66 | else { | ||
67 | #ifdef HAVE_LCD_BITMAP | ||
68 | /* I use xy here since it needs to disregard the margins */ | ||
69 | lcd_putsxy (x*6, y*8, " ", 0); | ||
70 | #else | ||
71 | lcd_puts(x, y, " "); | ||
72 | #endif | ||
73 | } | ||
74 | } | ||
75 | |||
54 | static void menu_draw(int m) | 76 | static void menu_draw(int m) |
55 | { | 77 | { |
56 | int i = 0; | 78 | int i = 0; |
@@ -66,8 +88,8 @@ static void menu_draw(int m) | |||
66 | lcd_puts(1, i-menus[m].top, menus[m].items[i].desc); | 88 | lcd_puts(1, i-menus[m].top, menus[m].items[i].desc); |
67 | } | 89 | } |
68 | 90 | ||
69 | /* place the cursor */ | 91 | /* place the cursor */ |
70 | lcd_puts(0, menus[m].cursor - menus[m].top, CURSOR_CHAR); | 92 | put_cursorxy(0, menus[m].cursor - menus[m].top, true); |
71 | 93 | ||
72 | lcd_update(); | 94 | lcd_update(); |
73 | } | 95 | } |
@@ -80,7 +102,7 @@ static void put_cursor(int m, int target) | |||
80 | { | 102 | { |
81 | bool do_update = true; | 103 | bool do_update = true; |
82 | 104 | ||
83 | lcd_puts(0, menus[m].cursor - menus[m].top, " "); | 105 | put_cursorxy(0, menus[m].cursor - menus[m].top, false); |
84 | menus[m].cursor = target; | 106 | menus[m].cursor = target; |
85 | 107 | ||
86 | if ( target < menus[m].top ) { | 108 | if ( target < menus[m].top ) { |
@@ -95,7 +117,7 @@ static void put_cursor(int m, int target) | |||
95 | } | 117 | } |
96 | 118 | ||
97 | if (do_update) { | 119 | if (do_update) { |
98 | lcd_puts(0, menus[m].cursor - menus[m].top, CURSOR_CHAR); | 120 | put_cursorxy(0, menus[m].cursor - menus[m].top, true); |
99 | lcd_update(); | 121 | lcd_update(); |
100 | } | 122 | } |
101 | 123 | ||