diff options
Diffstat (limited to 'apps/gui/skin_engine')
-rw-r--r-- | apps/gui/skin_engine/skin_display.c | 25 | ||||
-rw-r--r-- | apps/gui/skin_engine/skin_parser.c | 51 | ||||
-rw-r--r-- | apps/gui/skin_engine/wps_internals.h | 43 |
3 files changed, 58 insertions, 61 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 @@ | |||
68 | static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode); | 68 | static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode); |
69 | 69 | ||
70 | 70 | ||
71 | /* initial setup of wps_data */ | ||
72 | void 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 ? */ |
97 | bool gui_wps_display(struct gui_wps *gwps) | 72 | bool 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); | |||
104 | extern void debug_skin_usage(void); | 104 | extern void debug_skin_usage(void); |
105 | #endif | 105 | #endif |
106 | 106 | ||
107 | static 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 | ||
1585 | static 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 | **/ | ||
1590 | void 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 { | |||
244 | struct wps_data | 244 | struct 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 */ |