diff options
author | Thomas Martitz <kugel@rockbox.org> | 2013-05-06 07:20:40 +0200 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2014-03-03 15:14:16 +0100 |
commit | 05a67d021c8fbb10b2654f8378b549901dd4c520 (patch) | |
tree | 23d0fa787d7373bf2ea08d1678cff47306a1a55d /apps/gui/line.c | |
parent | 20e114c1a0f086e432f374fe0ecebf014a571448 (diff) | |
download | rockbox-05a67d021c8fbb10b2654f8378b549901dd4c520.tar.gz rockbox-05a67d021c8fbb10b2654f8378b549901dd4c520.zip |
Touchscreen: Show a line separator in lists.
This patch adds a configurable line separator between list items, very
similar to lists in Android. Additionally, below the list item there is a
thicker line. It can be disabled in the settings. Its color can
be configured as well.
Remote and monochrome displays are explicitly unsupported. If there is desire
this can be changed but it doesn't seem useful to me.
Change-Id: I005313b0d8f5ecd15864bf20e66ea4e3390d8b7d
Diffstat (limited to 'apps/gui/line.c')
-rw-r--r-- | apps/gui/line.c | 30 |
1 files changed, 26 insertions, 4 deletions
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; |