diff options
Diffstat (limited to 'apps/gui')
| -rw-r--r-- | apps/gui/bitmap/list.c | 13 | ||||
| -rw-r--r-- | apps/gui/line.c | 30 | ||||
| -rw-r--r-- | apps/gui/line.h | 5 |
3 files changed, 42 insertions, 6 deletions
diff --git a/apps/gui/bitmap/list.c b/apps/gui/bitmap/list.c index f1def90..97eefce 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) line.height = list->line_height[screen]; title_text_vp->height = line.height; +#if LCD_DEPTH > 1 + /* XXX: Do we want to support the separator on remote displays? */ + if (display->screen_type == SCREEN_MAIN && global_settings.list_separator_height != 0) + line.separator_height = abs(global_settings.list_separator_height) + + (lcd_get_dpi() > 200 ? 2 : 1); +#endif + #ifdef HAVE_LCD_COLOR if (list->title_color >= 0) line.style |= (STYLE_COLORED|list->title_color); @@ -154,7 +161,11 @@ void list_draw(struct screen *display, struct gui_synclist *list) linedes.height = list->line_height[screen]; linedes.nlines = list->selected_size; - +#if LCD_DEPTH > 1 + /* XXX: Do we want to support the separator on remote displays? */ + if (display->screen_type == SCREEN_MAIN) + linedes.separator_height = abs(global_settings.list_separator_height); +#endif start = list_start_item; end = start + nb_lines; diff --git a/apps/gui/line.c b/apps/gui/line.c index 55100f7..4a51c6e 100644 --- a/apps/gui/line.c +++ b/apps/gui/line.c @@ -305,6 +305,28 @@ static void style_line(struct screen *display, int style = line->style; int width = display->getwidth(); int height = line->height == -1 ? display->getcharheight() : line->height; + int bar_height = height; + + /* mask out gradient and colorbar styles for non-color displays */ + if (display->depth < 16 && (style & (STYLE_COLORBAR|STYLE_GRADIENT))) + { + style &= ~(STYLE_COLORBAR|STYLE_GRADIENT); + style |= STYLE_INVERT; + } + + if (line->separator_height > 0 && (line->line == line->nlines-1)) + { + int sep_height = MIN(line->separator_height, height); + display->set_drawmode(DRMODE_FG); +#if LCD_DEPTH > 1 + display->set_foreground(global_settings.list_separator_color); +#endif + display->fillrect(x, y + height - sep_height, width, sep_height); + bar_height -= sep_height; +#if LCD_DEPTH > 1 + display->set_foreground(global_settings.fg_color); +#endif + } /* mask out gradient and colorbar styles for non-color displays */ if (display->depth < 16) @@ -322,7 +344,7 @@ static void style_line(struct screen *display, #ifdef HAVE_LCD_COLOR case STYLE_GRADIENT: display->set_drawmode(DRMODE_FG); - display->gradient_fillrect_part(x, y, width, height, + display->gradient_fillrect_part(x, y, width, bar_height, line->line_color, line->line_end_color, height*line->nlines, @@ -331,16 +353,16 @@ static void style_line(struct screen *display, case STYLE_COLORBAR: display->set_drawmode(DRMODE_FG); display->set_foreground(line->line_color); - display->fillrect(x, y, width - x, height); + display->fillrect(x, y, width - x, bar_height); break; #endif case STYLE_INVERT: display->set_drawmode(DRMODE_FG); - display->fillrect(x, y, width - x, height); + display->fillrect(x, y, width - x, bar_height); break; case STYLE_DEFAULT: default: display->set_drawmode(DRMODE_BG | DRMODE_INVERSEVID); - display->fillrect(x, y, width - x, height); + display->fillrect(x, y, width - x, bar_height); break; case STYLE_NONE: break; diff --git a/apps/gui/line.h b/apps/gui/line.h index 9a0769d..c14f04d 100644 --- a/apps/gui/line.h +++ b/apps/gui/line.h @@ -74,11 +74,14 @@ struct line_desc { enum line_styles style; /* whether the line can scroll */ bool scroll; + /* height of the line separator (in pixels). 0 to disable drawing + * of the separator */ + int8_t separator_height; }; /* default initializer, can be used for static initialitation also. * This initializer will result in single lines without style that don't scroll */ -#define LINE_DESC_DEFINIT { .style = STYLE_DEFAULT, .height = -1, .line = 0, .nlines = 1, .scroll = false } +#define LINE_DESC_DEFINIT { .style = STYLE_DEFAULT, .height = -1, .separator_height = 0, .line = 0, .nlines = 1, .scroll = false } /** * Print a line at a given pixel postion, using decoration information from |