summaryrefslogtreecommitdiff
path: root/apps/gui/skin_engine
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2010-09-14 11:56:50 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2010-09-14 11:56:50 +0000
commit9928e3418f67fe6d2f82292ddbddcf56ae20b8f6 (patch)
tree397b13a537a476feb77b7d052250b98055924aec /apps/gui/skin_engine
parent0928cdf074c8991f470fa0d96e6d4f828998b643 (diff)
downloadrockbox-9928e3418f67fe6d2f82292ddbddcf56ae20b8f6.tar.gz
rockbox-9928e3418f67fe6d2f82292ddbddcf56ae20b8f6.zip
Another major skin backend update/hopefully bugfix:
Skins are now more self contained in the skin manager which in the future might allow on demand skin loading (i.e smaller skin buffers) Skin backdrops are also managed more intelegently (fixes a bug where you can get a crazy backdrop loaded if a .sbs fails to load) the rockbox_default rescue theme is now called rockbox_failsafe to better express what it actually is. This commit hopefully/maybe fixes the heavily reported data aborts, so please check if you are getting them git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28073 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/skin_engine')
-rw-r--r--apps/gui/skin_engine/skin_backdrops.c164
-rw-r--r--apps/gui/skin_engine/skin_display.c31
-rw-r--r--apps/gui/skin_engine/skin_engine.h24
-rw-r--r--apps/gui/skin_engine/skin_parser.c42
-rw-r--r--apps/gui/skin_engine/skin_render.c3
-rw-r--r--apps/gui/skin_engine/skin_tokens.c16
-rw-r--r--apps/gui/skin_engine/wps_internals.h20
7 files changed, 187 insertions, 113 deletions
diff --git a/apps/gui/skin_engine/skin_backdrops.c b/apps/gui/skin_engine/skin_backdrops.c
index 9ceee0cd05..f5b72a9652 100644
--- a/apps/gui/skin_engine/skin_backdrops.c
+++ b/apps/gui/skin_engine/skin_backdrops.c
@@ -30,88 +30,164 @@
30 30
31#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)) 31#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1))
32 32
33#define NB_BDROPS SKINNABLE_SCREENS_COUNT*NB_SCREENS
33static struct skin_backdrop { 34static struct skin_backdrop {
34 char name[MAX_PATH]; 35 char name[MAX_PATH];
35 char *buffer; 36 char *buffer;
36 enum screen_type screen; 37 enum screen_type screen;
37} backdrops[SKINNABLE_SCREENS_COUNT*NB_SCREENS]; 38} backdrops[NB_BDROPS];
39
40#define NB_BDROPS SKINNABLE_SCREENS_COUNT*NB_SCREENS
38 41
39void skin_backdrop_init(void) 42void skin_backdrop_init(void)
40{ 43{
41 int i; 44 int i;
42 for(i=0;i<SKINNABLE_SCREENS_COUNT*NB_SCREENS;i++) 45 for (i=0; i<NB_BDROPS; i++)
43 { 46 {
44 backdrops[i].name[0] = '\0'; 47 backdrops[i].name[0] = '\0';
45 backdrops[i].buffer = NULL; 48 backdrops[i].buffer = NULL;
46 } 49 }
47} 50}
48 51
49/* load a backdrop into the skin buffer. 52int skin_backdrop_assign(char* backdrop, char *bmpdir,
50 * reuse buffers if the file is already loaded */ 53 enum screen_type screen)
51char* skin_backdrop_load(char* backdrop, char *bmpdir, enum screen_type screen)
52{ 54{
53 int i;
54 struct skin_backdrop *bdrop = NULL;
55 char dir[MAX_PATH]; 55 char dir[MAX_PATH];
56 char filename[MAX_PATH]; 56 char filename[MAX_PATH];
57 size_t buf_size; 57 int i, free = -1;
58 bool loaded = false; 58 if (!backdrop)
59#if defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1) 59 return -1;
60 if (screen == SCREEN_REMOTE)
61 buf_size = REMOTE_LCD_BACKDROP_BYTES;
62 else
63#endif
64 buf_size = LCD_BACKDROP_BYTES;
65
66 if (backdrop[0] == '-') 60 if (backdrop[0] == '-')
67 { 61 {
62 filename[0] = '-';
63 filename[1] = '\0';
64 filename[2] = '\0'; /* we check this later to see if we actually have an
65 image to load. != '\0' means display the image */
68#if NB_SCREENS > 1 66#if NB_SCREENS > 1
69 if (screen == SCREEN_REMOTE) 67 if (screen == SCREEN_REMOTE)
70 { 68 {
71 return NULL; /* remotes don't have a backdrop setting (yet!) */ 69 filename[0] = '\0';
72 } 70 }
73 else
74#endif 71#endif
75 {
76 char settings_bdrop = global_settings.backdrop_file[0];
77 if (settings_bdrop == '\0' || settings_bdrop == '-')
78 {
79 return NULL; /* backdrop setting not set */
80 }
81 snprintf(filename, sizeof(filename), "%s/%s.bmp",
82 get_user_file_path(BACKDROP_DIR, 0, dir, sizeof(dir)),
83 global_settings.backdrop_file);
84 }
85 } 72 }
86 else 73 else
87 { 74 {
88 const char *bd_dir = get_user_file_path(bmpdir, 0, dir, sizeof(dir)); 75 const char *bd_dir = get_user_file_path(bmpdir, 0, dir, sizeof(dir));
89 get_image_filename(backdrop, bd_dir, filename, sizeof(filename)); 76 get_image_filename(backdrop, bd_dir, filename, sizeof(filename));
90 } 77 }
91 78 for (i=0; i<NB_BDROPS; i++)
92 for(i=0;i<SKINNABLE_SCREENS_COUNT*NB_SCREENS;i++)
93 { 79 {
80 if (!backdrops[i].name[0] && free < 0)
81 free = i;
94 if (!strcmp(backdrops[i].name, filename) && backdrops[i].screen == screen) 82 if (!strcmp(backdrops[i].name, filename) && backdrops[i].screen == screen)
95 { 83 {
96 return backdrops[i].buffer; 84 break;
85 }
86 }
87 if (i < NB_BDROPS)
88 return i;
89 else if (free >= 0)
90 {
91 strlcpy(backdrops[free].name, filename,
92 sizeof (backdrops[free].name));
93 backdrops[free].buffer = NULL;
94 backdrops[free].screen = screen;
95 return free;
96 }
97 return -1;
98}
99
100bool skin_backdrops_preload(void)
101{
102 bool retval = true;
103 int i;
104 char *filename;
105 for (i=0; i<NB_BDROPS; i++)
106 {
107 if (backdrops[i].name[0] && !backdrops[i].buffer)
108 {
109 size_t buf_size;
110 bool loaded = false;
111 enum screen_type screen = backdrops[i].screen;
112#if defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)
113 if (screen == SCREEN_REMOTE)
114 buf_size = REMOTE_LCD_BACKDROP_BYTES;
115 else
116#endif
117 buf_size = LCD_BACKDROP_BYTES;
118
119 filename = backdrops[i].name;
120 if (screen == SCREEN_MAIN && global_settings.backdrop_file[0] &&
121 global_settings.backdrop_file[0] != '-' && filename[0] == '-')
122 {
123 char dir[MAX_PATH];
124 char* temp = filename+2; /* slightly hacky to get a buffer */
125 size_t size = sizeof(backdrops[i].name) - 2;
126 snprintf(temp, size, "%s/%s.bmp",
127 get_user_file_path(BACKDROP_DIR, 0, dir, sizeof(dir)),
128 global_settings.backdrop_file);
129 filename = temp;
130 }
131 if (*filename && *filename != '-')
132 {
133 backdrops[i].buffer = (char*)skin_buffer_alloc(buf_size);
134 loaded = backdrops[i].buffer &&
135 screens[screen].backdrop_load(filename, backdrops[i].buffer);
136 if (!loaded)
137 retval = false;
138 }
139 if (backdrops[i].name[0] == '-' && loaded)
140 backdrops[i].name[2] = '.';
97 } 141 }
98 else if (!bdrop && backdrops[i].buffer == NULL) 142 }
143 return retval;
144}
145
146void skin_backdrop_show(int backdrop_id)
147{
148 if (backdrop_id < 0)
149 return;
150 enum screen_type screen = backdrops[backdrop_id].screen;
151 if (backdrops[backdrop_id].name[0] == '-' &&
152 backdrops[backdrop_id].name[2] == '\0')
153 return;
154 if (backdrops[backdrop_id].buffer)
155 screens[screen].backdrop_show(backdrops[backdrop_id].buffer);
156}
157
158void skin_backdrop_unload(int backdrop_id)
159{
160 backdrops[backdrop_id].buffer = NULL;
161}
162
163void skin_backdrop_load_setting(void)
164{
165 int i;
166 char filename[MAX_PATH], dir[MAX_PATH];
167 for(i=0;i<SKINNABLE_SCREENS_COUNT*NB_SCREENS;i++)
168 {
169 if (backdrops[i].name[0] == '-' && backdrops[i].screen == SCREEN_MAIN)
99 { 170 {
100 bdrop = &backdrops[i]; 171 if (global_settings.backdrop_file[0] &&
172 global_settings.backdrop_file[0] != '-')
173 {
174 if (!backdrops[i].buffer)
175 backdrops[i].buffer = (char*)skin_buffer_alloc(LCD_BACKDROP_BYTES);
176 snprintf(filename, sizeof filename, "%s/%s.bmp",
177 get_user_file_path(BACKDROP_DIR, 0, dir, sizeof(dir)),
178 global_settings.backdrop_file);
179 bool loaded = backdrops[i].buffer &&
180 screens[SCREEN_MAIN].backdrop_load(filename,
181 backdrops[i].buffer);
182 backdrops[i].name[2] = loaded ? '.' : '\0';
183 return;
184 }
185 else
186 backdrops[i].name[2] = '\0';
101 } 187 }
102 } 188 }
103 if (!bdrop)
104 return NULL; /* too many backdrops loaded */
105
106 bdrop->buffer = (char*)skin_buffer_alloc(buf_size);
107 if (!bdrop->buffer)
108 return NULL;
109 loaded = screens[screen].backdrop_load(filename, bdrop->buffer);
110 bdrop->screen = screen;
111 strlcpy(bdrop->name, filename, sizeof(bdrop->name));
112
113 return loaded ? bdrop->buffer : NULL;
114} 189}
190
115#else 191#else
116 192
117void skin_backdrop_init(void) 193void skin_backdrop_init(void)
diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c
index d76b57976d..f001640cde 100644
--- a/apps/gui/skin_engine/skin_display.c
+++ b/apps/gui/skin_engine/skin_display.c
@@ -74,18 +74,21 @@ void skin_render(struct gui_wps *gwps, unsigned refresh_mode);
74 74
75/* update a skinned screen, update_type is WPS_REFRESH_* values. 75/* update a skinned screen, update_type is WPS_REFRESH_* values.
76 * Usually it should only be WPS_REFRESH_NON_STATIC 76 * Usually it should only be WPS_REFRESH_NON_STATIC
77 * A full update will be done if required (state.do_full_update == true) 77 * A full update will be done if required (skin_do_full_update() == true)
78 */ 78 */
79void skin_update(struct gui_wps *gwps, unsigned int update_type) 79void skin_update(enum skinnable_screens skin, enum screen_type screen,
80 unsigned int update_type)
80{ 81{
82 struct gui_wps *gwps = skin_get_gwps(skin, screen);
81 /* This maybe shouldnt be here, 83 /* This maybe shouldnt be here,
82 * This is also safe for skined screen which dont use the id3 */ 84 * This is also safe for skined screen which dont use the id3 */
83 struct mp3entry *id3 = gwps->state->id3; 85 struct mp3entry *id3 = skin_get_global_state()->id3;
84 bool cuesheet_update = (id3 != NULL ? cuesheet_subtrack_changed(id3) : false); 86 bool cuesheet_update = (id3 != NULL ? cuesheet_subtrack_changed(id3) : false);
85 gwps->sync_data->do_full_update |= cuesheet_update; 87 if (cuesheet_update)
88 skin_request_full_update(skin);
86 89
87 skin_render(gwps, gwps->sync_data->do_full_update ? 90 skin_render(gwps, skin_do_full_update(skin, screen) ?
88 SKIN_REFRESH_ALL : update_type); 91 SKIN_REFRESH_ALL : update_type);
89} 92}
90 93
91#ifdef HAVE_LCD_BITMAP 94#ifdef HAVE_LCD_BITMAP
@@ -126,7 +129,7 @@ void draw_progressbar(struct gui_wps *gwps, int line, struct progressbar *pb)
126{ 129{
127 struct screen *display = gwps->display; 130 struct screen *display = gwps->display;
128 struct viewport *vp = pb->vp; 131 struct viewport *vp = pb->vp;
129 struct wps_state *state = gwps->state; 132 struct wps_state *state = skin_get_global_state();
130 struct mp3entry *id3 = state->id3; 133 struct mp3entry *id3 = state->id3;
131 int y = pb->y, height = pb->height; 134 int y = pb->y, height = pb->height;
132 unsigned long length, end; 135 unsigned long length, end;
@@ -729,11 +732,10 @@ bool skin_has_sbs(enum screen_type screen, struct wps_data *data)
729 732
730/* do the button loop as often as required for the peak meters to update 733/* do the button loop as often as required for the peak meters to update
731 * with a good refresh rate. 734 * with a good refresh rate.
732 * gwps is really gwps[NB_SCREENS]! don't wrap this if FOR_NB_SCREENS()
733 */ 735 */
734int skin_wait_for_action(struct gui_wps *gwps, int context, int timeout) 736int skin_wait_for_action(enum skinnable_screens skin, int context, int timeout)
735{ 737{
736 (void)gwps; /* silence charcell warning */ 738 (void)skin; /* silence charcell warning */
737 int button = ACTION_NONE; 739 int button = ACTION_NONE;
738#ifdef HAVE_LCD_BITMAP 740#ifdef HAVE_LCD_BITMAP
739 int i; 741 int i;
@@ -744,7 +746,7 @@ int skin_wait_for_action(struct gui_wps *gwps, int context, int timeout)
744 bool pm=false; 746 bool pm=false;
745 FOR_NB_SCREENS(i) 747 FOR_NB_SCREENS(i)
746 { 748 {
747 if(gwps[i].data->peak_meter_enabled) 749 if(skin_get_gwps(skin, i)->data->peak_meter_enabled)
748 pm = true; 750 pm = true;
749 } 751 }
750 752
@@ -763,8 +765,8 @@ int skin_wait_for_action(struct gui_wps *gwps, int context, int timeout)
763 if (TIME_AFTER(current_tick, next_refresh)) { 765 if (TIME_AFTER(current_tick, next_refresh)) {
764 FOR_NB_SCREENS(i) 766 FOR_NB_SCREENS(i)
765 { 767 {
766 if(gwps[i].data->peak_meter_enabled) 768 if(skin_get_gwps(skin, i)->data->peak_meter_enabled)
767 skin_update(&gwps[i], SKIN_REFRESH_PEAK_METER); 769 skin_update(skin, i, SKIN_REFRESH_PEAK_METER);
768 next_refresh += HZ / PEAK_METER_FPS; 770 next_refresh += HZ / PEAK_METER_FPS;
769 } 771 }
770 } 772 }
@@ -781,3 +783,6 @@ int skin_wait_for_action(struct gui_wps *gwps, int context, int timeout)
781 } 783 }
782 return button; 784 return button;
783} 785}
786
787
788
diff --git a/apps/gui/skin_engine/skin_engine.h b/apps/gui/skin_engine/skin_engine.h
index 6beedd90a2..ef4297d0ce 100644
--- a/apps/gui/skin_engine/skin_engine.h
+++ b/apps/gui/skin_engine/skin_engine.h
@@ -73,7 +73,8 @@ void skin_disarm_touchregions(struct wps_data *data);
73#endif 73#endif
74 74
75/* Do a update_type update of the skinned screen */ 75/* Do a update_type update of the skinned screen */
76void skin_update(struct gui_wps *gwps, unsigned int update_type); 76void skin_update(enum skinnable_screens skin, enum screen_type screen,
77 unsigned int update_type);
77 78
78/* 79/*
79 * setup up the skin-data from a format-buffer (isfile = false) 80 * setup up the skin-data from a format-buffer (isfile = false)
@@ -92,13 +93,28 @@ bool skin_has_sbs(enum screen_type screen, struct wps_data *data);
92 * reuse buffers if the file is already loaded */ 93 * reuse buffers if the file is already loaded */
93char* skin_backdrop_load(char* backdrop, char *bmpdir, enum screen_type screen); 94char* skin_backdrop_load(char* backdrop, char *bmpdir, enum screen_type screen);
94void skin_backdrop_init(void); 95void skin_backdrop_init(void);
95 96int skin_backdrop_assign(char* backdrop, char *bmpdir,
97 enum screen_type screen);
98bool skin_backdrops_preload(void);
99void skin_backdrop_show(int backdrop_id);
100void skin_backdrop_load_setting(void);
101void skin_backdrop_unload(int backdrop_id);
96 102
97/* do the button loop as often as required for the peak meters to update 103/* do the button loop as often as required for the peak meters to update
98 * with a good refresh rate. 104 * with a good refresh rate.
99 * gwps is really gwps[NB_SCREENS]! don't wrap this in FOR_NB_SCREENS() 105 * gwps is really gwps[NB_SCREENS]! don't wrap this in FOR_NB_SCREENS()
100 */ 106 */
101int skin_wait_for_action(struct gui_wps *gwps, int context, int timeout); 107int skin_wait_for_action(enum skinnable_screens skin, int context, int timeout);
102#endif 108
109void skin_load(enum skinnable_screens skin, enum screen_type screen,
110 const char *buf, bool isfile);
111struct gui_wps *skin_get_gwps(enum skinnable_screens skin, enum screen_type screen);
112struct wps_state *skin_get_global_state(void);
113void gui_sync_skin_init(void);
114
115
116bool skin_do_full_update(enum skinnable_screens skin, enum screen_type screen);
117void skin_request_full_update(enum skinnable_screens skin);
103 118
119#endif /* !PLUGIN */
104#endif 120#endif
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c
index a6d4c798dc..2534bf9104 100644
--- a/apps/gui/skin_engine/skin_parser.c
+++ b/apps/gui/skin_engine/skin_parser.c
@@ -447,26 +447,27 @@ static int parse_image_special(struct skin_element *element,
447{ 447{
448 (void)wps_data; /* kill warning */ 448 (void)wps_data; /* kill warning */
449 (void)token; 449 (void)token;
450 bool error = false;
451 450
452#if LCD_DEPTH > 1 451#if LCD_DEPTH > 1
452 char *filename;
453 if (token->type == SKIN_TOKEN_IMAGE_BACKDROP) 453 if (token->type == SKIN_TOKEN_IMAGE_BACKDROP)
454 { 454 {
455 char *filename = element->params[0].data.text; 455 if (isdefault(&element->params[0]))
456 /* format: %X|filename.bmp| or %Xd */
457 if (!strcmp(filename, "d"))
458 { 456 {
459 wps_data->backdrop = NULL; 457 filename = "-";
460 return 0;
461 } 458 }
462 else if (!error) 459 else
463 { 460 {
464 wps_data->backdrop = filename; 461 filename = element->params[0].data.text;
462 /* format: %X(filename.bmp) or %X(d) */
463 if (!strcmp(filename, "d"))
464 filename = NULL;
465 } 465 }
466 wps_data->backdrop = filename;
466 } 467 }
467#endif 468#endif
468 /* Skip the rest of the line */ 469
469 return error ? WPS_ERROR_INVALID_PARAM : 0; 470 return 0;
470} 471}
471#endif 472#endif
472 473
@@ -1010,6 +1011,8 @@ static void skin_data_reset(struct wps_data *wps_data)
1010 wps_data->progressbars = NULL; 1011 wps_data->progressbars = NULL;
1011#endif 1012#endif
1012#if LCD_DEPTH > 1 || defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 1013#if LCD_DEPTH > 1 || defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
1014 if (wps_data->backdrop_id >= 0)
1015 skin_backdrop_unload(wps_data->backdrop_id);
1013 wps_data->backdrop = NULL; 1016 wps_data->backdrop = NULL;
1014#endif 1017#endif
1015#ifdef HAVE_TOUCHSCREEN 1018#ifdef HAVE_TOUCHSCREEN
@@ -1128,23 +1131,7 @@ static bool load_skin_bitmaps(struct wps_data *wps_data, char *bmpdir)
1128 } 1131 }
1129 1132
1130#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)) 1133#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1))
1131 /* Backdrop load scheme: 1134 wps_data->backdrop_id = skin_backdrop_assign(wps_data->backdrop, bmpdir, curr_screen);
1132 * 1) %X|filename|
1133 * 2) load the backdrop from settings
1134 */
1135 if (wps_data->backdrop)
1136 {
1137 if (screens[curr_screen].depth == 1)
1138 {
1139 wps_data->backdrop = NULL;
1140 return retval;
1141 }
1142 bool needed = wps_data->backdrop[0] != '-';
1143 wps_data->backdrop = skin_backdrop_load(wps_data->backdrop,
1144 bmpdir, curr_screen);
1145 if (!wps_data->backdrop && needed)
1146 retval = false;
1147 }
1148#endif /* has backdrop support */ 1135#endif /* has backdrop support */
1149 return retval; 1136 return retval;
1150} 1137}
@@ -1575,6 +1562,7 @@ bool skin_data_load(enum screen_type screen, struct wps_data *wps_data,
1575 } 1562 }
1576#if LCD_DEPTH > 1 || defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 1563#if LCD_DEPTH > 1 || defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
1577 wps_data->backdrop = "-"; 1564 wps_data->backdrop = "-";
1565 wps_data->backdrop_id = -1;
1578#endif 1566#endif
1579 /* parse the skin source */ 1567 /* parse the skin source */
1580 skin_buffer_save_position(); 1568 skin_buffer_save_position();
diff --git a/apps/gui/skin_engine/skin_render.c b/apps/gui/skin_engine/skin_render.c
index 9f392f144f..4fbd550c72 100644
--- a/apps/gui/skin_engine/skin_render.c
+++ b/apps/gui/skin_engine/skin_render.c
@@ -749,7 +749,8 @@ static void skin_render_playlistviewer(struct playlistviewer* viewer,
749 else 749 else
750#endif 750#endif
751 { 751 {
752 struct cuesheet *cue = gwps->state->id3 ? gwps->state->id3->cuesheet:NULL; 752 struct cuesheet *cue = skin_get_global_state()->id3 ?
753 skin_get_global_state()->id3->cuesheet : NULL;
753 cur_pos = playlist_get_display_index(); 754 cur_pos = playlist_get_display_index();
754 max = playlist_amount()+1; 755 max = playlist_amount()+1;
755 if (cue) 756 if (cue)
diff --git a/apps/gui/skin_engine/skin_tokens.c b/apps/gui/skin_engine/skin_tokens.c
index 3de6630a51..0e98c2d42f 100644
--- a/apps/gui/skin_engine/skin_tokens.c
+++ b/apps/gui/skin_engine/skin_tokens.c
@@ -515,18 +515,18 @@ const char *get_radio_token(struct wps_token *token, int preset_offset,
515} 515}
516#endif 516#endif
517 517
518static struct mp3entry* get_mp3entry_from_offset(struct gui_wps *gwps, 518static struct mp3entry* get_mp3entry_from_offset(int offset, char **filename)
519 int offset, char **filename)
520{ 519{
521 struct mp3entry* pid3 = NULL; 520 struct mp3entry* pid3 = NULL;
522 struct cuesheet *cue = gwps->state->id3 ? gwps->state->id3->cuesheet:NULL; 521 struct wps_state *state = skin_get_global_state();
522 struct cuesheet *cue = state->id3 ? state->id3->cuesheet : NULL;
523 const char *fname = NULL; 523 const char *fname = NULL;
524 if (cue && cue->curr_track_idx + offset < cue->track_count) 524 if (cue && cue->curr_track_idx + offset < cue->track_count)
525 pid3 = gwps->state->id3; 525 pid3 = state->id3;
526 else if (offset == 0) 526 else if (offset == 0)
527 pid3 = gwps->state->id3; 527 pid3 = state->id3;
528 else if (offset == 1) 528 else if (offset == 1)
529 pid3 = gwps->state->nid3; 529 pid3 = state->nid3;
530 else 530 else
531 { 531 {
532 static char filename_buf[MAX_PATH + 1]; 532 static char filename_buf[MAX_PATH + 1];
@@ -568,7 +568,7 @@ const char *get_token_value(struct gui_wps *gwps,
568 return NULL; 568 return NULL;
569 569
570 struct wps_data *data = gwps->data; 570 struct wps_data *data = gwps->data;
571 struct wps_state *state = gwps->state; 571 struct wps_state *state = skin_get_global_state();
572 struct mp3entry *id3; /* Think very carefully about using this. 572 struct mp3entry *id3; /* Think very carefully about using this.
573 maybe get_id3_token() is the better place? */ 573 maybe get_id3_token() is the better place? */
574 const char *out_text = NULL; 574 const char *out_text = NULL;
@@ -577,7 +577,7 @@ const char *get_token_value(struct gui_wps *gwps,
577 if (!data || !state) 577 if (!data || !state)
578 return NULL; 578 return NULL;
579 579
580 id3 = get_mp3entry_from_offset(gwps, token->next? 1: offset, &filename); 580 id3 = get_mp3entry_from_offset(token->next? 1: offset, &filename);
581 if (id3) 581 if (id3)
582 filename = id3->path; 582 filename = id3->path;
583 583
diff --git a/apps/gui/skin_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h
index 0767f50279..5c3d953fdb 100644
--- a/apps/gui/skin_engine/wps_internals.h
+++ b/apps/gui/skin_engine/wps_internals.h
@@ -266,7 +266,10 @@ struct wps_data
266 struct skin_token_list *progressbars; 266 struct skin_token_list *progressbars;
267#endif 267#endif
268#if LCD_DEPTH > 1 || defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 268#if LCD_DEPTH > 1 || defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
269 char *backdrop; 269 struct {
270 char *backdrop;
271 int backdrop_id;
272 };
270#endif 273#endif
271 274
272#ifdef HAVE_TOUCHSCREEN 275#ifdef HAVE_TOUCHSCREEN
@@ -305,18 +308,6 @@ struct wps_state
305 bool is_fading; 308 bool is_fading;
306}; 309};
307 310
308/* Holds data for all screens in a skin. */
309struct wps_sync_data
310{
311 /* suitable for the viewportmanager, possibly only temporary here
312 * needs to be same for all screens! can't be split up for screens
313 * due to what viewportmanager_set_statusbar() accepts
314 * (FIXME?) */
315 int statusbars;
316 /* indicates whether the skin needs a full update for all screens */
317 bool do_full_update;
318};
319
320/* change the ff/rew-status 311/* change the ff/rew-status
321 if ff_rew = true then we are in skipping mode 312 if ff_rew = true then we are in skipping mode
322 else we are in normal mode */ 313 else we are in normal mode */
@@ -334,9 +325,6 @@ struct gui_wps
334{ 325{
335 struct screen *display; 326 struct screen *display;
336 struct wps_data *data; 327 struct wps_data *data;
337 struct wps_state *state;
338 /* must point to the same struct for all screens */
339 struct wps_sync_data *sync_data;
340}; 328};
341 329
342/* gui_wps end */ 330/* gui_wps end */