summaryrefslogtreecommitdiff
path: root/apps/gui
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2009-09-07 02:36:56 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2009-09-07 02:36:56 +0000
commitfe2f042670a59cf73c3775945df9185d933ca9b4 (patch)
treecbb5efd5f4cad7fd524a43d304e1dbeeddc2cdb1 /apps/gui
parent8898339fcf07aee644ebcabe77d5a2dd323642ed (diff)
downloadrockbox-fe2f042670a59cf73c3775945df9185d933ca9b4.tar.gz
rockbox-fe2f042670a59cf73c3775945df9185d933ca9b4.zip
rework AA load/display handling in the skins to get them working in viewports again
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22646 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui')
-rw-r--r--apps/gui/skin_engine/skin_display.c20
-rw-r--r--apps/gui/skin_engine/skin_parser.c136
-rw-r--r--apps/gui/skin_engine/skin_tokens.c8
-rw-r--r--apps/gui/skin_engine/skin_tokens.h1
-rw-r--r--apps/gui/skin_engine/wps_debug.c6
-rw-r--r--apps/gui/skin_engine/wps_internals.h30
-rw-r--r--apps/gui/wps.c9
7 files changed, 118 insertions, 92 deletions
diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c
index 01f8b13acb..4a87b69ce4 100644
--- a/apps/gui/skin_engine/skin_display.c
+++ b/apps/gui/skin_engine/skin_display.c
@@ -77,6 +77,9 @@ void skin_data_init(struct wps_data *wps_data)
77 wps_data->peak_meter_enabled = false; 77 wps_data->peak_meter_enabled = false;
78 wps_data->images = NULL; 78 wps_data->images = NULL;
79 wps_data->progressbars = NULL; 79 wps_data->progressbars = NULL;
80#ifdef HAVE_ALBUMART
81 wps_data->albumart = NULL;
82#endif
80 /* progress bars */ 83 /* progress bars */
81#else /* HAVE_LCD_CHARCELLS */ 84#else /* HAVE_LCD_CHARCELLS */
82 int i; 85 int i;
@@ -265,6 +268,14 @@ static void wps_display_images(struct gui_wps *gwps, struct viewport* vp)
265 } 268 }
266 list = list->next; 269 list = list->next;
267 } 270 }
271#ifdef HAVE_ALBUMART
272 /* now draw the AA */
273 if (data->albumart && data->albumart->vp == vp && data->albumart->draw)
274 {
275 draw_album_art(gwps, audio_current_aa_hid(), false);
276 }
277#endif
278
268 display->set_drawmode(DRMODE_SOLID); 279 display->set_drawmode(DRMODE_SOLID);
269} 280}
270 281
@@ -465,8 +476,11 @@ static bool evaluate_conditional(struct gui_wps *gwps, int *token_index)
465 clear_image_pos(gwps, find_image(data->tokens[i].value.i&0xFF, gwps->data)); 476 clear_image_pos(gwps, find_image(data->tokens[i].value.i&0xFF, gwps->data));
466#endif 477#endif
467#ifdef HAVE_ALBUMART 478#ifdef HAVE_ALBUMART
468 if (data->tokens[i].type == WPS_TOKEN_ALBUMART_DISPLAY) 479 if (data->albumart && data->tokens[i].type == WPS_TOKEN_ALBUMART_DISPLAY)
480 {
469 draw_album_art(gwps, audio_current_aa_hid(), true); 481 draw_album_art(gwps, audio_current_aa_hid(), true);
482 data->albumart->draw = false;
483 }
470#endif 484#endif
471 } 485 }
472 486
@@ -961,9 +975,9 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode)
961 skin_viewport->hidden_flags |= VP_DRAW_HIDDEN; 975 skin_viewport->hidden_flags |= VP_DRAW_HIDDEN;
962 } 976 }
963 } 977 }
964 978 int viewport_count = 0;
965 for (viewport_list = data->viewports; 979 for (viewport_list = data->viewports;
966 viewport_list; viewport_list = viewport_list->next) 980 viewport_list; viewport_list = viewport_list->next, viewport_count++)
967 { 981 {
968 struct skin_viewport *skin_viewport = 982 struct skin_viewport *skin_viewport =
969 (struct skin_viewport *)viewport_list->token->value.data; 983 (struct skin_viewport *)viewport_list->token->value.data;
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c
index 59499d7c98..e2f7f5363c 100644
--- a/apps/gui/skin_engine/skin_parser.c
+++ b/apps/gui/skin_engine/skin_parser.c
@@ -156,7 +156,7 @@ static int parse_image_special(const char *wps_bufptr,
156#ifdef HAVE_ALBUMART 156#ifdef HAVE_ALBUMART
157static int parse_albumart_load(const char *wps_bufptr, 157static int parse_albumart_load(const char *wps_bufptr,
158 struct wps_token *token, struct wps_data *wps_data); 158 struct wps_token *token, struct wps_data *wps_data);
159static int parse_albumart_conditional(const char *wps_bufptr, 159static int parse_albumart_display(const char *wps_bufptr,
160 struct wps_token *token, struct wps_data *wps_data); 160 struct wps_token *token, struct wps_data *wps_data);
161#endif /* HAVE_ALBUMART */ 161#endif /* HAVE_ALBUMART */
162#ifdef HAVE_TOUCHSCREEN 162#ifdef HAVE_TOUCHSCREEN
@@ -337,8 +337,7 @@ static const struct wps_tag all_tags[] = {
337 { WPS_TOKEN_IMAGE_DISPLAY, "x", 0, parse_image_load }, 337 { WPS_TOKEN_IMAGE_DISPLAY, "x", 0, parse_image_load },
338#ifdef HAVE_ALBUMART 338#ifdef HAVE_ALBUMART
339 { WPS_NO_TOKEN, "Cl", 0, parse_albumart_load }, 339 { WPS_NO_TOKEN, "Cl", 0, parse_albumart_load },
340 { WPS_TOKEN_ALBUMART_DISPLAY, "C", WPS_REFRESH_STATIC, 340 { WPS_TOKEN_ALBUMART_DISPLAY, "C", WPS_REFRESH_STATIC, parse_albumart_display },
341 parse_albumart_conditional },
342#endif 341#endif
343 342
344 { WPS_VIEWPORT_ENABLE, "Vd", WPS_REFRESH_DYNAMIC, 343 { WPS_VIEWPORT_ENABLE, "Vd", WPS_REFRESH_DYNAMIC,
@@ -960,13 +959,17 @@ static int parse_albumart_load(const char *wps_bufptr,
960{ 959{
961 const char *_pos, *newline; 960 const char *_pos, *newline;
962 bool parsing; 961 bool parsing;
962 struct skin_albumart *aa = skin_buffer_alloc(sizeof(struct skin_albumart));
963 (void)token; /* silence warning */ 963 (void)token; /* silence warning */
964 if (!aa)
965 return skip_end_of_line(wps_bufptr);
964 966
965 /* reset albumart info in wps */ 967 /* reset albumart info in wps */
966 wps_data->albumart_max_width = -1; 968 aa->albumart_max_width = -1;
967 wps_data->albumart_max_height = -1; 969 aa->albumart_max_height = -1;
968 wps_data->albumart_xalign = WPS_ALBUMART_ALIGN_CENTER; /* default */ 970 aa->albumart_xalign = WPS_ALBUMART_ALIGN_CENTER; /* default */
969 wps_data->albumart_yalign = WPS_ALBUMART_ALIGN_CENTER; /* default */ 971 aa->albumart_yalign = WPS_ALBUMART_ALIGN_CENTER; /* default */
972 aa->vp = &curr_vp->vp;
970 973
971 /* format: %Cl|x|y|[[l|c|r]mwidth]|[[t|c|b]mheight]| */ 974 /* format: %Cl|x|y|[[l|c|r]mwidth]|[[t|c|b]mheight]| */
972 975
@@ -979,13 +982,13 @@ static int parse_albumart_load(const char *wps_bufptr,
979 _pos = wps_bufptr + 1; 982 _pos = wps_bufptr + 1;
980 if (!isdigit(*_pos)) 983 if (!isdigit(*_pos))
981 return WPS_ERROR_INVALID_PARAM; /* malformed token: e.g. %Cl|@ */ 984 return WPS_ERROR_INVALID_PARAM; /* malformed token: e.g. %Cl|@ */
982 wps_data->albumart_x = atoi(_pos); 985 aa->albumart_x = atoi(_pos);
983 986
984 _pos = strchr(_pos, '|'); 987 _pos = strchr(_pos, '|');
985 if (!_pos || _pos > newline || !isdigit(*(++_pos))) 988 if (!_pos || _pos > newline || !isdigit(*(++_pos)))
986 return WPS_ERROR_INVALID_PARAM; /* malformed token: e.g. %Cl|7\n or %Cl|7|@ */ 989 return WPS_ERROR_INVALID_PARAM; /* malformed token: e.g. %Cl|7\n or %Cl|7|@ */
987 990
988 wps_data->albumart_y = atoi(_pos); 991 aa->albumart_y = atoi(_pos);
989 992
990 _pos = strchr(_pos, '|'); 993 _pos = strchr(_pos, '|');
991 if (!_pos || _pos > newline) 994 if (!_pos || _pos > newline)
@@ -1003,16 +1006,16 @@ static int parse_albumart_load(const char *wps_bufptr,
1003 case 'l': 1006 case 'l':
1004 case 'L': 1007 case 'L':
1005 case '+': 1008 case '+':
1006 wps_data->albumart_xalign = WPS_ALBUMART_ALIGN_LEFT; 1009 aa->albumart_xalign = WPS_ALBUMART_ALIGN_LEFT;
1007 break; 1010 break;
1008 case 'c': 1011 case 'c':
1009 case 'C': 1012 case 'C':
1010 wps_data->albumart_xalign = WPS_ALBUMART_ALIGN_CENTER; 1013 aa->albumart_xalign = WPS_ALBUMART_ALIGN_CENTER;
1011 break; 1014 break;
1012 case 'r': 1015 case 'r':
1013 case 'R': 1016 case 'R':
1014 case '-': 1017 case '-':
1015 wps_data->albumart_xalign = WPS_ALBUMART_ALIGN_RIGHT; 1018 aa->albumart_xalign = WPS_ALBUMART_ALIGN_RIGHT;
1016 break; 1019 break;
1017 case 'd': 1020 case 'd':
1018 case 'D': 1021 case 'D':
@@ -1033,7 +1036,7 @@ static int parse_albumart_load(const char *wps_bufptr,
1033 if (!isdigit(*_pos)) /* malformed token: e.g. %Cl|7|59|# */ 1036 if (!isdigit(*_pos)) /* malformed token: e.g. %Cl|7|59|# */
1034 return WPS_ERROR_INVALID_PARAM; 1037 return WPS_ERROR_INVALID_PARAM;
1035 1038
1036 wps_data->albumart_max_width = atoi(_pos); 1039 aa->albumart_max_width = atoi(_pos);
1037 1040
1038 _pos = strchr(_pos, '|'); 1041 _pos = strchr(_pos, '|');
1039 if (!_pos || _pos > newline) 1042 if (!_pos || _pos > newline)
@@ -1052,16 +1055,16 @@ static int parse_albumart_load(const char *wps_bufptr,
1052 case 't': 1055 case 't':
1053 case 'T': 1056 case 'T':
1054 case '-': 1057 case '-':
1055 wps_data->albumart_yalign = WPS_ALBUMART_ALIGN_TOP; 1058 aa->albumart_yalign = WPS_ALBUMART_ALIGN_TOP;
1056 break; 1059 break;
1057 case 'c': 1060 case 'c':
1058 case 'C': 1061 case 'C':
1059 wps_data->albumart_yalign = WPS_ALBUMART_ALIGN_CENTER; 1062 aa->albumart_yalign = WPS_ALBUMART_ALIGN_CENTER;
1060 break; 1063 break;
1061 case 'b': 1064 case 'b':
1062 case 'B': 1065 case 'B':
1063 case '+': 1066 case '+':
1064 wps_data->albumart_yalign = WPS_ALBUMART_ALIGN_BOTTOM; 1067 aa->albumart_yalign = WPS_ALBUMART_ALIGN_BOTTOM;
1065 break; 1068 break;
1066 case 'd': 1069 case 'd':
1067 case 'D': 1070 case 'D':
@@ -1082,7 +1085,7 @@ static int parse_albumart_load(const char *wps_bufptr,
1082 if (!isdigit(*_pos)) 1085 if (!isdigit(*_pos))
1083 return WPS_ERROR_INVALID_PARAM; /* malformed token e.g. %Cl|7|59|200|@ */ 1086 return WPS_ERROR_INVALID_PARAM; /* malformed token e.g. %Cl|7|59|200|@ */
1084 1087
1085 wps_data->albumart_max_height = atoi(_pos); 1088 aa->albumart_max_height = atoi(_pos);
1086 1089
1087 _pos = strchr(_pos, '|'); 1090 _pos = strchr(_pos, '|');
1088 if (!_pos || _pos > newline) 1091 if (!_pos || _pos > newline)
@@ -1091,54 +1094,41 @@ static int parse_albumart_load(const char *wps_bufptr,
1091 } 1094 }
1092 1095
1093 /* if we got here, we parsed everything ok .. ! */ 1096 /* if we got here, we parsed everything ok .. ! */
1094 if (wps_data->albumart_max_width < 0) 1097 if (aa->albumart_max_width < 0)
1095 wps_data->albumart_max_width = 0; 1098 aa->albumart_max_width = 0;
1096 else if (wps_data->albumart_max_width > LCD_WIDTH) 1099 else if (aa->albumart_max_width > LCD_WIDTH)
1097 wps_data->albumart_max_width = LCD_WIDTH; 1100 aa->albumart_max_width = LCD_WIDTH;
1098 1101
1099 if (wps_data->albumart_max_height < 0) 1102 if (aa->albumart_max_height < 0)
1100 wps_data->albumart_max_height = 0; 1103 aa->albumart_max_height = 0;
1101 else if (wps_data->albumart_max_height > LCD_HEIGHT) 1104 else if (aa->albumart_max_height > LCD_HEIGHT)
1102 wps_data->albumart_max_height = LCD_HEIGHT; 1105 aa->albumart_max_height = LCD_HEIGHT;
1103 1106
1104 wps_data->wps_uses_albumart = WPS_ALBUMART_LOAD; 1107 aa->wps_uses_albumart = WPS_ALBUMART_LOAD;
1108 aa->draw = false;
1109 wps_data->albumart = aa;
1105 1110
1106 /* Skip the rest of the line */ 1111 /* Skip the rest of the line */
1107 return skip_end_of_line(wps_bufptr); 1112 return skip_end_of_line(wps_bufptr);
1108} 1113}
1109 1114
1110static int parse_albumart_conditional(const char *wps_bufptr, 1115static int parse_albumart_display(const char *wps_bufptr,
1111 struct wps_token *token, 1116 struct wps_token *token,
1112 struct wps_data *wps_data) 1117 struct wps_data *wps_data)
1113{ 1118{
1114 struct wps_token *prevtoken = token; 1119 (void)wps_bufptr;
1115 --prevtoken; 1120 (void)token;
1116 if (wps_data->num_tokens >= 1 && prevtoken->type == WPS_TOKEN_CONDITIONAL) 1121 if (wps_data->albumart)
1117 {
1118 /* This %C is part of a %?C construct.
1119 It's either %?C<blah> or %?Cn<blah> */
1120 token->type = WPS_TOKEN_ALBUMART_FOUND;
1121 if (*wps_bufptr == 'n' && *(wps_bufptr + 1) == '<')
1122 {
1123 token->next = true;
1124 return 1;
1125 }
1126 else if (*wps_bufptr == '<')
1127 {
1128 return 0;
1129 }
1130 else
1131 {
1132 token->type = WPS_NO_TOKEN;
1133 return 0;
1134 }
1135 }
1136 else
1137 { 1122 {
1138 /* This %C tag is in a conditional construct. */ 1123 wps_data->albumart->vp = &curr_vp->vp;
1139 wps_data->albumart_cond_index = condindex[level];
1140 return 0;
1141 } 1124 }
1125#if 0
1126 /* the old code did this so keep it here for now...
1127 * this is to allow the posibility to showing the next tracks AA! */
1128 if (wps_bufptr+1 == 'n')
1129 return 1;
1130#endif
1131 return 0;
1142}; 1132};
1143#endif /* HAVE_ALBUMART */ 1133#endif /* HAVE_ALBUMART */
1144 1134
@@ -1675,16 +1665,21 @@ bool skin_data_load(struct wps_data *wps_data,
1675 const char *buf, 1665 const char *buf,
1676 bool isfile) 1666 bool isfile)
1677{ 1667{
1668
1669 if (!wps_data || !buf)
1670 return false;
1678#ifdef HAVE_ALBUMART 1671#ifdef HAVE_ALBUMART
1672 int status;
1679 struct mp3entry *curtrack; 1673 struct mp3entry *curtrack;
1680 long offset; 1674 long offset;
1681 int status; 1675 struct skin_albumart old_aa = {.wps_uses_albumart = WPS_ALBUMART_NONE};
1682 int wps_uses_albumart = wps_data->wps_uses_albumart; 1676 if (wps_data->albumart)
1683 int albumart_max_height = wps_data->albumart_max_height; 1677 {
1684 int albumart_max_width = wps_data->albumart_max_width; 1678 old_aa.wps_uses_albumart = wps_data->albumart->wps_uses_albumart;
1679 old_aa.albumart_max_height = wps_data->albumart->albumart_max_height;
1680 old_aa.albumart_max_width = wps_data->albumart->albumart_max_width;
1681 }
1685#endif 1682#endif
1686 if (!wps_data || !buf)
1687 return false;
1688 1683
1689 wps_reset(wps_data); 1684 wps_reset(wps_data);
1690 1685
@@ -1799,17 +1794,20 @@ bool skin_data_load(struct wps_data *wps_data,
1799#endif 1794#endif
1800#ifdef HAVE_ALBUMART 1795#ifdef HAVE_ALBUMART
1801 status = audio_status(); 1796 status = audio_status();
1802 if (((!wps_uses_albumart && wps_data->wps_uses_albumart) || 1797 if (status & AUDIO_STATUS_PLAY)
1803 (wps_data->wps_uses_albumart &&
1804 (albumart_max_height != wps_data->albumart_max_height ||
1805 albumart_max_width != wps_data->albumart_max_width))) &&
1806 status & AUDIO_STATUS_PLAY)
1807 { 1798 {
1808 curtrack = audio_current_track(); 1799 struct skin_albumart *aa = wps_data->albumart;
1809 offset = curtrack->offset; 1800 if (aa && ((aa->wps_uses_albumart && !old_aa.wps_uses_albumart) ||
1810 audio_stop(); 1801 (aa->wps_uses_albumart &&
1811 if (!(status & AUDIO_STATUS_PAUSE)) 1802 (((old_aa.albumart_max_height != aa->albumart_max_height) ||
1812 audio_play(offset); 1803 (old_aa.albumart_max_width != aa->albumart_max_width))))))
1804 {
1805 curtrack = audio_current_track();
1806 offset = curtrack->offset;
1807 audio_stop();
1808 if (!(status & AUDIO_STATUS_PAUSE))
1809 audio_play(offset);
1810 }
1813 } 1811 }
1814#endif 1812#endif
1815#if defined(DEBUG) || defined(SIMULATOR) 1813#if defined(DEBUG) || defined(SIMULATOR)
diff --git a/apps/gui/skin_engine/skin_tokens.c b/apps/gui/skin_engine/skin_tokens.c
index 1254900844..deab0eaf60 100644
--- a/apps/gui/skin_engine/skin_tokens.c
+++ b/apps/gui/skin_engine/skin_tokens.c
@@ -319,13 +319,13 @@ const char *get_token_value(struct gui_wps *gwps,
319 319
320#ifdef HAVE_ALBUMART 320#ifdef HAVE_ALBUMART
321 case WPS_TOKEN_ALBUMART_DISPLAY: 321 case WPS_TOKEN_ALBUMART_DISPLAY:
322 draw_album_art(gwps, audio_current_aa_hid(), false); 322 if (!data->albumart)
323 return NULL; 323 return NULL;
324
325 case WPS_TOKEN_ALBUMART_FOUND:
326 if (audio_current_aa_hid() >= 0) { 324 if (audio_current_aa_hid() >= 0) {
325 data->albumart->draw = true;
327 return "C"; 326 return "C";
328 } 327 }
328 data->albumart->draw = false;
329 return NULL; 329 return NULL;
330#endif 330#endif
331 331
diff --git a/apps/gui/skin_engine/skin_tokens.h b/apps/gui/skin_engine/skin_tokens.h
index ea59053c7a..ad016047ba 100644
--- a/apps/gui/skin_engine/skin_tokens.h
+++ b/apps/gui/skin_engine/skin_tokens.h
@@ -177,7 +177,6 @@ enum wps_token_type {
177 WPS_TOKEN_PLAYLIST_NAME, 177 WPS_TOKEN_PLAYLIST_NAME,
178 WPS_TOKEN_PLAYLIST_POSITION, 178 WPS_TOKEN_PLAYLIST_POSITION,
179 WPS_TOKEN_PLAYLIST_SHUFFLE, 179 WPS_TOKEN_PLAYLIST_SHUFFLE,
180
181#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD) 180#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
182 /* Virtual LED */ 181 /* Virtual LED */
183 WPS_TOKEN_VLED_HDD, 182 WPS_TOKEN_VLED_HDD,
diff --git a/apps/gui/skin_engine/wps_debug.c b/apps/gui/skin_engine/wps_debug.c
index 523e2d62ce..db8aa7759e 100644
--- a/apps/gui/skin_engine/wps_debug.c
+++ b/apps/gui/skin_engine/wps_debug.c
@@ -431,6 +431,12 @@ static char *get_token_desc(struct wps_token *token, char *buf, int bufsize)
431 snprintf(buf, bufsize, "pitch value"); 431 snprintf(buf, bufsize, "pitch value");
432 break; 432 break;
433#endif 433#endif
434
435#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
436 case WPS_TOKEN_VLED_HDD:
437 snprintf(buf, bufsize, "display virtual HDD LED");
438 break;
439#endif
434 case WPS_VIEWPORT_ENABLE: 440 case WPS_VIEWPORT_ENABLE:
435 snprintf(buf, bufsize, "enable VP:%d", 441 snprintf(buf, bufsize, "enable VP:%d",
436 token->value.i); 442 token->value.i);
diff --git a/apps/gui/skin_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h
index d1674ac88e..e2330a777e 100644
--- a/apps/gui/skin_engine/wps_internals.h
+++ b/apps/gui/skin_engine/wps_internals.h
@@ -220,6 +220,24 @@ struct touchregion {
220 int action; /* action this button will return */ 220 int action; /* action this button will return */
221}; 221};
222#endif 222#endif
223
224
225#ifdef HAVE_ALBUMART
226struct skin_albumart {
227 /* Album art support */
228 struct viewport *vp;/* The viewport this is in */
229 unsigned char wps_uses_albumart; /* WPS_ALBUMART_NONE, _CHECK, _LOAD */
230 short albumart_x;
231 short albumart_y;
232 unsigned char albumart_xalign; /* WPS_ALBUMART_ALIGN_LEFT, _CENTER, _RIGHT */
233 unsigned char albumart_yalign; /* WPS_ALBUMART_ALIGN_TOP, _CENTER, _BOTTOM */
234 short albumart_max_width;
235 short albumart_max_height;
236
237 bool draw;
238};
239#endif
240
223/* wps_data 241/* wps_data
224 this struct holds all necessary data which describes the 242 this struct holds all necessary data which describes the
225 viewable content of a wps */ 243 viewable content of a wps */
@@ -233,18 +251,8 @@ struct wps_data
233 struct skin_token_list *progressbars; 251 struct skin_token_list *progressbars;
234 252
235 bool peak_meter_enabled; 253 bool peak_meter_enabled;
236
237#ifdef HAVE_ALBUMART 254#ifdef HAVE_ALBUMART
238 /* Album art support */ 255 struct skin_albumart *albumart;
239 unsigned char wps_uses_albumart; /* WPS_ALBUMART_NONE, _CHECK, _LOAD */
240 short albumart_x;
241 short albumart_y;
242 unsigned char albumart_xalign; /* WPS_ALBUMART_ALIGN_LEFT, _CENTER, _RIGHT */
243 unsigned char albumart_yalign; /* WPS_ALBUMART_ALIGN_TOP, _CENTER, _BOTTOM */
244 short albumart_max_width;
245 short albumart_max_height;
246
247 int albumart_cond_index;
248#endif 256#endif
249 257
250#else /*HAVE_LCD_CHARCELLS */ 258#else /*HAVE_LCD_CHARCELLS */
diff --git a/apps/gui/wps.c b/apps/gui/wps.c
index f336f77503..dcd3e2480d 100644
--- a/apps/gui/wps.c
+++ b/apps/gui/wps.c
@@ -1280,7 +1280,7 @@ void gui_sync_wps_init(void)
1280 { 1280 {
1281 skin_data_init(&wps_datas[i]); 1281 skin_data_init(&wps_datas[i]);
1282#ifdef HAVE_ALBUMART 1282#ifdef HAVE_ALBUMART
1283 wps_datas[i].wps_uses_albumart = 0; 1283 wps_datas[i].albumart = NULL;
1284#endif 1284#endif
1285#ifdef HAVE_REMOTE_LCD 1285#ifdef HAVE_REMOTE_LCD
1286 wps_datas[i].remote_wps = (i == SCREEN_REMOTE); 1286 wps_datas[i].remote_wps = (i == SCREEN_REMOTE);
@@ -1306,12 +1306,13 @@ bool wps_uses_albumart(int *width, int *height)
1306 int i; 1306 int i;
1307 FOR_NB_SCREENS(i) { 1307 FOR_NB_SCREENS(i) {
1308 struct gui_wps *gwps = &gui_wps[i]; 1308 struct gui_wps *gwps = &gui_wps[i];
1309 if (gwps->data && (gwps->data->wps_uses_albumart != WPS_ALBUMART_NONE)) 1309 struct skin_albumart *aa = gwps->data->albumart;
1310 if (aa && (aa->wps_uses_albumart != WPS_ALBUMART_NONE))
1310 { 1311 {
1311 if (width) 1312 if (width)
1312 *width = gui_wps[0].data->albumart_max_width; 1313 *width = aa->albumart_max_width;
1313 if (height) 1314 if (height)
1314 *height = gui_wps[0].data->albumart_max_height; 1315 *height = aa->albumart_max_height;
1315 return true; 1316 return true;
1316 } 1317 }
1317 } 1318 }