summaryrefslogtreecommitdiff
path: root/apps/gui/bitmap/list.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/gui/bitmap/list.c')
-rw-r--r--apps/gui/bitmap/list.c46
1 files changed, 28 insertions, 18 deletions
diff --git a/apps/gui/bitmap/list.c b/apps/gui/bitmap/list.c
index 1b051cd800..e11ca5386e 100644
--- a/apps/gui/bitmap/list.c
+++ b/apps/gui/bitmap/list.c
@@ -168,8 +168,10 @@ static bool draw_title(struct screen *display,
168 int icon = list->title_icon; 168 int icon = list->title_icon;
169 int icon_w = list_icon_width(display->screen_type); 169 int icon_w = list_icon_width(display->screen_type);
170 bool have_icons = false; 170 bool have_icons = false;
171 if (icon != Icon_NOICON && global_settings.show_icons) 171 if (icon != Icon_NOICON && list->show_icons)
172 {
172 have_icons = true; 173 have_icons = true;
174 }
173 175
174 struct list_putlineinfo_t list_info = 176 struct list_putlineinfo_t list_info =
175 { 177 {
@@ -192,11 +194,14 @@ void list_draw(struct screen *display, struct gui_synclist *list)
192 list_draw_item *callback_draw_item; 194 list_draw_item *callback_draw_item;
193 195
194 const int list_start_item = list->start_item[screen]; 196 const int list_start_item = list->start_item[screen];
195 const bool scrollbar_in_left = (global_settings.scrollbar == SCROLLBAR_LEFT); 197 const bool scrollbar_in_left = (list->scrollbar == SCROLLBAR_LEFT);
196 const bool scrollbar_in_right = (global_settings.scrollbar == SCROLLBAR_RIGHT); 198 const bool scrollbar_in_right = (list->scrollbar == SCROLLBAR_RIGHT);
197 const bool show_cursor = !global_settings.cursor_style && 199
198 list->show_selection_marker; 200 const bool show_cursor = list->show_selection_marker &&
199 const bool have_icons = global_settings.show_icons && list->callback_get_item_icon; 201 (list->cursor_style == SYNCLIST_CURSOR_NOSTYLE);
202
203 const bool have_icons = list->callback_get_item_icon && list->show_icons;
204
200 struct viewport *parent = (list->parent[screen]); 205 struct viewport *parent = (list->parent[screen]);
201 struct line_desc linedes = LINE_DESC_DEFINIT; 206 struct line_desc linedes = LINE_DESC_DEFINIT;
202 bool show_title; 207 bool show_title;
@@ -264,7 +269,7 @@ void list_draw(struct screen *display, struct gui_synclist *list)
264#endif 269#endif
265 270
266 /* draw the scrollbar if its needed */ 271 /* draw the scrollbar if its needed */
267 if (global_settings.scrollbar != SCROLLBAR_OFF) 272 if (list->scrollbar != SCROLLBAR_OFF)
268 { 273 {
269 /* if the scrollbar is shown the text viewport needs to shrink */ 274 /* if the scrollbar is shown the text viewport needs to shrink */
270 if (nb_lines < list->nb_items) 275 if (nb_lines < list->nb_items)
@@ -340,7 +345,7 @@ void list_draw(struct screen *display, struct gui_synclist *list)
340 } 345 }
341 if (line_indent) 346 if (line_indent)
342 { 347 {
343 if (global_settings.show_icons) 348 if (list->show_icons)
344 line_indent *= icon_w; 349 line_indent *= icon_w;
345 else 350 else
346 line_indent *= character_width; 351 line_indent *= character_width;
@@ -374,12 +379,12 @@ void list_draw(struct screen *display, struct gui_synclist *list)
374 } 379 }
375 else 380 else
376#endif 381#endif
377 if (global_settings.cursor_style == 1 382 if (list->cursor_style == SYNCLIST_CURSOR_INVERT
378#ifdef HAVE_REMOTE_LCD 383#ifdef HAVE_REMOTE_LCD
379 /* the global_settings.cursor_style check is here to make 384 /* the global_settings.cursor_style check is here to make
380 * sure if they want the cursor instead of bar it will work 385 * sure if they want the cursor instead of bar it will work
381 */ 386 */
382 || (display->depth < 16 && global_settings.cursor_style) 387 || (display->depth < 16 && list->cursor_style)
383#endif 388#endif
384 ) 389 )
385 { 390 {
@@ -387,14 +392,14 @@ void list_draw(struct screen *display, struct gui_synclist *list)
387 style = STYLE_INVERT; 392 style = STYLE_INVERT;
388 } 393 }
389#ifdef HAVE_LCD_COLOR 394#ifdef HAVE_LCD_COLOR
390 else if (global_settings.cursor_style == 2) 395 else if (list->cursor_style == SYNCLIST_CURSOR_COLOR)
391 { 396 {
392 /* Display colour line selector */ 397 /* Display colour line selector */
393 style = STYLE_COLORBAR; 398 style = STYLE_COLORBAR;
394 linedes.text_color = global_settings.lst_color; 399 linedes.text_color = global_settings.lst_color;
395 linedes.line_color = global_settings.lss_color; 400 linedes.line_color = global_settings.lss_color;
396 } 401 }
397 else if (global_settings.cursor_style == 3) 402 else if (list->cursor_style == SYNCLIST_CURSOR_GRADIENT)
398 { 403 {
399 /* Display gradient line selector */ 404 /* Display gradient line selector */
400 style = STYLE_GRADIENT; 405 style = STYLE_GRADIENT;
@@ -753,7 +758,7 @@ static int get_click_location(struct gui_synclist *list, int x, int y)
753 if (viewport_point_within_vp(title, x, y)) 758 if (viewport_point_within_vp(title, x, y))
754 retval = TITLE_TEXT; 759 retval = TITLE_TEXT;
755 /* check the icon too */ 760 /* check the icon too */
756 if (list->title_icon != Icon_NOICON && global_settings.show_icons) 761 if (list->title_icon != Icon_NOICON && (list->show_icons)
757 { 762 {
758 int width = list_icon_width(screen); 763 int width = list_icon_width(screen);
759 struct viewport vp = *title; 764 struct viewport vp = *title;
@@ -771,14 +776,19 @@ static int get_click_location(struct gui_synclist *list, int x, int y)
771 { 776 {
772 bool on_scrollbar_clicked; 777 bool on_scrollbar_clicked;
773 int adj_x = x - parent->x; 778 int adj_x = x - parent->x;
774 switch (global_settings.scrollbar) 779 switch (list->scrollbar)
775 { 780 {
781 case SCROLLBAR_OFF:
782 /*fall-through*/
783 default:
784 on_scrollbar_clicked = false;
785 break;
776 case SCROLLBAR_LEFT: 786 case SCROLLBAR_LEFT:
777 on_scrollbar_clicked = adj_x <= SCROLLBAR_WIDTH; break; 787 on_scrollbar_clicked = adj_x <= SCROLLBAR_WIDTH;
788 break;
778 case SCROLLBAR_RIGHT: 789 case SCROLLBAR_RIGHT:
779 on_scrollbar_clicked = adj_x > (title->x + title->width - SCROLLBAR_WIDTH); break; 790 on_scrollbar_clicked = adj_x > (title->x + title->width - SCROLLBAR_WIDTH);
780 default: 791 break;
781 on_scrollbar_clicked = false; break;
782 } 792 }
783 if (on_scrollbar_clicked) 793 if (on_scrollbar_clicked)
784 retval = SCROLLBAR; 794 retval = SCROLLBAR;