summaryrefslogtreecommitdiff
path: root/apps/menu.c
diff options
context:
space:
mode:
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 3b0ee4ddd6..ad22047b9d 100644
--- a/apps/menu.c
+++ b/apps/menu.c
@@ -59,7 +59,8 @@ struct menu {
59 59
60/* pixel margins */ 60/* pixel margins */
61#define MARGIN_X (global_settings.scrollbar && \ 61#define MARGIN_X (global_settings.scrollbar && \
62 menu_lines < menus[m].itemcount ? SCROLLBAR_WIDTH : 0) 62 menu_lines < menus[m].itemcount ? SCROLLBAR_WIDTH : 0) +\
63 CURSOR_WIDTH
63#define MARGIN_Y (global_settings.statusbar ? STATUSBAR_HEIGHT : 0) 64#define MARGIN_Y (global_settings.statusbar ? STATUSBAR_HEIGHT : 0)
64 65
65/* position the entry-list starts at */ 66/* position the entry-list starts at */
@@ -72,6 +73,7 @@ struct menu {
72 the margins, so this is the amount of lines 73 the margins, so this is the amount of lines
73 we add to the cursor Y position to position 74 we add to the cursor Y position to position
74 it on a line */ 75 it on a line */
76#define CURSOR_WIDTH (global_settings.invert_cursor ? 0 : 4)
75 77
76#define SCROLLBAR_X 0 78#define SCROLLBAR_X 0
77#define SCROLLBAR_Y lcd_getymargin() 79#define SCROLLBAR_Y lcd_getymargin()
@@ -93,19 +95,44 @@ struct menu {
93static struct menu menus[MAX_MENUS]; 95static struct menu menus[MAX_MENUS];
94static bool inuse[MAX_MENUS] = { false }; 96static bool inuse[MAX_MENUS] = { false };
95 97
96#ifdef HAVE_LCD_CHARCELLS
97/* count in letter positions, NOT pixels */ 98/* count in letter positions, NOT pixels */
98void put_cursorxy(int x, int y, bool on) 99void put_cursorxy(int x, int y, bool on)
99{ 100{
101#ifdef HAVE_LCD_BITMAP
102 int fh, fw;
103 int xpos, ypos;
104
105 /* check here instead of at every call (ugly, but cheap) */
106 if (global_settings.invert_cursor)
107 return;
108
109 lcd_getstringsize("A", &fw, &fh);
110 xpos = x*6;
111 ypos = y*fh + lcd_getymargin();
112 if ( fh > 8 )
113 ypos += (fh - 8) / 2;
114#endif
115
100 /* place the cursor */ 116 /* place the cursor */
101 if(on) { 117 if(on) {
118#ifdef HAVE_LCD_BITMAP
119 lcd_mono_bitmap(bitmap_icons_6x8[Icon_Cursor], xpos, ypos, 4, 8);
120#else
102 lcd_putc(x, y, CURSOR_CHAR); 121 lcd_putc(x, y, CURSOR_CHAR);
122#endif
103 } 123 }
104 else { 124 else {
125#if defined(HAVE_LCD_BITMAP)
126 /* I use xy here since it needs to disregard the margins */
127 lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
128 lcd_fillrect (xpos, ypos, 4, 8);
129 lcd_set_drawmode(DRMODE_SOLID);
130#else
105 lcd_putc(x, y, ' '); 131 lcd_putc(x, y, ' ');
132#endif
106 } 133 }
107} 134}
108#endif 135
109void menu_draw(int m) 136void menu_draw(int m)
110{ 137{
111 int i = 0; 138 int i = 0;
@@ -153,20 +180,18 @@ void menu_draw(int m)
153 /* We want to scroll the line where the cursor is */ 180 /* We want to scroll the line where the cursor is */
154 if((menus[m].cursor - menus[m].top)==(i-menus[m].top)) 181 if((menus[m].cursor - menus[m].top)==(i-menus[m].top))
155#ifdef HAVE_LCD_BITMAP 182#ifdef HAVE_LCD_BITMAP
156 lcd_puts_scroll_style(LINE_X, i-menus[m].top, 183 if (global_settings.invert_cursor)
157 P2STR(menus[m].items[i].desc), STYLE_INVERT); 184 lcd_puts_scroll_style(LINE_X, i-menus[m].top,
158#else 185 P2STR(menus[m].items[i].desc), STYLE_INVERT);
159 lcd_puts_scroll(LINE_X, i-menus[m].top, 186 else
160 P2STR(menus[m].items[i].desc));
161#endif 187#endif
188 lcd_puts_scroll(LINE_X, i-menus[m].top, P2STR(menus[m].items[i].desc));
162 else 189 else
163 lcd_puts(LINE_X, i-menus[m].top, P2STR(menus[m].items[i].desc)); 190 lcd_puts(LINE_X, i-menus[m].top, P2STR(menus[m].items[i].desc));
164 } 191 }
165 192
166#ifdef HAVE_LCD_CHARCELLS
167 /* place the cursor */ 193 /* place the cursor */
168 put_cursorxy(CURSOR_X, menus[m].cursor - menus[m].top, true); 194 put_cursorxy(CURSOR_X, menus[m].cursor - menus[m].top, true);
169#endif
170 195
171#ifdef HAVE_LCD_BITMAP 196#ifdef HAVE_LCD_BITMAP
172 if (global_settings.scrollbar && menus[m].itemcount > menu_lines) 197 if (global_settings.scrollbar && menus[m].itemcount > menu_lines)