summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorTeruaki Kawashima <teru@rockbox.org>2010-03-06 14:14:44 +0000
committerTeruaki Kawashima <teru@rockbox.org>2010-03-06 14:14:44 +0000
commit1fbdd913337cbf235ebe3a2cf52f73b661f3b1cf (patch)
treede142d611e1912ebb315025f506535008b71f51d /apps
parentf79b45d8bb30d80c453f4722b23de31db3b49bf0 (diff)
downloadrockbox-1fbdd913337cbf235ebe3a2cf52f73b661f3b1cf.tar.gz
rockbox-1fbdd913337cbf235ebe3a2cf52f73b661f3b1cf.zip
skin: don't calculate id3->elapsed+state->ff_rewind_count each time. remove trailing spaces.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25045 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/gui/skin_engine/skin_backdrops.c4
-rw-r--r--apps/gui/skin_engine/skin_display.c55
-rw-r--r--apps/gui/skin_engine/skin_fonts.c9
-rw-r--r--apps/gui/skin_engine/skin_fonts.h1
-rw-r--r--apps/gui/skin_engine/skin_parser.c32
-rw-r--r--apps/gui/skin_engine/skin_tokens.c52
-rw-r--r--apps/gui/skin_engine/skin_tokens.h7
-rw-r--r--apps/gui/skin_engine/wps_debug.c9
-rw-r--r--apps/gui/skin_engine/wps_internals.h3
9 files changed, 77 insertions, 95 deletions
diff --git a/apps/gui/skin_engine/skin_backdrops.c b/apps/gui/skin_engine/skin_backdrops.c
index 8f928ff758..fd786a7882 100644
--- a/apps/gui/skin_engine/skin_backdrops.c
+++ b/apps/gui/skin_engine/skin_backdrops.c
@@ -93,7 +93,7 @@ char* skin_backdrop_load(char* backdrop, char *bmpdir, enum screen_type screen)
93 { 93 {
94 return backdrops[i].buffer; 94 return backdrops[i].buffer;
95 } 95 }
96 else if (backdrops[i].buffer == NULL) 96 else if (!bdrop && backdrops[i].buffer == NULL)
97 { 97 {
98 bdrop = &backdrops[i]; 98 bdrop = &backdrops[i];
99 } 99 }
@@ -107,7 +107,6 @@ char* skin_backdrop_load(char* backdrop, char *bmpdir, enum screen_type screen)
107 loaded = screens[screen].backdrop_load(filename, bdrop->buffer); 107 loaded = screens[screen].backdrop_load(filename, bdrop->buffer);
108 bdrop->screen = screen; 108 bdrop->screen = screen;
109 strlcpy(bdrop->name, backdrop, MAX_FILENAME+1); 109 strlcpy(bdrop->name, backdrop, MAX_FILENAME+1);
110 bdrop->name[MAX_FILENAME] = '\0';
111 110
112 return loaded ? bdrop->buffer : NULL; 111 return loaded ? bdrop->buffer : NULL;
113} 112}
@@ -117,4 +116,3 @@ void skin_backdrop_init(void)
117{ 116{
118} 117}
119#endif 118#endif
120
diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c
index 316b97523c..97f9ee3748 100644
--- a/apps/gui/skin_engine/skin_display.c
+++ b/apps/gui/skin_engine/skin_display.c
@@ -116,13 +116,13 @@ void skin_statusbar_changed(struct gui_wps *skin)
116 116
117static void draw_progressbar(struct gui_wps *gwps, 117static void draw_progressbar(struct gui_wps *gwps,
118 struct skin_viewport *wps_vp) 118 struct skin_viewport *wps_vp)
119 { 119{
120 struct screen *display = gwps->display; 120 struct screen *display = gwps->display;
121 struct wps_state *state = gwps->state; 121 struct wps_state *state = gwps->state;
122 struct progressbar *pb = wps_vp->pb; 122 struct progressbar *pb = wps_vp->pb;
123 struct mp3entry *id3 = state->id3; 123 struct mp3entry *id3 = state->id3;
124 int y = pb->y; 124 int y = pb->y, height = pb->height;
125 int height = pb->height; 125 unsigned long length, elapsed;
126 126
127 if (pb->height < 0 && !pb->have_bitmap_pb) 127 if (pb->height < 0 && !pb->have_bitmap_pb)
128 height = font_get(wps_vp->vp.font)->height; 128 height = font_get(wps_vp->vp.font)->height;
@@ -136,39 +136,39 @@ static void draw_progressbar(struct gui_wps *gwps,
136 y = (-y -1)*line_height + (0 > center ? 0 : center); 136 y = (-y -1)*line_height + (0 > center ? 0 : center);
137 } 137 }
138 138
139 int elapsed, length; 139 if (id3 && id3->length)
140 if (id3)
141 { 140 {
142 elapsed = id3->elapsed;
143 length = id3->length; 141 length = id3->length;
142 elapsed = id3->elapsed + state->ff_rewind_count;
144 } 143 }
145 else 144 else
146 { 145 {
146 length = 1;
147 elapsed = 0; 147 elapsed = 0;
148 length = 0;
149 } 148 }
150 149
151 if (pb->have_bitmap_pb) 150 if (pb->have_bitmap_pb)
152 gui_bitmap_scrollbar_draw(display, pb->bm, 151 gui_bitmap_scrollbar_draw(display, pb->bm,
153 pb->x, y, pb->width, pb->bm.height, 152 pb->x, y, pb->width, pb->bm.height,
154 length ? length : 1, 0, 153 length, 0, elapsed, HORIZONTAL);
155 length ? elapsed + state->ff_rewind_count : 0,
156 HORIZONTAL);
157 else 154 else
158 gui_scrollbar_draw(display, pb->x, y, pb->width, height, 155 gui_scrollbar_draw(display, pb->x, y, pb->width, height,
159 length ? length : 1, 0, 156 length, 0, elapsed, HORIZONTAL);
160 length ? elapsed + state->ff_rewind_count : 0, 157
161 HORIZONTAL); 158 if (id3 && id3->length)
159 {
162#ifdef AB_REPEAT_ENABLE 160#ifdef AB_REPEAT_ENABLE
163 if ( ab_repeat_mode_enabled() && length != 0 ) 161 if (ab_repeat_mode_enabled())
164 ab_draw_markers(display, length, 162 ab_draw_markers(display, id3->length,
165 pb->x, pb->x + pb->width, y, height); 163 pb->x, pb->x + pb->width, y, height);
166#endif 164#endif
167 165
168 if (id3 && id3->cuesheet) 166 if (id3->cuesheet)
169 cue_draw_markers(display, state->id3->cuesheet, length, 167 cue_draw_markers(display, id3->cuesheet, id3->length,
170 pb->x, pb->x + pb->width, y+1, height-2); 168 pb->x, pb->x + pb->width, y+1, height-2);
169 }
171} 170}
171
172bool audio_peek_track(struct mp3entry* id3, int offset); 172bool audio_peek_track(struct mp3entry* id3, int offset);
173static void draw_playlist_viewer_list(struct gui_wps *gwps, 173static void draw_playlist_viewer_list(struct gui_wps *gwps,
174 struct playlistviewer *viewer) 174 struct playlistviewer *viewer)
@@ -185,11 +185,10 @@ static void draw_playlist_viewer_list(struct gui_wps *gwps,
185 struct mp3entry *pid3; 185 struct mp3entry *pid3;
186#if CONFIG_CODEC == SWCODEC 186#if CONFIG_CODEC == SWCODEC
187 struct mp3entry id3; 187 struct mp3entry id3;
188#endif 188#endif
189 char buf[MAX_PATH*2], tempbuf[MAX_PATH]; 189 char buf[MAX_PATH*2], tempbuf[MAX_PATH];
190 unsigned int buf_used = 0; 190 unsigned int buf_used = 0;
191 191
192
193 gwps->display->set_viewport(viewer->vp); 192 gwps->display->set_viewport(viewer->vp);
194 for(i=start_item; (i-start_item)<lines && i<playlist_amount(); i++) 193 for(i=start_item; (i-start_item)<lines && i<playlist_amount(); i++)
195 { 194 {
@@ -211,8 +210,8 @@ static void draw_playlist_viewer_list(struct gui_wps *gwps,
211 { 210 {
212 pid3 = NULL; 211 pid3 = NULL;
213 } 212 }
214 213
215 int line = pid3 ? TRACK_HAS_INFO : TRACK_HAS_NO_INFO; 214 int line = pid3 ? TRACK_HAS_INFO : TRACK_HAS_NO_INFO;
216 int j = 0, cur_string = 0; 215 int j = 0, cur_string = 0;
217 char *filename = playlist_peek(i-cur_playlist_pos); 216 char *filename = playlist_peek(i-cur_playlist_pos);
218 buf[0] = '\0'; 217 buf[0] = '\0';
@@ -267,7 +266,7 @@ static void draw_playlist_viewer_list(struct gui_wps *gwps,
267 } 266 }
268 j++; 267 j++;
269 } 268 }
270 269
271 int vpwidth = viewer->vp->width; 270 int vpwidth = viewer->vp->width;
272 length = gwps->display->getstringsize(buf, NULL, NULL); 271 length = gwps->display->getstringsize(buf, NULL, NULL);
273 if (viewer->lines[line].scroll && length >= vpwidth) 272 if (viewer->lines[line].scroll && length >= vpwidth)
@@ -275,7 +274,7 @@ static void draw_playlist_viewer_list(struct gui_wps *gwps,
275 gwps->display->puts_scroll(0, (i-start_item), buf ); 274 gwps->display->puts_scroll(0, (i-start_item), buf );
276 } 275 }
277 else 276 else
278 { 277 {
279 if (length >= vpwidth) 278 if (length >= vpwidth)
280 x = 0; 279 x = 0;
281 else 280 else
@@ -307,7 +306,7 @@ static void draw_playlist_viewer_list(struct gui_wps *gwps,
307 x = 0; 306 x = 0;
308 break; 307 break;
309 } 308 }
310 } 309 }
311 gwps->display->putsxy(x, (i-start_item)*line_height, buf ); 310 gwps->display->putsxy(x, (i-start_item)*line_height, buf );
312 } 311 }
313 } 312 }
@@ -1088,8 +1087,8 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode)
1088 int i; 1087 int i;
1089 for (i = 0; i < 8; i++) 1088 for (i = 0; i < 8; i++)
1090 { 1089 {
1091 if (data->wps_progress_pat[i] == 0) 1090 if (data->wps_progress_pat[i] == 0)
1092 data->wps_progress_pat[i] = display->get_locked_pattern(); 1091 data->wps_progress_pat[i] = display->get_locked_pattern();
1093 } 1092 }
1094#endif 1093#endif
1095 1094
diff --git a/apps/gui/skin_engine/skin_fonts.c b/apps/gui/skin_engine/skin_fonts.c
index 9764b32f67..2db5ef2ec2 100644
--- a/apps/gui/skin_engine/skin_fonts.c
+++ b/apps/gui/skin_engine/skin_fonts.c
@@ -109,7 +109,7 @@ int skin_font_load(char* font_name)
109 109
110 if (font->font_id < 0) 110 if (font->font_id < 0)
111 return -1; 111 return -1;
112 font->ref_count = 1; 112 font->ref_count = 1;
113 113
114 return font->font_id; 114 return font->font_id;
115} 115}
@@ -128,13 +128,8 @@ void skin_font_unload(int font_id)
128 font_unload(font_id); 128 font_unload(font_id);
129 font_table[i].font_id = -1; 129 font_table[i].font_id = -1;
130 font_table[i].name[0] = '\0'; 130 font_table[i].name[0] = '\0';
131 } 131 }
132 return; 132 return;
133 } 133 }
134 } 134 }
135} 135}
136
137
138
139
140
diff --git a/apps/gui/skin_engine/skin_fonts.h b/apps/gui/skin_engine/skin_fonts.h
index 095083818c..778be0a73a 100644
--- a/apps/gui/skin_engine/skin_fonts.h
+++ b/apps/gui/skin_engine/skin_fonts.h
@@ -41,5 +41,4 @@ int skin_font_load(char* font_name);
41/* unload a skin font. If a font has been loaded more than once it wont actually 41/* unload a skin font. If a font has been loaded more than once it wont actually
42 * be unloaded untill all references have been unloaded */ 42 * be unloaded untill all references have been unloaded */
43void skin_font_unload(int font_id); 43void skin_font_unload(int font_id);
44
45#endif 44#endif
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c
index b66af75cb5..059c3d779c 100644
--- a/apps/gui/skin_engine/skin_parser.c
+++ b/apps/gui/skin_engine/skin_parser.c
@@ -380,7 +380,7 @@ static const struct wps_tag all_tags[] = {
380#endif 380#endif
381 381
382 { WPS_TOKEN_SETTING, "St", WPS_REFRESH_DYNAMIC, 382 { WPS_TOKEN_SETTING, "St", WPS_REFRESH_DYNAMIC,
383 parse_setting_and_lang }, 383 parse_setting_and_lang },
384 { WPS_TOKEN_TRANSLATEDSTRING, "Sx", WPS_REFRESH_STATIC, 384 { WPS_TOKEN_TRANSLATEDSTRING, "Sx", WPS_REFRESH_STATIC,
385 parse_setting_and_lang }, 385 parse_setting_and_lang },
386 { WPS_TOKEN_LANG_IS_RTL , "Sr", WPS_REFRESH_STATIC, NULL }, 386 { WPS_TOKEN_LANG_IS_RTL , "Sr", WPS_REFRESH_STATIC, NULL },
@@ -388,8 +388,8 @@ static const struct wps_tag all_tags[] = {
388 { WPS_TOKEN_LASTTOUCH, "Tl", WPS_REFRESH_DYNAMIC, parse_timeout }, 388 { WPS_TOKEN_LASTTOUCH, "Tl", WPS_REFRESH_DYNAMIC, parse_timeout },
389 { WPS_TOKEN_CURRENT_SCREEN, "cs", WPS_REFRESH_DYNAMIC, NULL }, 389 { WPS_TOKEN_CURRENT_SCREEN, "cs", WPS_REFRESH_DYNAMIC, NULL },
390 { WPS_NO_TOKEN, "T", 0, parse_touchregion }, 390 { WPS_NO_TOKEN, "T", 0, parse_touchregion },
391 391
392 392
393 /* Recording Tokens */ 393 /* Recording Tokens */
394 { WPS_TOKEN_HAVE_RECORDING, "Rp", WPS_REFRESH_STATIC, NULL }, 394 { WPS_TOKEN_HAVE_RECORDING, "Rp", WPS_REFRESH_STATIC, NULL },
395#ifdef HAVE_RECORDING 395#ifdef HAVE_RECORDING
@@ -827,12 +827,12 @@ static int parse_playlistview_text(struct playlistviewer *viewer,
827 taglen = i; 827 taglen = i;
828 } 828 }
829 else 829 else
830 { 830 {
831 if (tag->parse_func) 831 if (tag->parse_func)
832 { 832 {
833 /* unsupported tag, reject */ 833 /* unsupported tag, reject */
834 return -1; 834 return -1;
835 } 835 }
836 taglen = strlen(tag->name); 836 taglen = strlen(tag->name);
837 viewer->lines[line].tokens[viewer->lines[line].count++] = tag->type; 837 viewer->lines[line].tokens[viewer->lines[line].count++] = tag->type;
838 } 838 }
@@ -857,7 +857,7 @@ static int parse_playlistview_text(struct playlistviewer *viewer,
857 } 857 }
858 return text - start; 858 return text - start;
859} 859}
860 860
861 861
862static int parse_playlistview(const char *wps_bufptr, 862static int parse_playlistview(const char *wps_bufptr,
863 struct wps_token *token, struct wps_data *wps_data) 863 struct wps_token *token, struct wps_data *wps_data)
@@ -874,10 +874,10 @@ static int parse_playlistview(const char *wps_bufptr,
874 viewer->start_offset = atoi(ptr+1); 874 viewer->start_offset = atoi(ptr+1);
875 token->value.data = (void*)viewer; 875 token->value.data = (void*)viewer;
876 ptr = strchr(ptr+1, '|'); 876 ptr = strchr(ptr+1, '|');
877 length = parse_playlistview_text(viewer, TRACK_HAS_INFO, ptr); 877 length = parse_playlistview_text(viewer, TRACK_HAS_INFO, ptr);
878 if (length < 0) 878 if (length < 0)
879 return WPS_ERROR_INVALID_PARAM; 879 return WPS_ERROR_INVALID_PARAM;
880 length = parse_playlistview_text(viewer, TRACK_HAS_NO_INFO, ptr+length); 880 length = parse_playlistview_text(viewer, TRACK_HAS_NO_INFO, ptr+length);
881 if (length < 0) 881 if (length < 0)
882 return WPS_ERROR_INVALID_PARAM; 882 return WPS_ERROR_INVALID_PARAM;
883 883
@@ -909,8 +909,7 @@ static int parse_viewport(const char *wps_bufptr,
909 curr_line = NULL; 909 curr_line = NULL;
910 if (!skin_start_new_line(skin_vp, wps_data->num_tokens)) 910 if (!skin_start_new_line(skin_vp, wps_data->num_tokens))
911 return WPS_ERROR_INVALID_PARAM; 911 return WPS_ERROR_INVALID_PARAM;
912 912
913
914 if (*ptr == 'i') 913 if (*ptr == 'i')
915 { 914 {
916 skin_vp->label = VP_INFO_LABEL; 915 skin_vp->label = VP_INFO_LABEL;
@@ -940,7 +939,7 @@ static int parse_viewport(const char *wps_bufptr,
940 /* format: %V|x|y|width|height|font|fg_pattern|bg_pattern| */ 939 /* format: %V|x|y|width|height|font|fg_pattern|bg_pattern| */
941 if (!(ptr = viewport_parse_viewport(vp, curr_screen, ptr, '|'))) 940 if (!(ptr = viewport_parse_viewport(vp, curr_screen, ptr, '|')))
942 return WPS_ERROR_INVALID_PARAM; 941 return WPS_ERROR_INVALID_PARAM;
943 942
944 /* Check for trailing | */ 943 /* Check for trailing | */
945 if (*ptr != '|') 944 if (*ptr != '|')
946 return WPS_ERROR_INVALID_PARAM; 945 return WPS_ERROR_INVALID_PARAM;
@@ -975,9 +974,8 @@ static int parse_image_special(const char *wps_bufptr,
975 974
976 pos = strchr(wps_bufptr + 1, '|'); 975 pos = strchr(wps_bufptr + 1, '|');
977 newline = strchr(wps_bufptr, '\n'); 976 newline = strchr(wps_bufptr, '\n');
978 977
979 error = (pos > newline); 978 error = (pos > newline);
980
981 979
982#if LCD_DEPTH > 1 980#if LCD_DEPTH > 1
983 if (token->type == WPS_TOKEN_IMAGE_BACKDROP) 981 if (token->type == WPS_TOKEN_IMAGE_BACKDROP)
@@ -1386,7 +1384,7 @@ static int parse_albumart_load(const char *wps_bufptr,
1386 aa->height = 0; 1384 aa->height = 0;
1387 else if (aa->height > LCD_HEIGHT) 1385 else if (aa->height > LCD_HEIGHT)
1388 aa->height = LCD_HEIGHT; 1386 aa->height = LCD_HEIGHT;
1389 1387
1390 if (swap_for_rtl) 1388 if (swap_for_rtl)
1391 aa->x = LCD_WIDTH - (aa->x + aa->width); 1389 aa->x = LCD_WIDTH - (aa->x + aa->width);
1392 1390
@@ -1689,7 +1687,7 @@ static int check_feature_tag(const char *wps_bufptr, const int type)
1689 return 0; 1687 return 0;
1690#else 1688#else
1691 return find_false_branch(wps_bufptr); 1689 return find_false_branch(wps_bufptr);
1692#endif 1690#endif
1693 default: /* not a tag we care about, just don't skip */ 1691 default: /* not a tag we care about, just don't skip */
1694 return 0; 1692 return 0;
1695 } 1693 }
@@ -2083,8 +2081,8 @@ static bool load_skin_bitmaps(struct wps_data *wps_data, char *bmpdir)
2083 if (wps_data->backdrop) 2081 if (wps_data->backdrop)
2084 { 2082 {
2085 bool needed = wps_data->backdrop[0] != '-'; 2083 bool needed = wps_data->backdrop[0] != '-';
2086 wps_data->backdrop = skin_backdrop_load(wps_data->backdrop, 2084 wps_data->backdrop = skin_backdrop_load(wps_data->backdrop,
2087 bmpdir, curr_screen); 2085 bmpdir, curr_screen);
2088 if (!wps_data->backdrop && needed) 2086 if (!wps_data->backdrop && needed)
2089 retval = false; 2087 retval = false;
2090 } 2088 }
diff --git a/apps/gui/skin_engine/skin_tokens.c b/apps/gui/skin_engine/skin_tokens.c
index 5228dd16bc..486a2efc76 100644
--- a/apps/gui/skin_engine/skin_tokens.c
+++ b/apps/gui/skin_engine/skin_tokens.c
@@ -158,6 +158,8 @@ const char *get_id3_token(struct wps_token *token, struct mp3entry *id3,
158 struct wps_state *state = &wps_state; 158 struct wps_state *state = &wps_state;
159 if (id3) 159 if (id3)
160 { 160 {
161 unsigned long length = id3->length;
162 unsigned long elapsed = id3->elapsed + state->ff_rewind_count;
161 switch (token->type) 163 switch (token->type)
162 { 164 {
163 case WPS_TOKEN_METADATA_ARTIST: 165 case WPS_TOKEN_METADATA_ARTIST:
@@ -216,9 +218,9 @@ const char *get_id3_token(struct wps_token *token, struct mp3entry *id3,
216 } 218 }
217 return NULL; 219 return NULL;
218 case WPS_TOKEN_METADATA_COMMENT: 220 case WPS_TOKEN_METADATA_COMMENT:
219 return id3->comment; 221 return id3->comment;
220 case WPS_TOKEN_FILE_PATH: 222 case WPS_TOKEN_FILE_PATH:
221 return id3->path; 223 return id3->path;
222 case WPS_TOKEN_FILE_BITRATE: 224 case WPS_TOKEN_FILE_BITRATE:
223 if(id3->bitrate) 225 if(id3->bitrate)
224 snprintf(buf, buf_size, "%d", id3->bitrate); 226 snprintf(buf, buf_size, "%d", id3->bitrate);
@@ -226,31 +228,26 @@ const char *get_id3_token(struct wps_token *token, struct mp3entry *id3,
226 return "?"; 228 return "?";
227 return buf; 229 return buf;
228 case WPS_TOKEN_TRACK_TIME_ELAPSED: 230 case WPS_TOKEN_TRACK_TIME_ELAPSED:
229 format_time(buf, buf_size, 231 format_time(buf, buf_size, elapsed);
230 id3->elapsed + state->ff_rewind_count);
231 return buf; 232 return buf;
232 233
233 case WPS_TOKEN_TRACK_TIME_REMAINING: 234 case WPS_TOKEN_TRACK_TIME_REMAINING:
234 format_time(buf, buf_size, 235 format_time(buf, buf_size, length - elapsed);
235 id3->length - id3->elapsed -
236 state->ff_rewind_count);
237 return buf; 236 return buf;
238 237
239 case WPS_TOKEN_TRACK_LENGTH: 238 case WPS_TOKEN_TRACK_LENGTH:
240 format_time(buf, buf_size, id3->length); 239 format_time(buf, buf_size, length);
241 return buf; 240 return buf;
242 241
243 case WPS_TOKEN_TRACK_ELAPSED_PERCENT: 242 case WPS_TOKEN_TRACK_ELAPSED_PERCENT:
244 if (id3->length <= 0) 243 if (length <= 0)
245 return NULL; 244 return NULL;
246 245
247 if (intval) 246 if (intval)
248 { 247 {
249 *intval = limit * (id3->elapsed + state->ff_rewind_count) 248 *intval = limit * elapsed / length + 1;
250 / id3->length + 1;
251 } 249 }
252 snprintf(buf, buf_size, "%d", 250 snprintf(buf, buf_size, "%d", 100 * elapsed / length);
253 100*(id3->elapsed + state->ff_rewind_count) / id3->length);
254 return buf; 251 return buf;
255 252
256 253
@@ -295,7 +292,7 @@ const char *get_id3_token(struct wps_token *token, struct mp3entry *id3,
295 return (id3->vbr) ? "(avg)" : NULL; 292 return (id3->vbr) ? "(avg)" : NULL;
296 case WPS_TOKEN_FILE_DIRECTORY: 293 case WPS_TOKEN_FILE_DIRECTORY:
297 return get_dir(buf, buf_size, id3->path, token->value.i); 294 return get_dir(buf, buf_size, id3->path, token->value.i);
298 295
299#ifdef HAVE_TAGCACHE 296#ifdef HAVE_TAGCACHE
300 case WPS_TOKEN_DATABASE_PLAYCOUNT: 297 case WPS_TOKEN_DATABASE_PLAYCOUNT:
301 if (intval) 298 if (intval)
@@ -313,7 +310,7 @@ const char *get_id3_token(struct wps_token *token, struct mp3entry *id3,
313 snprintf(buf, buf_size, "%ld", id3->score); 310 snprintf(buf, buf_size, "%ld", id3->score);
314 return buf; 311 return buf;
315#endif 312#endif
316 313
317 default: 314 default:
318 return NULL; 315 return NULL;
319 } 316 }
@@ -326,7 +323,7 @@ const char *get_id3_token(struct wps_token *token, struct mp3entry *id3,
326 * The ones that expect "0" need to be handled */ 323 * The ones that expect "0" need to be handled */
327 case WPS_TOKEN_FILE_FREQUENCY: 324 case WPS_TOKEN_FILE_FREQUENCY:
328 case WPS_TOKEN_FILE_FREQUENCY_KHZ: 325 case WPS_TOKEN_FILE_FREQUENCY_KHZ:
329 case WPS_TOKEN_FILE_SIZE: 326 case WPS_TOKEN_FILE_SIZE:
330#ifdef HAVE_TAGCACHE 327#ifdef HAVE_TAGCACHE
331 case WPS_TOKEN_DATABASE_PLAYCOUNT: 328 case WPS_TOKEN_DATABASE_PLAYCOUNT:
332 case WPS_TOKEN_DATABASE_RATING: 329 case WPS_TOKEN_DATABASE_RATING:
@@ -443,7 +440,8 @@ const char *get_token_value(struct gui_wps *gwps,
443 snprintf(buf, buf_size, "%d", global_settings.volume); 440 snprintf(buf, buf_size, "%d", global_settings.volume);
444 if (intval) 441 if (intval)
445 { 442 {
446 if (global_settings.volume == sound_min(SOUND_VOLUME)) 443 int minvol = sound_min(SOUND_VOLUME);
444 if (global_settings.volume == minvol)
447 { 445 {
448 *intval = 1; 446 *intval = 1;
449 } 447 }
@@ -457,9 +455,8 @@ const char *get_token_value(struct gui_wps *gwps,
457 } 455 }
458 else 456 else
459 { 457 {
460 *intval = (limit - 3) * (global_settings.volume 458 *intval = (limit-3) * (global_settings.volume - minvol - 1)
461 - sound_min(SOUND_VOLUME) - 1) 459 / (-1 - minvol) + 2;
462 / (-1 - sound_min(SOUND_VOLUME)) + 2;
463 } 460 }
464 } 461 }
465 return buf; 462 return buf;
@@ -473,7 +470,7 @@ const char *get_token_value(struct gui_wps *gwps,
473 470
474 case WPS_TOKEN_ALBUMART_DISPLAY: 471 case WPS_TOKEN_ALBUMART_DISPLAY:
475 if (!data->albumart) 472 if (!data->albumart)
476 return NULL; 473 return NULL;
477 if (!data->albumart->draw) 474 if (!data->albumart->draw)
478 data->albumart->draw = true; 475 data->albumart->draw = true;
479 return NULL; 476 return NULL;
@@ -801,7 +798,7 @@ const char *get_token_value(struct gui_wps *gwps,
801 id3->album_gain_string != NULL); 798 id3->album_gain_string != NULL);
802 else 799 else
803 type = -1; 800 type = -1;
804 801
805 if (type < 0) 802 if (type < 0)
806 val = 6; /* no tag */ 803 val = 6; /* no tag */
807 else 804 else
@@ -923,7 +920,7 @@ const char *get_token_value(struct gui_wps *gwps,
923 int sound_setting = s->sound_setting->setting; 920 int sound_setting = s->sound_setting->setting;
924 /* settings with decimals can't be used in conditionals */ 921 /* settings with decimals can't be used in conditionals */
925 if (sound_numdecimals(sound_setting) == 0) 922 if (sound_numdecimals(sound_setting) == 0)
926 { 923 {
927 *intval = (*(int*)s->setting-sound_min(sound_setting)) 924 *intval = (*(int*)s->setting-sound_min(sound_setting))
928 /sound_steps(sound_setting) + 1; 925 /sound_steps(sound_setting) + 1;
929 } 926 }
@@ -999,7 +996,7 @@ const char *get_token_value(struct gui_wps *gwps,
999 rec_freq = 0; 996 rec_freq = 0;
1000 while (rec_freq < SAMPR_NUM_FREQ && 997 while (rec_freq < SAMPR_NUM_FREQ &&
1001 audio_master_sampr_list[rec_freq] != samprk) 998 audio_master_sampr_list[rec_freq] != samprk)
1002 { 999 {
1003 rec_freq++; 1000 rec_freq++;
1004 } 1001 }
1005 } 1002 }
@@ -1053,7 +1050,7 @@ const char *get_token_value(struct gui_wps *gwps,
1053#else /* HWCODEC */ 1050#else /* HWCODEC */
1054 1051
1055 static const char * const freq_strings[] = 1052 static const char * const freq_strings[] =
1056 {"--", "44", "48", "32", "22", "24", "16"}; 1053 {"--", "44", "48", "32", "22", "24", "16"};
1057 int freq = 1 + global_settings.rec_frequency; 1054 int freq = 1 + global_settings.rec_frequency;
1058#ifdef HAVE_SPDIF_REC 1055#ifdef HAVE_SPDIF_REC
1059 if (global_settings.rec_source == AUDIO_SRC_SPDIF) 1056 if (global_settings.rec_source == AUDIO_SRC_SPDIF)
@@ -1069,7 +1066,7 @@ const char *get_token_value(struct gui_wps *gwps,
1069#endif 1066#endif
1070 return buf; 1067 return buf;
1071 } 1068 }
1072#if CONFIG_CODEC == SWCODEC 1069#if CONFIG_CODEC == SWCODEC
1073 case WPS_TOKEN_REC_ENCODER: 1070 case WPS_TOKEN_REC_ENCODER:
1074 { 1071 {
1075 int rec_format = global_settings.rec_format+1; /* WAV, AIFF, WV, MPEG */ 1072 int rec_format = global_settings.rec_format+1; /* WAV, AIFF, WV, MPEG */
@@ -1092,7 +1089,7 @@ const char *get_token_value(struct gui_wps *gwps,
1092 } 1089 }
1093#endif 1090#endif
1094 case WPS_TOKEN_REC_BITRATE: 1091 case WPS_TOKEN_REC_BITRATE:
1095#if CONFIG_CODEC == SWCODEC 1092#if CONFIG_CODEC == SWCODEC
1096 if (global_settings.rec_format == REC_FORMAT_MPA_L3) 1093 if (global_settings.rec_format == REC_FORMAT_MPA_L3)
1097 { 1094 {
1098 if (intval) 1095 if (intval)
@@ -1201,7 +1198,6 @@ const char *get_token_value(struct gui_wps *gwps,
1201 } 1198 }
1202 if (intval) 1199 if (intval)
1203 { 1200 {
1204
1205 *intval = curr_screen; 1201 *intval = curr_screen;
1206 } 1202 }
1207 snprintf(buf, buf_size, "%d", curr_screen); 1203 snprintf(buf, buf_size, "%d", curr_screen);
diff --git a/apps/gui/skin_engine/skin_tokens.h b/apps/gui/skin_engine/skin_tokens.h
index 2c6dd6b72a..d20a6ee2e6 100644
--- a/apps/gui/skin_engine/skin_tokens.h
+++ b/apps/gui/skin_engine/skin_tokens.h
@@ -23,7 +23,7 @@
23#define _SKIN_TOKENS_H_ 23#define _SKIN_TOKENS_H_
24 24
25#include <stdbool.h> 25#include <stdbool.h>
26 26
27 27
28enum wps_token_type { 28enum wps_token_type {
29 29
@@ -235,13 +235,12 @@ struct wps_token {
235 void* data; 235 void* data;
236 } value; 236 } value;
237}; 237};
238 238
239struct skin_token_list { 239struct skin_token_list {
240 struct wps_token *token; 240 struct wps_token *token;
241 struct skin_token_list *next; 241 struct skin_token_list *next;
242}; 242};
243 243
244char* get_dir(char* buf, int buf_size, const char* path, int level); 244char* get_dir(char* buf, int buf_size, const char* path, int level);
245 245
246#endif 246#endif
247
diff --git a/apps/gui/skin_engine/wps_debug.c b/apps/gui/skin_engine/wps_debug.c
index 59bc5edc43..2e4f428af4 100644
--- a/apps/gui/skin_engine/wps_debug.c
+++ b/apps/gui/skin_engine/wps_debug.c
@@ -56,7 +56,7 @@ struct debug_token_table tokens[] = {
56 { X(TOKEN_MARKER_DATABASE) }, 56 { X(TOKEN_MARKER_DATABASE) },
57 { X(TOKEN_MARKER_FILE) }, 57 { X(TOKEN_MARKER_FILE) },
58 { X(TOKEN_MARKER_IMAGES) }, 58 { X(TOKEN_MARKER_IMAGES) },
59 { X(TOKEN_MARKER_METADATA) }, 59 { X(TOKEN_MARKER_METADATA) },
60 { X(TOKEN_MARKER_PLAYBACK_INFO) }, 60 { X(TOKEN_MARKER_PLAYBACK_INFO) },
61 { X(TOKEN_MARKER_PLAYLIST) }, 61 { X(TOKEN_MARKER_PLAYLIST) },
62 { X(TOKEN_MARKER_MISC) }, 62 { X(TOKEN_MARKER_MISC) },
@@ -194,7 +194,7 @@ static char *get_token_desc(struct wps_token *token, char *buf,
194 case WPS_TOKEN_PLAYBACK_STATUS: 194 case WPS_TOKEN_PLAYBACK_STATUS:
195 snprintf(buf, bufsize, "mode playback"); 195 snprintf(buf, bufsize, "mode playback");
196 break; 196 break;
197 197
198 case WPS_TOKEN_RTC_PRESENT: 198 case WPS_TOKEN_RTC_PRESENT:
199 snprintf(buf, bufsize, "rtc: present?"); 199 snprintf(buf, bufsize, "rtc: present?");
200 break; 200 break;
@@ -500,7 +500,7 @@ static char *get_token_desc(struct wps_token *token, char *buf,
500 break; 500 break;
501 case WPS_TOKEN_SETTING: 501 case WPS_TOKEN_SETTING:
502 snprintf(buf, bufsize, "Setting value: '%s'", 502 snprintf(buf, bufsize, "Setting value: '%s'",
503 settings[token->value.i].cfg_name); 503 settings[token->value.i].cfg_name);
504 break; 504 break;
505 case WPS_TOKEN_LANG_IS_RTL: 505 case WPS_TOKEN_LANG_IS_RTL:
506 snprintf(buf, bufsize, "lang: is_rtl?"); 506 snprintf(buf, bufsize, "lang: is_rtl?");
@@ -514,7 +514,7 @@ static char *get_token_desc(struct wps_token *token, char *buf,
514 token->type - tokens[i-1].start_marker); 514 token->type - tokens[i-1].start_marker);
515 break; 515 break;
516 } 516 }
517 } 517 }
518 break; 518 break;
519 } 519 }
520 520
@@ -649,5 +649,4 @@ void debug_skin_usage(void)
649 (unsigned long)(skin_buffer_usage() + skin_buffer_freespace())); 649 (unsigned long)(skin_buffer_usage() + skin_buffer_freespace()));
650} 650}
651 651
652
653#endif /* DEBUG || SIMULATOR */ 652#endif /* DEBUG || SIMULATOR */
diff --git a/apps/gui/skin_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h
index f6c7463804..0a8857a0b7 100644
--- a/apps/gui/skin_engine/wps_internals.h
+++ b/apps/gui/skin_engine/wps_internals.h
@@ -33,7 +33,7 @@
33 33
34#include "skin_tokens.h" 34#include "skin_tokens.h"
35 35
36 36
37/* TODO: sort this mess out */ 37/* TODO: sort this mess out */
38 38
39#include "screen_access.h" 39#include "screen_access.h"
@@ -245,7 +245,6 @@ struct playlistviewer {
245 bool scroll; 245 bool scroll;
246 } lines[2]; 246 } lines[2];
247}; 247};
248
249 248
250 249
251#ifdef HAVE_ALBUMART 250#ifdef HAVE_ALBUMART