diff options
| author | Jonathan Gordon <rockbox@jdgordon.info> | 2011-01-24 09:04:28 +0000 |
|---|---|---|
| committer | Jonathan Gordon <rockbox@jdgordon.info> | 2011-01-24 09:04:28 +0000 |
| commit | f06f6852733b084a5bd09528322d9ffc6886d2f3 (patch) | |
| tree | 1b5519291250a96fccb0a4660ba266c7f6b84802 | |
| parent | cb39ac6b1e2fa14ef3a12a2f6a1f9083c7eeb4aa (diff) | |
| download | rockbox-f06f6852733b084a5bd09528322d9ffc6886d2f3.zip rockbox-f06f6852733b084a5bd09528322d9ffc6886d2f3.tar.gz rockbox-f06f6852733b084a5bd09528322d9ffc6886d2f3.tar.bz2 rockbox-f06f6852733b084a5bd09528322d9ffc6886d2f3.tar.xz | |
New option for the bar tags: 'backdrop, <label>' will draw another image under the progressbar (only works with image and slider bars)
example:
%V(22,253,198,14,-)
%xl(a,PLAY_BAR_BACKDROP-240x320x16.bmp,0,0)
%pb(0,0,198,14,PLAY_BAR-240x320x16.bmp, backdrop, a)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29127 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | apps/gui/scrollbar.c | 3 | ||||
| -rw-r--r-- | apps/gui/scrollbar.h | 1 | ||||
| -rw-r--r-- | apps/gui/skin_engine/skin_display.c | 22 | ||||
| -rw-r--r-- | apps/gui/skin_engine/skin_parser.c | 16 | ||||
| -rw-r--r-- | apps/gui/skin_engine/wps_internals.h | 1 | ||||
| -rw-r--r-- | manual/appendix/wps_tags.tex | 5 |
6 files changed, 44 insertions, 4 deletions
diff --git a/apps/gui/scrollbar.c b/apps/gui/scrollbar.c index 83e86c1..70d3417 100644 --- a/apps/gui/scrollbar.c +++ b/apps/gui/scrollbar.c @@ -192,7 +192,8 @@ void gui_bitmap_scrollbar_draw(struct screen * screen, struct bitmap *bm, int x, screen->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); /* clear pixels in progress bar */ - screen->fillrect(x, y, width, height); + if ((flags&DONT_CLEAR_EXCESS) == 0) + screen->fillrect(x, y, width, height); screen->set_drawmode(DRMODE_SOLID); diff --git a/apps/gui/scrollbar.h b/apps/gui/scrollbar.h index 31f91a3..606b9bd 100644 --- a/apps/gui/scrollbar.h +++ b/apps/gui/scrollbar.h @@ -37,6 +37,7 @@ enum orientation { color even if FOREGROUND */ INNER_FILL_MASK = 0x00c0, #endif + DONT_CLEAR_EXCESS = 0x0100, /* Don't clear the entire bar area */ }; /* diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c index ccedea9..5d90e14 100644 --- a/apps/gui/skin_engine/skin_display.c +++ b/apps/gui/skin_engine/skin_display.c @@ -234,6 +234,28 @@ void draw_progressbar(struct gui_wps *gwps, int line, struct progressbar *pb) y += img->bm.height / 2; } } + + if (pb->backdrop) + { + struct gui_img *img = pb->backdrop; +#if LCD_DEPTH > 1 + if(img->bm.format == FORMAT_MONO) { +#endif + display->mono_bitmap_part(img->bm.data, + 0, 0, img->bm.width, + x, y, width, height); +#if LCD_DEPTH > 1 + } else { + display->transparent_bitmap_part((fb_data *)img->bm.data, + 0, 0, + STRIDE(display->screen_type, + img->bm.width, img->bm.height), + x, y, width, height); + } +#endif + flags |= DONT_CLEAR_EXCESS; + } + if (!pb->nobar) { if (pb->image) diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c index e23f842..31dd89d 100644 --- a/apps/gui/skin_engine/skin_parser.c +++ b/apps/gui/skin_engine/skin_parser.c @@ -601,6 +601,7 @@ static int parse_progressbar_tag(struct skin_element* element, pb->nobar = false; pb->image = NULL; pb->slider = NULL; + pb->backdrop = NULL; pb->invert_fill_direction = false; pb->horizontal = true; @@ -696,6 +697,18 @@ static int parse_progressbar_tag(struct skin_element* element, else /* option needs the next param */ return -1; } + else if (!strcmp(param->data.text, "backdrop")) + { + if (curr_param+1 < element->params_count) + { + curr_param++; + param++; + pb->backdrop = find_image(param->data.text, wps_data); + + } + else /* option needs the next param */ + return -1; + } else if (!strcmp(param->data.text, "vertical")) { pb->horizontal = false; @@ -735,8 +748,7 @@ static int parse_progressbar_tag(struct skin_element* element, add_to_ll_chain(&wps_data->images, item); pb->image = img; } - } - + } if (token->type == SKIN_TOKEN_VOLUME) token->type = SKIN_TOKEN_VOLUMEBAR; diff --git a/apps/gui/skin_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h index 02585f2..2bf0ee9 100644 --- a/apps/gui/skin_engine/wps_internals.h +++ b/apps/gui/skin_engine/wps_internals.h @@ -111,6 +111,7 @@ struct progressbar { bool nobar; struct gui_img *slider; bool horizontal; + struct gui_img *backdrop; }; #endif diff --git a/manual/appendix/wps_tags.tex b/manual/appendix/wps_tags.tex index 5028fa8..06bae6c 100644 --- a/manual/appendix/wps_tags.tex +++ b/manual/appendix/wps_tags.tex @@ -663,9 +663,12 @@ display cycling round the defined sublines. See \item[vertical] -- force the bar to be drawn vertically. \item[invert] -- invert the draw direction (i.e. right to left, or top to bottom). - \item[slider] -- draw an preloaded image over the top of the bar so that + \item[slider] -- draw a preloaded image over the top of the bar so that the centre of the image matches the current position. This must be followed by the label of the desired image. + \item[backdrop] -- draw a preloaded image under the bar. The full + image will be displayed and must be the same size as the bar. + This must be followed by the label of the desired image. \item[nofill] -- don't draw the bar, only its frame (for use with the ``slider'' option). \item[nobar] -- don't draw the bar or its frame (for use with the |