summaryrefslogtreecommitdiff
path: root/apps/gui
diff options
context:
space:
mode:
Diffstat (limited to 'apps/gui')
-rw-r--r--apps/gui/bitmap/list.c13
-rw-r--r--apps/gui/line.c30
-rw-r--r--apps/gui/line.h5
3 files changed, 42 insertions, 6 deletions
diff --git a/apps/gui/bitmap/list.c b/apps/gui/bitmap/list.c
index f1def9007d..97eefce9db 100644
--- a/apps/gui/bitmap/list.c
+++ b/apps/gui/bitmap/list.c
@@ -106,6 +106,13 @@ static bool draw_title(struct screen *display, struct gui_synclist *list)
106 line.height = list->line_height[screen]; 106 line.height = list->line_height[screen];
107 title_text_vp->height = line.height; 107 title_text_vp->height = line.height;
108 108
109#if LCD_DEPTH > 1
110 /* XXX: Do we want to support the separator on remote displays? */
111 if (display->screen_type == SCREEN_MAIN && global_settings.list_separator_height != 0)
112 line.separator_height = abs(global_settings.list_separator_height)
113 + (lcd_get_dpi() > 200 ? 2 : 1);
114#endif
115
109#ifdef HAVE_LCD_COLOR 116#ifdef HAVE_LCD_COLOR
110 if (list->title_color >= 0) 117 if (list->title_color >= 0)
111 line.style |= (STYLE_COLORED|list->title_color); 118 line.style |= (STYLE_COLORED|list->title_color);
@@ -154,7 +161,11 @@ void list_draw(struct screen *display, struct gui_synclist *list)
154 161
155 linedes.height = list->line_height[screen]; 162 linedes.height = list->line_height[screen];
156 linedes.nlines = list->selected_size; 163 linedes.nlines = list->selected_size;
157 164#if LCD_DEPTH > 1
165 /* XXX: Do we want to support the separator on remote displays? */
166 if (display->screen_type == SCREEN_MAIN)
167 linedes.separator_height = abs(global_settings.list_separator_height);
168#endif
158 start = list_start_item; 169 start = list_start_item;
159 end = start + nb_lines; 170 end = start + nb_lines;
160 171
diff --git a/apps/gui/line.c b/apps/gui/line.c
index 55100f715c..4a51c6e307 100644
--- a/apps/gui/line.c
+++ b/apps/gui/line.c
@@ -305,6 +305,28 @@ static void style_line(struct screen *display,
305 int style = line->style; 305 int style = line->style;
306 int width = display->getwidth(); 306 int width = display->getwidth();
307 int height = line->height == -1 ? display->getcharheight() : line->height; 307 int height = line->height == -1 ? display->getcharheight() : line->height;
308 int bar_height = height;
309
310 /* mask out gradient and colorbar styles for non-color displays */
311 if (display->depth < 16 && (style & (STYLE_COLORBAR|STYLE_GRADIENT)))
312 {
313 style &= ~(STYLE_COLORBAR|STYLE_GRADIENT);
314 style |= STYLE_INVERT;
315 }
316
317 if (line->separator_height > 0 && (line->line == line->nlines-1))
318 {
319 int sep_height = MIN(line->separator_height, height);
320 display->set_drawmode(DRMODE_FG);
321#if LCD_DEPTH > 1
322 display->set_foreground(global_settings.list_separator_color);
323#endif
324 display->fillrect(x, y + height - sep_height, width, sep_height);
325 bar_height -= sep_height;
326#if LCD_DEPTH > 1
327 display->set_foreground(global_settings.fg_color);
328#endif
329 }
308 330
309 /* mask out gradient and colorbar styles for non-color displays */ 331 /* mask out gradient and colorbar styles for non-color displays */
310 if (display->depth < 16) 332 if (display->depth < 16)
@@ -322,7 +344,7 @@ static void style_line(struct screen *display,
322#ifdef HAVE_LCD_COLOR 344#ifdef HAVE_LCD_COLOR
323 case STYLE_GRADIENT: 345 case STYLE_GRADIENT:
324 display->set_drawmode(DRMODE_FG); 346 display->set_drawmode(DRMODE_FG);
325 display->gradient_fillrect_part(x, y, width, height, 347 display->gradient_fillrect_part(x, y, width, bar_height,
326 line->line_color, 348 line->line_color,
327 line->line_end_color, 349 line->line_end_color,
328 height*line->nlines, 350 height*line->nlines,
@@ -331,16 +353,16 @@ static void style_line(struct screen *display,
331 case STYLE_COLORBAR: 353 case STYLE_COLORBAR:
332 display->set_drawmode(DRMODE_FG); 354 display->set_drawmode(DRMODE_FG);
333 display->set_foreground(line->line_color); 355 display->set_foreground(line->line_color);
334 display->fillrect(x, y, width - x, height); 356 display->fillrect(x, y, width - x, bar_height);
335 break; 357 break;
336#endif 358#endif
337 case STYLE_INVERT: 359 case STYLE_INVERT:
338 display->set_drawmode(DRMODE_FG); 360 display->set_drawmode(DRMODE_FG);
339 display->fillrect(x, y, width - x, height); 361 display->fillrect(x, y, width - x, bar_height);
340 break; 362 break;
341 case STYLE_DEFAULT: default: 363 case STYLE_DEFAULT: default:
342 display->set_drawmode(DRMODE_BG | DRMODE_INVERSEVID); 364 display->set_drawmode(DRMODE_BG | DRMODE_INVERSEVID);
343 display->fillrect(x, y, width - x, height); 365 display->fillrect(x, y, width - x, bar_height);
344 break; 366 break;
345 case STYLE_NONE: 367 case STYLE_NONE:
346 break; 368 break;
diff --git a/apps/gui/line.h b/apps/gui/line.h
index 9a0769de35..c14f04d9a2 100644
--- a/apps/gui/line.h
+++ b/apps/gui/line.h
@@ -74,11 +74,14 @@ struct line_desc {
74 enum line_styles style; 74 enum line_styles style;
75 /* whether the line can scroll */ 75 /* whether the line can scroll */
76 bool scroll; 76 bool scroll;
77 /* height of the line separator (in pixels). 0 to disable drawing
78 * of the separator */
79 int8_t separator_height;
77}; 80};
78 81
79/* default initializer, can be used for static initialitation also. 82/* default initializer, can be used for static initialitation also.
80 * This initializer will result in single lines without style that don't scroll */ 83 * This initializer will result in single lines without style that don't scroll */
81#define LINE_DESC_DEFINIT { .style = STYLE_DEFAULT, .height = -1, .line = 0, .nlines = 1, .scroll = false } 84#define LINE_DESC_DEFINIT { .style = STYLE_DEFAULT, .height = -1, .separator_height = 0, .line = 0, .nlines = 1, .scroll = false }
82 85
83/** 86/**
84 * Print a line at a given pixel postion, using decoration information from 87 * Print a line at a given pixel postion, using decoration information from