diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2012-07-05 22:44:13 +1000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2012-07-05 23:30:06 +1000 |
commit | 65f9df3083623484efccf502c33ecc959555d247 (patch) | |
tree | 6d55b2eb2d874166be00306a5cc3a7c67ebea227 /apps/gui/skin_engine/skin_parser.c | |
parent | f6d6a4602c9bb94565f8bb421b465a06f215fb7d (diff) | |
download | rockbox-65f9df3083623484efccf502c33ecc959555d247.tar.gz rockbox-65f9df3083623484efccf502c33ecc959555d247.zip |
skin_engine: Allow the %St() (setting) skin tag be used as a bar
%St(<setting name>) or %St(<bar tags>, setting, <setting name>)
Change-Id: I71396d683634d4d1ad2357018c4029ecb4229677
Diffstat (limited to 'apps/gui/skin_engine/skin_parser.c')
-rw-r--r-- | apps/gui/skin_engine/skin_parser.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c index f66961d488..cbc2ebed4e 100644 --- a/apps/gui/skin_engine/skin_parser.c +++ b/apps/gui/skin_engine/skin_parser.c | |||
@@ -736,6 +736,10 @@ static int parse_image_special(struct skin_element *element, | |||
736 | 736 | ||
737 | #endif /* HAVE_LCD_BITMAP */ | 737 | #endif /* HAVE_LCD_BITMAP */ |
738 | 738 | ||
739 | static int parse_progressbar_tag(struct skin_element* element, | ||
740 | struct wps_token *token, | ||
741 | struct wps_data *wps_data); | ||
742 | |||
739 | static int parse_setting_and_lang(struct skin_element *element, | 743 | static int parse_setting_and_lang(struct skin_element *element, |
740 | struct wps_token *token, | 744 | struct wps_token *token, |
741 | struct wps_data *wps_data) | 745 | struct wps_data *wps_data) |
@@ -757,6 +761,13 @@ static int parse_setting_and_lang(struct skin_element *element, | |||
757 | return WPS_ERROR_INVALID_PARAM; | 761 | return WPS_ERROR_INVALID_PARAM; |
758 | #endif | 762 | #endif |
759 | } | 763 | } |
764 | else if (element->params_count > 1) | ||
765 | { | ||
766 | if (element->params_count > 4) | ||
767 | return parse_progressbar_tag(element, token, wps_data); | ||
768 | else | ||
769 | return WPS_ERROR_INVALID_PARAM; | ||
770 | } | ||
760 | else | 771 | else |
761 | { | 772 | { |
762 | #ifndef __PCTOOL__ | 773 | #ifndef __PCTOOL__ |
@@ -891,6 +902,7 @@ static int parse_progressbar_tag(struct skin_element* element, | |||
891 | pb->image = PTRTOSKINOFFSET(skin_buffer, NULL); | 902 | pb->image = PTRTOSKINOFFSET(skin_buffer, NULL); |
892 | pb->slider = PTRTOSKINOFFSET(skin_buffer, NULL); | 903 | pb->slider = PTRTOSKINOFFSET(skin_buffer, NULL); |
893 | pb->backdrop = PTRTOSKINOFFSET(skin_buffer, NULL); | 904 | pb->backdrop = PTRTOSKINOFFSET(skin_buffer, NULL); |
905 | pb->setting_id = -1; | ||
894 | pb->invert_fill_direction = false; | 906 | pb->invert_fill_direction = false; |
895 | pb->horizontal = true; | 907 | pb->horizontal = true; |
896 | 908 | ||
@@ -1015,6 +1027,19 @@ static int parse_progressbar_tag(struct skin_element* element, | |||
1015 | else if (!strcmp(text, "notouch")) | 1027 | else if (!strcmp(text, "notouch")) |
1016 | suppress_touchregion = true; | 1028 | suppress_touchregion = true; |
1017 | #endif | 1029 | #endif |
1030 | else if (token->type == SKIN_TOKEN_SETTING && !strcmp(text, "setting")) | ||
1031 | { | ||
1032 | if (curr_param+1 < element->params_count) | ||
1033 | { | ||
1034 | curr_param++; | ||
1035 | param++; | ||
1036 | text = SKINOFFSETTOPTR(skin_buffer, param->data.text); | ||
1037 | #ifndef __PCTOOL__ | ||
1038 | if (find_setting_by_cfgname(text, &pb->setting_id) == NULL) | ||
1039 | return WPS_ERROR_INVALID_PARAM; | ||
1040 | #endif | ||
1041 | } | ||
1042 | } | ||
1018 | else if (curr_param == 4) | 1043 | else if (curr_param == 4) |
1019 | image_filename = text; | 1044 | image_filename = text; |
1020 | 1045 | ||
@@ -1060,6 +1085,8 @@ static int parse_progressbar_tag(struct skin_element* element, | |||
1060 | token->type = SKIN_TOKEN_PEAKMETER_RIGHTBAR; | 1085 | token->type = SKIN_TOKEN_PEAKMETER_RIGHTBAR; |
1061 | else if (token->type == SKIN_TOKEN_LIST_NEEDS_SCROLLBAR) | 1086 | else if (token->type == SKIN_TOKEN_LIST_NEEDS_SCROLLBAR) |
1062 | token->type = SKIN_TOKEN_LIST_SCROLLBAR; | 1087 | token->type = SKIN_TOKEN_LIST_SCROLLBAR; |
1088 | else if (token->type == SKIN_TOKEN_SETTING) | ||
1089 | token->type = SKIN_TOKEN_SETTINGBAR; | ||
1063 | pb->type = token->type; | 1090 | pb->type = token->type; |
1064 | 1091 | ||
1065 | #ifdef HAVE_TOUCHSCREEN | 1092 | #ifdef HAVE_TOUCHSCREEN |