diff options
Diffstat (limited to 'apps/gui/skin_engine/skin_tokens.c')
-rw-r--r-- | apps/gui/skin_engine/skin_tokens.c | 528 |
1 files changed, 269 insertions, 259 deletions
diff --git a/apps/gui/skin_engine/skin_tokens.c b/apps/gui/skin_engine/skin_tokens.c index b86c664d7e..3eef1e84e7 100644 --- a/apps/gui/skin_engine/skin_tokens.c +++ b/apps/gui/skin_engine/skin_tokens.c | |||
@@ -667,6 +667,9 @@ const char *get_token_value(struct gui_wps *gwps, | |||
667 | char *buf, int buf_size, | 667 | char *buf, int buf_size, |
668 | int *intval) | 668 | int *intval) |
669 | { | 669 | { |
670 | int numeric_ret = -1; | ||
671 | const char *numeric_buf = "?"; | ||
672 | |||
670 | if (!gwps) | 673 | if (!gwps) |
671 | return NULL; | 674 | return NULL; |
672 | if (!token) | 675 | if (!token) |
@@ -796,9 +799,12 @@ const char *get_token_value(struct gui_wps *gwps, | |||
796 | buf[byte_len] = '\0'; | 799 | buf[byte_len] = '\0'; |
797 | if (ss->expect_number && | 800 | if (ss->expect_number && |
798 | intval && (buf[0] >= '0' && buf[0] <= '9')) | 801 | intval && (buf[0] >= '0' && buf[0] <= '9')) |
799 | *intval = atoi(buf) + 1; /* so 0 is the first item */ | 802 | { |
800 | 803 | ||
801 | return buf; | 804 | numeric_ret = atoi(buf) + 1; /* so 0 is the first item */ |
805 | } | ||
806 | numeric_buf = buf; | ||
807 | goto gtv_ret_numeric_tag_info; | ||
802 | } | 808 | } |
803 | return NULL; | 809 | return NULL; |
804 | } | 810 | } |
@@ -816,17 +822,17 @@ const char *get_token_value(struct gui_wps *gwps, | |||
816 | return (char*)P2STR(ID2P(token->value.i)); | 822 | return (char*)P2STR(ID2P(token->value.i)); |
817 | 823 | ||
818 | case SKIN_TOKEN_PLAYLIST_ENTRIES: | 824 | case SKIN_TOKEN_PLAYLIST_ENTRIES: |
819 | snprintf(buf, buf_size, "%d", playlist_amount()); | 825 | numeric_ret = playlist_amount(); |
820 | if (intval) | 826 | snprintf(buf, buf_size, "%d", numeric_ret); |
821 | *intval = playlist_amount(); | 827 | numeric_buf = buf; |
822 | return buf; | 828 | goto gtv_ret_numeric_tag_info; |
823 | case SKIN_TOKEN_LIST_TITLE_TEXT: | 829 | case SKIN_TOKEN_LIST_TITLE_TEXT: |
824 | return sb_get_title(gwps->display->screen_type); | 830 | return sb_get_title(gwps->display->screen_type); |
825 | case SKIN_TOKEN_LIST_TITLE_ICON: | 831 | case SKIN_TOKEN_LIST_TITLE_ICON: |
826 | if (intval) | 832 | numeric_ret = sb_get_icon(gwps->display->screen_type); |
827 | *intval = sb_get_icon(gwps->display->screen_type); | 833 | snprintf(buf, buf_size, "%d", numeric_ret); |
828 | snprintf(buf, buf_size, "%d",sb_get_icon(gwps->display->screen_type)); | 834 | numeric_buf = buf; |
829 | return buf; | 835 | goto gtv_ret_numeric_tag_info; |
830 | case SKIN_TOKEN_LIST_ITEM_TEXT: | 836 | case SKIN_TOKEN_LIST_ITEM_TEXT: |
831 | { | 837 | { |
832 | struct listitem *li = (struct listitem *)SKINOFFSETTOPTR(get_skin_buffer(data), token->value.data); | 838 | struct listitem *li = (struct listitem *)SKINOFFSETTOPTR(get_skin_buffer(data), token->value.data); |
@@ -834,20 +840,20 @@ const char *get_token_value(struct gui_wps *gwps, | |||
834 | return skinlist_get_item_text(li->offset, li->wrap, buf, buf_size); | 840 | return skinlist_get_item_text(li->offset, li->wrap, buf, buf_size); |
835 | } | 841 | } |
836 | case SKIN_TOKEN_LIST_ITEM_ROW: | 842 | case SKIN_TOKEN_LIST_ITEM_ROW: |
837 | if (intval) | 843 | numeric_ret = skinlist_get_item_row() + 1; |
838 | *intval = skinlist_get_item_row() + 1; | 844 | snprintf(buf, buf_size, "%d", numeric_ret); |
839 | snprintf(buf, buf_size, "%d",skinlist_get_item_row() + 1); | 845 | numeric_buf = buf; |
840 | return buf; | 846 | goto gtv_ret_numeric_tag_info; |
841 | case SKIN_TOKEN_LIST_ITEM_COLUMN: | 847 | case SKIN_TOKEN_LIST_ITEM_COLUMN: |
842 | if (intval) | 848 | numeric_ret = skinlist_get_item_column() + 1; |
843 | *intval = skinlist_get_item_column() + 1; | 849 | snprintf(buf, buf_size, "%d", numeric_ret); |
844 | snprintf(buf, buf_size, "%d",skinlist_get_item_column() + 1); | 850 | numeric_buf = buf; |
845 | return buf; | 851 | goto gtv_ret_numeric_tag_info; |
846 | case SKIN_TOKEN_LIST_ITEM_NUMBER: | 852 | case SKIN_TOKEN_LIST_ITEM_NUMBER: |
847 | if (intval) | 853 | numeric_ret = skinlist_get_item_number() + 1; |
848 | *intval = skinlist_get_item_number() + 1; | 854 | snprintf(buf, buf_size, "%d", numeric_ret); |
849 | snprintf(buf, buf_size, "%d",skinlist_get_item_number() + 1); | 855 | numeric_buf = buf; |
850 | return buf; | 856 | goto gtv_ret_numeric_tag_info; |
851 | case SKIN_TOKEN_LIST_ITEM_IS_SELECTED: | 857 | case SKIN_TOKEN_LIST_ITEM_IS_SELECTED: |
852 | return skinlist_is_selected_item()?"s":""; | 858 | return skinlist_is_selected_item()?"s":""; |
853 | case SKIN_TOKEN_LIST_ITEM_ICON: | 859 | case SKIN_TOKEN_LIST_ITEM_ICON: |
@@ -855,10 +861,10 @@ const char *get_token_value(struct gui_wps *gwps, | |||
855 | struct listitem *li = (struct listitem *)SKINOFFSETTOPTR(get_skin_buffer(data), token->value.data); | 861 | struct listitem *li = (struct listitem *)SKINOFFSETTOPTR(get_skin_buffer(data), token->value.data); |
856 | if (!li) return NULL; | 862 | if (!li) return NULL; |
857 | int icon = skinlist_get_item_icon(li->offset, li->wrap); | 863 | int icon = skinlist_get_item_icon(li->offset, li->wrap); |
858 | if (intval) | 864 | numeric_ret = icon; |
859 | *intval = icon; | 865 | snprintf(buf, buf_size, "%d", numeric_ret); |
860 | snprintf(buf, buf_size, "%d", icon); | 866 | numeric_buf = buf; |
861 | return buf; | 867 | goto gtv_ret_numeric_tag_info; |
862 | } | 868 | } |
863 | case SKIN_TOKEN_LIST_NEEDS_SCROLLBAR: | 869 | case SKIN_TOKEN_LIST_NEEDS_SCROLLBAR: |
864 | return skinlist_needs_scrollbar(gwps->display->screen_type) ? "s" : ""; | 870 | return skinlist_needs_scrollbar(gwps->display->screen_type) ? "s" : ""; |
@@ -866,10 +872,10 @@ const char *get_token_value(struct gui_wps *gwps, | |||
866 | return playlist_name(NULL, buf, buf_size); | 872 | return playlist_name(NULL, buf, buf_size); |
867 | 873 | ||
868 | case SKIN_TOKEN_PLAYLIST_POSITION: | 874 | case SKIN_TOKEN_PLAYLIST_POSITION: |
869 | snprintf(buf, buf_size, "%d", playlist_get_display_index()+offset); | 875 | numeric_ret = playlist_get_display_index()+offset; |
870 | if (intval) | 876 | snprintf(buf, buf_size, "%d", numeric_ret); |
871 | *intval = playlist_get_display_index()+offset; | 877 | numeric_buf = buf; |
872 | return buf; | 878 | goto gtv_ret_numeric_tag_info; |
873 | 879 | ||
874 | case SKIN_TOKEN_PLAYLIST_SHUFFLE: | 880 | case SKIN_TOKEN_PLAYLIST_SHUFFLE: |
875 | if ( global_settings.playlist_shuffle ) | 881 | if ( global_settings.playlist_shuffle ) |
@@ -885,27 +891,28 @@ const char *get_token_value(struct gui_wps *gwps, | |||
885 | int minvol = sound_min(SOUND_VOLUME); | 891 | int minvol = sound_min(SOUND_VOLUME); |
886 | if (limit == TOKEN_VALUE_ONLY) | 892 | if (limit == TOKEN_VALUE_ONLY) |
887 | { | 893 | { |
888 | *intval = global_settings.volume; | 894 | numeric_ret = global_settings.volume; |
889 | } | 895 | } |
890 | else if (global_settings.volume == minvol) | 896 | else if (global_settings.volume == minvol) |
891 | { | 897 | { |
892 | *intval = 1; | 898 | numeric_ret = 1; |
893 | } | 899 | } |
894 | else if (global_settings.volume == 0) | 900 | else if (global_settings.volume == 0) |
895 | { | 901 | { |
896 | *intval = limit - 1; | 902 | numeric_ret = limit - 1; |
897 | } | 903 | } |
898 | else if (global_settings.volume > 0) | 904 | else if (global_settings.volume > 0) |
899 | { | 905 | { |
900 | *intval = limit; | 906 | numeric_ret = limit; |
901 | } | 907 | } |
902 | else | 908 | else |
903 | { | 909 | { |
904 | *intval = (limit-3) * (global_settings.volume - minvol - 1) | 910 | numeric_ret = (limit-3) * (global_settings.volume - minvol - 1) |
905 | / (-1 - minvol) + 2; | 911 | / (-1 - minvol) + 2; |
906 | } | 912 | } |
907 | } | 913 | } |
908 | return buf; | 914 | numeric_buf = buf; |
915 | goto gtv_ret_numeric_tag_info; | ||
909 | #ifdef HAVE_ALBUMART | 916 | #ifdef HAVE_ALBUMART |
910 | case SKIN_TOKEN_ALBUMART_FOUND: | 917 | case SKIN_TOKEN_ALBUMART_FOUND: |
911 | if (SKINOFFSETTOPTR(get_skin_buffer(data), data->albumart)) | 918 | if (SKINOFFSETTOPTR(get_skin_buffer(data), data->albumart)) |
@@ -925,7 +932,7 @@ const char *get_token_value(struct gui_wps *gwps, | |||
925 | return "C"; | 932 | return "C"; |
926 | } | 933 | } |
927 | return NULL; | 934 | return NULL; |
928 | #endif | 935 | #endif /* def HAVE_ALBUMART */ |
929 | 936 | ||
930 | case SKIN_TOKEN_BATTERY_PERCENT: | 937 | case SKIN_TOKEN_BATTERY_PERCENT: |
931 | { | 938 | { |
@@ -935,7 +942,7 @@ const char *get_token_value(struct gui_wps *gwps, | |||
935 | { | 942 | { |
936 | if (limit == TOKEN_VALUE_ONLY) | 943 | if (limit == TOKEN_VALUE_ONLY) |
937 | { | 944 | { |
938 | *intval = l; | 945 | numeric_ret = l; |
939 | } | 946 | } |
940 | else | 947 | else |
941 | { | 948 | { |
@@ -944,18 +951,20 @@ const char *get_token_value(struct gui_wps *gwps, | |||
944 | /* First enum is used for "unknown level", | 951 | /* First enum is used for "unknown level", |
945 | * last enum is used for 100%. | 952 | * last enum is used for 100%. |
946 | */ | 953 | */ |
947 | *intval = (limit - 2) * l / 100 + 2; | 954 | numeric_ret = (limit - 2) * l / 100 + 2; |
948 | } else { | 955 | } else { |
949 | *intval = 1; | 956 | numeric_ret = 1; |
950 | } | 957 | } |
951 | } | 958 | } |
952 | } | 959 | } |
953 | 960 | ||
954 | if (l > -1) { | 961 | if (l > -1) { |
955 | snprintf(buf, buf_size, "%d", l); | 962 | snprintf(buf, buf_size, "%d", l); |
956 | return buf; | 963 | numeric_buf = buf; |
964 | goto gtv_ret_numeric_tag_info; | ||
957 | } else { | 965 | } else { |
958 | return "?"; | 966 | numeric_buf = "?"; |
967 | goto gtv_ret_numeric_tag_info; | ||
959 | } | 968 | } |
960 | } | 969 | } |
961 | 970 | ||
@@ -1046,20 +1055,17 @@ const char *get_token_value(struct gui_wps *gwps, | |||
1046 | mode = 9; | 1055 | mode = 9; |
1047 | #endif | 1056 | #endif |
1048 | 1057 | ||
1049 | if (intval) { | 1058 | numeric_ret = mode; |
1050 | *intval = mode; | ||
1051 | } | ||
1052 | |||
1053 | snprintf(buf, buf_size, "%d", mode-1); | 1059 | snprintf(buf, buf_size, "%d", mode-1); |
1054 | return buf; | 1060 | numeric_buf = buf; |
1061 | goto gtv_ret_numeric_tag_info; | ||
1055 | } | 1062 | } |
1056 | 1063 | ||
1057 | case SKIN_TOKEN_REPEAT_MODE: | 1064 | case SKIN_TOKEN_REPEAT_MODE: |
1058 | if (intval) | ||
1059 | *intval = global_settings.repeat_mode + 1; | ||
1060 | snprintf(buf, buf_size, "%d", global_settings.repeat_mode); | 1065 | snprintf(buf, buf_size, "%d", global_settings.repeat_mode); |
1061 | return buf; | 1066 | numeric_ret = global_settings.repeat_mode + 1; |
1062 | 1067 | numeric_buf = buf; | |
1068 | goto gtv_ret_numeric_tag_info; | ||
1063 | case SKIN_TOKEN_RTC_PRESENT: | 1069 | case SKIN_TOKEN_RTC_PRESENT: |
1064 | #if CONFIG_RTC | 1070 | #if CONFIG_RTC |
1065 | return "c"; | 1071 | return "c"; |
@@ -1069,101 +1075,99 @@ const char *get_token_value(struct gui_wps *gwps, | |||
1069 | 1075 | ||
1070 | #if CONFIG_RTC | 1076 | #if CONFIG_RTC |
1071 | case SKIN_TOKEN_RTC_12HOUR_CFG: | 1077 | case SKIN_TOKEN_RTC_12HOUR_CFG: |
1072 | if (intval) | ||
1073 | *intval = global_settings.timeformat + 1; | ||
1074 | snprintf(buf, buf_size, "%d", global_settings.timeformat); | 1078 | snprintf(buf, buf_size, "%d", global_settings.timeformat); |
1075 | return buf; | 1079 | numeric_ret = global_settings.timeformat + 1; |
1080 | numeric_buf = buf; | ||
1081 | goto gtv_ret_numeric_tag_info; | ||
1076 | 1082 | ||
1077 | case SKIN_TOKEN_RTC_DAY_OF_MONTH: | 1083 | case SKIN_TOKEN_RTC_DAY_OF_MONTH: |
1078 | /* d: day of month (01..31) */ | 1084 | /* d: day of month (01..31) */ |
1079 | snprintf(buf, buf_size, "%02d", tm->tm_mday); | 1085 | snprintf(buf, buf_size, "%02d", tm->tm_mday); |
1080 | if (intval) | 1086 | numeric_ret = tm->tm_mday - 1; |
1081 | *intval = tm->tm_mday - 1; | 1087 | numeric_buf = buf; |
1082 | return buf; | 1088 | goto gtv_ret_numeric_tag_info; |
1083 | 1089 | ||
1084 | case SKIN_TOKEN_RTC_DAY_OF_MONTH_BLANK_PADDED: | 1090 | case SKIN_TOKEN_RTC_DAY_OF_MONTH_BLANK_PADDED: |
1085 | /* e: day of month, blank padded ( 1..31) */ | 1091 | /* e: day of month, blank padded ( 1..31) */ |
1086 | snprintf(buf, buf_size, "%2d", tm->tm_mday); | 1092 | snprintf(buf, buf_size, "%2d", tm->tm_mday); |
1087 | if (intval) | 1093 | numeric_ret = tm->tm_mday - 1; |
1088 | *intval = tm->tm_mday - 1; | 1094 | numeric_buf = buf; |
1089 | return buf; | 1095 | goto gtv_ret_numeric_tag_info; |
1090 | 1096 | ||
1091 | case SKIN_TOKEN_RTC_HOUR_24_ZERO_PADDED: | 1097 | case SKIN_TOKEN_RTC_HOUR_24_ZERO_PADDED: |
1092 | /* H: hour (00..23) */ | 1098 | /* H: hour (00..23) */ |
1093 | snprintf(buf, buf_size, "%02d", tm->tm_hour); | 1099 | numeric_ret = tm->tm_hour; |
1094 | if (intval) | 1100 | snprintf(buf, buf_size, "%02d", numeric_ret); |
1095 | *intval = tm->tm_hour; | 1101 | numeric_buf = buf; |
1096 | return buf; | 1102 | goto gtv_ret_numeric_tag_info; |
1097 | 1103 | ||
1098 | case SKIN_TOKEN_RTC_HOUR_24: | 1104 | case SKIN_TOKEN_RTC_HOUR_24: |
1099 | /* k: hour ( 0..23) */ | 1105 | /* k: hour ( 0..23) */ |
1100 | snprintf(buf, buf_size, "%2d", tm->tm_hour); | 1106 | numeric_ret = tm->tm_hour; |
1101 | if (intval) | 1107 | snprintf(buf, buf_size, "%2d", numeric_ret); |
1102 | *intval = tm->tm_hour; | 1108 | numeric_buf = buf; |
1103 | return buf; | 1109 | goto gtv_ret_numeric_tag_info; |
1104 | 1110 | ||
1105 | case SKIN_TOKEN_RTC_HOUR_12_ZERO_PADDED: | 1111 | case SKIN_TOKEN_RTC_HOUR_12_ZERO_PADDED: |
1106 | /* I: hour (01..12) */ | 1112 | /* I: hour (01..12) */ |
1107 | snprintf(buf, buf_size, "%02d", | 1113 | numeric_ret = (tm->tm_hour % 12 == 0) ? 12 : tm->tm_hour % 12; |
1108 | (tm->tm_hour % 12 == 0) ? 12 : tm->tm_hour % 12); | 1114 | snprintf(buf, buf_size, "%02d", numeric_ret); |
1109 | if (intval) | 1115 | numeric_buf = buf; |
1110 | *intval = (tm->tm_hour % 12 == 0) ? 12 : tm->tm_hour % 12; | 1116 | goto gtv_ret_numeric_tag_info; |
1111 | return buf; | ||
1112 | 1117 | ||
1113 | case SKIN_TOKEN_RTC_HOUR_12: | 1118 | case SKIN_TOKEN_RTC_HOUR_12: |
1114 | /* l: hour ( 1..12) */ | 1119 | /* l: hour ( 1..12) */ |
1115 | snprintf(buf, buf_size, "%2d", | 1120 | numeric_ret = (tm->tm_hour % 12 == 0) ? 12 : tm->tm_hour % 12; |
1116 | (tm->tm_hour % 12 == 0) ? 12 : tm->tm_hour % 12); | 1121 | snprintf(buf, buf_size, "%2d", numeric_ret); |
1117 | if (intval) | 1122 | numeric_buf = buf; |
1118 | *intval = (tm->tm_hour % 12 == 0) ? 12 : tm->tm_hour % 12; | 1123 | goto gtv_ret_numeric_tag_info; |
1119 | return buf; | ||
1120 | 1124 | ||
1121 | case SKIN_TOKEN_RTC_MONTH: | 1125 | case SKIN_TOKEN_RTC_MONTH: |
1122 | /* m: month (01..12) */ | 1126 | /* m: month (01..12) */ |
1123 | if (intval) | 1127 | numeric_ret = tm->tm_mon + 1; |
1124 | *intval = tm->tm_mon + 1; | 1128 | snprintf(buf, buf_size, "%02d", numeric_ret); |
1125 | snprintf(buf, buf_size, "%02d", tm->tm_mon + 1); | 1129 | numeric_buf = buf; |
1126 | return buf; | 1130 | goto gtv_ret_numeric_tag_info; |
1127 | 1131 | ||
1128 | case SKIN_TOKEN_RTC_MINUTE: | 1132 | case SKIN_TOKEN_RTC_MINUTE: |
1129 | /* M: minute (00..59) */ | 1133 | /* M: minute (00..59) */ |
1130 | snprintf(buf, buf_size, "%02d", tm->tm_min); | 1134 | numeric_ret = tm->tm_min; |
1131 | if (intval) | 1135 | snprintf(buf, buf_size, "%02d", numeric_ret); |
1132 | *intval = tm->tm_min; | 1136 | numeric_buf = buf; |
1133 | return buf; | 1137 | goto gtv_ret_numeric_tag_info; |
1134 | 1138 | ||
1135 | case SKIN_TOKEN_RTC_SECOND: | 1139 | case SKIN_TOKEN_RTC_SECOND: |
1136 | /* S: second (00..59) */ | 1140 | /* S: second (00..59) */ |
1137 | snprintf(buf, buf_size, "%02d", tm->tm_sec); | 1141 | numeric_ret = tm->tm_sec; |
1138 | if (intval) | 1142 | snprintf(buf, buf_size, "%02d", numeric_ret); |
1139 | *intval = tm->tm_sec; | 1143 | numeric_buf = buf; |
1140 | return buf; | 1144 | goto gtv_ret_numeric_tag_info; |
1141 | 1145 | ||
1142 | case SKIN_TOKEN_RTC_YEAR_2_DIGITS: | 1146 | case SKIN_TOKEN_RTC_YEAR_2_DIGITS: |
1143 | /* y: last two digits of year (00..99) */ | 1147 | /* y: last two digits of year (00..99) */ |
1144 | snprintf(buf, buf_size, "%02d", tm->tm_year % 100); | 1148 | numeric_ret = tm->tm_year % 100; |
1145 | if (intval) | 1149 | snprintf(buf, buf_size, "%02d", numeric_ret); |
1146 | *intval = tm->tm_year % 100; | 1150 | numeric_buf = buf; |
1147 | return buf; | 1151 | goto gtv_ret_numeric_tag_info; |
1148 | 1152 | ||
1149 | case SKIN_TOKEN_RTC_YEAR_4_DIGITS: | 1153 | case SKIN_TOKEN_RTC_YEAR_4_DIGITS: |
1150 | /* Y: year (1970...) */ | 1154 | /* Y: year (1970...) */ |
1151 | snprintf(buf, buf_size, "%04d", tm->tm_year + 1900); | 1155 | numeric_ret = tm->tm_year + 1900; |
1152 | if (intval) | 1156 | snprintf(buf, buf_size, "%04d", numeric_ret); |
1153 | *intval = tm->tm_year + 1900; | 1157 | numeric_buf = buf; |
1154 | return buf; | 1158 | goto gtv_ret_numeric_tag_info; |
1155 | 1159 | ||
1156 | case SKIN_TOKEN_RTC_AM_PM_UPPER: | 1160 | case SKIN_TOKEN_RTC_AM_PM_UPPER: |
1157 | /* p: upper case AM or PM indicator */ | 1161 | /* p: upper case AM or PM indicator */ |
1158 | if (intval) | 1162 | numeric_ret = tm->tm_hour/12 == 0 ? 0 : 1; |
1159 | *intval = tm->tm_hour/12 == 0 ? 0 : 1; | 1163 | numeric_buf = numeric_ret == 0 ? "AM" : "PM"; |
1160 | return tm->tm_hour/12 == 0 ? "AM" : "PM"; | 1164 | goto gtv_ret_numeric_tag_info; |
1161 | 1165 | ||
1162 | case SKIN_TOKEN_RTC_AM_PM_LOWER: | 1166 | case SKIN_TOKEN_RTC_AM_PM_LOWER: |
1163 | /* P: lower case am or pm indicator */ | 1167 | /* P: lower case am or pm indicator */ |
1164 | if (intval) | 1168 | numeric_ret= tm->tm_hour/12 == 0 ? 0 : 1; |
1165 | *intval = tm->tm_hour/12 == 0 ? 0 : 1; | 1169 | numeric_buf = numeric_ret == 0 ? "am" : "pm"; |
1166 | return tm->tm_hour/12 == 0 ? "am" : "pm"; | 1170 | goto gtv_ret_numeric_tag_info; |
1167 | 1171 | ||
1168 | case SKIN_TOKEN_RTC_WEEKDAY_NAME: | 1172 | case SKIN_TOKEN_RTC_WEEKDAY_NAME: |
1169 | /* a: abbreviated weekday name (Sun..Sat) */ | 1173 | /* a: abbreviated weekday name (Sun..Sat) */ |
@@ -1175,18 +1179,18 @@ const char *get_token_value(struct gui_wps *gwps, | |||
1175 | 1179 | ||
1176 | case SKIN_TOKEN_RTC_DAY_OF_WEEK_START_MON: | 1180 | case SKIN_TOKEN_RTC_DAY_OF_WEEK_START_MON: |
1177 | /* u: day of week (1..7); 1 is Monday */ | 1181 | /* u: day of week (1..7); 1 is Monday */ |
1178 | if (intval) | ||
1179 | *intval = (tm->tm_wday == 0) ? 7 : tm->tm_wday; | ||
1180 | snprintf(buf, buf_size, "%1d", tm->tm_wday + 1); | 1182 | snprintf(buf, buf_size, "%1d", tm->tm_wday + 1); |
1181 | return buf; | 1183 | numeric_ret = (tm->tm_wday == 0) ? 7 : tm->tm_wday; |
1184 | numeric_buf = buf; | ||
1185 | goto gtv_ret_numeric_tag_info; | ||
1182 | 1186 | ||
1183 | case SKIN_TOKEN_RTC_DAY_OF_WEEK_START_SUN: | 1187 | case SKIN_TOKEN_RTC_DAY_OF_WEEK_START_SUN: |
1184 | /* w: day of week (0..6); 0 is Sunday */ | 1188 | /* w: day of week (0..6); 0 is Sunday */ |
1185 | if (intval) | ||
1186 | *intval = tm->tm_wday + 1; | ||
1187 | snprintf(buf, buf_size, "%1d", tm->tm_wday); | 1189 | snprintf(buf, buf_size, "%1d", tm->tm_wday); |
1188 | return buf; | 1190 | numeric_ret = tm->tm_wday + 1; |
1189 | #else | 1191 | numeric_buf = buf; |
1192 | goto gtv_ret_numeric_tag_info; | ||
1193 | #else /* !CONFIG_RTC */ | ||
1190 | case SKIN_TOKEN_RTC_DAY_OF_MONTH: | 1194 | case SKIN_TOKEN_RTC_DAY_OF_MONTH: |
1191 | case SKIN_TOKEN_RTC_DAY_OF_MONTH_BLANK_PADDED: | 1195 | case SKIN_TOKEN_RTC_DAY_OF_MONTH_BLANK_PADDED: |
1192 | case SKIN_TOKEN_RTC_HOUR_24_ZERO_PADDED: | 1196 | case SKIN_TOKEN_RTC_HOUR_24_ZERO_PADDED: |
@@ -1208,7 +1212,7 @@ const char *get_token_value(struct gui_wps *gwps, | |||
1208 | case SKIN_TOKEN_RTC_DAY_OF_WEEK_START_MON: | 1212 | case SKIN_TOKEN_RTC_DAY_OF_WEEK_START_MON: |
1209 | case SKIN_TOKEN_RTC_DAY_OF_WEEK_START_SUN: | 1213 | case SKIN_TOKEN_RTC_DAY_OF_WEEK_START_SUN: |
1210 | return "-"; | 1214 | return "-"; |
1211 | #endif | 1215 | #endif /* CONFIG_RTC */ |
1212 | 1216 | ||
1213 | /* peakmeter */ | 1217 | /* peakmeter */ |
1214 | case SKIN_TOKEN_PEAKMETER_LEFT: | 1218 | case SKIN_TOKEN_PEAKMETER_LEFT: |
@@ -1219,22 +1223,22 @@ const char *get_token_value(struct gui_wps *gwps, | |||
1219 | val = token->type == SKIN_TOKEN_PEAKMETER_LEFT ? | 1223 | val = token->type == SKIN_TOKEN_PEAKMETER_LEFT ? |
1220 | left : right; | 1224 | left : right; |
1221 | val = peak_meter_scale_value(val, limit==1 ? MAX_PEAK : limit); | 1225 | val = peak_meter_scale_value(val, limit==1 ? MAX_PEAK : limit); |
1222 | if (intval) | 1226 | numeric_ret = val; |
1223 | *intval = val; | 1227 | snprintf(buf, buf_size, "%d", numeric_ret); |
1224 | snprintf(buf, buf_size, "%d", val); | ||
1225 | data->peak_meter_enabled = true; | 1228 | data->peak_meter_enabled = true; |
1226 | return buf; | 1229 | numeric_buf = buf; |
1230 | goto gtv_ret_numeric_tag_info; | ||
1227 | } | 1231 | } |
1228 | 1232 | ||
1229 | case SKIN_TOKEN_CROSSFADE: | 1233 | case SKIN_TOKEN_CROSSFADE: |
1230 | #ifdef HAVE_CROSSFADE | 1234 | #ifdef HAVE_CROSSFADE |
1231 | if (intval) | ||
1232 | *intval = global_settings.crossfade + 1; | ||
1233 | snprintf(buf, buf_size, "%d", global_settings.crossfade); | 1235 | snprintf(buf, buf_size, "%d", global_settings.crossfade); |
1236 | numeric_ret = global_settings.crossfade + 1; | ||
1234 | #else | 1237 | #else |
1235 | snprintf(buf, buf_size, "%d", 0); | 1238 | snprintf(buf, buf_size, "%d", 0); |
1236 | #endif | 1239 | #endif |
1237 | return buf; | 1240 | numeric_buf = buf; |
1241 | goto gtv_ret_numeric_tag_info; | ||
1238 | 1242 | ||
1239 | case SKIN_TOKEN_REPLAYGAIN: | 1243 | case SKIN_TOKEN_REPLAYGAIN: |
1240 | { | 1244 | { |
@@ -1257,15 +1261,13 @@ const char *get_token_value(struct gui_wps *gwps, | |||
1257 | val += 2; | 1261 | val += 2; |
1258 | } | 1262 | } |
1259 | 1263 | ||
1260 | if (intval) | 1264 | numeric_ret = val; |
1261 | *intval = val; | ||
1262 | |||
1263 | switch (val) | 1265 | switch (val) |
1264 | { | 1266 | { |
1265 | case 1: | 1267 | case 1: |
1266 | case 6: | 1268 | case 6: |
1267 | return "+0.00 dB"; | 1269 | numeric_buf = "+0.00 dB";; |
1268 | break; | 1270 | goto gtv_ret_numeric_tag_info; |
1269 | /* due to above, coming here with !id3 shouldn't be possible */ | 1271 | /* due to above, coming here with !id3 shouldn't be possible */ |
1270 | case 2: | 1272 | case 2: |
1271 | case 4: | 1273 | case 4: |
@@ -1276,7 +1278,8 @@ const char *get_token_value(struct gui_wps *gwps, | |||
1276 | replaygain_itoa(buf, buf_size, id3->album_level); | 1278 | replaygain_itoa(buf, buf_size, id3->album_level); |
1277 | break; | 1279 | break; |
1278 | } | 1280 | } |
1279 | return buf; | 1281 | numeric_buf = buf; |
1282 | goto gtv_ret_numeric_tag_info; | ||
1280 | } | 1283 | } |
1281 | 1284 | ||
1282 | #if defined (HAVE_PITCHCONTROL) | 1285 | #if defined (HAVE_PITCHCONTROL) |
@@ -1286,11 +1289,10 @@ const char *get_token_value(struct gui_wps *gwps, | |||
1286 | snprintf(buf, buf_size, "%ld.%ld", | 1289 | snprintf(buf, buf_size, "%ld.%ld", |
1287 | pitch / PITCH_SPEED_PRECISION, | 1290 | pitch / PITCH_SPEED_PRECISION, |
1288 | (pitch % PITCH_SPEED_PRECISION) / (PITCH_SPEED_PRECISION / 10)); | 1291 | (pitch % PITCH_SPEED_PRECISION) / (PITCH_SPEED_PRECISION / 10)); |
1289 | |||
1290 | if (intval) | 1292 | if (intval) |
1291 | *intval = pitch_speed_enum(limit, pitch, | 1293 | numeric_ret = pitch_speed_enum(limit, pitch, PITCH_SPEED_PRECISION * 100); |
1292 | PITCH_SPEED_PRECISION * 100); | 1294 | numeric_buf = buf; |
1293 | return buf; | 1295 | goto gtv_ret_numeric_tag_info; |
1294 | } | 1296 | } |
1295 | #endif | 1297 | #endif |
1296 | 1298 | ||
@@ -1307,9 +1309,9 @@ const char *get_token_value(struct gui_wps *gwps, | |||
1307 | speed / PITCH_SPEED_PRECISION, | 1309 | speed / PITCH_SPEED_PRECISION, |
1308 | (speed % PITCH_SPEED_PRECISION) / (PITCH_SPEED_PRECISION / 10)); | 1310 | (speed % PITCH_SPEED_PRECISION) / (PITCH_SPEED_PRECISION / 10)); |
1309 | if (intval) | 1311 | if (intval) |
1310 | *intval = pitch_speed_enum(limit, speed, | 1312 | numeric_ret = pitch_speed_enum(limit, speed, PITCH_SPEED_PRECISION * 100); |
1311 | PITCH_SPEED_PRECISION * 100); | 1313 | numeric_buf = buf; |
1312 | return buf; | 1314 | goto gtv_ret_numeric_tag_info; |
1313 | } | 1315 | } |
1314 | #endif | 1316 | #endif |
1315 | 1317 | ||
@@ -1389,57 +1391,65 @@ const char *get_token_value(struct gui_wps *gwps, | |||
1389 | /* settings with decimals can't be used in conditionals */ | 1391 | /* settings with decimals can't be used in conditionals */ |
1390 | if (sound_numdecimals(sound_setting) == 0) | 1392 | if (sound_numdecimals(sound_setting) == 0) |
1391 | { | 1393 | { |
1392 | *intval = (*(int*)s->setting-sound_min(sound_setting)) | 1394 | numeric_ret = (*(int*)s->setting-sound_min(sound_setting)) |
1393 | /sound_steps(sound_setting) + 1; | 1395 | /sound_steps(sound_setting) + 1; |
1394 | } | 1396 | } |
1395 | else | 1397 | else |
1396 | *intval = -1; | 1398 | numeric_ret = -1; |
1397 | } | 1399 | } |
1398 | else if (s->flags&F_RGB) | 1400 | else if (s->flags&F_RGB) |
1399 | /* %?St|name|<#000000|#000001|...|#FFFFFF> */ | 1401 | /* %?St|name|<#000000|#000001|...|#FFFFFF> */ |
1400 | /* shouldn't overflow since colors are stored | 1402 | /* shouldn't overflow since colors are stored |
1401 | * on 16 bits ... | 1403 | * on 16 bits ... |
1402 | * but this is pretty useless anyway */ | 1404 | * but this is pretty useless anyway */ |
1403 | *intval = *(int*)s->setting + 1; | 1405 | numeric_ret = *(int*)s->setting + 1; |
1404 | else if (s->cfg_vals == NULL) | 1406 | else if (s->cfg_vals == NULL) |
1405 | /* %?St|name|<1st choice|2nd choice|...> */ | 1407 | /* %?St|name|<1st choice|2nd choice|...> */ |
1406 | *intval = (*(int*)s->setting-s->int_setting->min) | 1408 | numeric_ret = (*(int*)s->setting-s->int_setting->min) |
1407 | /s->int_setting->step + 1; | 1409 | /s->int_setting->step + 1; |
1408 | else | 1410 | else |
1409 | /* %?St|name|<1st choice|2nd choice|...> */ | 1411 | /* %?St|name|<1st choice|2nd choice|...> */ |
1410 | /* Not sure about this one. cfg_name/vals are | 1412 | /* Not sure about this one. cfg_name/vals are |
1411 | * indexed from 0 right? */ | 1413 | * indexed from 0 right? */ |
1412 | *intval = *(int*)s->setting + 1; | 1414 | numeric_ret = *(int*)s->setting + 1; |
1413 | break; | 1415 | break; |
1414 | case F_T_BOOL: | 1416 | case F_T_BOOL: |
1415 | /* %?St|name|<if true|if false> */ | 1417 | /* %?St|name|<if true|if false> */ |
1416 | *intval = *(bool*)s->setting?1:2; | 1418 | numeric_ret = *(bool*)s->setting?1:2; |
1417 | break; | 1419 | break; |
1418 | case F_T_CHARPTR: | 1420 | case F_T_CHARPTR: |
1419 | case F_T_UCHARPTR: | 1421 | case F_T_UCHARPTR: |
1420 | /* %?St|name|<if non empty string|if empty> | 1422 | /* %?St|name|<if non empty string|if empty> |
1421 | * The string's emptyness discards the setting's | 1423 | * The string's emptyness discards the setting's |
1422 | * prefix and suffix */ | 1424 | * prefix and suffix */ |
1423 | *intval = ((char*)s->setting)[0]?1:2; | 1425 | numeric_ret = ((char*)s->setting)[0]?1:2; |
1424 | /* if there is a prefix we should ignore it here */ | 1426 | /* if there is a prefix we should ignore it here */ |
1425 | if (s->filename_setting->prefix) | 1427 | if (s->filename_setting->prefix) |
1426 | return (char*)s->setting; | 1428 | { |
1429 | numeric_buf = (char*)s->setting; | ||
1430 | goto gtv_ret_numeric_tag_info; | ||
1431 | } | ||
1427 | break; | 1432 | break; |
1428 | default: | 1433 | default: |
1429 | /* This shouldn't happen ... but you never know */ | 1434 | /* This shouldn't happen ... but you never know */ |
1430 | *intval = -1; | 1435 | numeric_ret = -1; |
1431 | break; | 1436 | break; |
1432 | } | 1437 | } |
1433 | } | 1438 | } |
1439 | |||
1434 | /* Special handlng for filenames because we dont want to show the prefix */ | 1440 | /* Special handlng for filenames because we dont want to show the prefix */ |
1435 | if ((s->flags&F_T_MASK) == F_T_CHARPTR || | 1441 | if ((s->flags&F_T_MASK) == F_T_CHARPTR || |
1436 | (s->flags&F_T_MASK) == F_T_UCHARPTR) | 1442 | (s->flags&F_T_MASK) == F_T_UCHARPTR) |
1437 | { | 1443 | { |
1438 | if (s->filename_setting->prefix) | 1444 | if (s->filename_setting->prefix) |
1439 | return (char*)s->setting; | 1445 | { |
1446 | numeric_buf = (char*)s->setting; | ||
1447 | goto gtv_ret_numeric_tag_info; | ||
1448 | } | ||
1440 | } | 1449 | } |
1441 | cfg_to_string(token->value.i,buf,buf_size); | 1450 | cfg_to_string(token->value.i,buf,buf_size); |
1442 | return buf; | 1451 | numeric_buf = buf; |
1452 | goto gtv_ret_numeric_tag_info; | ||
1443 | } | 1453 | } |
1444 | case SKIN_TOKEN_HAVE_TUNER: | 1454 | case SKIN_TOKEN_HAVE_TUNER: |
1445 | #if CONFIG_TUNER | 1455 | #if CONFIG_TUNER |
@@ -1484,50 +1494,48 @@ const char *get_token_value(struct gui_wps *gwps, | |||
1484 | #endif | 1494 | #endif |
1485 | samprk = rec_freq_sampr[rec_freq]; | 1495 | samprk = rec_freq_sampr[rec_freq]; |
1486 | #endif /* SIMULATOR */ | 1496 | #endif /* SIMULATOR */ |
1487 | if (intval) | 1497 | switch (rec_freq) |
1488 | { | 1498 | { |
1489 | switch (rec_freq) | 1499 | REC_HAVE_96_(case REC_FREQ_96: |
1490 | { | 1500 | numeric_ret = 1; |
1491 | REC_HAVE_96_(case REC_FREQ_96: | 1501 | break;) |
1492 | *intval = 1; | 1502 | REC_HAVE_88_(case REC_FREQ_88: |
1493 | break;) | 1503 | numeric_ret = 2; |
1494 | REC_HAVE_88_(case REC_FREQ_88: | 1504 | break;) |
1495 | *intval = 2; | 1505 | REC_HAVE_64_(case REC_FREQ_64: |
1496 | break;) | 1506 | numeric_ret = 3; |
1497 | REC_HAVE_64_(case REC_FREQ_64: | 1507 | break;) |
1498 | *intval = 3; | 1508 | REC_HAVE_48_(case REC_FREQ_48: |
1499 | break;) | 1509 | numeric_ret = 4; |
1500 | REC_HAVE_48_(case REC_FREQ_48: | 1510 | break;) |
1501 | *intval = 4; | 1511 | REC_HAVE_44_(case REC_FREQ_44: |
1502 | break;) | 1512 | numeric_ret = 5; |
1503 | REC_HAVE_44_(case REC_FREQ_44: | 1513 | break;) |
1504 | *intval = 5; | 1514 | REC_HAVE_32_(case REC_FREQ_32: |
1505 | break;) | 1515 | numeric_ret = 6; |
1506 | REC_HAVE_32_(case REC_FREQ_32: | 1516 | break;) |
1507 | *intval = 6; | 1517 | REC_HAVE_24_(case REC_FREQ_24: |
1508 | break;) | 1518 | numeric_ret = 7; |
1509 | REC_HAVE_24_(case REC_FREQ_24: | 1519 | break;) |
1510 | *intval = 7; | 1520 | REC_HAVE_22_(case REC_FREQ_22: |
1511 | break;) | 1521 | numeric_ret = 8; |
1512 | REC_HAVE_22_(case REC_FREQ_22: | 1522 | break;) |
1513 | *intval = 8; | 1523 | REC_HAVE_16_(case REC_FREQ_16: |
1514 | break;) | 1524 | numeric_ret = 9; |
1515 | REC_HAVE_16_(case REC_FREQ_16: | 1525 | break;) |
1516 | *intval = 9; | 1526 | REC_HAVE_12_(case REC_FREQ_12: |
1517 | break;) | 1527 | numeric_ret = 10; |
1518 | REC_HAVE_12_(case REC_FREQ_12: | 1528 | break;) |
1519 | *intval = 10; | 1529 | REC_HAVE_11_(case REC_FREQ_11: |
1520 | break;) | 1530 | numeric_ret = 11; |
1521 | REC_HAVE_11_(case REC_FREQ_11: | 1531 | break;) |
1522 | *intval = 11; | 1532 | REC_HAVE_8_(case REC_FREQ_8: |
1523 | break;) | 1533 | numeric_ret = 12; |
1524 | REC_HAVE_8_(case REC_FREQ_8: | 1534 | break;) |
1525 | *intval = 12; | ||
1526 | break;) | ||
1527 | } | ||
1528 | } | 1535 | } |
1529 | snprintf(buf, buf_size, "%lu.%1lu", samprk/1000,samprk%1000); | 1536 | snprintf(buf, buf_size, "%lu.%1lu", samprk/1000,samprk%1000); |
1530 | return buf; | 1537 | numeric_buf = buf; |
1538 | goto gtv_ret_numeric_tag_info; | ||
1531 | } | 1539 | } |
1532 | case SKIN_TOKEN_REC_ENCODER: | 1540 | case SKIN_TOKEN_REC_ENCODER: |
1533 | { | 1541 | { |
@@ -1552,62 +1560,60 @@ const char *get_token_value(struct gui_wps *gwps, | |||
1552 | case SKIN_TOKEN_REC_BITRATE: | 1560 | case SKIN_TOKEN_REC_BITRATE: |
1553 | if (global_settings.rec_format == REC_FORMAT_MPA_L3) | 1561 | if (global_settings.rec_format == REC_FORMAT_MPA_L3) |
1554 | { | 1562 | { |
1555 | if (intval) | 1563 | #if 0 /* FIXME: I dont know if this is needed? */ |
1564 | switch (1<<global_settings.mp3_enc_config.bitrate) | ||
1556 | { | 1565 | { |
1557 | #if 0 /* FIXME: I dont know if this is needed? */ | 1566 | case MP3_BITR_CAP_8: |
1558 | switch (1<<global_settings.mp3_enc_config.bitrate) | 1567 | numeric_ret = 1; |
1559 | { | 1568 | break; |
1560 | case MP3_BITR_CAP_8: | 1569 | case MP3_BITR_CAP_16: |
1561 | *intval = 1; | 1570 | numeric_ret = 2; |
1562 | break; | 1571 | break; |
1563 | case MP3_BITR_CAP_16: | 1572 | case MP3_BITR_CAP_24: |
1564 | *intval = 2; | 1573 | numeric_ret = 3; |
1565 | break; | 1574 | break; |
1566 | case MP3_BITR_CAP_24: | 1575 | case MP3_BITR_CAP_32: |
1567 | *intval = 3; | 1576 | numeric_ret = 4; |
1568 | break; | 1577 | break; |
1569 | case MP3_BITR_CAP_32: | 1578 | case MP3_BITR_CAP_40: |
1570 | *intval = 4; | 1579 | numeric_ret = 5; |
1571 | break; | 1580 | break; |
1572 | case MP3_BITR_CAP_40: | 1581 | case MP3_BITR_CAP_48: |
1573 | *intval = 5; | 1582 | numeric_ret = 6; |
1574 | break; | 1583 | break; |
1575 | case MP3_BITR_CAP_48: | 1584 | case MP3_BITR_CAP_56: |
1576 | *intval = 6; | 1585 | numeric_ret = 7; |
1577 | break; | 1586 | break; |
1578 | case MP3_BITR_CAP_56: | 1587 | case MP3_BITR_CAP_64: |
1579 | *intval = 7; | 1588 | numeric_ret = 8; |
1580 | break; | 1589 | break; |
1581 | case MP3_BITR_CAP_64: | 1590 | case MP3_BITR_CAP_80: |
1582 | *intval = 8; | 1591 | numeric_ret = 9; |
1583 | break; | 1592 | break; |
1584 | case MP3_BITR_CAP_80: | 1593 | case MP3_BITR_CAP_96: |
1585 | *intval = 9; | 1594 | numeric_ret = 10; |
1586 | break; | 1595 | break; |
1587 | case MP3_BITR_CAP_96: | 1596 | case MP3_BITR_CAP_112: |
1588 | *intval = 10; | 1597 | numeric_ret = 11; |
1589 | break; | 1598 | break; |
1590 | case MP3_BITR_CAP_112: | 1599 | case MP3_BITR_CAP_128: |
1591 | *intval = 11; | 1600 | numeric_ret = 12; |
1592 | break; | 1601 | break; |
1593 | case MP3_BITR_CAP_128: | 1602 | case MP3_BITR_CAP_144: |
1594 | *intval = 12; | 1603 | numeric_ret = 13; |
1595 | break; | 1604 | break; |
1596 | case MP3_BITR_CAP_144: | 1605 | case MP3_BITR_CAP_160: |
1597 | *intval = 13; | 1606 | numeric_ret = 14; |
1598 | break; | 1607 | break; |
1599 | case MP3_BITR_CAP_160: | 1608 | case MP3_BITR_CAP_192: |
1600 | *intval = 14; | 1609 | numeric_ret = 15; |
1601 | break; | 1610 | break; |
1602 | case MP3_BITR_CAP_192: | ||
1603 | *intval = 15; | ||
1604 | break; | ||
1605 | } | ||
1606 | #endif | ||
1607 | *intval = global_settings.mp3_enc_config.bitrate+1; | ||
1608 | } | 1611 | } |
1612 | #endif | ||
1613 | numeric_ret = global_settings.mp3_enc_config.bitrate+1; | ||
1609 | snprintf(buf, buf_size, "%lu", global_settings.mp3_enc_config.bitrate+1); | 1614 | snprintf(buf, buf_size, "%lu", global_settings.mp3_enc_config.bitrate+1); |
1610 | return buf; | 1615 | numeric_buf = buf; |
1616 | goto gtv_ret_numeric_tag_info; | ||
1611 | } | 1617 | } |
1612 | else | 1618 | else |
1613 | return NULL; /* Fixme later */ | 1619 | return NULL; /* Fixme later */ |
@@ -1619,26 +1625,26 @@ const char *get_token_value(struct gui_wps *gwps, | |||
1619 | case SKIN_TOKEN_REC_SECONDS: | 1625 | case SKIN_TOKEN_REC_SECONDS: |
1620 | { | 1626 | { |
1621 | int time = (audio_recorded_time() / HZ) % 60; | 1627 | int time = (audio_recorded_time() / HZ) % 60; |
1622 | if (intval) | 1628 | numeric_ret = time; |
1623 | *intval = time; | 1629 | snprintf(buf, buf_size, "%02d", numeric_ret); |
1624 | snprintf(buf, buf_size, "%02d", time); | 1630 | numeric_buf = buf; |
1625 | return buf; | 1631 | goto gtv_ret_numeric_tag_info; |
1626 | } | 1632 | } |
1627 | case SKIN_TOKEN_REC_MINUTES: | 1633 | case SKIN_TOKEN_REC_MINUTES: |
1628 | { | 1634 | { |
1629 | int time = (audio_recorded_time() / HZ) / 60; | 1635 | int time = (audio_recorded_time() / HZ) / 60; |
1630 | if (intval) | 1636 | numeric_ret = time; |
1631 | *intval = time; | 1637 | snprintf(buf, buf_size, "%02d", numeric_ret); |
1632 | snprintf(buf, buf_size, "%02d", time); | 1638 | numeric_buf = buf; |
1633 | return buf; | 1639 | goto gtv_ret_numeric_tag_info; |
1634 | } | 1640 | } |
1635 | case SKIN_TOKEN_REC_HOURS: | 1641 | case SKIN_TOKEN_REC_HOURS: |
1636 | { | 1642 | { |
1637 | int time = (audio_recorded_time() / HZ) / 3600; | 1643 | int time = (audio_recorded_time() / HZ) / 3600; |
1638 | if (intval) | 1644 | numeric_ret = time; |
1639 | *intval = time; | 1645 | snprintf(buf, buf_size, "%02d", numeric_ret); |
1640 | snprintf(buf, buf_size, "%02d", time); | 1646 | numeric_buf = buf; |
1641 | return buf; | 1647 | goto gtv_ret_numeric_tag_info; |
1642 | } | 1648 | } |
1643 | 1649 | ||
1644 | #endif /* HAVE_RECORDING */ | 1650 | #endif /* HAVE_RECORDING */ |
@@ -1646,12 +1652,10 @@ const char *get_token_value(struct gui_wps *gwps, | |||
1646 | case SKIN_TOKEN_CURRENT_SCREEN: | 1652 | case SKIN_TOKEN_CURRENT_SCREEN: |
1647 | { | 1653 | { |
1648 | int curr_screen = get_current_activity(); | 1654 | int curr_screen = get_current_activity(); |
1649 | if (intval) | 1655 | numeric_ret = curr_screen; |
1650 | { | 1656 | snprintf(buf, buf_size, "%d", numeric_ret); |
1651 | *intval = curr_screen; | 1657 | numeric_buf = buf; |
1652 | } | 1658 | goto gtv_ret_numeric_tag_info; |
1653 | snprintf(buf, buf_size, "%d", curr_screen); | ||
1654 | return buf; | ||
1655 | } | 1659 | } |
1656 | 1660 | ||
1657 | case SKIN_TOKEN_LANG_IS_RTL: | 1661 | case SKIN_TOKEN_LANG_IS_RTL: |
@@ -1662,10 +1666,10 @@ const char *get_token_value(struct gui_wps *gwps, | |||
1662 | { | 1666 | { |
1663 | char *skin_base = get_skin_buffer(data); | 1667 | char *skin_base = get_skin_buffer(data); |
1664 | struct skin_var* var = SKINOFFSETTOPTR(skin_base, token->value.data); | 1668 | struct skin_var* var = SKINOFFSETTOPTR(skin_base, token->value.data); |
1665 | if (intval) | 1669 | numeric_ret = var->value; |
1666 | *intval = var->value; | 1670 | snprintf(buf, buf_size, "%d", numeric_ret); |
1667 | snprintf(buf, buf_size, "%d", var->value); | 1671 | numeric_buf = buf; |
1668 | return buf; | 1672 | goto gtv_ret_numeric_tag_info; |
1669 | } | 1673 | } |
1670 | break; | 1674 | break; |
1671 | case SKIN_TOKEN_VAR_TIMEOUT: | 1675 | case SKIN_TOKEN_VAR_TIMEOUT: |
@@ -1685,4 +1689,10 @@ const char *get_token_value(struct gui_wps *gwps, | |||
1685 | return NULL; | 1689 | return NULL; |
1686 | } | 1690 | } |
1687 | 1691 | ||
1692 | gtv_ret_numeric_tag_info: | ||
1693 | if (intval) | ||
1694 | { | ||
1695 | *intval = numeric_ret; | ||
1696 | } | ||
1697 | return numeric_buf; | ||
1688 | } | 1698 | } |