Christi Scarborough | f8cc321 | 2005-11-17 20:20:01 +0000 | [diff] [blame] | 1 | /*************************************************************************** |
| 2 | * __________ __ ___. |
| 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
| 4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
| 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
| 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
| 7 | * \/ \/ \/ \/ \/ |
| 8 | * $Id$ |
| 9 | * |
Nicolas Pennequin | ab90d58 | 2007-04-04 14:41:40 +0000 | [diff] [blame] | 10 | * Copyright (C) 2007 Nicolas Pennequin |
Christi Scarborough | f8cc321 | 2005-11-17 20:20:01 +0000 | [diff] [blame] | 11 | * |
Daniel Stenberg | 2acc0ac | 2008-06-28 18:10:04 +0000 | [diff] [blame^] | 12 | * This program is free software; you can redistribute it and/or |
| 13 | * modify it under the terms of the GNU General Public License |
| 14 | * as published by the Free Software Foundation; either version 2 |
| 15 | * of the License, or (at your option) any later version. |
Christi Scarborough | f8cc321 | 2005-11-17 20:20:01 +0000 | [diff] [blame] | 16 | * |
| 17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
| 18 | * KIND, either express or implied. |
| 19 | * |
| 20 | ****************************************************************************/ |
| 21 | #ifndef _WPS_H |
| 22 | #define _WPS_H |
| 23 | |
| 24 | #include "screen_access.h" |
Kevin Ferrare | 0d9c7b5 | 2005-11-20 22:13:52 +0000 | [diff] [blame] | 25 | #include "statusbar.h" |
Christi Scarborough | f8cc321 | 2005-11-17 20:20:01 +0000 | [diff] [blame] | 26 | #include "id3.h" |
Christi Scarborough | f8cc321 | 2005-11-17 20:20:01 +0000 | [diff] [blame] | 27 | |
Christi Scarborough | f8cc321 | 2005-11-17 20:20:01 +0000 | [diff] [blame] | 28 | /* constants used in line_type and as refresh_mode for wps_refresh */ |
| 29 | #define WPS_REFRESH_STATIC 1 /* line doesn't change over time */ |
| 30 | #define WPS_REFRESH_DYNAMIC 2 /* line may change (e.g. time flag) */ |
| 31 | #define WPS_REFRESH_SCROLL 4 /* line scrolls */ |
| 32 | #define WPS_REFRESH_PLAYER_PROGRESS 8 /* line contains a progress bar */ |
| 33 | #define WPS_REFRESH_PEAK_METER 16 /* line contains a peak meter */ |
| 34 | #define WPS_REFRESH_ALL 0xff /* to refresh all line types */ |
| 35 | /* to refresh only those lines that change over time */ |
| 36 | #define WPS_REFRESH_NON_STATIC (WPS_REFRESH_ALL & ~WPS_REFRESH_STATIC & ~WPS_REFRESH_SCROLL) |
| 37 | |
| 38 | /* alignments */ |
| 39 | #define WPS_ALIGN_RIGHT 32 |
| 40 | #define WPS_ALIGN_CENTER 64 |
| 41 | #define WPS_ALIGN_LEFT 128 |
| 42 | |
Nicolas Pennequin | 9d4bed7 | 2007-11-11 12:29:37 +0000 | [diff] [blame] | 43 | #ifdef HAVE_ALBUMART |
| 44 | |
| 45 | /* albumart definitions */ |
| 46 | #define WPS_ALBUMART_NONE 0 /* WPS does not contain AA tag */ |
| 47 | #define WPS_ALBUMART_CHECK 1 /* WPS contains AA conditional tag */ |
| 48 | #define WPS_ALBUMART_LOAD 2 /* WPS contains AA tag */ |
| 49 | |
| 50 | #define WPS_ALBUMART_ALIGN_RIGHT WPS_ALIGN_RIGHT /* x align: right */ |
| 51 | #define WPS_ALBUMART_ALIGN_CENTER WPS_ALIGN_CENTER /* x/y align: center */ |
| 52 | #define WPS_ALBUMART_ALIGN_LEFT WPS_ALIGN_LEFT /* x align: left */ |
| 53 | #define WPS_ALBUMART_ALIGN_TOP WPS_ALIGN_RIGHT /* y align: top */ |
| 54 | #define WPS_ALBUMART_ALIGN_BOTTOM WPS_ALIGN_LEFT /* y align: bottom */ |
| 55 | #define WPS_ALBUMART_INCREASE 8 /* increase if smaller */ |
| 56 | #define WPS_ALBUMART_DECREASE 16 /* decrease if larger */ |
| 57 | |
| 58 | #endif /* HAVE_ALBUMART */ |
| 59 | |
Christi Scarborough | f8cc321 | 2005-11-17 20:20:01 +0000 | [diff] [blame] | 60 | /* wps_data*/ |
| 61 | |
| 62 | #ifdef HAVE_LCD_BITMAP |
| 63 | struct gui_img{ |
Linus Nielsen Feltzing | 745adad | 2006-01-28 12:12:42 +0000 | [diff] [blame] | 64 | struct bitmap bm; |
Dave Chapman | d02c79c | 2008-03-21 19:38:00 +0000 | [diff] [blame] | 65 | struct viewport* vp; /* The viewport to display this image in */ |
Nils Wallménius | f79bc56 | 2008-04-27 12:54:36 +0000 | [diff] [blame] | 66 | short int x; /* x-pos */ |
| 67 | short int y; /* y-pos */ |
| 68 | short int num_subimages; /* number of sub-images */ |
| 69 | short int subimage_height; /* height of each sub-image */ |
| 70 | short int display; /* -1 for no display, 0..n to display a subimage */ |
Christi Scarborough | f8cc321 | 2005-11-17 20:20:01 +0000 | [diff] [blame] | 71 | bool loaded; /* load state */ |
Christi Scarborough | f8cc321 | 2005-11-17 20:20:01 +0000 | [diff] [blame] | 72 | bool always_display; /* not using the preload/display mechanism */ |
| 73 | }; |
Ben Basha | e0622ab | 2006-02-10 13:57:11 +0000 | [diff] [blame] | 74 | |
Jonathan Gordon | 5a169bb | 2008-06-23 06:04:17 +0000 | [diff] [blame] | 75 | struct progressbar { |
| 76 | /* regular pb */ |
| 77 | short x; |
| 78 | short y; |
| 79 | short width; |
| 80 | short height; |
| 81 | /*progressbar image*/ |
Ben Basha | e0622ab | 2006-02-10 13:57:11 +0000 | [diff] [blame] | 82 | struct bitmap bm; |
| 83 | bool have_bitmap_pb; |
| 84 | }; |
Christi Scarborough | f8cc321 | 2005-11-17 20:20:01 +0000 | [diff] [blame] | 85 | #endif |
| 86 | |
| 87 | struct align_pos { |
| 88 | char* left; |
| 89 | char* center; |
| 90 | char* right; |
| 91 | }; |
| 92 | |
| 93 | #ifdef HAVE_LCD_BITMAP |
Nicolas Pennequin | ab90d58 | 2007-04-04 14:41:40 +0000 | [diff] [blame] | 94 | |
Christi Scarborough | f8cc321 | 2005-11-17 20:20:01 +0000 | [diff] [blame] | 95 | #define MAX_IMAGES (26*2) /* a-z and A-Z */ |
Jonathan Gordon | 5a169bb | 2008-06-23 06:04:17 +0000 | [diff] [blame] | 96 | #define MAX_PROGRESSBARS 3 |
Dave Chapman | aa9dbfe | 2008-04-04 12:32:37 +0000 | [diff] [blame] | 97 | |
| 98 | /* The image buffer is big enough to store one full-screen native bitmap, |
| 99 | plus two full-screen mono bitmaps. */ |
| 100 | |
Jens Arnold | ecdadcb | 2006-02-26 18:17:47 +0000 | [diff] [blame] | 101 | #define IMG_BUFSIZE ((LCD_HEIGHT*LCD_WIDTH*LCD_DEPTH/8) \ |
| 102 | + (2*LCD_HEIGHT*LCD_WIDTH/8)) |
Nicolas Pennequin | 07696c1 | 2007-04-08 04:01:06 +0000 | [diff] [blame] | 103 | |
Jonathan Gordon | 5a169bb | 2008-06-23 06:04:17 +0000 | [diff] [blame] | 104 | #define WPS_MAX_VIEWPORTS 24 |
Dave Chapman | 45b2d88 | 2008-03-22 00:31:22 +0000 | [diff] [blame] | 105 | #define WPS_MAX_LINES ((LCD_HEIGHT/5+1) * 2) |
Nicolas Pennequin | 07696c1 | 2007-04-08 04:01:06 +0000 | [diff] [blame] | 106 | #define WPS_MAX_SUBLINES (WPS_MAX_LINES*3) |
| 107 | #define WPS_MAX_TOKENS 1024 |
| 108 | #define WPS_MAX_STRINGS 128 |
Nicolas Pennequin | 2e1169b | 2007-04-15 02:59:34 +0000 | [diff] [blame] | 109 | #define STRING_BUFFER_SIZE 1024 |
Nicolas Pennequin | 07696c1 | 2007-04-08 04:01:06 +0000 | [diff] [blame] | 110 | #define WPS_MAX_COND_LEVEL 10 |
Nicolas Pennequin | ab90d58 | 2007-04-04 14:41:40 +0000 | [diff] [blame] | 111 | |
Christi Scarborough | f8cc321 | 2005-11-17 20:20:01 +0000 | [diff] [blame] | 112 | #else |
Nicolas Pennequin | ab90d58 | 2007-04-04 14:41:40 +0000 | [diff] [blame] | 113 | |
Dave Chapman | d02c79c | 2008-03-21 19:38:00 +0000 | [diff] [blame] | 114 | #define WPS_MAX_VIEWPORTS 2 |
Nicolas Pennequin | 07696c1 | 2007-04-08 04:01:06 +0000 | [diff] [blame] | 115 | #define WPS_MAX_LINES 2 |
| 116 | #define WPS_MAX_SUBLINES 12 |
| 117 | #define WPS_MAX_TOKENS 64 |
| 118 | #define WPS_MAX_STRINGS 32 |
| 119 | #define STRING_BUFFER_SIZE 64 |
| 120 | #define WPS_MAX_COND_LEVEL 5 |
Nicolas Pennequin | ab90d58 | 2007-04-04 14:41:40 +0000 | [diff] [blame] | 121 | |
Christi Scarborough | f8cc321 | 2005-11-17 20:20:01 +0000 | [diff] [blame] | 122 | #endif |
Nicolas Pennequin | ab90d58 | 2007-04-04 14:41:40 +0000 | [diff] [blame] | 123 | |
Christi Scarborough | f8cc321 | 2005-11-17 20:20:01 +0000 | [diff] [blame] | 124 | #define DEFAULT_SUBLINE_TIME_MULTIPLIER 20 /* (10ths of sec) */ |
| 125 | #define BASE_SUBLINE_TIME 10 /* base time that multiplier is applied to |
| 126 | (1/HZ sec, or 100ths of sec) */ |
| 127 | #define SUBLINE_RESET -1 |
| 128 | |
Nicolas Pennequin | ab90d58 | 2007-04-04 14:41:40 +0000 | [diff] [blame] | 129 | enum wps_token_type { |
| 130 | WPS_NO_TOKEN, /* for WPS tags we don't want to save as tokens */ |
| 131 | WPS_TOKEN_UNKNOWN, |
| 132 | |
| 133 | /* Markers */ |
| 134 | WPS_TOKEN_CHARACTER, |
| 135 | WPS_TOKEN_STRING, |
Nicolas Pennequin | ab90d58 | 2007-04-04 14:41:40 +0000 | [diff] [blame] | 136 | |
| 137 | /* Alignment */ |
| 138 | WPS_TOKEN_ALIGN_LEFT, |
| 139 | WPS_TOKEN_ALIGN_CENTER, |
| 140 | WPS_TOKEN_ALIGN_RIGHT, |
| 141 | |
Nicolas Pennequin | 07696c1 | 2007-04-08 04:01:06 +0000 | [diff] [blame] | 142 | /* Sublines */ |
Nicolas Pennequin | ab90d58 | 2007-04-04 14:41:40 +0000 | [diff] [blame] | 143 | WPS_TOKEN_SUBLINE_TIMEOUT, |
| 144 | |
| 145 | /* Battery */ |
| 146 | WPS_TOKEN_BATTERY_PERCENT, |
| 147 | WPS_TOKEN_BATTERY_VOLTS, |
| 148 | WPS_TOKEN_BATTERY_TIME, |
| 149 | WPS_TOKEN_BATTERY_CHARGER_CONNECTED, |
| 150 | WPS_TOKEN_BATTERY_CHARGING, |
| 151 | WPS_TOKEN_BATTERY_SLEEPTIME, |
| 152 | |
Nicolas Pennequin | ab90d58 | 2007-04-04 14:41:40 +0000 | [diff] [blame] | 153 | /* Sound */ |
Nicolas Pennequin | 830a3a4 | 2007-04-04 15:47:51 +0000 | [diff] [blame] | 154 | #if (CONFIG_CODEC != MAS3507D) |
Nicolas Pennequin | ab90d58 | 2007-04-04 14:41:40 +0000 | [diff] [blame] | 155 | WPS_TOKEN_SOUND_PITCH, |
Nicolas Pennequin | 830a3a4 | 2007-04-04 15:47:51 +0000 | [diff] [blame] | 156 | #endif |
| 157 | #if (CONFIG_CODEC == SWCODEC) |
Nicolas Pennequin | ab90d58 | 2007-04-04 14:41:40 +0000 | [diff] [blame] | 158 | WPS_TOKEN_REPLAYGAIN, |
Nicolas Pennequin | 27cbf6b | 2007-04-12 16:15:34 +0000 | [diff] [blame] | 159 | WPS_TOKEN_CROSSFADE, |
Nicolas Pennequin | ab90d58 | 2007-04-04 14:41:40 +0000 | [diff] [blame] | 160 | #endif |
| 161 | |
Nicolas Pennequin | ab90d58 | 2007-04-04 14:41:40 +0000 | [diff] [blame] | 162 | /* Time */ |
Nicolas Pennequin | 5cac461 | 2007-04-10 15:27:52 +0000 | [diff] [blame] | 163 | |
| 164 | /* The begin/end values allow us to know if a token is an RTC one. |
| 165 | New RTC tokens should be added between the markers. */ |
| 166 | |
| 167 | WPS_TOKENS_RTC_BEGIN, /* just the start marker, not an actual token */ |
| 168 | |
Nicolas Pennequin | ab90d58 | 2007-04-04 14:41:40 +0000 | [diff] [blame] | 169 | WPS_TOKEN_RTC_DAY_OF_MONTH, |
| 170 | WPS_TOKEN_RTC_DAY_OF_MONTH_BLANK_PADDED, |
Jonathan Gordon | 923cbe3 | 2007-11-27 01:41:59 +0000 | [diff] [blame] | 171 | WPS_TOKEN_RTC_12HOUR_CFG, |
Nicolas Pennequin | ab90d58 | 2007-04-04 14:41:40 +0000 | [diff] [blame] | 172 | WPS_TOKEN_RTC_HOUR_24_ZERO_PADDED, |
| 173 | WPS_TOKEN_RTC_HOUR_24, |
| 174 | WPS_TOKEN_RTC_HOUR_12_ZERO_PADDED, |
| 175 | WPS_TOKEN_RTC_HOUR_12, |
| 176 | WPS_TOKEN_RTC_MONTH, |
| 177 | WPS_TOKEN_RTC_MINUTE, |
| 178 | WPS_TOKEN_RTC_SECOND, |
| 179 | WPS_TOKEN_RTC_YEAR_2_DIGITS, |
| 180 | WPS_TOKEN_RTC_YEAR_4_DIGITS, |
| 181 | WPS_TOKEN_RTC_AM_PM_UPPER, |
| 182 | WPS_TOKEN_RTC_AM_PM_LOWER, |
| 183 | WPS_TOKEN_RTC_WEEKDAY_NAME, |
| 184 | WPS_TOKEN_RTC_MONTH_NAME, |
| 185 | WPS_TOKEN_RTC_DAY_OF_WEEK_START_MON, |
| 186 | WPS_TOKEN_RTC_DAY_OF_WEEK_START_SUN, |
Nicolas Pennequin | 5cac461 | 2007-04-10 15:27:52 +0000 | [diff] [blame] | 187 | |
| 188 | WPS_TOKENS_RTC_END, /* just the end marker, not an actual token */ |
Nicolas Pennequin | ab90d58 | 2007-04-04 14:41:40 +0000 | [diff] [blame] | 189 | |
| 190 | /* Conditional */ |
| 191 | WPS_TOKEN_CONDITIONAL, |
| 192 | WPS_TOKEN_CONDITIONAL_START, |
| 193 | WPS_TOKEN_CONDITIONAL_OPTION, |
| 194 | WPS_TOKEN_CONDITIONAL_END, |
| 195 | |
| 196 | /* Database */ |
Nicolas Pennequin | 31f7611 | 2007-11-14 22:02:41 +0000 | [diff] [blame] | 197 | #ifdef HAVE_TAGCACHE |
Nicolas Pennequin | ab90d58 | 2007-04-04 14:41:40 +0000 | [diff] [blame] | 198 | WPS_TOKEN_DATABASE_PLAYCOUNT, |
| 199 | WPS_TOKEN_DATABASE_RATING, |
Miika Pekkarinen | f53a8f8 | 2007-04-15 15:46:46 +0000 | [diff] [blame] | 200 | WPS_TOKEN_DATABASE_AUTOSCORE, |
Nicolas Pennequin | 31f7611 | 2007-11-14 22:02:41 +0000 | [diff] [blame] | 201 | #endif |
Nicolas Pennequin | ab90d58 | 2007-04-04 14:41:40 +0000 | [diff] [blame] | 202 | |
| 203 | /* File */ |
| 204 | WPS_TOKEN_FILE_BITRATE, |
| 205 | WPS_TOKEN_FILE_CODEC, |
| 206 | WPS_TOKEN_FILE_FREQUENCY, |
Nicolas Pennequin | 5cc98ef | 2007-05-21 13:41:43 +0000 | [diff] [blame] | 207 | WPS_TOKEN_FILE_FREQUENCY_KHZ, |
Nicolas Pennequin | ab90d58 | 2007-04-04 14:41:40 +0000 | [diff] [blame] | 208 | WPS_TOKEN_FILE_NAME, |
| 209 | WPS_TOKEN_FILE_NAME_WITH_EXTENSION, |
| 210 | WPS_TOKEN_FILE_PATH, |
| 211 | WPS_TOKEN_FILE_SIZE, |
| 212 | WPS_TOKEN_FILE_VBR, |
| 213 | WPS_TOKEN_FILE_DIRECTORY, |
| 214 | |
| 215 | #ifdef HAVE_LCD_BITMAP |
| 216 | /* Image */ |
| 217 | WPS_TOKEN_IMAGE_BACKDROP, |
| 218 | WPS_TOKEN_IMAGE_PROGRESS_BAR, |
| 219 | WPS_TOKEN_IMAGE_PRELOAD, |
| 220 | WPS_TOKEN_IMAGE_PRELOAD_DISPLAY, |
| 221 | WPS_TOKEN_IMAGE_DISPLAY, |
| 222 | #endif |
| 223 | |
Nicolas Pennequin | 9d4bed7 | 2007-11-11 12:29:37 +0000 | [diff] [blame] | 224 | #ifdef HAVE_ALBUMART |
| 225 | /* Albumart */ |
| 226 | WPS_TOKEN_ALBUMART_DISPLAY, |
| 227 | WPS_TOKEN_ALBUMART_FOUND, |
| 228 | #endif |
| 229 | |
Nicolas Pennequin | ab90d58 | 2007-04-04 14:41:40 +0000 | [diff] [blame] | 230 | /* Metadata */ |
| 231 | WPS_TOKEN_METADATA_ARTIST, |
| 232 | WPS_TOKEN_METADATA_COMPOSER, |
| 233 | WPS_TOKEN_METADATA_ALBUM_ARTIST, |
Dan Everton | eecfe9f | 2007-08-08 10:19:56 +0000 | [diff] [blame] | 234 | WPS_TOKEN_METADATA_GROUPING, |
Nicolas Pennequin | ab90d58 | 2007-04-04 14:41:40 +0000 | [diff] [blame] | 235 | WPS_TOKEN_METADATA_ALBUM, |
| 236 | WPS_TOKEN_METADATA_GENRE, |
Dan Everton | f4a61f0 | 2007-08-03 10:00:42 +0000 | [diff] [blame] | 237 | WPS_TOKEN_METADATA_DISC_NUMBER, |
Nicolas Pennequin | ab90d58 | 2007-04-04 14:41:40 +0000 | [diff] [blame] | 238 | WPS_TOKEN_METADATA_TRACK_NUMBER, |
| 239 | WPS_TOKEN_METADATA_TRACK_TITLE, |
| 240 | WPS_TOKEN_METADATA_VERSION, |
| 241 | WPS_TOKEN_METADATA_YEAR, |
| 242 | WPS_TOKEN_METADATA_COMMENT, |
| 243 | |
| 244 | /* Mode */ |
| 245 | WPS_TOKEN_REPEAT_MODE, |
| 246 | WPS_TOKEN_PLAYBACK_STATUS, |
| 247 | |
Nicolas Pennequin | ab90d58 | 2007-04-04 14:41:40 +0000 | [diff] [blame] | 248 | WPS_TOKEN_MAIN_HOLD, |
Marianne Arnold | 74aabc8 | 2007-06-25 20:54:11 +0000 | [diff] [blame] | 249 | |
Nicolas Pennequin | ab90d58 | 2007-04-04 14:41:40 +0000 | [diff] [blame] | 250 | #ifdef HAS_REMOTE_BUTTON_HOLD |
| 251 | WPS_TOKEN_REMOTE_HOLD, |
| 252 | #endif |
| 253 | |
| 254 | /* Progressbar */ |
| 255 | WPS_TOKEN_PROGRESSBAR, |
Nicolas Pennequin | 31f7611 | 2007-11-14 22:02:41 +0000 | [diff] [blame] | 256 | #ifdef HAVE_LCD_CHARCELLS |
Nicolas Pennequin | ab90d58 | 2007-04-04 14:41:40 +0000 | [diff] [blame] | 257 | WPS_TOKEN_PLAYER_PROGRESSBAR, |
Nicolas Pennequin | 31f7611 | 2007-11-14 22:02:41 +0000 | [diff] [blame] | 258 | #endif |
Nicolas Pennequin | ab90d58 | 2007-04-04 14:41:40 +0000 | [diff] [blame] | 259 | |
| 260 | #ifdef HAVE_LCD_BITMAP |
| 261 | /* Peakmeter */ |
| 262 | WPS_TOKEN_PEAKMETER, |
| 263 | #endif |
| 264 | |
| 265 | /* Volume level */ |
| 266 | WPS_TOKEN_VOLUME, |
| 267 | |
| 268 | /* Current track */ |
Nicolas Pennequin | 29407cb | 2007-07-25 14:14:47 +0000 | [diff] [blame] | 269 | WPS_TOKEN_TRACK_ELAPSED_PERCENT, |
Nicolas Pennequin | ab90d58 | 2007-04-04 14:41:40 +0000 | [diff] [blame] | 270 | WPS_TOKEN_TRACK_TIME_ELAPSED, |
| 271 | WPS_TOKEN_TRACK_TIME_REMAINING, |
| 272 | WPS_TOKEN_TRACK_LENGTH, |
| 273 | |
| 274 | /* Playlist */ |
| 275 | WPS_TOKEN_PLAYLIST_ENTRIES, |
| 276 | WPS_TOKEN_PLAYLIST_NAME, |
| 277 | WPS_TOKEN_PLAYLIST_POSITION, |
| 278 | WPS_TOKEN_PLAYLIST_SHUFFLE, |
| 279 | |
Nicolas Pennequin | ab90d58 | 2007-04-04 14:41:40 +0000 | [diff] [blame] | 280 | #if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD) |
| 281 | /* Virtual LED */ |
Jonathan Gordon | 5a169bb | 2008-06-23 06:04:17 +0000 | [diff] [blame] | 282 | WPS_TOKEN_VLED_HDD, |
Nicolas Pennequin | ab90d58 | 2007-04-04 14:41:40 +0000 | [diff] [blame] | 283 | #endif |
Jonathan Gordon | 5a169bb | 2008-06-23 06:04:17 +0000 | [diff] [blame] | 284 | |
| 285 | /* Viewport display */ |
| 286 | WPS_VIEWPORT_ENABLE |
Nicolas Pennequin | ab90d58 | 2007-04-04 14:41:40 +0000 | [diff] [blame] | 287 | }; |
| 288 | |
| 289 | struct wps_token { |
Nils Wallménius | f79bc56 | 2008-04-27 12:54:36 +0000 | [diff] [blame] | 290 | unsigned char type; /* enough to store the token type */ |
Nicolas Pennequin | 07696c1 | 2007-04-08 04:01:06 +0000 | [diff] [blame] | 291 | |
| 292 | /* Whether the tag (e.g. track name or the album) refers the |
| 293 | current or the next song (false=current, true=next) */ |
Nicolas Pennequin | ab90d58 | 2007-04-04 14:41:40 +0000 | [diff] [blame] | 294 | bool next; |
Nicolas Pennequin | 07696c1 | 2007-04-08 04:01:06 +0000 | [diff] [blame] | 295 | |
Nicolas Pennequin | ab90d58 | 2007-04-04 14:41:40 +0000 | [diff] [blame] | 296 | union { |
| 297 | char c; |
| 298 | unsigned short i; |
| 299 | } value; |
| 300 | }; |
| 301 | |
Nicolas Pennequin | 07696c1 | 2007-04-08 04:01:06 +0000 | [diff] [blame] | 302 | /* Description of a subline on the WPS */ |
| 303 | struct wps_subline { |
| 304 | |
| 305 | /* Index of the first token for this subline in the token array. |
| 306 | Tokens of this subline end where tokens for the next subline |
| 307 | begin. */ |
| 308 | unsigned short first_token_idx; |
| 309 | |
| 310 | /* Bit or'ed WPS_REFRESH_xxx */ |
| 311 | unsigned char line_type; |
| 312 | |
| 313 | /* How long the subline should be displayed, in 10ths of sec */ |
| 314 | unsigned char time_mult; |
| 315 | }; |
| 316 | |
| 317 | /* Description of a line on the WPS. A line is a set of sublines. |
| 318 | A subline is displayed for a certain amount of time. After that, |
| 319 | the next subline of the line is displayed. And so on. */ |
| 320 | struct wps_line { |
| 321 | |
| 322 | /* Number of sublines in this line */ |
| 323 | signed char num_sublines; |
| 324 | |
| 325 | /* Number (0-based) of the subline within this line currently being displayed */ |
| 326 | signed char curr_subline; |
| 327 | |
| 328 | /* Index of the first subline of this line in the subline array. |
| 329 | Sublines for this line end where sublines for the next line begin. */ |
| 330 | unsigned short first_subline_idx; |
| 331 | |
| 332 | /* When the next subline of this line should be displayed |
| 333 | (absolute time value in ticks) */ |
| 334 | long subline_expire_time; |
| 335 | }; |
| 336 | |
Jonathan Gordon | 5a169bb | 2008-06-23 06:04:17 +0000 | [diff] [blame] | 337 | #define VP_DRAW_HIDEABLE 0x1 |
| 338 | #define VP_DRAW_HIDDEN 0x2 |
| 339 | #define VP_DRAW_WASHIDDEN 0x4 |
Dave Chapman | d02c79c | 2008-03-21 19:38:00 +0000 | [diff] [blame] | 340 | struct wps_viewport { |
| 341 | struct viewport vp; /* The LCD viewport struct */ |
Jonathan Gordon | 5a169bb | 2008-06-23 06:04:17 +0000 | [diff] [blame] | 342 | struct progressbar *pb; |
Dave Chapman | 45b2d88 | 2008-03-22 00:31:22 +0000 | [diff] [blame] | 343 | /* Indexes of the first and last lines belonging to this viewport in the |
| 344 | lines[] array */ |
| 345 | int first_line, last_line; |
Jonathan Gordon | 5a169bb | 2008-06-23 06:04:17 +0000 | [diff] [blame] | 346 | char hidden_flags; |
| 347 | char label; |
Dave Chapman | d02c79c | 2008-03-21 19:38:00 +0000 | [diff] [blame] | 348 | }; |
Nicolas Pennequin | ab90d58 | 2007-04-04 14:41:40 +0000 | [diff] [blame] | 349 | |
Christi Scarborough | f8cc321 | 2005-11-17 20:20:01 +0000 | [diff] [blame] | 350 | /* wps_data |
Nicolas Pennequin | ab90d58 | 2007-04-04 14:41:40 +0000 | [diff] [blame] | 351 | this struct holds all necessary data which describes the |
Christi Scarborough | f8cc321 | 2005-11-17 20:20:01 +0000 | [diff] [blame] | 352 | viewable content of a wps */ |
| 353 | struct wps_data |
| 354 | { |
| 355 | #ifdef HAVE_LCD_BITMAP |
| 356 | struct gui_img img[MAX_IMAGES]; |
| 357 | unsigned char img_buf[IMG_BUFSIZE]; |
Magnus Holmgren | 1cce533 | 2005-12-07 20:42:06 +0000 | [diff] [blame] | 358 | unsigned char* img_buf_ptr; |
| 359 | int img_buf_free; |
Daniel Stenberg | 09fce70 | 2005-11-18 09:03:25 +0000 | [diff] [blame] | 360 | bool wps_sb_tag; |
| 361 | bool show_sb_on_wps; |
Nicolas Pennequin | ab90d58 | 2007-04-04 14:41:40 +0000 | [diff] [blame] | 362 | |
Jonathan Gordon | 5a169bb | 2008-06-23 06:04:17 +0000 | [diff] [blame] | 363 | struct progressbar progressbar[MAX_PROGRESSBARS]; |
| 364 | short progressbar_count; |
| 365 | |
Nicolas Pennequin | ab90d58 | 2007-04-04 14:41:40 +0000 | [diff] [blame] | 366 | bool peak_meter_enabled; |
Nicolas Pennequin | 9d4bed7 | 2007-11-11 12:29:37 +0000 | [diff] [blame] | 367 | |
| 368 | #ifdef HAVE_ALBUMART |
| 369 | /* Album art support */ |
| 370 | unsigned char wps_uses_albumart; /* WPS_ALBUMART_NONE, _CHECK, _LOAD */ |
| 371 | short albumart_x; |
| 372 | short albumart_y; |
| 373 | unsigned short albumart_xalign; /* WPS_ALBUMART_ALIGN_LEFT, _CENTER, _RIGHT, |
| 374 | + .._INCREASE, + .._DECREASE */ |
| 375 | unsigned short albumart_yalign; /* WPS_ALBUMART_ALIGN_TOP, _CENTER, _BOTTOM, |
| 376 | + .._INCREASE, + .._DECREASE */ |
| 377 | short albumart_max_width; |
| 378 | short albumart_max_height; |
Nicolas Pennequin | 81dedee | 2007-11-12 01:31:42 +0000 | [diff] [blame] | 379 | |
| 380 | int albumart_cond_index; |
Nicolas Pennequin | 9d4bed7 | 2007-11-11 12:29:37 +0000 | [diff] [blame] | 381 | #endif |
| 382 | |
Nicolas Pennequin | ab90d58 | 2007-04-04 14:41:40 +0000 | [diff] [blame] | 383 | #else /*HAVE_LCD_CHARCELLS */ |
Jens Arnold | 2684e36 | 2007-04-01 17:32:12 +0000 | [diff] [blame] | 384 | unsigned short wps_progress_pat[8]; |
Christi Scarborough | f8cc321 | 2005-11-17 20:20:01 +0000 | [diff] [blame] | 385 | bool full_line_progressbar; |
| 386 | #endif |
Nicolas Pennequin | 2a2b8d8 | 2007-04-25 13:09:56 +0000 | [diff] [blame] | 387 | |
| 388 | #ifdef HAVE_REMOTE_LCD |
| 389 | bool remote_wps; |
| 390 | #endif |
| 391 | |
Dave Chapman | 45b2d88 | 2008-03-22 00:31:22 +0000 | [diff] [blame] | 392 | /* Number of lines in the WPS. During WPS parsing, this is |
| 393 | the index of the line being parsed. */ |
| 394 | int num_lines; |
| 395 | |
Dave Chapman | d02c79c | 2008-03-21 19:38:00 +0000 | [diff] [blame] | 396 | /* Number of viewports in the WPS */ |
| 397 | int num_viewports; |
| 398 | struct wps_viewport viewports[WPS_MAX_VIEWPORTS]; |
Nicolas Pennequin | ab90d58 | 2007-04-04 14:41:40 +0000 | [diff] [blame] | 399 | |
Dave Chapman | 45b2d88 | 2008-03-22 00:31:22 +0000 | [diff] [blame] | 400 | struct wps_line lines[WPS_MAX_LINES]; |
| 401 | |
Nicolas Pennequin | 07696c1 | 2007-04-08 04:01:06 +0000 | [diff] [blame] | 402 | /* Total number of sublines in the WPS. During WPS parsing, this is |
| 403 | the index of the subline where the parsed tokens are added to. */ |
| 404 | int num_sublines; |
| 405 | struct wps_subline sublines[WPS_MAX_SUBLINES]; |
| 406 | |
| 407 | /* Total number of tokens in the WPS. During WPS parsing, this is |
| 408 | the index of the token being parsed. */ |
| 409 | int num_tokens; |
Nicolas Pennequin | ab90d58 | 2007-04-04 14:41:40 +0000 | [diff] [blame] | 410 | struct wps_token tokens[WPS_MAX_TOKENS]; |
Nicolas Pennequin | ab90d58 | 2007-04-04 14:41:40 +0000 | [diff] [blame] | 411 | |
| 412 | char string_buffer[STRING_BUFFER_SIZE]; |
| 413 | char *strings[WPS_MAX_STRINGS]; |
Nicolas Pennequin | 07696c1 | 2007-04-08 04:01:06 +0000 | [diff] [blame] | 414 | int num_strings; |
Nicolas Pennequin | ab90d58 | 2007-04-04 14:41:40 +0000 | [diff] [blame] | 415 | |
Christi Scarborough | f8cc321 | 2005-11-17 20:20:01 +0000 | [diff] [blame] | 416 | bool wps_loaded; |
Christi Scarborough | f8cc321 | 2005-11-17 20:20:01 +0000 | [diff] [blame] | 417 | }; |
| 418 | |
| 419 | /* initial setup of wps_data */ |
| 420 | void wps_data_init(struct wps_data *wps_data); |
| 421 | |
| 422 | /* to setup up the wps-data from a format-buffer (isfile = false) |
| 423 | from a (wps-)file (isfile = true)*/ |
Daniel Stenberg | 09fce70 | 2005-11-18 09:03:25 +0000 | [diff] [blame] | 424 | bool wps_data_load(struct wps_data *wps_data, |
Dave Chapman | d02c79c | 2008-03-21 19:38:00 +0000 | [diff] [blame] | 425 | struct screen *display, |
Daniel Stenberg | 09fce70 | 2005-11-18 09:03:25 +0000 | [diff] [blame] | 426 | const char *buf, |
Marcoen Hirschberg | 53a56c1 | 2005-12-09 01:11:14 +0000 | [diff] [blame] | 427 | bool isfile); |
Christi Scarborough | f8cc321 | 2005-11-17 20:20:01 +0000 | [diff] [blame] | 428 | |
Nicolas Pennequin | 07696c1 | 2007-04-08 04:01:06 +0000 | [diff] [blame] | 429 | /* Returns the index of the subline in the subline array |
| 430 | line - 0-based line number |
| 431 | subline - 0-based subline number within the line |
| 432 | */ |
Dave Chapman | 45b2d88 | 2008-03-22 00:31:22 +0000 | [diff] [blame] | 433 | int wps_subline_index(struct wps_data *wps_data, int line, int subline); |
Nicolas Pennequin | 07696c1 | 2007-04-08 04:01:06 +0000 | [diff] [blame] | 434 | |
| 435 | /* Returns the index of the first subline's token in the token array |
| 436 | line - 0-based line number |
| 437 | subline - 0-based subline number within the line |
| 438 | */ |
Dave Chapman | 45b2d88 | 2008-03-22 00:31:22 +0000 | [diff] [blame] | 439 | int wps_first_token_index(struct wps_data *data, int line, int subline); |
Nicolas Pennequin | 07696c1 | 2007-04-08 04:01:06 +0000 | [diff] [blame] | 440 | |
| 441 | /* Returns the index of the last subline's token in the token array. |
| 442 | line - 0-based line number |
| 443 | subline - 0-based subline number within the line |
| 444 | */ |
Dave Chapman | 45b2d88 | 2008-03-22 00:31:22 +0000 | [diff] [blame] | 445 | int wps_last_token_index(struct wps_data *data, int line, int subline); |
Nicolas Pennequin | 07696c1 | 2007-04-08 04:01:06 +0000 | [diff] [blame] | 446 | |
Christi Scarborough | f8cc321 | 2005-11-17 20:20:01 +0000 | [diff] [blame] | 447 | /* wps_data end */ |
| 448 | |
| 449 | /* wps_state |
| 450 | holds the data which belongs to the current played track, |
| 451 | the track which will be played afterwards, current path to the track |
| 452 | and some status infos */ |
| 453 | struct wps_state |
| 454 | { |
| 455 | bool ff_rewind; |
| 456 | bool paused; |
| 457 | int ff_rewind_count; |
| 458 | bool wps_time_countup; |
| 459 | struct mp3entry* id3; |
| 460 | struct mp3entry* nid3; |
Steve Bavin | 276ff3b | 2007-07-06 22:34:18 +0000 | [diff] [blame] | 461 | char current_track_path[MAX_PATH]; |
Christi Scarborough | f8cc321 | 2005-11-17 20:20:01 +0000 | [diff] [blame] | 462 | }; |
| 463 | |
Christi Scarborough | f8cc321 | 2005-11-17 20:20:01 +0000 | [diff] [blame] | 464 | |
| 465 | /* change the ff/rew-status |
Zakk Roberts | 15b2eef | 2006-04-02 10:41:16 +0000 | [diff] [blame] | 466 | if ff_rew = true then we are in skipping mode |
Christi Scarborough | f8cc321 | 2005-11-17 20:20:01 +0000 | [diff] [blame] | 467 | else we are in normal mode */ |
Nils Wallménius | 20338ca | 2006-12-13 11:52:21 +0000 | [diff] [blame] | 468 | /* void wps_state_update_ff_rew(bool ff_rew); Currently unused */ |
Christi Scarborough | f8cc321 | 2005-11-17 20:20:01 +0000 | [diff] [blame] | 469 | |
Christi Scarborough | f8cc321 | 2005-11-17 20:20:01 +0000 | [diff] [blame] | 470 | /* change the tag-information of the current played track |
| 471 | and the following track */ |
Nils Wallménius | 20338ca | 2006-12-13 11:52:21 +0000 | [diff] [blame] | 472 | /* void wps_state_update_id3_nid3(struct mp3entry *id3, struct mp3entry *nid3); Currently unused */ |
Christi Scarborough | f8cc321 | 2005-11-17 20:20:01 +0000 | [diff] [blame] | 473 | /* wps_state end*/ |
| 474 | |
| 475 | /* gui_wps |
Nicolas Pennequin | 07696c1 | 2007-04-08 04:01:06 +0000 | [diff] [blame] | 476 | defines a wps with its data, state, |
Christi Scarborough | f8cc321 | 2005-11-17 20:20:01 +0000 | [diff] [blame] | 477 | and the screen on which the wps-content should be drawn */ |
| 478 | struct gui_wps |
| 479 | { |
Nicolas Pennequin | 07696c1 | 2007-04-08 04:01:06 +0000 | [diff] [blame] | 480 | struct screen *display; |
Christi Scarborough | f8cc321 | 2005-11-17 20:20:01 +0000 | [diff] [blame] | 481 | struct wps_data *data; |
| 482 | struct wps_state *state; |
Kevin Ferrare | 0d9c7b5 | 2005-11-20 22:13:52 +0000 | [diff] [blame] | 483 | struct gui_statusbar *statusbar; |
Christi Scarborough | f8cc321 | 2005-11-17 20:20:01 +0000 | [diff] [blame] | 484 | }; |
| 485 | |
Christi Scarborough | f8cc321 | 2005-11-17 20:20:01 +0000 | [diff] [blame] | 486 | /* gui_wps end */ |
| 487 | |
Christi Scarborough | f8cc321 | 2005-11-17 20:20:01 +0000 | [diff] [blame] | 488 | long gui_wps_show(void); |
| 489 | |
| 490 | /* currently only on wps_state is needed */ |
| 491 | extern struct wps_state wps_state; |
Daniel Stenberg | 09fce70 | 2005-11-18 09:03:25 +0000 | [diff] [blame] | 492 | extern struct gui_wps gui_wps[NB_SCREENS]; |
Christi Scarborough | f8cc321 | 2005-11-17 20:20:01 +0000 | [diff] [blame] | 493 | |
| 494 | void gui_sync_wps_init(void); |
Christi Scarborough | f8cc321 | 2005-11-17 20:20:01 +0000 | [diff] [blame] | 495 | void gui_sync_wps_screen_init(void); |
| 496 | |
Nicolas Pennequin | 9d4bed7 | 2007-11-11 12:29:37 +0000 | [diff] [blame] | 497 | #ifdef HAVE_ALBUMART |
| 498 | /* gives back if WPS contains an albumart tag */ |
| 499 | bool gui_sync_wps_uses_albumart(void); |
| 500 | #endif |
| 501 | |
Christi Scarborough | f8cc321 | 2005-11-17 20:20:01 +0000 | [diff] [blame] | 502 | #endif |