diff options
Diffstat (limited to 'apps/gui/gwps.h')
-rw-r--r-- | apps/gui/gwps.h | 122 |
1 files changed, 87 insertions, 35 deletions
diff --git a/apps/gui/gwps.h b/apps/gui/gwps.h index 02a83085b9..f012b3b304 100644 --- a/apps/gui/gwps.h +++ b/apps/gui/gwps.h | |||
@@ -71,23 +71,25 @@ struct align_pos { | |||
71 | #define MAX_IMAGES (26*2) /* a-z and A-Z */ | 71 | #define MAX_IMAGES (26*2) /* a-z and A-Z */ |
72 | #define IMG_BUFSIZE ((LCD_HEIGHT*LCD_WIDTH*LCD_DEPTH/8) \ | 72 | #define IMG_BUFSIZE ((LCD_HEIGHT*LCD_WIDTH*LCD_DEPTH/8) \ |
73 | + (2*LCD_HEIGHT*LCD_WIDTH/8)) | 73 | + (2*LCD_HEIGHT*LCD_WIDTH/8)) |
74 | #define WPS_MAX_LINES (LCD_HEIGHT/5+1) | 74 | |
75 | #define WPS_MAX_TOKENS 1024 | 75 | #define WPS_MAX_LINES (LCD_HEIGHT/5+1) |
76 | #define WPS_MAX_STRINGS 128 | 76 | #define WPS_MAX_SUBLINES (WPS_MAX_LINES*3) |
77 | #define STRING_BUFFER_SIZE 512 | 77 | #define WPS_MAX_TOKENS 1024 |
78 | #define WPS_MAX_COND_LEVEL 10 | 78 | #define WPS_MAX_STRINGS 128 |
79 | #define STRING_BUFFER_SIZE 512 | ||
80 | #define WPS_MAX_COND_LEVEL 10 | ||
79 | 81 | ||
80 | #else | 82 | #else |
81 | 83 | ||
82 | #define WPS_MAX_LINES 2 | 84 | #define WPS_MAX_LINES 2 |
83 | #define WPS_MAX_TOKENS 64 | 85 | #define WPS_MAX_SUBLINES 12 |
84 | #define WPS_MAX_STRINGS 32 | 86 | #define WPS_MAX_TOKENS 64 |
85 | #define STRING_BUFFER_SIZE 64 | 87 | #define WPS_MAX_STRINGS 32 |
86 | #define WPS_MAX_COND_LEVEL 5 | 88 | #define STRING_BUFFER_SIZE 64 |
89 | #define WPS_MAX_COND_LEVEL 5 | ||
87 | 90 | ||
88 | #endif | 91 | #endif |
89 | 92 | ||
90 | #define WPS_MAX_SUBLINES 12 | ||
91 | #define DEFAULT_SUBLINE_TIME_MULTIPLIER 20 /* (10ths of sec) */ | 93 | #define DEFAULT_SUBLINE_TIME_MULTIPLIER 20 /* (10ths of sec) */ |
92 | #define BASE_SUBLINE_TIME 10 /* base time that multiplier is applied to | 94 | #define BASE_SUBLINE_TIME 10 /* base time that multiplier is applied to |
93 | (1/HZ sec, or 100ths of sec) */ | 95 | (1/HZ sec, or 100ths of sec) */ |
@@ -100,18 +102,13 @@ enum wps_token_type { | |||
100 | /* Markers */ | 102 | /* Markers */ |
101 | WPS_TOKEN_CHARACTER, | 103 | WPS_TOKEN_CHARACTER, |
102 | WPS_TOKEN_STRING, | 104 | WPS_TOKEN_STRING, |
103 | WPS_TOKEN_EOL, | ||
104 | 105 | ||
105 | /* Alignment */ | 106 | /* Alignment */ |
106 | WPS_TOKEN_ALIGN_LEFT, | 107 | WPS_TOKEN_ALIGN_LEFT, |
107 | WPS_TOKEN_ALIGN_CENTER, | 108 | WPS_TOKEN_ALIGN_CENTER, |
108 | WPS_TOKEN_ALIGN_RIGHT, | 109 | WPS_TOKEN_ALIGN_RIGHT, |
109 | 110 | ||
110 | /* Scrolling */ | 111 | /* Sublines */ |
111 | WPS_TOKEN_SCROLL, | ||
112 | |||
113 | /* Alternating sublines */ | ||
114 | WPS_TOKEN_SUBLINE_SEPARATOR, | ||
115 | WPS_TOKEN_SUBLINE_TIMEOUT, | 112 | WPS_TOKEN_SUBLINE_TIMEOUT, |
116 | 113 | ||
117 | /* Battery */ | 114 | /* Battery */ |
@@ -228,12 +225,6 @@ enum wps_token_type { | |||
228 | WPS_TOKEN_PLAYLIST_POSITION, | 225 | WPS_TOKEN_PLAYLIST_POSITION, |
229 | WPS_TOKEN_PLAYLIST_SHUFFLE, | 226 | WPS_TOKEN_PLAYLIST_SHUFFLE, |
230 | 227 | ||
231 | #ifdef HAVE_LCD_BITMAP | ||
232 | /* Statusbar */ | ||
233 | WPS_TOKEN_STATUSBAR_ENABLED, | ||
234 | WPS_TOKEN_STATUSBAR_DISABLED, | ||
235 | #endif | ||
236 | |||
237 | #if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD) | 228 | #if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD) |
238 | /* Virtual LED */ | 229 | /* Virtual LED */ |
239 | WPS_TOKEN_VLED_HDD | 230 | WPS_TOKEN_VLED_HDD |
@@ -242,13 +233,52 @@ enum wps_token_type { | |||
242 | 233 | ||
243 | struct wps_token { | 234 | struct wps_token { |
244 | enum wps_token_type type; | 235 | enum wps_token_type type; |
236 | |||
237 | /* Whether the tag (e.g. track name or the album) refers the | ||
238 | current or the next song (false=current, true=next) */ | ||
245 | bool next; | 239 | bool next; |
240 | |||
246 | union { | 241 | union { |
247 | char c; | 242 | char c; |
248 | unsigned short i; | 243 | unsigned short i; |
249 | } value; | 244 | } value; |
250 | }; | 245 | }; |
251 | 246 | ||
247 | /* Description of a subline on the WPS */ | ||
248 | struct wps_subline { | ||
249 | |||
250 | /* Index of the first token for this subline in the token array. | ||
251 | Tokens of this subline end where tokens for the next subline | ||
252 | begin. */ | ||
253 | unsigned short first_token_idx; | ||
254 | |||
255 | /* Bit or'ed WPS_REFRESH_xxx */ | ||
256 | unsigned char line_type; | ||
257 | |||
258 | /* How long the subline should be displayed, in 10ths of sec */ | ||
259 | unsigned char time_mult; | ||
260 | }; | ||
261 | |||
262 | /* Description of a line on the WPS. A line is a set of sublines. | ||
263 | A subline is displayed for a certain amount of time. After that, | ||
264 | the next subline of the line is displayed. And so on. */ | ||
265 | struct wps_line { | ||
266 | |||
267 | /* Number of sublines in this line */ | ||
268 | signed char num_sublines; | ||
269 | |||
270 | /* Number (0-based) of the subline within this line currently being displayed */ | ||
271 | signed char curr_subline; | ||
272 | |||
273 | /* Index of the first subline of this line in the subline array. | ||
274 | Sublines for this line end where sublines for the next line begin. */ | ||
275 | unsigned short first_subline_idx; | ||
276 | |||
277 | /* When the next subline of this line should be displayed | ||
278 | (absolute time value in ticks) */ | ||
279 | long subline_expire_time; | ||
280 | }; | ||
281 | |||
252 | 282 | ||
253 | /* wps_data | 283 | /* wps_data |
254 | this struct holds all necessary data which describes the | 284 | this struct holds all necessary data which describes the |
@@ -273,20 +303,24 @@ struct wps_data | |||
273 | unsigned short wps_progress_pat[8]; | 303 | unsigned short wps_progress_pat[8]; |
274 | bool full_line_progressbar; | 304 | bool full_line_progressbar; |
275 | #endif | 305 | #endif |
276 | unsigned short format_lines[WPS_MAX_LINES][WPS_MAX_SUBLINES]; | 306 | /* Number of lines in the WPS. During WPS parsing, this is |
277 | unsigned char num_lines; | 307 | the index of the line being parsed. */ |
278 | unsigned char line_type[WPS_MAX_LINES][WPS_MAX_SUBLINES]; | 308 | int num_lines; |
279 | unsigned short time_mult[WPS_MAX_LINES][WPS_MAX_SUBLINES]; | 309 | struct wps_line lines[WPS_MAX_LINES]; |
280 | long subline_expire_time[WPS_MAX_LINES]; | 310 | |
281 | short curr_subline[WPS_MAX_LINES]; | 311 | /* Total number of sublines in the WPS. During WPS parsing, this is |
282 | unsigned char num_sublines[WPS_MAX_LINES]; | 312 | the index of the subline where the parsed tokens are added to. */ |
283 | 313 | int num_sublines; | |
314 | struct wps_subline sublines[WPS_MAX_SUBLINES]; | ||
315 | |||
316 | /* Total number of tokens in the WPS. During WPS parsing, this is | ||
317 | the index of the token being parsed. */ | ||
318 | int num_tokens; | ||
284 | struct wps_token tokens[WPS_MAX_TOKENS]; | 319 | struct wps_token tokens[WPS_MAX_TOKENS]; |
285 | unsigned short num_tokens; | ||
286 | 320 | ||
287 | char string_buffer[STRING_BUFFER_SIZE]; | 321 | char string_buffer[STRING_BUFFER_SIZE]; |
288 | char *strings[WPS_MAX_STRINGS]; | 322 | char *strings[WPS_MAX_STRINGS]; |
289 | unsigned char num_strings; | 323 | int num_strings; |
290 | 324 | ||
291 | bool wps_loaded; | 325 | bool wps_loaded; |
292 | }; | 326 | }; |
@@ -300,6 +334,24 @@ bool wps_data_load(struct wps_data *wps_data, | |||
300 | const char *buf, | 334 | const char *buf, |
301 | bool isfile); | 335 | bool isfile); |
302 | 336 | ||
337 | /* Returns the index of the subline in the subline array | ||
338 | line - 0-based line number | ||
339 | subline - 0-based subline number within the line | ||
340 | */ | ||
341 | int wps_subline_index(struct wps_data *wps_data, int line, int subline); | ||
342 | |||
343 | /* Returns the index of the first subline's token in the token array | ||
344 | line - 0-based line number | ||
345 | subline - 0-based subline number within the line | ||
346 | */ | ||
347 | int wps_first_token_index(struct wps_data *data, int line, int subline); | ||
348 | |||
349 | /* Returns the index of the last subline's token in the token array. | ||
350 | line - 0-based line number | ||
351 | subline - 0-based subline number within the line | ||
352 | */ | ||
353 | int wps_last_token_index(struct wps_data *data, int line, int subline); | ||
354 | |||
303 | /* wps_data end */ | 355 | /* wps_data end */ |
304 | 356 | ||
305 | /* wps_state | 357 | /* wps_state |
@@ -329,11 +381,11 @@ struct wps_state | |||
329 | /* wps_state end*/ | 381 | /* wps_state end*/ |
330 | 382 | ||
331 | /* gui_wps | 383 | /* gui_wps |
332 | defines a wps with it's data, state, | 384 | defines a wps with its data, state, |
333 | and the screen on which the wps-content should be drawn */ | 385 | and the screen on which the wps-content should be drawn */ |
334 | struct gui_wps | 386 | struct gui_wps |
335 | { | 387 | { |
336 | struct screen * display; | 388 | struct screen *display; |
337 | struct wps_data *data; | 389 | struct wps_data *data; |
338 | struct wps_state *state; | 390 | struct wps_state *state; |
339 | struct gui_statusbar *statusbar; | 391 | struct gui_statusbar *statusbar; |