2 * Copyright (C) 2005 Andre Noll <maan@tuebingen.mpg.de>
4 * Licensed under the GPL v2. For licencing details see COPYING.
7 /** \file gui_theme.c Theme definitions. */
13 static void init_theme_simple(struct gui_theme *t)
15 struct stat_item_data *d = t->data;
16 t->author = "Andre Noll";
20 t->top_lines_default = 2;
21 t->sb.bg = COLOR_CYAN;
22 t->sb.fg = COLOR_BLACK;
23 t->cmd.bg = COLOR_WHITE;
24 t->cmd.fg = COLOR_BLACK;
25 t->output.bg = COLOR_BLUE;
26 t->output.fg = COLOR_WHITE;
27 t->msg.bg = COLOR_BLUE;
28 t->msg.fg = COLOR_YELLOW;
29 t->err_msg.bg = COLOR_RED;
30 t->err_msg.fg = COLOR_WHITE;
31 t->sep.bg = COLOR_BLUE;
32 t->sep.fg = COLOR_CYAN;
33 t->dflt.fg = COLOR_WHITE;
34 t->dflt.bg = COLOR_BLUE;
37 d[SI_BASENAME].prefix = "";
38 d[SI_BASENAME].postfix = "";
39 d[SI_BASENAME].color.fg = COLOR_WHITE;
40 d[SI_BASENAME].color.bg = COLOR_BLUE;
41 d[SI_BASENAME].align = CENTER;
44 d[SI_BASENAME].len = 100;
46 d[SI_STATUS].prefix = "para_server: ";
47 d[SI_STATUS].postfix = "";
48 d[SI_STATUS].color.fg = COLOR_WHITE;
49 d[SI_STATUS].color.bg = COLOR_BLUE;
50 d[SI_STATUS].align = CENTER;
53 d[SI_STATUS].len = 50;
55 d[SI_AUDIOD_STATUS].prefix = "para_audiod: ";
56 d[SI_AUDIOD_STATUS].postfix = "";
57 d[SI_AUDIOD_STATUS].color.fg = COLOR_WHITE;
58 d[SI_AUDIOD_STATUS].color.bg = COLOR_BLUE;
59 d[SI_AUDIOD_STATUS].align = CENTER;
60 d[SI_AUDIOD_STATUS].x = 50;
61 d[SI_AUDIOD_STATUS].y = 60;
62 d[SI_AUDIOD_STATUS].len = 50;
66 static void init_theme_colorful_blackness(struct gui_theme *t)
68 struct stat_item_data *d = t->data;
69 t->author = "Andre Noll";
70 /* minimal number of lines that is needed to display all
71 * information provided by this theme
76 t->top_lines_default = 11; /* default number of lines */
78 t->sb.bg = COLOR_GREEN; /* status bar background */
79 t->sb.fg = COLOR_BLACK; /* status bar foreground */
80 t->cmd.bg = COLOR_BLACK;
81 t->cmd.fg = COLOR_YELLOW;
82 t->output.bg = COLOR_BLACK;
83 t->output.fg = COLOR_CYAN;
84 t->msg.bg = COLOR_BLACK;
85 t->msg.fg = COLOR_WHITE;
86 t->err_msg.bg = COLOR_RED;
87 t->err_msg.fg = COLOR_WHITE;
88 t->sep.bg = COLOR_BLACK; /* color of the separator */
89 t->sep.fg = COLOR_BLUE;
90 t->sep_char = 0; /* default (ACS_HLINE) */
91 t->dflt.bg = COLOR_BLACK;
92 t->dflt.fg = COLOR_MAGENTA;
95 d[SI_PLAY_TIME].prefix = "";
96 d[SI_PLAY_TIME].postfix = "";
97 d[SI_PLAY_TIME].color.fg = COLOR_CYAN;
98 d[SI_PLAY_TIME].color.bg = COLOR_BLACK;
99 d[SI_PLAY_TIME].align = CENTER;
100 d[SI_PLAY_TIME].x = 0;
101 d[SI_PLAY_TIME].y = 7;
102 d[SI_PLAY_TIME].len = 35;
104 d[SI_BASENAME].prefix = "";
105 d[SI_BASENAME].postfix = "";
106 d[SI_BASENAME].color.fg = COLOR_CYAN;
107 d[SI_BASENAME].color.bg = COLOR_BLACK;
108 d[SI_BASENAME].align = LEFT;
109 d[SI_BASENAME].x = 35;
110 d[SI_BASENAME].y = 7;
111 d[SI_BASENAME].len = 65;
113 d[SI_STATUS].prefix = "";
114 d[SI_STATUS].postfix = " ";
115 d[SI_STATUS].color.fg = COLOR_RED;
116 d[SI_STATUS].color.bg = COLOR_BLACK;
117 d[SI_STATUS].align = RIGHT;
120 d[SI_STATUS].len = 11;
122 d[SI_STATUS_FLAGS].prefix = "(";
123 d[SI_STATUS_FLAGS].postfix = ")";
124 d[SI_STATUS_FLAGS].color.fg = COLOR_RED;
125 d[SI_STATUS_FLAGS].color.bg = COLOR_BLACK;
126 d[SI_STATUS_FLAGS].align = LEFT;
127 d[SI_STATUS_FLAGS].x = 11;
128 d[SI_STATUS_FLAGS].y = 17;
129 d[SI_STATUS_FLAGS].len = 10;
131 d[SI_IMAGE_ID].prefix = "img: ";
132 d[SI_IMAGE_ID].postfix = "";
133 d[SI_IMAGE_ID].color.fg = COLOR_RED;
134 d[SI_IMAGE_ID].color.bg = COLOR_BLACK;
135 d[SI_IMAGE_ID].align = CENTER;
136 d[SI_IMAGE_ID].x = 21;
137 d[SI_IMAGE_ID].y = 17;
138 d[SI_IMAGE_ID].len = 10;
140 d[SI_LYRICS_ID].prefix = "lyr: ";
141 d[SI_LYRICS_ID].postfix = "";
142 d[SI_LYRICS_ID].color.fg = COLOR_RED;
143 d[SI_LYRICS_ID].color.bg = COLOR_BLACK;
144 d[SI_LYRICS_ID].align = CENTER;
145 d[SI_LYRICS_ID].x = 31;
146 d[SI_LYRICS_ID].y = 17;
147 d[SI_LYRICS_ID].len = 11;
149 d[SI_FORMAT].prefix = "format: ";
150 d[SI_FORMAT].postfix = "";
151 d[SI_FORMAT].color.fg = COLOR_RED;
152 d[SI_FORMAT].color.bg = COLOR_BLACK;
153 d[SI_FORMAT].align = CENTER;
156 d[SI_FORMAT].len = 18;
158 d[SI_NUM_PLAYED].prefix = "#";
159 d[SI_NUM_PLAYED].postfix = "";
160 d[SI_NUM_PLAYED].color.fg = COLOR_RED;
161 d[SI_NUM_PLAYED].color.bg = COLOR_BLACK;
162 d[SI_NUM_PLAYED].align = LEFT;
163 d[SI_NUM_PLAYED].x = 60;
164 d[SI_NUM_PLAYED].y = 17;
165 d[SI_NUM_PLAYED].len = 5;
167 d[SI_BITRATE].prefix = "";
168 d[SI_BITRATE].postfix = "";
169 d[SI_BITRATE].color.fg = COLOR_RED;
170 d[SI_BITRATE].color.bg = COLOR_BLACK;
171 d[SI_BITRATE].align = CENTER;
172 d[SI_BITRATE].x = 65;
173 d[SI_BITRATE].y = 17;
174 d[SI_BITRATE].len = 13;
176 d[SI_FREQUENCY].prefix = "";
177 d[SI_FREQUENCY].postfix = "";
178 d[SI_FREQUENCY].color.fg = COLOR_RED;
179 d[SI_FREQUENCY].color.bg = COLOR_BLACK;
180 d[SI_FREQUENCY].align = CENTER;
181 d[SI_FREQUENCY].x = 78;
182 d[SI_FREQUENCY].y = 17;
183 d[SI_FREQUENCY].len = 10;
185 d[SI_SCORE].prefix = "sc: ";
186 d[SI_SCORE].postfix = "";
187 d[SI_SCORE].color.fg = COLOR_RED;
188 d[SI_SCORE].color.bg = COLOR_BLACK;
189 d[SI_SCORE].align = CENTER;
192 d[SI_SCORE].len = 10;
194 d[SI_AUDIOD_STATUS].prefix = "";
195 d[SI_AUDIOD_STATUS].postfix = "";
196 d[SI_AUDIOD_STATUS].color.fg = COLOR_MAGENTA;
197 d[SI_AUDIOD_STATUS].color.bg = COLOR_BLACK;
198 d[SI_AUDIOD_STATUS].align = CENTER;
199 d[SI_AUDIOD_STATUS].x = 0;
200 d[SI_AUDIOD_STATUS].y = 27;
201 d[SI_AUDIOD_STATUS].len = 5;
203 d[SI_DECODER_FLAGS].prefix = "[";
204 d[SI_DECODER_FLAGS].postfix = "]";
205 d[SI_DECODER_FLAGS].color.fg = COLOR_MAGENTA;
206 d[SI_DECODER_FLAGS].color.bg = COLOR_BLACK;
207 d[SI_DECODER_FLAGS].align = CENTER;
208 d[SI_DECODER_FLAGS].x = 5;
209 d[SI_DECODER_FLAGS].y = 27;
210 d[SI_DECODER_FLAGS].len = 10;
212 d[SI_MTIME].prefix = "mod: ";
213 d[SI_MTIME].postfix = "";
214 d[SI_MTIME].color.fg = COLOR_MAGENTA;
215 d[SI_MTIME].color.bg = COLOR_BLACK;
216 d[SI_MTIME].align = CENTER;
219 d[SI_MTIME].len = 22;
221 d[SI_FILE_SIZE].prefix = "";
222 d[SI_FILE_SIZE].postfix = "kb";
223 d[SI_FILE_SIZE].color.fg = COLOR_MAGENTA;
224 d[SI_FILE_SIZE].color.bg = COLOR_BLACK;
225 d[SI_FILE_SIZE].align = CENTER;
226 d[SI_FILE_SIZE].x = 37;
227 d[SI_FILE_SIZE].y = 27;
228 d[SI_FILE_SIZE].len = 10;
230 d[SI_CHANNELS].prefix = "";
231 d[SI_CHANNELS].postfix = "ch";
232 d[SI_CHANNELS].color.fg = COLOR_MAGENTA;
233 d[SI_CHANNELS].color.bg = COLOR_BLACK;
234 d[SI_CHANNELS].align = CENTER;
235 d[SI_CHANNELS].x = 47;
236 d[SI_CHANNELS].y = 27;
237 d[SI_CHANNELS].len = 5;
239 d[SI_LAST_PLAYED].prefix = "lp: ";
240 d[SI_LAST_PLAYED].postfix = "";
241 d[SI_LAST_PLAYED].color.fg = COLOR_MAGENTA;
242 d[SI_LAST_PLAYED].color.bg = COLOR_BLACK;
243 d[SI_LAST_PLAYED].align = CENTER;
244 d[SI_LAST_PLAYED].x = 52;
245 d[SI_LAST_PLAYED].y = 27;
246 d[SI_LAST_PLAYED].len = 21;
248 d[SI_NUM_CHUNKS].prefix = "";
249 d[SI_NUM_CHUNKS].postfix = "x";
250 d[SI_NUM_CHUNKS].color.fg = COLOR_MAGENTA;
251 d[SI_NUM_CHUNKS].color.bg = COLOR_BLACK;
252 d[SI_NUM_CHUNKS].align = RIGHT;
253 d[SI_NUM_CHUNKS].x = 73;
254 d[SI_NUM_CHUNKS].y = 27;
255 d[SI_NUM_CHUNKS].len = 11;
257 d[SI_CHUNK_TIME].prefix = "";
258 d[SI_CHUNK_TIME].postfix = "ms";
259 d[SI_CHUNK_TIME].color.fg = COLOR_MAGENTA;
260 d[SI_CHUNK_TIME].color.bg = COLOR_BLACK;
261 d[SI_CHUNK_TIME].align = LEFT;
262 d[SI_CHUNK_TIME].x = 84;
263 d[SI_CHUNK_TIME].y = 27;
264 d[SI_CHUNK_TIME].len = 8;
266 d[SI_AMPLIFICATION].prefix = "amp:";
267 d[SI_AMPLIFICATION].postfix = "";
268 d[SI_AMPLIFICATION].color.fg = COLOR_MAGENTA;
269 d[SI_AMPLIFICATION].color.bg = COLOR_BLACK;
270 d[SI_AMPLIFICATION].align = RIGHT;
271 d[SI_AMPLIFICATION].x = 92;
272 d[SI_AMPLIFICATION].y = 27;
273 d[SI_AMPLIFICATION].len = 8;
275 d[SI_TECHINFO].prefix = "";
276 d[SI_TECHINFO].postfix = "";
277 d[SI_TECHINFO].color.fg = COLOR_GREEN;
278 d[SI_TECHINFO].color.bg = COLOR_BLACK;
279 d[SI_TECHINFO].align = CENTER;
280 d[SI_TECHINFO].x = 0;
281 d[SI_TECHINFO].y = 43;
282 d[SI_TECHINFO].len = 100;
284 d[SI_TITLE].prefix = "";
285 d[SI_TITLE].postfix = ",";
286 d[SI_TITLE].color.fg = COLOR_GREEN;
287 d[SI_TITLE].color.bg = COLOR_BLACK;
288 d[SI_TITLE].align = RIGHT;
291 d[SI_TITLE].len = 45;
293 d[SI_ARTIST].prefix = " by ";
294 d[SI_ARTIST].postfix = "";
295 d[SI_ARTIST].color.fg = COLOR_GREEN;
296 d[SI_ARTIST].color.bg = COLOR_BLACK;
297 d[SI_ARTIST].align = LEFT;
300 d[SI_ARTIST].len = 45;
302 d[SI_YEAR].prefix = "(";
303 d[SI_YEAR].postfix = ")";
304 d[SI_YEAR].color.fg = COLOR_GREEN;
305 d[SI_YEAR].color.bg = COLOR_BLACK;
306 d[SI_YEAR].align = RIGHT;
311 d[SI_ALBUM].prefix = "A: ";
312 d[SI_ALBUM].postfix = ",";
313 d[SI_ALBUM].color.fg = COLOR_GREEN;
314 d[SI_ALBUM].color.bg = COLOR_BLACK;
315 d[SI_ALBUM].align = RIGHT;
318 d[SI_ALBUM].len = 50;
320 d[SI_COMMENT].prefix = " C: ";
321 d[SI_COMMENT].postfix = "";
322 d[SI_COMMENT].color.fg = COLOR_GREEN;
323 d[SI_COMMENT].color.bg = COLOR_BLACK;
324 d[SI_COMMENT].align = LEFT;
325 d[SI_COMMENT].x = 50;
326 d[SI_COMMENT].y = 63;
327 d[SI_COMMENT].len = 50;
329 d[SI_AFS_MODE].prefix = "";
330 d[SI_AFS_MODE].postfix = "";
331 d[SI_AFS_MODE].color.fg = COLOR_YELLOW;
332 d[SI_AFS_MODE].color.bg = COLOR_BLACK;
333 d[SI_AFS_MODE].align = CENTER;
334 d[SI_AFS_MODE].x = 0;
335 d[SI_AFS_MODE].y = 77;
336 d[SI_AFS_MODE].len = 100;
338 d[SI_ATTRIBUTES_TXT].prefix = "";
339 d[SI_ATTRIBUTES_TXT].postfix = "";
340 d[SI_ATTRIBUTES_TXT].color.fg = COLOR_YELLOW;
341 d[SI_ATTRIBUTES_TXT].color.bg = COLOR_BLACK;
342 d[SI_ATTRIBUTES_TXT].align = CENTER;
343 d[SI_ATTRIBUTES_TXT].x = 0;
344 d[SI_ATTRIBUTES_TXT].y = 87;
345 d[SI_ATTRIBUTES_TXT].len = 100;
347 d[SI_DIRECTORY].prefix = "dir: ";
348 d[SI_DIRECTORY].postfix = "";
349 d[SI_DIRECTORY].color.fg = COLOR_YELLOW;
350 d[SI_DIRECTORY].color.bg = COLOR_BLACK;
351 d[SI_DIRECTORY].align = CENTER;
352 d[SI_DIRECTORY].x = 0;
353 d[SI_DIRECTORY].y = 97;
354 d[SI_DIRECTORY].len = 100;
357 struct theme_description {
359 void (*init)(struct gui_theme *t);
362 static struct theme_description themes[] = {
364 .name = "colorful blackness",
365 .init = init_theme_colorful_blackness,
369 .init = init_theme_simple,
373 /** Number of elements in the \a themes array. */
374 #define NUM_THEMES (ARRAY_SIZE(themes))
376 static int current_theme_num;
378 static void set_theme(int num, struct gui_theme *t)
381 FOR_EACH_STATUS_ITEM(i)
384 t->name = themes[num].name;
386 current_theme_num = num;
387 PARA_NOTICE_LOG("theme: %s\n", t->name);
391 * Initialize a theme.
393 * \param name Name of the theme to be initialized.
394 * \param t The function fills out this structure.
396 * This function exits if there is no theme called \a name.
398 void theme_init(const char *name, struct gui_theme *t)
403 return set_theme(0, t);
404 for (i = 0; i < NUM_THEMES; i++)
405 if (strcmp(name, themes[i].name) == 0)
406 return set_theme(i, t);
407 fprintf(stderr, "Available themes:\n");
408 for (i = 0; i < NUM_THEMES; i++)
409 fprintf(stderr, "\t%s\n", themes[i].name);
414 * Activate the previous available theme.
416 * \param t Theme definition is stored here.
418 * This picks the theme that comes before the currently active one, or the last
419 * available theme, if the current one is the first.
421 * \sa \ref theme_next().
423 void theme_prev(struct gui_theme *t)
425 return set_theme(++current_theme_num, t);
429 * Activate the next available theme.
431 * \param t Theme definition is stored here.
433 * This works exactly as theme_prev() but cycles forwards through the list of
436 void theme_next(struct gui_theme *t)
438 return set_theme(--current_theme_num, t);