Major audio format handler cleanups.
[paraslash.git] / gui_theme.c
1 /*
2 * Copyright (C) 2005-2009 Andre Noll <maan@systemlinux.org>
3 *
4 * Licensed under the GPL v2. For licencing details see COPYING.
5 */
6
7 #include "para.h"
8 #include "gui.h"
9 #include <curses.h>
10
11 #define NUM_THEMES 2
12
13
14 static int current_theme_num;
15
16 static void init_theme_simple(struct gui_theme *t)
17 {
18 struct stat_item_data *d = t->data;
19 t->name = "simple";
20 t->author = "Andre Noll";
21 t->lines_min = 5;
22 t->top_lines_min = 2;
23 t->cols_min = 40;
24 t->top_lines_default = 2;
25 t->sb_bg = COLOR_CYAN;
26 t->sb_fg = COLOR_BLACK;
27 t->cmd_bg = COLOR_WHITE;
28 t->cmd_fg = COLOR_BLACK;
29 t->output_bg = COLOR_BLUE;
30 t->output_fg = COLOR_WHITE;
31 t->msg_bg = COLOR_BLUE;
32 t->msg_fg = COLOR_YELLOW;
33 t->err_msg_bg = COLOR_RED;
34 t->err_msg_fg = COLOR_WHITE;
35 t->welcome_bg = COLOR_BLUE;
36 t->welcome_fg = COLOR_WHITE;
37 t->sep_bg = COLOR_BLUE;
38 t->sep_fg = COLOR_CYAN;
39 t->default_fg = COLOR_WHITE;
40 t->default_bg = COLOR_BLUE;
41 t->sep_str = "*";
42
43 d[SI_BASENAME].prefix = "";
44 d[SI_BASENAME].postfix = "";
45 d[SI_BASENAME].fg = COLOR_WHITE;
46 d[SI_BASENAME].bg = COLOR_BLUE;
47 d[SI_BASENAME].align = CENTER;
48 d[SI_BASENAME].x = 0;
49 d[SI_BASENAME].y = 7;
50 d[SI_BASENAME].len = 100;
51
52 d[SI_STATUS].prefix = "para_server: ";
53 d[SI_STATUS].postfix = "";
54 d[SI_STATUS].fg = COLOR_WHITE;
55 d[SI_STATUS].bg = COLOR_BLUE;
56 d[SI_STATUS].align = CENTER;
57 d[SI_STATUS].x = 0;
58 d[SI_STATUS].y = 60;
59 d[SI_STATUS].len = 50;
60
61 d[SI_AUDIOD_STATUS].prefix = "para_audiod: ";
62 d[SI_AUDIOD_STATUS].postfix = "";
63 d[SI_AUDIOD_STATUS].fg = COLOR_WHITE;
64 d[SI_AUDIOD_STATUS].bg = COLOR_BLUE;
65 d[SI_AUDIOD_STATUS].align = CENTER;
66 d[SI_AUDIOD_STATUS].x = 50;
67 d[SI_AUDIOD_STATUS].y = 60;
68 d[SI_AUDIOD_STATUS].len = 50;
69
70 }
71
72 static void init_theme_colorful_blackness(struct gui_theme *t)
73 {
74 struct stat_item_data *d = t->data;
75 t->name = "colorful blackness";
76 t->author = "Andre Noll";
77 /* minimal number of lines that is needed to display all
78 * information provided by this theme
79 */
80 t->lines_min = 15;
81 t->cols_min = 80;
82 t->top_lines_min = 9;
83 t->top_lines_default = 11; /* default number of lines */
84
85 t->sb_bg = COLOR_GREEN; /* status bar background */
86 t->sb_fg = COLOR_BLACK; /* status bar foreground */
87 t->cmd_bg = COLOR_BLACK;
88 t->cmd_fg = COLOR_YELLOW;
89 t->output_bg = COLOR_BLACK;
90 t->output_fg = COLOR_CYAN;
91 t->msg_bg = COLOR_BLACK;
92 t->msg_fg = COLOR_WHITE;
93 t->err_msg_bg = COLOR_RED;
94 t->err_msg_fg = COLOR_WHITE;
95 t->welcome_bg = COLOR_BLUE;
96 t->welcome_fg = COLOR_WHITE;
97 t->sep_bg = COLOR_BLACK; /* color of the separator */
98 t->sep_fg = COLOR_BLUE;
99 t->sep_str = "-";
100 t->default_bg = COLOR_BLACK;
101 t->default_fg = COLOR_MAGENTA;
102
103
104 d[SI_PLAY_TIME].prefix = "";
105 d[SI_PLAY_TIME].postfix = "";
106 d[SI_PLAY_TIME].fg = COLOR_CYAN;
107 d[SI_PLAY_TIME].bg = COLOR_BLACK;
108 d[SI_PLAY_TIME].align = CENTER;
109 d[SI_PLAY_TIME].x = 0;
110 d[SI_PLAY_TIME].y = 7;
111 d[SI_PLAY_TIME].len = 35;
112
113 d[SI_BASENAME].prefix = "";
114 d[SI_BASENAME].postfix = "";
115 d[SI_BASENAME].fg = COLOR_CYAN;
116 d[SI_BASENAME].bg = COLOR_BLACK;
117 d[SI_BASENAME].align = LEFT;
118 d[SI_BASENAME].x = 35;
119 d[SI_BASENAME].y = 7;
120 d[SI_BASENAME].len = 65;
121
122 d[SI_STATUS].prefix = "";
123 d[SI_STATUS].postfix = " ";
124 d[SI_STATUS].fg = COLOR_RED;
125 d[SI_STATUS].bg = COLOR_BLACK;
126 d[SI_STATUS].align = RIGHT;
127 d[SI_STATUS].x = 0;
128 d[SI_STATUS].y = 17;
129 d[SI_STATUS].len = 11;
130
131 d[SI_STATUS_FLAGS].prefix = "(";
132 d[SI_STATUS_FLAGS].postfix = ")";
133 d[SI_STATUS_FLAGS].fg = COLOR_RED;
134 d[SI_STATUS_FLAGS].bg = COLOR_BLACK;
135 d[SI_STATUS_FLAGS].align = LEFT;
136 d[SI_STATUS_FLAGS].x = 11;
137 d[SI_STATUS_FLAGS].y = 17;
138 d[SI_STATUS_FLAGS].len = 10;
139
140 d[SI_IMAGE_ID].prefix = "img: ";
141 d[SI_IMAGE_ID].postfix = "";
142 d[SI_IMAGE_ID].fg = COLOR_RED;
143 d[SI_IMAGE_ID].bg = COLOR_BLACK;
144 d[SI_IMAGE_ID].align = CENTER;
145 d[SI_IMAGE_ID].x = 21;
146 d[SI_IMAGE_ID].y = 17;
147 d[SI_IMAGE_ID].len = 10;
148
149 d[SI_LYRICS_ID].prefix = "lyr: ";
150 d[SI_LYRICS_ID].postfix = "";
151 d[SI_LYRICS_ID].fg = COLOR_RED;
152 d[SI_LYRICS_ID].bg = COLOR_BLACK;
153 d[SI_LYRICS_ID].align = CENTER;
154 d[SI_LYRICS_ID].x = 31;
155 d[SI_LYRICS_ID].y = 17;
156 d[SI_LYRICS_ID].len = 11;
157
158 d[SI_FORMAT].prefix = "format: ";
159 d[SI_FORMAT].postfix = "";
160 d[SI_FORMAT].fg = COLOR_RED;
161 d[SI_FORMAT].bg = COLOR_BLACK;
162 d[SI_FORMAT].align = CENTER;
163 d[SI_FORMAT].x = 42;
164 d[SI_FORMAT].y = 17;
165 d[SI_FORMAT].len = 18;
166
167 d[SI_NUM_PLAYED].prefix = "#";
168 d[SI_NUM_PLAYED].postfix = "";
169 d[SI_NUM_PLAYED].fg = COLOR_RED;
170 d[SI_NUM_PLAYED].bg = COLOR_BLACK;
171 d[SI_NUM_PLAYED].align = LEFT;
172 d[SI_NUM_PLAYED].x = 60;
173 d[SI_NUM_PLAYED].y = 17;
174 d[SI_NUM_PLAYED].len = 5;
175
176 d[SI_BITRATE].prefix = "";
177 d[SI_BITRATE].postfix = "";
178 d[SI_BITRATE].fg = COLOR_RED;
179 d[SI_BITRATE].bg = COLOR_BLACK;
180 d[SI_BITRATE].align = CENTER;
181 d[SI_BITRATE].x = 65;
182 d[SI_BITRATE].y = 17;
183 d[SI_BITRATE].len = 13;
184
185 d[SI_FREQUENCY].prefix = "";
186 d[SI_FREQUENCY].postfix = "";
187 d[SI_FREQUENCY].fg = COLOR_RED;
188 d[SI_FREQUENCY].bg = COLOR_BLACK;
189 d[SI_FREQUENCY].align = CENTER;
190 d[SI_FREQUENCY].x = 78;
191 d[SI_FREQUENCY].y = 17;
192 d[SI_FREQUENCY].len = 10;
193
194 d[SI_SCORE].prefix = "sc: ";
195 d[SI_SCORE].postfix = "";
196 d[SI_SCORE].fg = COLOR_RED;
197 d[SI_SCORE].bg = COLOR_BLACK;
198 d[SI_SCORE].align = CENTER;
199 d[SI_SCORE].x = 88;
200 d[SI_SCORE].y = 17;
201 d[SI_SCORE].len = 10;
202
203 d[SI_AUDIOD_STATUS].prefix = "";
204 d[SI_AUDIOD_STATUS].postfix = "";
205 d[SI_AUDIOD_STATUS].fg = COLOR_MAGENTA;
206 d[SI_AUDIOD_STATUS].bg = COLOR_BLACK;
207 d[SI_AUDIOD_STATUS].align = CENTER;
208 d[SI_AUDIOD_STATUS].x = 0;
209 d[SI_AUDIOD_STATUS].y = 27;
210 d[SI_AUDIOD_STATUS].len = 5;
211
212 d[SI_DECODER_FLAGS].prefix = "[";
213 d[SI_DECODER_FLAGS].postfix = "]";
214 d[SI_DECODER_FLAGS].fg = COLOR_MAGENTA;
215 d[SI_DECODER_FLAGS].bg = COLOR_BLACK;
216 d[SI_DECODER_FLAGS].align = CENTER;
217 d[SI_DECODER_FLAGS].x = 5;
218 d[SI_DECODER_FLAGS].y = 27;
219 d[SI_DECODER_FLAGS].len = 10;
220
221 d[SI_MTIME].prefix = "mod: ";
222 d[SI_MTIME].postfix = "";
223 d[SI_MTIME].fg = COLOR_MAGENTA;
224 d[SI_MTIME].bg = COLOR_BLACK;
225 d[SI_MTIME].align = CENTER;
226 d[SI_MTIME].x = 15;
227 d[SI_MTIME].y = 27;
228 d[SI_MTIME].len = 22;
229
230 d[SI_FILE_SIZE].prefix = "";
231 d[SI_FILE_SIZE].postfix = "kb";
232 d[SI_FILE_SIZE].fg = COLOR_MAGENTA;
233 d[SI_FILE_SIZE].bg = COLOR_BLACK;
234 d[SI_FILE_SIZE].align = CENTER;
235 d[SI_FILE_SIZE].x = 37;
236 d[SI_FILE_SIZE].y = 27;
237 d[SI_FILE_SIZE].len = 10;
238
239 d[SI_CHANNELS].prefix = "";
240 d[SI_CHANNELS].postfix = "ch";
241 d[SI_CHANNELS].fg = COLOR_MAGENTA;
242 d[SI_CHANNELS].bg = COLOR_BLACK;
243 d[SI_CHANNELS].align = CENTER;
244 d[SI_CHANNELS].x = 47;
245 d[SI_CHANNELS].y = 27;
246 d[SI_CHANNELS].len = 5;
247
248 d[SI_LAST_PLAYED].prefix = "lp: ";
249 d[SI_LAST_PLAYED].postfix = "";
250 d[SI_LAST_PLAYED].fg = COLOR_MAGENTA;
251 d[SI_LAST_PLAYED].bg = COLOR_BLACK;
252 d[SI_LAST_PLAYED].align = CENTER;
253 d[SI_LAST_PLAYED].x = 52;
254 d[SI_LAST_PLAYED].y = 27;
255 d[SI_LAST_PLAYED].len = 21;
256
257 d[SI_NUM_CHUNKS].prefix = "";
258 d[SI_NUM_CHUNKS].postfix = "x";
259 d[SI_NUM_CHUNKS].fg = COLOR_MAGENTA;
260 d[SI_NUM_CHUNKS].bg = COLOR_BLACK;
261 d[SI_NUM_CHUNKS].align = RIGHT;
262 d[SI_NUM_CHUNKS].x = 73;
263 d[SI_NUM_CHUNKS].y = 27;
264 d[SI_NUM_CHUNKS].len = 11;
265
266 d[SI_CHUNK_TIME].prefix = "";
267 d[SI_CHUNK_TIME].postfix = "ms";
268 d[SI_CHUNK_TIME].fg = COLOR_MAGENTA;
269 d[SI_CHUNK_TIME].bg = COLOR_BLACK;
270 d[SI_CHUNK_TIME].align = LEFT;
271 d[SI_CHUNK_TIME].x = 84;
272 d[SI_CHUNK_TIME].y = 27;
273 d[SI_CHUNK_TIME].len = 8;
274
275 d[SI_AMPLIFICATION].prefix = "amp:";
276 d[SI_AMPLIFICATION].postfix = "";
277 d[SI_AMPLIFICATION].fg = COLOR_MAGENTA;
278 d[SI_AMPLIFICATION].bg = COLOR_BLACK;
279 d[SI_AMPLIFICATION].align = RIGHT;
280 d[SI_AMPLIFICATION].x = 92;
281 d[SI_AMPLIFICATION].y = 27;
282 d[SI_AMPLIFICATION].len = 8;
283
284 d[SI_TECHINFO].prefix = "";
285 d[SI_TECHINFO].postfix = "";
286 d[SI_TECHINFO].fg = COLOR_GREEN;
287 d[SI_TECHINFO].bg = COLOR_BLACK;
288 d[SI_TECHINFO].align = CENTER;
289 d[SI_TECHINFO].x = 0;
290 d[SI_TECHINFO].y = 43;
291 d[SI_TECHINFO].len = 100;
292
293 d[SI_TITLE].prefix = "";
294 d[SI_TITLE].postfix = ",";
295 d[SI_TITLE].fg = COLOR_GREEN;
296 d[SI_TITLE].bg = COLOR_BLACK;
297 d[SI_TITLE].align = RIGHT;
298 d[SI_TITLE].x = 0;
299 d[SI_TITLE].y = 53;
300 d[SI_TITLE].len = 45;
301
302 d[SI_ARTIST].prefix = " by ";
303 d[SI_ARTIST].postfix = "";
304 d[SI_ARTIST].fg = COLOR_GREEN;
305 d[SI_ARTIST].bg = COLOR_BLACK;
306 d[SI_ARTIST].align = LEFT;
307 d[SI_ARTIST].x = 45;
308 d[SI_ARTIST].y = 53;
309 d[SI_ARTIST].len = 45;
310
311 d[SI_YEAR].prefix = "(";
312 d[SI_YEAR].postfix = ")";
313 d[SI_YEAR].fg = COLOR_GREEN;
314 d[SI_YEAR].bg = COLOR_BLACK;
315 d[SI_YEAR].align = RIGHT;
316 d[SI_YEAR].x = 90;
317 d[SI_YEAR].y = 53;
318 d[SI_YEAR].len = 10;
319
320 d[SI_ALBUM].prefix = "A: ";
321 d[SI_ALBUM].postfix = "";
322 d[SI_ALBUM].fg = COLOR_GREEN;
323 d[SI_ALBUM].bg = COLOR_BLACK;
324 d[SI_ALBUM].align = CENTER;
325 d[SI_ALBUM].x = 0;
326 d[SI_ALBUM].y = 63;
327 d[SI_ALBUM].len = 50;
328
329 d[SI_COMMENT].prefix = "C: ";
330 d[SI_COMMENT].postfix = "";
331 d[SI_COMMENT].fg = COLOR_GREEN;
332 d[SI_COMMENT].bg = COLOR_BLACK;
333 d[SI_COMMENT].align = CENTER;
334 d[SI_COMMENT].x = 50;
335 d[SI_COMMENT].y = 63;
336 d[SI_COMMENT].len = 50;
337
338 d[SI_AFS_MODE].prefix = "";
339 d[SI_AFS_MODE].postfix = "";
340 d[SI_AFS_MODE].fg = COLOR_YELLOW;
341 d[SI_AFS_MODE].bg = COLOR_BLACK;
342 d[SI_AFS_MODE].align = CENTER;
343 d[SI_AFS_MODE].x = 0;
344 d[SI_AFS_MODE].y = 77;
345 d[SI_AFS_MODE].len = 100;
346
347 d[SI_ATTRIBUTES_TXT].prefix = "";
348 d[SI_ATTRIBUTES_TXT].postfix = "";
349 d[SI_ATTRIBUTES_TXT].fg = COLOR_YELLOW;
350 d[SI_ATTRIBUTES_TXT].bg = COLOR_BLACK;
351 d[SI_ATTRIBUTES_TXT].align = CENTER;
352 d[SI_ATTRIBUTES_TXT].x = 0;
353 d[SI_ATTRIBUTES_TXT].y = 87;
354 d[SI_ATTRIBUTES_TXT].len = 100;
355
356 d[SI_DIRECTORY].prefix = "dir: ";
357 d[SI_DIRECTORY].postfix = "";
358 d[SI_DIRECTORY].fg = COLOR_YELLOW;
359 d[SI_DIRECTORY].bg = COLOR_BLACK;
360 d[SI_DIRECTORY].align = CENTER;
361 d[SI_DIRECTORY].x = 0;
362 d[SI_DIRECTORY].y = 97;
363 d[SI_DIRECTORY].len = 100;
364 }
365
366 void init_theme(int num, struct gui_theme *t)
367 {
368 int i;
369 FOR_EACH_STATUS_ITEM(i)
370 t->data[i].len = 0;
371 current_theme_num = num;
372
373 return (num % NUM_THEMES)?
374 init_theme_simple(t) : init_theme_colorful_blackness(t);
375 }
376
377 void prev_theme(struct gui_theme *t)
378 {
379 return init_theme(++current_theme_num, t);
380 }
381
382 void next_theme(struct gui_theme *t)
383 {
384 return init_theme(--current_theme_num, t);
385 }
386