Theme Editor: Committed FS#11477 to add a DECIMAL parameter type in the parser and...
[maemo-rb.git] / lib / skin_parser / tag_table.h
blobf84d4ac76292220a9cb45bddbda149bd25d06ceb
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2010 Robert Bieber
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.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 #ifndef TAG_TABLE_H
23 #define TAG_TABLE_H
25 #ifdef __cplusplus
26 extern "C"
28 #endif
30 /* Flag to tell the renderer not to insert a line break */
31 #define NOBREAK 0x1
34 enum skin_token_type {
36 SKIN_TOKEN_UNKNOWN,
38 /* Markers */
39 SKIN_TOKEN_CHARACTER,
40 SKIN_TOKEN_STRING,
41 SKIN_TOKEN_TRANSLATEDSTRING,
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,
52 /* Sublines */
53 SKIN_TOKEN_SUBLINE_TIMEOUT,
54 SKIN_TOKEN_SUBLINE_SCROLL,
56 /* Conditional */
57 SKIN_TOKEN_CONDITIONAL,
58 SKIN_TOKEN_CONDITIONAL_START,
59 SKIN_TOKEN_CONDITIONAL_OPTION,
60 SKIN_TOKEN_CONDITIONAL_END,
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,
69 SKIN_TOKEN_VIEWPORT_FGCOLOUR,
70 SKIN_TOKEN_VIEWPORT_BGCOLOUR,
72 /* Battery */
73 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,
82 /* Sound */
83 SKIN_TOKEN_SOUND_PITCH,
84 SKIN_TOKEN_SOUND_SPEED,
85 SKIN_TOKEN_REPLAYGAIN,
86 SKIN_TOKEN_CROSSFADE,
88 /* Time */
89 SKIN_TOKEN_RTC_PRESENT,
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. */
94 SKIN_TOKENs_RTC_BEGIN, /* just the start marker, not an actual token */
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,
115 SKIN_TOKENS_RTC_END, /* just the end marker, not an actual token */
117 /* Database */
118 SKIN_TOKEN_DATABASE_PLAYCOUNT,
119 SKIN_TOKEN_DATABASE_RATING,
120 SKIN_TOKEN_DATABASE_AUTOSCORE,
122 /* File */
123 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,
134 /* Image */
135 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,
141 /* Albumart */
142 SKIN_TOKEN_ALBUMART_LOAD,
143 SKIN_TOKEN_ALBUMART_DISPLAY,
144 SKIN_TOKEN_ALBUMART_FOUND,
146 /* Metadata */
147 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,
160 /* 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,
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,
177 /* Playlist */
178 SKIN_TOKEN_PLAYLIST_ENTRIES,
179 SKIN_TOKEN_PLAYLIST_NAME,
180 SKIN_TOKEN_PLAYLIST_POSITION,
181 SKIN_TOKEN_PLAYLIST_SHUFFLE,
184 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,
190 SKIN_TOKEN_LOAD_FONT,
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,
205 /* Setting option */
206 SKIN_TOKEN_SETTING,
207 SKIN_TOKEN_CURRENT_SCREEN,
208 SKIN_TOKEN_LANG_IS_RTL,
210 /* Recording Tokens */
211 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,
222 /* Radio Tokens */
223 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,
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 * D - Required decimal
250 * d - Nullable decimal
251 * Decimals are stored as (whole*10)+part
252 * S - Required string
253 * s - Nullable string
254 * F - Required file name
255 * f - Nullable file name
256 * C - Required skin code
257 * N - any amount of strings.. must be the last param in the list
258 * \n - causes the parser to eat everything up to and including the \n
259 * MUST be the last character of the prams string
260 * Any nullable parameter may be replaced in the WPS file
261 * with a '-'. To specify that parameters may be left off
262 * altogether, place a '|' in the parameter string. For
263 * instance, with the parameter string...
264 * Ii|Ss
265 * one integer must be specified, one integer can be
266 * specified or set to default with '-', and the user can
267 * stop providing parameters at any time after that.
268 * To specify multiple instances of the same type, put a
269 * number before the character. For instance, the string...
270 * 2s
271 * will specify two strings. An asterisk (*) at the beginning of the
272 * string will specify that you may choose to omit all arguments
275 struct tag_info
277 enum skin_token_type type;
278 char* name;
279 char* params;
280 int flags;
284 * Finds a tag by name and returns its parameter list, or an empty
285 * string if the tag is not found in the table
287 struct tag_info* find_tag(char* name);
290 * Determines whether a character is legal to escape or not. If
291 * lookup is not found in the legal escape characters string, returns
292 * false, otherwise returns true
294 int find_escape_character(char lookup);
296 #ifdef __cplusplus
298 #endif
300 #endif /* TAG_TABLE_H */