blob: 149f148cca86e8548bf9b147116d85fbb06ca03c [file] [log] [blame]
Robert Bieberd5b24dd2010-05-25 15:19:52 +00001/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2010 Robert Bieber
11 *
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.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22#ifndef TAG_TABLE_H
23#define TAG_TABLE_H
24
Robert Bieber0769fc52010-05-25 22:24:08 +000025#ifdef __cplusplus
26extern "C"
27{
Robert Bieber0769fc52010-05-25 22:24:08 +000028#endif
29
Robert Bieber32ff4e92010-07-04 01:39:57 +000030 /* Flag to tell the renderer not to insert a line break */
31#define NOBREAK 0x1
32
Robert Bieber0769fc52010-05-25 22:24:08 +000033
Robert Bieber48198822010-05-30 05:51:50 +000034enum skin_token_type {
35
Robert Bieber48198822010-05-30 05:51:50 +000036 SKIN_TOKEN_UNKNOWN,
37
38 /* Markers */
39 SKIN_TOKEN_CHARACTER,
40 SKIN_TOKEN_STRING,
41 SKIN_TOKEN_TRANSLATEDSTRING,
42
43 /* Alignment */
44 SKIN_TOKEN_ALIGN_LEFT,
45 SKIN_TOKEN_ALIGN_LEFT_RTL,
46 SKIN_TOKEN_ALIGN_CENTER,
47 SKIN_TOKEN_ALIGN_RIGHT,
48 SKIN_TOKEN_ALIGN_RIGHT_RTL,
49 SKIN_TOKEN_ALIGN_LANGDIRECTION,
50
51
52 /* Sublines */
53 SKIN_TOKEN_SUBLINE_TIMEOUT,
54 SKIN_TOKEN_SUBLINE_SCROLL,
55
56 /* Conditional */
57 SKIN_TOKEN_CONDITIONAL,
58 SKIN_TOKEN_CONDITIONAL_START,
59 SKIN_TOKEN_CONDITIONAL_OPTION,
60 SKIN_TOKEN_CONDITIONAL_END,
61
62 /* Viewport display */
63 SKIN_TOKEN_VIEWPORT_LOAD,
64 SKIN_TOKEN_VIEWPORT_CONDITIONAL,
65 SKIN_TOKEN_VIEWPORT_ENABLE,
66 SKIN_TOKEN_VIEWPORT_CUSTOMLIST,
67 SKIN_TOKEN_UIVIEWPORT_ENABLE,
68 SKIN_TOKEN_UIVIEWPORT_LOAD,
Jonathan Gordon9f2bd982010-06-07 10:45:15 +000069 SKIN_TOKEN_VIEWPORT_FGCOLOUR,
70 SKIN_TOKEN_VIEWPORT_BGCOLOUR,
Robert Bieber48198822010-05-30 05:51:50 +000071
72 /* Battery */
Robert Bieber48198822010-05-30 05:51:50 +000073 SKIN_TOKEN_BATTERY_PERCENT,
74 SKIN_TOKEN_BATTERY_PERCENTBAR,
75 SKIN_TOKEN_BATTERY_VOLTS,
76 SKIN_TOKEN_BATTERY_TIME,
77 SKIN_TOKEN_BATTERY_CHARGER_CONNECTED,
78 SKIN_TOKEN_BATTERY_CHARGING,
79 SKIN_TOKEN_BATTERY_SLEEPTIME,
80 SKIN_TOKEN_USB_POWERED,
81
82 /* Sound */
Robert Bieber48198822010-05-30 05:51:50 +000083 SKIN_TOKEN_SOUND_PITCH,
84 SKIN_TOKEN_SOUND_SPEED,
85 SKIN_TOKEN_REPLAYGAIN,
86 SKIN_TOKEN_CROSSFADE,
87
88 /* Time */
Robert Bieber48198822010-05-30 05:51:50 +000089 SKIN_TOKEN_RTC_PRESENT,
90
91 /* The begin/end values allow us to know if a token is an RTC one.
92 New RTC tokens should be added between the markers. */
93
94 SKIN_TOKENs_RTC_BEGIN, /* just the start marker, not an actual token */
95
96 SKIN_TOKEN_RTC_DAY_OF_MONTH,
97 SKIN_TOKEN_RTC_DAY_OF_MONTH_BLANK_PADDED,
98 SKIN_TOKEN_RTC_12HOUR_CFG,
99 SKIN_TOKEN_RTC_HOUR_24_ZERO_PADDED,
100 SKIN_TOKEN_RTC_HOUR_24,
101 SKIN_TOKEN_RTC_HOUR_12_ZERO_PADDED,
102 SKIN_TOKEN_RTC_HOUR_12,
103 SKIN_TOKEN_RTC_MONTH,
104 SKIN_TOKEN_RTC_MINUTE,
105 SKIN_TOKEN_RTC_SECOND,
106 SKIN_TOKEN_RTC_YEAR_2_DIGITS,
107 SKIN_TOKEN_RTC_YEAR_4_DIGITS,
108 SKIN_TOKEN_RTC_AM_PM_UPPER,
109 SKIN_TOKEN_RTC_AM_PM_LOWER,
110 SKIN_TOKEN_RTC_WEEKDAY_NAME,
111 SKIN_TOKEN_RTC_MONTH_NAME,
112 SKIN_TOKEN_RTC_DAY_OF_WEEK_START_MON,
113 SKIN_TOKEN_RTC_DAY_OF_WEEK_START_SUN,
114
115 SKIN_TOKENS_RTC_END, /* just the end marker, not an actual token */
116
117 /* Database */
Robert Bieber48198822010-05-30 05:51:50 +0000118 SKIN_TOKEN_DATABASE_PLAYCOUNT,
119 SKIN_TOKEN_DATABASE_RATING,
120 SKIN_TOKEN_DATABASE_AUTOSCORE,
121
122 /* File */
Robert Bieber48198822010-05-30 05:51:50 +0000123 SKIN_TOKEN_FILE_BITRATE,
124 SKIN_TOKEN_FILE_CODEC,
125 SKIN_TOKEN_FILE_FREQUENCY,
126 SKIN_TOKEN_FILE_FREQUENCY_KHZ,
127 SKIN_TOKEN_FILE_NAME,
128 SKIN_TOKEN_FILE_NAME_WITH_EXTENSION,
129 SKIN_TOKEN_FILE_PATH,
130 SKIN_TOKEN_FILE_SIZE,
131 SKIN_TOKEN_FILE_VBR,
132 SKIN_TOKEN_FILE_DIRECTORY,
133
134 /* Image */
Robert Bieber48198822010-05-30 05:51:50 +0000135 SKIN_TOKEN_IMAGE_BACKDROP,
136 SKIN_TOKEN_IMAGE_PROGRESS_BAR,
137 SKIN_TOKEN_IMAGE_PRELOAD,
138 SKIN_TOKEN_IMAGE_PRELOAD_DISPLAY,
139 SKIN_TOKEN_IMAGE_DISPLAY,
140
141 /* Albumart */
142 SKIN_TOKEN_ALBUMART_LOAD,
143 SKIN_TOKEN_ALBUMART_DISPLAY,
Jonathan Gordon20b90202010-06-09 14:51:52 +0000144 SKIN_TOKEN_ALBUMART_FOUND,
Robert Bieber48198822010-05-30 05:51:50 +0000145
146 /* Metadata */
Robert Bieber48198822010-05-30 05:51:50 +0000147 SKIN_TOKEN_METADATA_ARTIST,
148 SKIN_TOKEN_METADATA_COMPOSER,
149 SKIN_TOKEN_METADATA_ALBUM_ARTIST,
150 SKIN_TOKEN_METADATA_GROUPING,
151 SKIN_TOKEN_METADATA_ALBUM,
152 SKIN_TOKEN_METADATA_GENRE,
153 SKIN_TOKEN_METADATA_DISC_NUMBER,
154 SKIN_TOKEN_METADATA_TRACK_NUMBER,
155 SKIN_TOKEN_METADATA_TRACK_TITLE,
156 SKIN_TOKEN_METADATA_VERSION,
157 SKIN_TOKEN_METADATA_YEAR,
158 SKIN_TOKEN_METADATA_COMMENT,
159
Robert Bieber48198822010-05-30 05:51:50 +0000160 /* Mode */
161 SKIN_TOKEN_REPEAT_MODE,
162 SKIN_TOKEN_PLAYBACK_STATUS,
163 /* Progressbar */
164 SKIN_TOKEN_PROGRESSBAR,
165 SKIN_TOKEN_PLAYER_PROGRESSBAR,
166 /* Peakmeter */
167 SKIN_TOKEN_PEAKMETER,
168
169 /* Current track */
170 SKIN_TOKEN_TRACK_ELAPSED_PERCENT,
171 SKIN_TOKEN_TRACK_TIME_ELAPSED,
172 SKIN_TOKEN_TRACK_TIME_REMAINING,
173 SKIN_TOKEN_TRACK_LENGTH,
174 SKIN_TOKEN_TRACK_STARTING,
175 SKIN_TOKEN_TRACK_ENDING,
176
177 /* Playlist */
Robert Bieber48198822010-05-30 05:51:50 +0000178 SKIN_TOKEN_PLAYLIST_ENTRIES,
179 SKIN_TOKEN_PLAYLIST_NAME,
180 SKIN_TOKEN_PLAYLIST_POSITION,
181 SKIN_TOKEN_PLAYLIST_SHUFFLE,
182
183
Robert Bieber48198822010-05-30 05:51:50 +0000184 SKIN_TOKEN_ENABLE_THEME,
185 SKIN_TOKEN_DISABLE_THEME,
186 SKIN_TOKEN_DRAW_INBUILTBAR,
187 SKIN_TOKEN_LIST_TITLE_TEXT,
188 SKIN_TOKEN_LIST_TITLE_ICON,
189
190 SKIN_TOKEN_LOAD_FONT,
191
192 /* buttons */
193 SKIN_TOKEN_BUTTON_VOLUME,
194 SKIN_TOKEN_LASTTOUCH,
195 SKIN_TOKEN_TOUCHREGION,
196 /* Virtual LED */
197 SKIN_TOKEN_VLED_HDD,
198 /* Volume level */
199 SKIN_TOKEN_VOLUME,
200 SKIN_TOKEN_VOLUMEBAR,
201 /* hold */
202 SKIN_TOKEN_MAIN_HOLD,
203 SKIN_TOKEN_REMOTE_HOLD,
204
205 /* Setting option */
206 SKIN_TOKEN_SETTING,
207 SKIN_TOKEN_CURRENT_SCREEN,
208 SKIN_TOKEN_LANG_IS_RTL,
209
210 /* Recording Tokens */
Robert Bieber48198822010-05-30 05:51:50 +0000211 SKIN_TOKEN_HAVE_RECORDING,
212 SKIN_TOKEN_IS_RECORDING,
213 SKIN_TOKEN_REC_FREQ,
214 SKIN_TOKEN_REC_ENCODER,
215 SKIN_TOKEN_REC_BITRATE, /* SWCODEC: MP3 bitrate, HWCODEC: MP3 "quality" */
216 SKIN_TOKEN_REC_MONO,
217 SKIN_TOKEN_REC_SECONDS,
218 SKIN_TOKEN_REC_MINUTES,
219 SKIN_TOKEN_REC_HOURS,
220
221
222 /* Radio Tokens */
Robert Bieber48198822010-05-30 05:51:50 +0000223 SKIN_TOKEN_HAVE_TUNER,
224 SKIN_TOKEN_TUNER_TUNED,
225 SKIN_TOKEN_TUNER_SCANMODE,
226 SKIN_TOKEN_TUNER_STEREO,
227 SKIN_TOKEN_TUNER_MINFREQ, /* changes based on "region" */
228 SKIN_TOKEN_TUNER_MAXFREQ, /* changes based on "region" */
229 SKIN_TOKEN_TUNER_CURFREQ,
230 SKIN_TOKEN_PRESET_ID, /* "id" of this preset.. really the array element number */
231 SKIN_TOKEN_PRESET_NAME,
232 SKIN_TOKEN_PRESET_FREQ,
233 SKIN_TOKEN_PRESET_COUNT,
234 /* RDS tokens */
235 SKIN_TOKEN_HAVE_RDS,
236 SKIN_TOKEN_RDS_NAME,
237 SKIN_TOKEN_RDS_TEXT,
238
Robert Bieber48198822010-05-30 05:51:50 +0000239};
240
Robert Bieberd5b24dd2010-05-25 15:19:52 +0000241/*
242 * Struct for tag parsing information
243 * name - The name of the tag, i.e. V for %V
244 * params - A string specifying all of the tags parameters, each
245 * character representing a single parameter. Valid
246 * characters for parameters are:
247 * I - Required integer
248 * i - Nullable integer
249 * S - Required string
250 * s - Nullable string
251 * F - Required file name
252 * f - Nullable file name
Jonathan Gordon20b90202010-06-09 14:51:52 +0000253 * C - Required skin code
Jonathan Gordon9ac4b442010-06-09 16:15:01 +0000254 * N - any amount of strings.. must be the last param in the list
Robert Bieber7dfd0c02010-07-01 08:45:49 +0000255 * \n - causes the parser to eat everything up to and including the \n
256 * MUST be the last character of the prams string
Robert Bieberd5b24dd2010-05-25 15:19:52 +0000257 * Any nullable parameter may be replaced in the WPS file
258 * with a '-'. To specify that parameters may be left off
259 * altogether, place a '|' in the parameter string. For
260 * instance, with the parameter string...
261 * Ii|Ss
262 * one integer must be specified, one integer can be
263 * specified or set to default with '-', and the user can
264 * stop providing parameters at any time after that.
265 * To specify multiple instances of the same type, put a
266 * number before the character. For instance, the string...
267 * 2s
Robert Bieber1937b1b2010-05-25 17:22:39 +0000268 * will specify two strings. An asterisk (*) at the beginning of the
Robert Bieberf02a2442010-06-02 05:27:37 +0000269 * string will specify that you may choose to omit all arguments
Robert Bieberd5b24dd2010-05-25 15:19:52 +0000270 *
271 */
272struct tag_info
273{
Robert Bieber48198822010-05-30 05:51:50 +0000274 enum skin_token_type type;
Robert Bieberd5b24dd2010-05-25 15:19:52 +0000275 char* name;
276 char* params;
Robert Bieber32ff4e92010-07-04 01:39:57 +0000277 int flags;
Robert Bieberd5b24dd2010-05-25 15:19:52 +0000278};
279
280/*
281 * Finds a tag by name and returns its parameter list, or an empty
282 * string if the tag is not found in the table
283 */
Robert Bieber0a054b22010-06-01 16:44:52 +0000284struct tag_info* find_tag(char* name);
Robert Bieberd5b24dd2010-05-25 15:19:52 +0000285
286/*
287 * Determines whether a character is legal to escape or not. If
288 * lookup is not found in the legal escape characters string, returns
289 * false, otherwise returns true
290 */
291int find_escape_character(char lookup);
292
Robert Bieberc5e14b52010-05-31 17:39:58 +0000293#ifdef __cplusplus
294}
295#endif
296
Robert Bieberd5b24dd2010-05-25 15:19:52 +0000297#endif /* TAG_TABLE_H */