summaryrefslogtreecommitdiff
path: root/apps/gui/skin_engine/skin_parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/gui/skin_engine/skin_parser.c')
-rw-r--r--apps/gui/skin_engine/skin_parser.c57
1 files changed, 33 insertions, 24 deletions
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c
index f5923747ab..ed475acb2b 100644
--- a/apps/gui/skin_engine/skin_parser.c
+++ b/apps/gui/skin_engine/skin_parser.c
@@ -581,10 +581,10 @@ static int parse_progressbar_tag(struct skin_element* element,
581{ 581{
582#ifdef HAVE_LCD_BITMAP 582#ifdef HAVE_LCD_BITMAP
583 struct progressbar *pb; 583 struct progressbar *pb;
584 struct skin_token_list *item;
585 struct viewport *vp = &curr_vp->vp; 584 struct viewport *vp = &curr_vp->vp;
586 struct skin_tag_parameter *param = element->params; 585 struct skin_tag_parameter *param = element->params;
587 int curr_param = 0; 586 int curr_param = 0;
587 char *image_filename = NULL;
588 588
589 if (element->params_count == 0 && 589 if (element->params_count == 0 &&
590 element->tag->type != SKIN_TOKEN_PROGRESSBAR) 590 element->tag->type != SKIN_TOKEN_PROGRESSBAR)
@@ -596,11 +596,10 @@ static int parse_progressbar_tag(struct skin_element* element,
596 if (!pb) 596 if (!pb)
597 return WPS_ERROR_INVALID_PARAM; 597 return WPS_ERROR_INVALID_PARAM;
598 pb->vp = vp; 598 pb->vp = vp;
599 pb->have_bitmap_pb = false;
600 pb->bm.data = NULL; /* no bitmap specified */
601 pb->follow_lang_direction = follow_lang_direction > 0; 599 pb->follow_lang_direction = follow_lang_direction > 0;
602 pb->nofill = false; 600 pb->nofill = false;
603 pb->nobar = false; 601 pb->nobar = false;
602 pb->image = NULL;
604 pb->slider = NULL; 603 pb->slider = NULL;
605 pb->invert_fill_direction = false; 604 pb->invert_fill_direction = false;
606 pb->horizontal = true; 605 pb->horizontal = true;
@@ -615,11 +614,6 @@ static int parse_progressbar_tag(struct skin_element* element,
615 return 0; 614 return 0;
616 } 615 }
617 616
618 item = new_skin_token_list_item(token, pb);
619 if (!item)
620 return -1;
621 add_to_ll_chain(&wps_data->progressbars, item);
622
623 /* (x, y, width, height, ...) */ 617 /* (x, y, width, height, ...) */
624 if (!isdefault(param)) 618 if (!isdefault(param))
625 pb->x = param->data.number; 619 pb->x = param->data.number;
@@ -696,7 +690,8 @@ static int parse_progressbar_tag(struct skin_element* element,
696 { 690 {
697 curr_param++; 691 curr_param++;
698 param++; 692 param++;
699 pb->bm.data = param->data.text; 693 image_filename = param->data.text;
694
700 } 695 }
701 else /* option needs the next param */ 696 else /* option needs the next param */
702 return -1; 697 return -1;
@@ -710,10 +705,37 @@ static int parse_progressbar_tag(struct skin_element* element,
710 else if (!strcmp(param->data.text, "horizontal")) 705 else if (!strcmp(param->data.text, "horizontal"))
711 pb->horizontal = true; 706 pb->horizontal = true;
712 else if (curr_param == 4) 707 else if (curr_param == 4)
713 pb->bm.data = param->data.text; 708 image_filename = param->data.text;
714 709
715 curr_param++; 710 curr_param++;
716 } 711 }
712
713 if (image_filename)
714 {
715 pb->image = find_image(image_filename, wps_data);
716 if (!pb->image) /* load later */
717 {
718 struct gui_img* img = (struct gui_img*)skin_buffer_alloc(sizeof(struct gui_img));
719 if (!img)
720 return WPS_ERROR_INVALID_PARAM;
721 /* save a pointer to the filename */
722 img->bm.data = (char*)image_filename;
723 img->label = image_filename;
724 img->x = 0;
725 img->y = 0;
726 img->num_subimages = 1;
727 img->always_display = false;
728 img->display = -1;
729 img->using_preloaded_icons = false;
730 img->vp = &curr_vp->vp;
731 struct skin_token_list *item =
732 (struct skin_token_list *)new_skin_token_list_item(NULL, img);
733 if (!item)
734 return WPS_ERROR_INVALID_PARAM;
735 add_to_ll_chain(&wps_data->images, item);
736 pb->image = img;
737 }
738 }
717 739
718 740
719 if (token->type == SKIN_TOKEN_VOLUME) 741 if (token->type == SKIN_TOKEN_VOLUME)
@@ -1033,7 +1055,6 @@ static void skin_data_reset(struct wps_data *wps_data)
1033 wps_data->tree = NULL; 1055 wps_data->tree = NULL;
1034#ifdef HAVE_LCD_BITMAP 1056#ifdef HAVE_LCD_BITMAP
1035 wps_data->images = NULL; 1057 wps_data->images = NULL;
1036 wps_data->progressbars = NULL;
1037#endif 1058#endif
1038#if LCD_DEPTH > 1 || defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 1059#if LCD_DEPTH > 1 || defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
1039 if (wps_data->backdrop_id >= 0) 1060 if (wps_data->backdrop_id >= 0)
@@ -1118,19 +1139,7 @@ static bool load_skin_bitmaps(struct wps_data *wps_data, char *bmpdir)
1118{ 1139{
1119 struct skin_token_list *list; 1140 struct skin_token_list *list;
1120 bool retval = true; /* return false if a single image failed to load */ 1141 bool retval = true; /* return false if a single image failed to load */
1121 /* do the progressbars */ 1142
1122 list = wps_data->progressbars;
1123 while (list)
1124 {
1125 struct progressbar *pb = (struct progressbar*)list->token->value.data;
1126 if (pb->bm.data)
1127 {
1128 pb->have_bitmap_pb = load_skin_bmp(wps_data, &pb->bm, bmpdir);
1129 if (!pb->have_bitmap_pb) /* no success */
1130 retval = false;
1131 }
1132 list = list->next;
1133 }
1134 /* regular images */ 1143 /* regular images */
1135 list = wps_data->images; 1144 list = wps_data->images;
1136 while (list) 1145 while (list)