diff options
Diffstat (limited to 'apps/gui/gwps.h')
-rw-r--r-- | apps/gui/gwps.h | 206 |
1 files changed, 192 insertions, 14 deletions
diff --git a/apps/gui/gwps.h b/apps/gui/gwps.h index 123bb8fa7c..c18fc0c4e3 100644 --- a/apps/gui/gwps.h +++ b/apps/gui/gwps.h | |||
@@ -7,7 +7,7 @@ | |||
7 | * \/ \/ \/ \/ \/ | 7 | * \/ \/ \/ \/ \/ |
8 | * $Id$ | 8 | * $Id$ |
9 | * | 9 | * |
10 | * Copyright (C) 2002 Jerome Kuptz | 10 | * Copyright (C) 2007 Nicolas Pennequin |
11 | * | 11 | * |
12 | * All files in this archive are subject to the GNU General Public License. | 12 | * All files in this archive are subject to the GNU General Public License. |
13 | * See the file COPYING in the source tree root for full license agreement. | 13 | * See the file COPYING in the source tree root for full license agreement. |
@@ -49,6 +49,9 @@ struct gui_img{ | |||
49 | bool loaded; /* load state */ | 49 | bool loaded; /* load state */ |
50 | bool display; /* is to be displayed */ | 50 | bool display; /* is to be displayed */ |
51 | bool always_display; /* not using the preload/display mechanism */ | 51 | bool always_display; /* not using the preload/display mechanism */ |
52 | |||
53 | /* the index of the conditional the image is in */ | ||
54 | unsigned short cond_index; | ||
52 | }; | 55 | }; |
53 | 56 | ||
54 | struct prog_img{ /*progressbar image*/ | 57 | struct prog_img{ /*progressbar image*/ |
@@ -64,23 +67,189 @@ struct align_pos { | |||
64 | }; | 67 | }; |
65 | 68 | ||
66 | #ifdef HAVE_LCD_BITMAP | 69 | #ifdef HAVE_LCD_BITMAP |
70 | |||
67 | #define MAX_IMAGES (26*2) /* a-z and A-Z */ | 71 | #define MAX_IMAGES (26*2) /* a-z and A-Z */ |
68 | #define IMG_BUFSIZE ((LCD_HEIGHT*LCD_WIDTH*LCD_DEPTH/8) \ | 72 | #define IMG_BUFSIZE ((LCD_HEIGHT*LCD_WIDTH*LCD_DEPTH/8) \ |
69 | + (2*LCD_HEIGHT*LCD_WIDTH/8)) | 73 | + (2*LCD_HEIGHT*LCD_WIDTH/8)) |
70 | #define WPS_MAX_LINES (LCD_HEIGHT/5+1) | 74 | #define WPS_MAX_LINES (LCD_HEIGHT/5+1) |
71 | #define FORMAT_BUFFER_SIZE 3072 | 75 | #define WPS_MAX_TOKENS 1024 |
76 | #define WPS_MAX_STRINGS 128 | ||
77 | #define STRING_BUFFER_SIZE 512 | ||
78 | #define WPS_MAX_COND_LEVEL 10 | ||
79 | |||
72 | #else | 80 | #else |
81 | |||
73 | #define WPS_MAX_LINES 2 | 82 | #define WPS_MAX_LINES 2 |
74 | #define FORMAT_BUFFER_SIZE 400 | 83 | #define WPS_MAX_TOKENS 64 |
84 | #define WPS_MAX_STRINGS 32 | ||
85 | #define STRING_BUFFER_SIZE 64 | ||
86 | #define WPS_MAX_COND_LEVEL 5 | ||
87 | |||
75 | #endif | 88 | #endif |
89 | |||
76 | #define WPS_MAX_SUBLINES 12 | 90 | #define WPS_MAX_SUBLINES 12 |
77 | #define DEFAULT_SUBLINE_TIME_MULTIPLIER 20 /* (10ths of sec) */ | 91 | #define DEFAULT_SUBLINE_TIME_MULTIPLIER 20 /* (10ths of sec) */ |
78 | #define BASE_SUBLINE_TIME 10 /* base time that multiplier is applied to | 92 | #define BASE_SUBLINE_TIME 10 /* base time that multiplier is applied to |
79 | (1/HZ sec, or 100ths of sec) */ | 93 | (1/HZ sec, or 100ths of sec) */ |
80 | #define SUBLINE_RESET -1 | 94 | #define SUBLINE_RESET -1 |
81 | 95 | ||
96 | enum wps_token_type { | ||
97 | WPS_NO_TOKEN, /* for WPS tags we don't want to save as tokens */ | ||
98 | WPS_TOKEN_UNKNOWN, | ||
99 | |||
100 | /* Markers */ | ||
101 | WPS_TOKEN_CHARACTER, | ||
102 | WPS_TOKEN_STRING, | ||
103 | WPS_TOKEN_EOL, | ||
104 | |||
105 | /* Alignment */ | ||
106 | WPS_TOKEN_ALIGN_LEFT, | ||
107 | WPS_TOKEN_ALIGN_CENTER, | ||
108 | WPS_TOKEN_ALIGN_RIGHT, | ||
109 | |||
110 | /* Scrolling */ | ||
111 | WPS_TOKEN_SCROLL, | ||
112 | |||
113 | /* Alternating sublines */ | ||
114 | WPS_TOKEN_SUBLINE_SEPARATOR, | ||
115 | WPS_TOKEN_SUBLINE_TIMEOUT, | ||
116 | |||
117 | /* Battery */ | ||
118 | WPS_TOKEN_BATTERY_PERCENT, | ||
119 | WPS_TOKEN_BATTERY_VOLTS, | ||
120 | WPS_TOKEN_BATTERY_TIME, | ||
121 | WPS_TOKEN_BATTERY_CHARGER_CONNECTED, | ||
122 | WPS_TOKEN_BATTERY_CHARGING, | ||
123 | WPS_TOKEN_BATTERY_SLEEPTIME, | ||
124 | |||
125 | #if (CONFIG_CODEC == SWCODEC) | ||
126 | /* Sound */ | ||
127 | WPS_TOKEN_SOUND_PITCH, | ||
128 | WPS_TOKEN_REPLAYGAIN, | ||
129 | #endif | ||
130 | |||
131 | #if CONFIG_RTC | ||
132 | /* Time */ | ||
133 | WPS_TOKEN_RTC, | ||
134 | WPS_TOKEN_RTC_DAY_OF_MONTH, | ||
135 | WPS_TOKEN_RTC_DAY_OF_MONTH_BLANK_PADDED, | ||
136 | WPS_TOKEN_RTC_HOUR_24_ZERO_PADDED, | ||
137 | WPS_TOKEN_RTC_HOUR_24, | ||
138 | WPS_TOKEN_RTC_HOUR_12_ZERO_PADDED, | ||
139 | WPS_TOKEN_RTC_HOUR_12, | ||
140 | WPS_TOKEN_RTC_MONTH, | ||
141 | WPS_TOKEN_RTC_MINUTE, | ||
142 | WPS_TOKEN_RTC_SECOND, | ||
143 | WPS_TOKEN_RTC_YEAR_2_DIGITS, | ||
144 | WPS_TOKEN_RTC_YEAR_4_DIGITS, | ||
145 | WPS_TOKEN_RTC_AM_PM_UPPER, | ||
146 | WPS_TOKEN_RTC_AM_PM_LOWER, | ||
147 | WPS_TOKEN_RTC_WEEKDAY_NAME, | ||
148 | WPS_TOKEN_RTC_MONTH_NAME, | ||
149 | WPS_TOKEN_RTC_DAY_OF_WEEK_START_MON, | ||
150 | WPS_TOKEN_RTC_DAY_OF_WEEK_START_SUN, | ||
151 | #endif | ||
152 | |||
153 | /* Conditional */ | ||
154 | WPS_TOKEN_CONDITIONAL, | ||
155 | WPS_TOKEN_CONDITIONAL_START, | ||
156 | WPS_TOKEN_CONDITIONAL_OPTION, | ||
157 | WPS_TOKEN_CONDITIONAL_END, | ||
158 | |||
159 | /* Database */ | ||
160 | WPS_TOKEN_DATABASE_PLAYCOUNT, | ||
161 | WPS_TOKEN_DATABASE_RATING, | ||
162 | |||
163 | /* File */ | ||
164 | WPS_TOKEN_FILE_BITRATE, | ||
165 | WPS_TOKEN_FILE_CODEC, | ||
166 | WPS_TOKEN_FILE_FREQUENCY, | ||
167 | WPS_TOKEN_FILE_NAME, | ||
168 | WPS_TOKEN_FILE_NAME_WITH_EXTENSION, | ||
169 | WPS_TOKEN_FILE_PATH, | ||
170 | WPS_TOKEN_FILE_SIZE, | ||
171 | WPS_TOKEN_FILE_VBR, | ||
172 | WPS_TOKEN_FILE_DIRECTORY, | ||
173 | |||
174 | #ifdef HAVE_LCD_BITMAP | ||
175 | /* Image */ | ||
176 | WPS_TOKEN_IMAGE_BACKDROP, | ||
177 | WPS_TOKEN_IMAGE_PROGRESS_BAR, | ||
178 | WPS_TOKEN_IMAGE_PRELOAD, | ||
179 | WPS_TOKEN_IMAGE_PRELOAD_DISPLAY, | ||
180 | WPS_TOKEN_IMAGE_DISPLAY, | ||
181 | #endif | ||
182 | |||
183 | /* Metadata */ | ||
184 | WPS_TOKEN_METADATA_ARTIST, | ||
185 | WPS_TOKEN_METADATA_COMPOSER, | ||
186 | WPS_TOKEN_METADATA_ALBUM_ARTIST, | ||
187 | WPS_TOKEN_METADATA_ALBUM, | ||
188 | WPS_TOKEN_METADATA_GENRE, | ||
189 | WPS_TOKEN_METADATA_TRACK_NUMBER, | ||
190 | WPS_TOKEN_METADATA_TRACK_TITLE, | ||
191 | WPS_TOKEN_METADATA_VERSION, | ||
192 | WPS_TOKEN_METADATA_YEAR, | ||
193 | WPS_TOKEN_METADATA_COMMENT, | ||
194 | |||
195 | /* Mode */ | ||
196 | WPS_TOKEN_REPEAT_MODE, | ||
197 | WPS_TOKEN_PLAYBACK_STATUS, | ||
198 | |||
199 | #ifdef HAS_BUTTON_HOLD | ||
200 | WPS_TOKEN_MAIN_HOLD, | ||
201 | #endif | ||
202 | #ifdef HAS_REMOTE_BUTTON_HOLD | ||
203 | WPS_TOKEN_REMOTE_HOLD, | ||
204 | #endif | ||
205 | |||
206 | /* Progressbar */ | ||
207 | WPS_TOKEN_PROGRESSBAR, | ||
208 | WPS_TOKEN_PLAYER_PROGRESSBAR, | ||
209 | |||
210 | #ifdef HAVE_LCD_BITMAP | ||
211 | /* Peakmeter */ | ||
212 | WPS_TOKEN_PEAKMETER, | ||
213 | #endif | ||
214 | |||
215 | /* Volume level */ | ||
216 | WPS_TOKEN_VOLUME, | ||
217 | |||
218 | /* Current track */ | ||
219 | WPS_TOKEN_TRACK_TIME_ELAPSED, | ||
220 | WPS_TOKEN_TRACK_TIME_REMAINING, | ||
221 | WPS_TOKEN_TRACK_LENGTH, | ||
222 | |||
223 | /* Playlist */ | ||
224 | WPS_TOKEN_PLAYLIST_ENTRIES, | ||
225 | WPS_TOKEN_PLAYLIST_NAME, | ||
226 | WPS_TOKEN_PLAYLIST_POSITION, | ||
227 | WPS_TOKEN_PLAYLIST_SHUFFLE, | ||
228 | |||
229 | #ifdef HAVE_LCD_BITMAP | ||
230 | /* Statusbar */ | ||
231 | WPS_TOKEN_STATUSBAR_ENABLED, | ||
232 | WPS_TOKEN_STATUSBAR_DISABLED, | ||
233 | #endif | ||
234 | |||
235 | #if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD) | ||
236 | /* Virtual LED */ | ||
237 | WPS_TOKEN_VLED_HDD | ||
238 | #endif | ||
239 | }; | ||
240 | |||
241 | struct wps_token { | ||
242 | enum wps_token_type type; | ||
243 | bool next; | ||
244 | union { | ||
245 | char c; | ||
246 | unsigned short i; | ||
247 | } value; | ||
248 | }; | ||
249 | |||
250 | |||
82 | /* wps_data | 251 | /* wps_data |
83 | this struct old all necessary data which describes the | 252 | this struct holds all necessary data which describes the |
84 | viewable content of a wps */ | 253 | viewable content of a wps */ |
85 | struct wps_data | 254 | struct wps_data |
86 | { | 255 | { |
@@ -92,23 +261,32 @@ struct wps_data | |||
92 | int img_buf_free; | 261 | int img_buf_free; |
93 | bool wps_sb_tag; | 262 | bool wps_sb_tag; |
94 | bool show_sb_on_wps; | 263 | bool show_sb_on_wps; |
95 | #endif | 264 | |
96 | #ifdef HAVE_LCD_CHARCELLS | 265 | short progress_top; |
266 | short progress_height; | ||
267 | short progress_start; | ||
268 | short progress_end; | ||
269 | bool peak_meter_enabled; | ||
270 | #else /*HAVE_LCD_CHARCELLS */ | ||
97 | unsigned short wps_progress_pat[8]; | 271 | unsigned short wps_progress_pat[8]; |
98 | bool full_line_progressbar; | 272 | bool full_line_progressbar; |
99 | #endif | 273 | #endif |
100 | char format_buffer[FORMAT_BUFFER_SIZE]; | 274 | unsigned short format_lines[WPS_MAX_LINES][WPS_MAX_SUBLINES]; |
101 | char* format_lines[WPS_MAX_LINES][WPS_MAX_SUBLINES]; | 275 | unsigned char num_lines; |
102 | unsigned char line_type[WPS_MAX_LINES][WPS_MAX_SUBLINES]; | 276 | unsigned char line_type[WPS_MAX_LINES][WPS_MAX_SUBLINES]; |
103 | unsigned short time_mult[WPS_MAX_LINES][WPS_MAX_SUBLINES]; | 277 | unsigned short time_mult[WPS_MAX_LINES][WPS_MAX_SUBLINES]; |
104 | long subline_expire_time[WPS_MAX_LINES]; | 278 | long subline_expire_time[WPS_MAX_LINES]; |
105 | int curr_subline[WPS_MAX_LINES]; | 279 | short curr_subline[WPS_MAX_LINES]; |
106 | int progress_top; | 280 | unsigned char num_sublines[WPS_MAX_LINES]; |
107 | int progress_height; | 281 | |
108 | int progress_start; | 282 | struct wps_token tokens[WPS_MAX_TOKENS]; |
109 | int progress_end; | 283 | unsigned short num_tokens; |
284 | |||
285 | char string_buffer[STRING_BUFFER_SIZE]; | ||
286 | char *strings[WPS_MAX_STRINGS]; | ||
287 | unsigned char num_strings; | ||
288 | |||
110 | bool wps_loaded; | 289 | bool wps_loaded; |
111 | bool peak_meter_enabled; | ||
112 | }; | 290 | }; |
113 | 291 | ||
114 | /* initial setup of wps_data */ | 292 | /* initial setup of wps_data */ |