diff options
Diffstat (limited to 'apps/gui/skin_engine/wps_internals.h')
-rw-r--r-- | apps/gui/skin_engine/wps_internals.h | 102 |
1 files changed, 28 insertions, 74 deletions
diff --git a/apps/gui/skin_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h index f3f83370f4..ec37560e79 100644 --- a/apps/gui/skin_engine/wps_internals.h +++ b/apps/gui/skin_engine/wps_internals.h | |||
@@ -24,6 +24,8 @@ | |||
24 | 24 | ||
25 | #ifndef _WPS_ENGINE_INTERNALS_ | 25 | #ifndef _WPS_ENGINE_INTERNALS_ |
26 | #define _WPS_ENGINE_INTERNALS_ | 26 | #define _WPS_ENGINE_INTERNALS_ |
27 | |||
28 | |||
27 | /* Timeout unit expressed in HZ. In WPS, all timeouts are given in seconds | 29 | /* Timeout unit expressed in HZ. In WPS, all timeouts are given in seconds |
28 | (possibly with a decimal fraction) but stored as integer values. | 30 | (possibly with a decimal fraction) but stored as integer values. |
29 | E.g. 2.5 is stored as 25. This means 25 tenth of a second, i.e. 25 units. | 31 | E.g. 2.5 is stored as 25. This means 25 tenth of a second, i.e. 25 units. |
@@ -32,6 +34,8 @@ | |||
32 | #define DEFAULT_SUBLINE_TIME_MULTIPLIER 20 /* In TIMEOUT_UNIT's */ | 34 | #define DEFAULT_SUBLINE_TIME_MULTIPLIER 20 /* In TIMEOUT_UNIT's */ |
33 | 35 | ||
34 | #include "skin_tokens.h" | 36 | #include "skin_tokens.h" |
37 | #include "tag_table.h" | ||
38 | #include "skin_parser.h" | ||
35 | 39 | ||
36 | 40 | ||
37 | /* TODO: sort this mess out */ | 41 | /* TODO: sort this mess out */ |
@@ -40,19 +44,6 @@ | |||
40 | #include "statusbar.h" | 44 | #include "statusbar.h" |
41 | #include "metadata.h" | 45 | #include "metadata.h" |
42 | 46 | ||
43 | /* constants used in line_type and as refresh_mode for wps_refresh */ | ||
44 | #define WPS_REFRESH_STATIC (1u<<0) /* line doesn't change over time */ | ||
45 | #define WPS_REFRESH_DYNAMIC (1u<<1) /* line may change (e.g. time flag) */ | ||
46 | #define WPS_REFRESH_SCROLL (1u<<2) /* line scrolls */ | ||
47 | #define WPS_REFRESH_PLAYER_PROGRESS (1u<<3) /* line contains a progress bar */ | ||
48 | #define WPS_REFRESH_PEAK_METER (1u<<4) /* line contains a peak meter */ | ||
49 | #define WPS_REFRESH_STATUSBAR (1u<<5) /* refresh statusbar */ | ||
50 | #define WPS_REFRESH_ALL (0xffffffffu) /* to refresh all line types */ | ||
51 | |||
52 | /* to refresh only those lines that change over time */ | ||
53 | #define WPS_REFRESH_NON_STATIC (WPS_REFRESH_DYNAMIC| \ | ||
54 | WPS_REFRESH_PLAYER_PROGRESS| \ | ||
55 | WPS_REFRESH_PEAK_METER) | ||
56 | /* alignments */ | 47 | /* alignments */ |
57 | #define WPS_ALIGN_RIGHT 32 | 48 | #define WPS_ALIGN_RIGHT 32 |
58 | #define WPS_ALIGN_CENTER 64 | 49 | #define WPS_ALIGN_CENTER 64 |
@@ -82,16 +73,16 @@ struct gui_img { | |||
82 | short int y; /* y-pos */ | 73 | short int y; /* y-pos */ |
83 | short int num_subimages; /* number of sub-images */ | 74 | short int num_subimages; /* number of sub-images */ |
84 | short int subimage_height; /* height of each sub-image */ | 75 | short int subimage_height; /* height of each sub-image */ |
85 | short int display; /* -1 for no display, 0..n to display a subimage */ | ||
86 | struct bitmap bm; | 76 | struct bitmap bm; |
87 | char label; | 77 | char label; |
88 | bool loaded; /* load state */ | 78 | bool loaded; /* load state */ |
89 | bool always_display; /* not using the preload/display mechanism */ | 79 | bool always_display; /* not using the preload/display mechanism */ |
80 | int display; | ||
90 | }; | 81 | }; |
91 | 82 | ||
92 | 83 | ||
93 | struct progressbar { | 84 | struct progressbar { |
94 | enum wps_token_type type; | 85 | enum skin_token_type type; |
95 | struct viewport *vp; | 86 | struct viewport *vp; |
96 | /* regular pb */ | 87 | /* regular pb */ |
97 | short x; | 88 | short x; |
@@ -105,8 +96,6 @@ struct progressbar { | |||
105 | /*progressbar image*/ | 96 | /*progressbar image*/ |
106 | struct bitmap bm; | 97 | struct bitmap bm; |
107 | bool have_bitmap_pb; | 98 | bool have_bitmap_pb; |
108 | |||
109 | bool draw; | ||
110 | }; | 99 | }; |
111 | #endif | 100 | #endif |
112 | 101 | ||
@@ -157,45 +146,6 @@ enum wps_parse_error { | |||
157 | PARSE_FAIL_LIMITS_EXCEEDED, | 146 | PARSE_FAIL_LIMITS_EXCEEDED, |
158 | }; | 147 | }; |
159 | 148 | ||
160 | |||
161 | /* Description of a subline on the WPS */ | ||
162 | struct skin_subline { | ||
163 | |||
164 | /* Index of the first token for this subline in the token array. | ||
165 | Tokens of this subline end where tokens for the next subline | ||
166 | begin. */ | ||
167 | unsigned short first_token_idx; | ||
168 | unsigned short last_token_idx; | ||
169 | |||
170 | /* Bit or'ed WPS_REFRESH_xxx */ | ||
171 | unsigned char line_type; | ||
172 | |||
173 | /* How long the subline should be displayed, in 10ths of sec */ | ||
174 | unsigned char time_mult; | ||
175 | |||
176 | /* pointer to the next subline in this line */ | ||
177 | struct skin_subline *next; | ||
178 | }; | ||
179 | |||
180 | /* Description of a line on the WPS. A line is a set of sublines. | ||
181 | A subline is displayed for a certain amount of time. After that, | ||
182 | the next subline of the line is displayed. And so on. */ | ||
183 | struct skin_line { | ||
184 | |||
185 | /* Linked list of all the sublines on this line, | ||
186 | * a line *must* have at least one subline so no need to add an extra pointer */ | ||
187 | struct skin_subline sublines; | ||
188 | /* pointer to the current subline */ | ||
189 | struct skin_subline *curr_subline; | ||
190 | |||
191 | /* When the next subline of this line should be displayed | ||
192 | (absolute time value in ticks) */ | ||
193 | long subline_expire_time; | ||
194 | |||
195 | /* pointer to the next line */ | ||
196 | struct skin_line *next; | ||
197 | }; | ||
198 | |||
199 | #define VP_DRAW_HIDEABLE 0x1 | 149 | #define VP_DRAW_HIDEABLE 0x1 |
200 | #define VP_DRAW_HIDDEN 0x2 | 150 | #define VP_DRAW_HIDDEN 0x2 |
201 | #define VP_DRAW_WASHIDDEN 0x4 | 151 | #define VP_DRAW_WASHIDDEN 0x4 |
@@ -206,7 +156,6 @@ struct skin_line { | |||
206 | #define VP_INFO_LABEL 0x80 | 156 | #define VP_INFO_LABEL 0x80 |
207 | struct skin_viewport { | 157 | struct skin_viewport { |
208 | struct viewport vp; /* The LCD viewport struct */ | 158 | struct viewport vp; /* The LCD viewport struct */ |
209 | struct skin_line *lines; | ||
210 | char hidden_flags; | 159 | char hidden_flags; |
211 | char label; | 160 | char label; |
212 | unsigned start_fgcolour; | 161 | unsigned start_fgcolour; |
@@ -236,9 +185,6 @@ struct touchregion { | |||
236 | }; | 185 | }; |
237 | #endif | 186 | #endif |
238 | 187 | ||
239 | #define MAX_PLAYLISTLINE_TOKENS 16 | ||
240 | #define MAX_PLAYLISTLINE_STRINGS 8 | ||
241 | #define MAX_PLAYLISTLINE_STRLEN 8 | ||
242 | enum info_line_type { | 188 | enum info_line_type { |
243 | TRACK_HAS_INFO = 0, | 189 | TRACK_HAS_INFO = 0, |
244 | TRACK_HAS_NO_INFO | 190 | TRACK_HAS_NO_INFO |
@@ -250,36 +196,50 @@ struct playlistviewer { | |||
250 | #ifdef HAVE_TC_RAMCACHE | 196 | #ifdef HAVE_TC_RAMCACHE |
251 | struct mp3entry tempid3; | 197 | struct mp3entry tempid3; |
252 | #endif | 198 | #endif |
253 | struct { | 199 | struct skin_element *lines[2]; |
254 | enum wps_token_type tokens[MAX_PLAYLISTLINE_TOKENS]; | ||
255 | char strings[MAX_PLAYLISTLINE_STRINGS][MAX_PLAYLISTLINE_STRLEN]; | ||
256 | int count; | ||
257 | bool scroll; | ||
258 | } lines[2]; | ||
259 | }; | 200 | }; |
260 | 201 | ||
261 | 202 | ||
262 | #ifdef HAVE_ALBUMART | 203 | #ifdef HAVE_ALBUMART |
263 | struct skin_albumart { | 204 | struct skin_albumart { |
264 | /* Album art support */ | 205 | /* Album art support */ |
265 | struct viewport *vp;/* The viewport this is in */ | ||
266 | int x; | 206 | int x; |
267 | int y; | 207 | int y; |
268 | int width; | 208 | int width; |
269 | int height; | 209 | int height; |
270 | 210 | ||
271 | bool draw; | ||
272 | unsigned char xalign; /* WPS_ALBUMART_ALIGN_LEFT, _CENTER, _RIGHT */ | 211 | unsigned char xalign; /* WPS_ALBUMART_ALIGN_LEFT, _CENTER, _RIGHT */ |
273 | unsigned char yalign; /* WPS_ALBUMART_ALIGN_TOP, _CENTER, _BOTTOM */ | 212 | unsigned char yalign; /* WPS_ALBUMART_ALIGN_TOP, _CENTER, _BOTTOM */ |
274 | unsigned char state; /* WPS_ALBUMART_NONE, _CHECK, _LOAD */ | 213 | unsigned char state; /* WPS_ALBUMART_NONE, _CHECK, _LOAD */ |
214 | |||
215 | struct viewport *vp; | ||
216 | int draw_handle; | ||
275 | }; | 217 | }; |
276 | #endif | 218 | #endif |
277 | 219 | ||
220 | |||
221 | struct line { | ||
222 | int timeout; /* if inside a line alternator */ | ||
223 | unsigned update_mode; | ||
224 | }; | ||
225 | |||
226 | struct line_alternator { | ||
227 | int current_line; | ||
228 | unsigned long last_change_tick; | ||
229 | }; | ||
230 | |||
231 | struct conditional { | ||
232 | int last_value; | ||
233 | struct wps_token *token; | ||
234 | }; | ||
235 | |||
236 | |||
278 | /* wps_data | 237 | /* wps_data |
279 | this struct holds all necessary data which describes the | 238 | this struct holds all necessary data which describes the |
280 | viewable content of a wps */ | 239 | viewable content of a wps */ |
281 | struct wps_data | 240 | struct wps_data |
282 | { | 241 | { |
242 | struct skin_element *tree; | ||
283 | #ifdef HAVE_LCD_BITMAP | 243 | #ifdef HAVE_LCD_BITMAP |
284 | struct skin_token_list *images; | 244 | struct skin_token_list *images; |
285 | struct skin_token_list *progressbars; | 245 | struct skin_token_list *progressbars; |
@@ -291,16 +251,10 @@ struct wps_data | |||
291 | #ifdef HAVE_TOUCHSCREEN | 251 | #ifdef HAVE_TOUCHSCREEN |
292 | struct skin_token_list *touchregions; | 252 | struct skin_token_list *touchregions; |
293 | #endif | 253 | #endif |
294 | struct skin_token_list *viewports; | ||
295 | struct skin_token_list *strings; | ||
296 | #ifdef HAVE_ALBUMART | 254 | #ifdef HAVE_ALBUMART |
297 | struct skin_albumart *albumart; | 255 | struct skin_albumart *albumart; |
298 | int playback_aa_slot; | 256 | int playback_aa_slot; |
299 | #endif | 257 | #endif |
300 | struct wps_token *tokens; | ||
301 | /* Total number of tokens in the WPS. During WPS parsing, this is | ||
302 | the index of the token being parsed. */ | ||
303 | int num_tokens; | ||
304 | 258 | ||
305 | #ifdef HAVE_LCD_BITMAP | 259 | #ifdef HAVE_LCD_BITMAP |
306 | bool peak_meter_enabled; | 260 | bool peak_meter_enabled; |