Replace status item DBINFO2 by ATTRIBUTES.
[paraslash.git] / gui_theme.c
1 /*
2 * Copyright (C) 2005-2007 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_STATUS_BAR].prefix = "";
44 d[SI_STATUS_BAR].postfix = "";
45 d[SI_STATUS_BAR].fg = COLOR_WHITE;
46 d[SI_STATUS_BAR].bg = COLOR_BLUE;
47 d[SI_STATUS_BAR].align = CENTER;
48 d[SI_STATUS_BAR].x = 0;
49 d[SI_STATUS_BAR].y = 7;
50 d[SI_STATUS_BAR].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_STATUS_BAR].prefix = "";
114 d[SI_STATUS_BAR].postfix = "";
115 d[SI_STATUS_BAR].fg = COLOR_CYAN;
116 d[SI_STATUS_BAR].bg = COLOR_BLACK;
117 d[SI_STATUS_BAR].align = LEFT;
118 d[SI_STATUS_BAR].x = 35;
119 d[SI_STATUS_BAR].y = 7;
120 d[SI_STATUS_BAR].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_SELECTOR].prefix = "selector: ";
141 d[SI_SELECTOR].postfix = "";
142 d[SI_SELECTOR].fg = COLOR_RED;
143 d[SI_SELECTOR].bg = COLOR_BLACK;
144 d[SI_SELECTOR].align = CENTER;
145 d[SI_SELECTOR].x = 21;
146 d[SI_SELECTOR].y = 17;
147 d[SI_SELECTOR].len = 21;
148
149 d[SI_FORMAT].prefix = "format: ";
150 d[SI_FORMAT].postfix = "";
151 d[SI_FORMAT].fg = COLOR_RED;
152 d[SI_FORMAT].bg = COLOR_BLACK;
153 d[SI_FORMAT].align = CENTER;
154 d[SI_FORMAT].x = 42;
155 d[SI_FORMAT].y = 17;
156 d[SI_FORMAT].len = 18;
157
158 d[SI_NUM_PLAYED].prefix = "#";
159 d[SI_NUM_PLAYED].postfix = "";
160 d[SI_NUM_PLAYED].fg = COLOR_RED;
161 d[SI_NUM_PLAYED].bg = COLOR_BLACK;
162 d[SI_NUM_PLAYED].align = CENTER;
163 d[SI_NUM_PLAYED].x = 60;
164 d[SI_NUM_PLAYED].y = 17;
165 d[SI_NUM_PLAYED].len = 15;
166
167 d[SI_UPTIME].prefix = "SUp: ";
168 d[SI_UPTIME].postfix = "";
169 d[SI_UPTIME].fg = COLOR_RED;
170 d[SI_UPTIME].bg = COLOR_BLACK;
171 d[SI_UPTIME].align = CENTER;
172 d[SI_UPTIME].x = 75;
173 d[SI_UPTIME].y = 17;
174 d[SI_UPTIME].len = 25;
175
176 d[SI_AUDIOD_STATUS].prefix = "audiod: ";
177 d[SI_AUDIOD_STATUS].postfix = "";
178 d[SI_AUDIOD_STATUS].fg = COLOR_MAGENTA;
179 d[SI_AUDIOD_STATUS].bg = COLOR_BLACK;
180 d[SI_AUDIOD_STATUS].align = RIGHT;
181 d[SI_AUDIOD_STATUS].x = 0;
182 d[SI_AUDIOD_STATUS].y = 27;
183 d[SI_AUDIOD_STATUS].len = 14;
184
185
186 d[SI_DECODER_FLAGS].prefix = "[";
187 d[SI_DECODER_FLAGS].postfix = "]";
188 d[SI_DECODER_FLAGS].fg = COLOR_MAGENTA;
189 d[SI_DECODER_FLAGS].bg = COLOR_BLACK;
190 d[SI_DECODER_FLAGS].align = LEFT;
191 d[SI_DECODER_FLAGS].x = 15;
192 d[SI_DECODER_FLAGS].y = 27;
193 d[SI_DECODER_FLAGS].len = 10;
194
195 d[SI_MTIME].prefix = "Mtime: ";
196 d[SI_MTIME].postfix = "";
197 d[SI_MTIME].fg = COLOR_MAGENTA;
198 d[SI_MTIME].bg = COLOR_BLACK;
199 d[SI_MTIME].align = CENTER;
200 d[SI_MTIME].x = 25;
201 d[SI_MTIME].y = 27;
202 d[SI_MTIME].len = 29;
203
204 d[SI_FILE_SIZE].prefix = "Size: ";
205 d[SI_FILE_SIZE].postfix = " kb";
206 d[SI_FILE_SIZE].fg = COLOR_MAGENTA;
207 d[SI_FILE_SIZE].bg = COLOR_BLACK;
208 d[SI_FILE_SIZE].align = CENTER;
209 d[SI_FILE_SIZE].x = 54;
210 d[SI_FILE_SIZE].y = 27;
211 d[SI_FILE_SIZE].len = 24;
212
213 d[SI_AUDIOD_UPTIME].prefix = "AUp: ";
214 d[SI_AUDIOD_UPTIME].postfix = "";
215 d[SI_AUDIOD_UPTIME].fg = COLOR_MAGENTA;
216 d[SI_AUDIOD_UPTIME].bg = COLOR_BLACK;
217 d[SI_AUDIOD_UPTIME].align = CENTER;
218 d[SI_AUDIOD_UPTIME].x = 78;
219 d[SI_AUDIOD_UPTIME].y = 27;
220 d[SI_AUDIOD_UPTIME].len = 22;
221
222
223 d[SI_AUDIO_INFO1].prefix = "";
224 d[SI_AUDIO_INFO1].postfix = "";
225 d[SI_AUDIO_INFO1].fg = COLOR_GREEN;
226 d[SI_AUDIO_INFO1].bg = COLOR_BLACK;
227 d[SI_AUDIO_INFO1].align = CENTER;
228 d[SI_AUDIO_INFO1].x = 0;
229 d[SI_AUDIO_INFO1].y = 43;
230 d[SI_AUDIO_INFO1].len = 100;
231
232 d[SI_AUDIO_INFO2].prefix = "";
233 d[SI_AUDIO_INFO2].postfix = "";
234 d[SI_AUDIO_INFO2].fg = COLOR_GREEN;
235 d[SI_AUDIO_INFO2].bg = COLOR_BLACK;
236 d[SI_AUDIO_INFO2].align = CENTER;
237 d[SI_AUDIO_INFO2].x = 0;
238 d[SI_AUDIO_INFO2].y = 53;
239 d[SI_AUDIO_INFO2].len = 100;
240
241 d[SI_AUDIO_INFO3].prefix = "";
242 d[SI_AUDIO_INFO3].postfix = "";
243 d[SI_AUDIO_INFO3].fg = COLOR_GREEN;
244 d[SI_AUDIO_INFO3].bg = COLOR_BLACK;
245 d[SI_AUDIO_INFO3].align = CENTER;
246 d[SI_AUDIO_INFO3].x = 0;
247 d[SI_AUDIO_INFO3].y = 63;
248 d[SI_AUDIO_INFO3].len = 100;
249
250 d[SI_AFS_MODE].prefix = "";
251 d[SI_AFS_MODE].postfix = "";
252 d[SI_AFS_MODE].fg = COLOR_YELLOW;
253 d[SI_AFS_MODE].bg = COLOR_BLACK;
254 d[SI_AFS_MODE].align = CENTER;
255 d[SI_AFS_MODE].x = 0;
256 d[SI_AFS_MODE].y = 77;
257 d[SI_AFS_MODE].len = 100;
258
259 d[SI_ATTRIBUTES].prefix = "";
260 d[SI_ATTRIBUTES].postfix = "";
261 d[SI_ATTRIBUTES].fg = COLOR_YELLOW;
262 d[SI_ATTRIBUTES].bg = COLOR_BLACK;
263 d[SI_ATTRIBUTES].align = CENTER;
264 d[SI_ATTRIBUTES].x = 0;
265 d[SI_ATTRIBUTES].y = 87;
266 d[SI_ATTRIBUTES].len = 100;
267
268 d[SI_DBINFO3].prefix = "";
269 d[SI_DBINFO3].postfix = "";
270 d[SI_DBINFO3].fg = COLOR_YELLOW;
271 d[SI_DBINFO3].bg = COLOR_BLACK;
272 d[SI_DBINFO3].align = CENTER;
273 d[SI_DBINFO3].x = 0;
274 d[SI_DBINFO3].y = 97;
275 d[SI_DBINFO3].len = 100;
276 }
277
278 void init_theme(int num, struct gui_theme *t)
279 {
280 int i;
281
282 for (i = 0; i < NUM_STAT_ITEMS; i++)
283 t->data[i].len = 0;
284 current_theme_num = num;
285
286 return (num % NUM_THEMES)?
287 init_theme_simple(t) : init_theme_colorful_blackness(t);
288 }
289
290 void prev_theme(struct gui_theme *t)
291 {
292 return init_theme(++current_theme_num, t);
293 }
294
295 void next_theme(struct gui_theme *t)
296 {
297 return init_theme(--current_theme_num, t);
298 }
299