summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/gui/skin_engine/skin_display.c25
-rw-r--r--apps/gui/skin_engine/skin_parser.c51
-rw-r--r--apps/gui/skin_engine/wps_internals.h43
-rw-r--r--apps/gui/wps.c18
-rw-r--r--apps/gui/wps.h1
-rw-r--r--apps/settings.c8
6 files changed, 68 insertions, 78 deletions
diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c
index cf1dbaa771..7d75b48506 100644
--- a/apps/gui/skin_engine/skin_display.c
+++ b/apps/gui/skin_engine/skin_display.c
@@ -68,31 +68,6 @@
68static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode); 68static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode);
69 69
70 70
71/* initial setup of wps_data */
72void skin_data_init(struct wps_data *wps_data)
73{
74#ifdef HAVE_LCD_BITMAP
75 wps_data->wps_sb_tag = false;
76 wps_data->show_sb_on_wps = false;
77 wps_data->peak_meter_enabled = false;
78 wps_data->images = NULL;
79 wps_data->progressbars = NULL;
80#ifdef HAVE_ALBUMART
81 wps_data->albumart = NULL;
82#endif
83 /* progress bars */
84#else /* HAVE_LCD_CHARCELLS */
85 int i;
86 for (i = 0; i < 8; i++)
87 {
88 wps_data->wps_progress_pat[i] = 0;
89 }
90 wps_data->full_line_progressbar = false;
91#endif
92 wps_data->button_time_volume = 0;
93 wps_data->wps_loaded = false;
94}
95
96/* TODO: maybe move this whole function into wps.c instead ? */ 71/* TODO: maybe move this whole function into wps.c instead ? */
97bool gui_wps_display(struct gui_wps *gwps) 72bool gui_wps_display(struct gui_wps *gwps)
98{ 73{
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c
index bd6199c5e9..dbbdc32730 100644
--- a/apps/gui/skin_engine/skin_parser.c
+++ b/apps/gui/skin_engine/skin_parser.c
@@ -104,8 +104,6 @@ extern void print_debug_info(struct wps_data *data, int fail, int line);
104extern void debug_skin_usage(void); 104extern void debug_skin_usage(void);
105#endif 105#endif
106 106
107static void wps_reset(struct wps_data *data);
108
109/* Function for parsing of details for a token. At the moment the 107/* Function for parsing of details for a token. At the moment the
110 function is called, the token type has already been set. The 108 function is called, the token type has already been set. The
111 function must fill in the details and possibly add more tokens 109 function must fill in the details and possibly add more tokens
@@ -1582,16 +1580,45 @@ static bool wps_parse(struct wps_data *data, const char *wps_bufptr, bool debug)
1582 return (fail == 0); 1580 return (fail == 0);
1583} 1581}
1584 1582
1585static void wps_reset(struct wps_data *data) 1583
1584/*
1585 * initial setup of wps_data; does reset everything
1586 * except fields which need to survive, i.e.
1587 *
1588 * wps_data->remote_wps
1589 **/
1590void skin_data_reset(struct wps_data *wps_data)
1586{ 1591{
1587#ifdef HAVE_REMOTE_LCD 1592#ifdef HAVE_LCD_BITMAP
1588 bool rwps = data->remote_wps; /* remember whether the data is for a RWPS */ 1593 wps_data->images = NULL;
1594 wps_data->progressbars = NULL;
1589#endif 1595#endif
1590 memset(data, 0, sizeof(*data)); 1596#ifdef HAVE_TOUCHSCREEN
1591 skin_data_init(data); 1597 wps_data->touchregions = NULL;
1592#ifdef HAVE_REMOTE_LCD 1598#endif
1593 data->remote_wps = rwps; 1599 wps_data->viewports = NULL;
1600 wps_data->strings = NULL;
1601#ifdef HAVE_ALBUMART
1602 wps_data->albumart = NULL;
1603#endif
1604 wps_data->tokens = NULL;
1605 wps_data->num_tokens = 0;
1606 wps_data->button_time_volume = 0;
1607
1608#ifdef HAVE_LCD_BITMAP
1609 wps_data->peak_meter_enabled = false;
1610 wps_data->wps_sb_tag = false;
1611 wps_data->show_sb_on_wps = false;
1612#else /* HAVE_LCD_CHARCELLS */
1613 /* progress bars */
1614 int i;
1615 for (i = 0; i < 8; i++)
1616 {
1617 wps_data->wps_progress_pat[i] = 0;
1618 }
1619 wps_data->full_line_progressbar = false;
1594#endif 1620#endif
1621 wps_data->wps_loaded = false;
1595} 1622}
1596 1623
1597#ifdef HAVE_LCD_BITMAP 1624#ifdef HAVE_LCD_BITMAP
@@ -1704,7 +1731,7 @@ bool skin_data_load(struct wps_data *wps_data,
1704 } 1731 }
1705#endif 1732#endif
1706 1733
1707 wps_reset(wps_data); 1734 skin_data_reset(wps_data);
1708 1735
1709 curr_vp = skin_buffer_alloc(sizeof(struct skin_viewport)); 1736 curr_vp = skin_buffer_alloc(sizeof(struct skin_viewport));
1710 if (!curr_vp) 1737 if (!curr_vp)
@@ -1796,7 +1823,7 @@ bool skin_data_load(struct wps_data *wps_data,
1796 1823
1797 /* parse the WPS source */ 1824 /* parse the WPS source */
1798 if (!wps_parse(wps_data, wps_buffer, true)) { 1825 if (!wps_parse(wps_data, wps_buffer, true)) {
1799 wps_reset(wps_data); 1826 skin_data_reset(wps_data);
1800 return false; 1827 return false;
1801 } 1828 }
1802 1829
@@ -1811,7 +1838,7 @@ bool skin_data_load(struct wps_data *wps_data,
1811 1838
1812 /* load the bitmaps that were found by the parsing */ 1839 /* load the bitmaps that were found by the parsing */
1813 if (!load_skin_bitmaps(wps_data, bmpdir)) { 1840 if (!load_skin_bitmaps(wps_data, bmpdir)) {
1814 wps_reset(wps_data); 1841 skin_data_reset(wps_data);
1815 return false; 1842 return false;
1816 } 1843 }
1817#endif 1844#endif
diff --git a/apps/gui/skin_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h
index 177a376008..7a4fdddc7c 100644
--- a/apps/gui/skin_engine/wps_internals.h
+++ b/apps/gui/skin_engine/wps_internals.h
@@ -244,43 +244,38 @@ struct skin_albumart {
244struct wps_data 244struct wps_data
245{ 245{
246#ifdef HAVE_LCD_BITMAP 246#ifdef HAVE_LCD_BITMAP
247 bool wps_sb_tag;
248 bool show_sb_on_wps;
249
250 struct skin_token_list *images; 247 struct skin_token_list *images;
251 struct skin_token_list *progressbars; 248 struct skin_token_list *progressbars;
252
253 bool peak_meter_enabled;
254#ifdef HAVE_ALBUMART
255 struct skin_albumart *albumart;
256#endif
257
258#else /*HAVE_LCD_CHARCELLS */
259 unsigned short wps_progress_pat[8];
260 bool full_line_progressbar;
261#endif 249#endif
262 250
263#ifdef HAVE_TOUCHSCREEN 251#ifdef HAVE_TOUCHSCREEN
264 struct skin_token_list *touchregions; 252 struct skin_token_list *touchregions;
265#endif 253#endif
266
267#ifdef HAVE_REMOTE_LCD
268 bool remote_wps;
269#endif
270
271 struct skin_token_list *viewports; 254 struct skin_token_list *viewports;
272 255 struct skin_token_list *strings;
256#ifdef HAVE_ALBUMART
257 struct skin_albumart *albumart;
258#endif
259 struct wps_token *tokens;
273 /* Total number of tokens in the WPS. During WPS parsing, this is 260 /* Total number of tokens in the WPS. During WPS parsing, this is
274 the index of the token being parsed. */ 261 the index of the token being parsed. */
275 int num_tokens; 262 int num_tokens;
276 struct wps_token *tokens;
277
278 struct skin_token_list *strings;
279
280 bool wps_loaded;
281
282 /* tick the volume button was last pressed */ 263 /* tick the volume button was last pressed */
283 unsigned int button_time_volume; 264 unsigned int button_time_volume;
265
266#ifdef HAVE_LCD_BITMAP
267 bool peak_meter_enabled;
268 bool wps_sb_tag;
269 bool show_sb_on_wps;
270#else /*HAVE_LCD_CHARCELLS */
271 unsigned short wps_progress_pat[8];
272 bool full_line_progressbar;
273#endif
274 bool wps_loaded;
275#ifdef HAVE_REMOTE_LCD
276 /* this must not be reset on skin loading */
277 bool remote_wps;
278#endif
284}; 279};
285 280
286/* wps_data end */ 281/* wps_data end */
diff --git a/apps/gui/wps.c b/apps/gui/wps.c
index 2529686e3e..3524ba34b7 100644
--- a/apps/gui/wps.c
+++ b/apps/gui/wps.c
@@ -79,11 +79,12 @@
79#define MIN_FF_REWIND_STEP 500 79#define MIN_FF_REWIND_STEP 500
80 80
81/* this is for the viewportmanager */ 81/* this is for the viewportmanager */
82static int wpsbars; 82static int wpsbars = 0;
83/* currently only one wps_state is needed */ 83
84static struct wps_state wps_state; 84/* currently only one wps_state is needed, initialize to 0 */
85static struct gui_wps gui_wps[NB_SCREENS]; 85static struct wps_state wps_state = { .id3 = NULL};
86static struct wps_data wps_datas[NB_SCREENS]; 86static struct gui_wps gui_wps[NB_SCREENS] = {{ 0 }};
87static struct wps_data wps_datas[NB_SCREENS] = {{ 0 }};
87 88
88/* initial setup of wps_data */ 89/* initial setup of wps_data */
89static void wps_state_init(void); 90static void wps_state_init(void);
@@ -160,12 +161,6 @@ void wps_data_load(enum screen_type screen, const char *buf, bool isfile)
160#endif 161#endif
161} 162}
162 163
163void wps_data_init(enum screen_type screen)
164{
165 skin_data_init(gui_wps[screen].data);
166}
167
168
169static bool wps_fading_out = false; 164static bool wps_fading_out = false;
170void fade(bool fade_in, bool updatewps) 165void fade(bool fade_in, bool updatewps)
171{ 166{
@@ -1288,7 +1283,6 @@ void gui_sync_wps_init(void)
1288 int i; 1283 int i;
1289 FOR_NB_SCREENS(i) 1284 FOR_NB_SCREENS(i)
1290 { 1285 {
1291 skin_data_init(&wps_datas[i]);
1292#ifdef HAVE_ALBUMART 1286#ifdef HAVE_ALBUMART
1293 wps_datas[i].albumart = NULL; 1287 wps_datas[i].albumart = NULL;
1294#endif 1288#endif
diff --git a/apps/gui/wps.h b/apps/gui/wps.h
index f2f44859ca..6affcee698 100644
--- a/apps/gui/wps.h
+++ b/apps/gui/wps.h
@@ -27,7 +27,6 @@ long gui_wps_show(void);
27 27
28/* wrapper for the wps to load the skin (.wps/.rwps) files */ 28/* wrapper for the wps to load the skin (.wps/.rwps) files */
29void wps_data_load(enum screen_type, const char *, bool); 29void wps_data_load(enum screen_type, const char *, bool);
30void wps_data_init(enum screen_type);
31 30
32void gui_sync_wps_init(void); 31void gui_sync_wps_init(void);
33 32
diff --git a/apps/settings.c b/apps/settings.c
index ce888c44c5..2a5e31824f 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -741,25 +741,25 @@ void settings_apply_skins(void)
741 /* re-initialize the skin buffer before we start reloading skins */ 741 /* re-initialize the skin buffer before we start reloading skins */
742 skin_buffer_init(); 742 skin_buffer_init();
743 if ( global_settings.wps_file[0] && 743 if ( global_settings.wps_file[0] &&
744 global_settings.wps_file[0] != 0xff ) { 744 global_settings.wps_file[0] != 0xff )
745 {
745 snprintf(buf, sizeof buf, WPS_DIR "/%s.wps", 746 snprintf(buf, sizeof buf, WPS_DIR "/%s.wps",
746 global_settings.wps_file); 747 global_settings.wps_file);
747 wps_data_load(SCREEN_MAIN, buf, true); 748 wps_data_load(SCREEN_MAIN, buf, true);
748 } 749 }
749 else 750 else
750 { 751 {
751 wps_data_init(SCREEN_MAIN);
752 wps_data_load(SCREEN_MAIN, NULL, true); 752 wps_data_load(SCREEN_MAIN, NULL, true);
753 } 753 }
754#if defined(HAVE_REMOTE_LCD) && (NB_SCREENS > 1) 754#if defined(HAVE_REMOTE_LCD) && (NB_SCREENS > 1)
755 if ( global_settings.rwps_file[0]) { 755 if ( global_settings.rwps_file[0])
756 {
756 snprintf(buf, sizeof buf, WPS_DIR "/%s.rwps", 757 snprintf(buf, sizeof buf, WPS_DIR "/%s.rwps",
757 global_settings.rwps_file); 758 global_settings.rwps_file);
758 wps_data_load(SCREEN_REMOTE, buf, true); 759 wps_data_load(SCREEN_REMOTE, buf, true);
759 } 760 }
760 else 761 else
761 { 762 {
762 wps_data_init(SCREEN_REMOTE);
763 wps_data_load(SCREEN_REMOTE, NULL, true); 763 wps_data_load(SCREEN_REMOTE, NULL, true);
764 } 764 }
765#endif 765#endif