diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2010-08-15 14:13:36 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2010-08-15 14:13:36 +0000 |
commit | eda80390d5afc4346d2e64a256762df7df30bb17 (patch) | |
tree | b3f9fd726fdb1172b9f048cedb4bbb6808c03aa7 /apps/gui/skin_engine/skin_parser.c | |
parent | ac2c69ccae5db7d5e22acf976910cdf3be84fe5a (diff) | |
download | rockbox-eda80390d5afc4346d2e64a256762df7df30bb17.tar.gz rockbox-eda80390d5afc4346d2e64a256762df7df30bb17.zip |
A bunch of new features for the bar type tags (%pb, %pv, %bl, etc):
* the bar orientation (horiz/vert) is now chosen based on the width and heigt values (or can be forced).
* the fill direction can now be inverted (fill right to left, or top to bottom is considered inverted)
* It can now draw a slider type bar instead of a fill type (or indeed a slider with a fill type)
To configure the new bar, any (or all) of the following params can be used after the bmp filename (order makes no difference either):
invert - cause the bar to fill in the inverted direction
vertical - draw a vertical bar (not needed if the height > width)
horizontal - draw a horizontal bar (this is obviously the default)
nofill - dont draw the filling bar (this still draws the outline, obviously pointless without the slider param)
slider - draw an image for the slider. The next param MUST be the label of the image to draw. No option to use a subimage here, so the whole image needs to be the image you want on the slider.
example: %pb(0,0,-,-,-,nofill, slider, slider_image, invert) - draw a boring horizontal progressbar which doesnt fill and only draws the image "slider_image" which moves right to left.
the slider type might need some tweaking. let us know how it goes
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27821 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/skin_engine/skin_parser.c')
-rw-r--r-- | apps/gui/skin_engine/skin_parser.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c index 68cb01470c..341056ff87 100644 --- a/apps/gui/skin_engine/skin_parser.c +++ b/apps/gui/skin_engine/skin_parser.c | |||
@@ -540,6 +540,7 @@ static int parse_progressbar_tag(struct skin_element* element, | |||
540 | struct skin_token_list *item; | 540 | struct skin_token_list *item; |
541 | struct viewport *vp = &curr_vp->vp; | 541 | struct viewport *vp = &curr_vp->vp; |
542 | struct skin_tag_parameter *param = element->params; | 542 | struct skin_tag_parameter *param = element->params; |
543 | int curr_param = 0; | ||
543 | 544 | ||
544 | if (element->params_count == 0 && | 545 | if (element->params_count == 0 && |
545 | element->tag->type != SKIN_TOKEN_PROGRESSBAR) | 546 | element->tag->type != SKIN_TOKEN_PROGRESSBAR) |
@@ -554,6 +555,7 @@ static int parse_progressbar_tag(struct skin_element* element, | |||
554 | pb->have_bitmap_pb = false; | 555 | pb->have_bitmap_pb = false; |
555 | pb->bm.data = NULL; /* no bitmap specified */ | 556 | pb->bm.data = NULL; /* no bitmap specified */ |
556 | pb->follow_lang_direction = follow_lang_direction > 0; | 557 | pb->follow_lang_direction = follow_lang_direction > 0; |
558 | pb->invert_fill_direction = false; | ||
557 | 559 | ||
558 | if (element->params_count == 0) | 560 | if (element->params_count == 0) |
559 | { | 561 | { |
@@ -614,6 +616,41 @@ static int parse_progressbar_tag(struct skin_element* element, | |||
614 | if (!isdefault(param)) | 616 | if (!isdefault(param)) |
615 | pb->bm.data = param->data.text; | 617 | pb->bm.data = param->data.text; |
616 | 618 | ||
619 | curr_param = 5; | ||
620 | pb->invert_fill_direction = false; | ||
621 | pb->nofill = false; | ||
622 | pb->slider = NULL; | ||
623 | pb->horizontal = pb->width > pb->height; | ||
624 | while (curr_param < element->params_count) | ||
625 | { | ||
626 | param++; | ||
627 | if (!strcmp(param->data.text, "invert")) | ||
628 | pb->invert_fill_direction = true; | ||
629 | else if (!strcmp(param->data.text, "nofill")) | ||
630 | pb->nofill = true; | ||
631 | else if (!strcmp(param->data.text, "slider")) | ||
632 | { | ||
633 | if (curr_param+1 < element->params_count) | ||
634 | { | ||
635 | curr_param++; | ||
636 | param++; | ||
637 | pb->slider = find_image(param->data.text, wps_data); | ||
638 | if (!pb->slider) | ||
639 | return -1; | ||
640 | } | ||
641 | } | ||
642 | else if (!strcmp(param->data.text, "vertical")) | ||
643 | { | ||
644 | pb->horizontal = false; | ||
645 | if (isdefault(&element->params[3])) | ||
646 | pb->height = vp->height - pb->x; | ||
647 | } | ||
648 | else if (!strcmp(param->data.text, "horizontal")) | ||
649 | pb->horizontal = true; | ||
650 | |||
651 | curr_param++; | ||
652 | } | ||
653 | |||
617 | 654 | ||
618 | if (token->type == SKIN_TOKEN_VOLUME) | 655 | if (token->type == SKIN_TOKEN_VOLUME) |
619 | token->type = SKIN_TOKEN_VOLUMEBAR; | 656 | token->type = SKIN_TOKEN_VOLUMEBAR; |