Add the mosx Authors to CREDITS
[paraslash.git] / gui_theme.c
1 /*
2 * Copyright (C) 2005 Andre Noll <maan@systemlinux.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
17 */
18
19 #include "para.h"
20 #include <curses.h>
21
22 #define NUM_THEMES 2
23
24
25 static int current_theme_num;
26
27 static void init_theme_simple(struct gui_theme *t)
28 {
29 struct stat_item_data *d = t->data;
30 t->name = "simple";
31 t->author = "Andre Noll";
32 t->lines_min = 5;
33 t->top_lines_min = 2;
34 t->cols_min = 40;
35 t->top_lines_default = 2;
36 t->sb_bg = COLOR_CYAN;
37 t->sb_fg = COLOR_BLACK;
38 t->cmd_bg = COLOR_WHITE;
39 t->cmd_fg = COLOR_BLACK;
40 t->output_bg = COLOR_BLUE;
41 t->output_fg = COLOR_WHITE;
42 t->msg_bg = COLOR_BLUE;
43 t->msg_fg = COLOR_YELLOW;
44 t->err_msg_bg = COLOR_RED;
45 t->err_msg_fg = COLOR_WHITE;
46 t->welcome_bg = COLOR_BLUE;
47 t->welcome_fg = COLOR_WHITE;
48 t->sep_bg = COLOR_BLUE;
49 t->sep_fg = COLOR_CYAN;
50 t->default_fg = COLOR_WHITE;
51 t->default_bg = COLOR_BLUE;
52 t->sep_str = "*";
53
54 d[SI_STATUS_BAR].prefix = "";
55 d[SI_STATUS_BAR].postfix = "";
56 d[SI_STATUS_BAR].fg = COLOR_WHITE;
57 d[SI_STATUS_BAR].bg = COLOR_BLUE;
58 d[SI_STATUS_BAR].align = CENTER;
59 d[SI_STATUS_BAR].x = 0;
60 d[SI_STATUS_BAR].y = 7;
61 d[SI_STATUS_BAR].len = 100;
62
63 d[SI_STATUS].prefix = "para_server: ";
64 d[SI_STATUS].postfix = "";
65 d[SI_STATUS].fg = COLOR_WHITE;
66 d[SI_STATUS].bg = COLOR_BLUE;
67 d[SI_STATUS].align = CENTER;
68 d[SI_STATUS].x = 0;
69 d[SI_STATUS].y = 60;
70 d[SI_STATUS].len = 50;
71
72 d[SI_AUDIOD_STATUS].prefix = "para_audiod: ";
73 d[SI_AUDIOD_STATUS].postfix = "";
74 d[SI_AUDIOD_STATUS].fg = COLOR_WHITE;
75 d[SI_AUDIOD_STATUS].bg = COLOR_BLUE;
76 d[SI_AUDIOD_STATUS].align = CENTER;
77 d[SI_AUDIOD_STATUS].x = 50;
78 d[SI_AUDIOD_STATUS].y = 60;
79 d[SI_AUDIOD_STATUS].len = 50;
80
81 }
82
83 static void init_theme_colorful_blackness(struct gui_theme *t)
84 {
85 struct stat_item_data *d = t->data;
86 t->name = "colorful blackness";
87 t->author = "Andre Noll";
88 /* minimal number of lines that is needed to display all
89 * information provided by this theme
90 */
91 t->lines_min = 15;
92 t->cols_min = 80;
93 t->top_lines_min = 9;
94 t->top_lines_default = 11; /* default number of lines */
95
96 t->sb_bg = COLOR_GREEN; /* status bar background */
97 t->sb_fg = COLOR_BLACK; /* status bar foreground */
98 t->cmd_bg = COLOR_BLACK;
99 t->cmd_fg = COLOR_YELLOW;
100 t->output_bg = COLOR_BLACK;
101 t->output_fg = COLOR_CYAN;
102 t->msg_bg = COLOR_BLACK;
103 t->msg_fg = COLOR_WHITE;
104 t->err_msg_bg = COLOR_RED;
105 t->err_msg_fg = COLOR_WHITE;
106 t->welcome_bg = COLOR_BLUE;
107 t->welcome_fg = COLOR_WHITE;
108 t->sep_bg = COLOR_BLACK; /* color of the separator */
109 t->sep_fg = COLOR_BLUE;
110 t->sep_str = "-";
111 t->default_bg = COLOR_BLACK;
112 t->default_fg = COLOR_MAGENTA;
113
114
115 d[SI_PLAY_TIME].prefix = "";
116 d[SI_PLAY_TIME].postfix = "";
117 d[SI_PLAY_TIME].fg = COLOR_CYAN;
118 d[SI_PLAY_TIME].bg = COLOR_BLACK;
119 d[SI_PLAY_TIME].align = CENTER;
120 d[SI_PLAY_TIME].x = 0;
121 d[SI_PLAY_TIME].y = 7;
122 d[SI_PLAY_TIME].len = 35;
123
124 d[SI_STATUS_BAR].prefix = "";
125 d[SI_STATUS_BAR].postfix = "";
126 d[SI_STATUS_BAR].fg = COLOR_CYAN;
127 d[SI_STATUS_BAR].bg = COLOR_BLACK;
128 d[SI_STATUS_BAR].align = LEFT;
129 d[SI_STATUS_BAR].x = 35;
130 d[SI_STATUS_BAR].y = 7;
131 d[SI_STATUS_BAR].len = 65;
132
133 d[SI_STATUS].prefix = "";
134 d[SI_STATUS].postfix = " ";
135 d[SI_STATUS].fg = COLOR_RED;
136 d[SI_STATUS].bg = COLOR_BLACK;
137 d[SI_STATUS].align = RIGHT;
138 d[SI_STATUS].x = 0;
139 d[SI_STATUS].y = 17;
140 d[SI_STATUS].len = 11;
141
142 d[SI_STATUS_FLAGS].prefix = "(";
143 d[SI_STATUS_FLAGS].postfix = ")";
144 d[SI_STATUS_FLAGS].fg = COLOR_RED;
145 d[SI_STATUS_FLAGS].bg = COLOR_BLACK;
146 d[SI_STATUS_FLAGS].align = LEFT;
147 d[SI_STATUS_FLAGS].x = 11;
148 d[SI_STATUS_FLAGS].y = 17;
149 d[SI_STATUS_FLAGS].len = 10;
150
151 d[SI_SELECTOR].prefix = "selector: ";
152 d[SI_SELECTOR].postfix = "";
153 d[SI_SELECTOR].fg = COLOR_RED;
154 d[SI_SELECTOR].bg = COLOR_BLACK;
155 d[SI_SELECTOR].align = CENTER;
156 d[SI_SELECTOR].x = 21;
157 d[SI_SELECTOR].y = 17;
158 d[SI_SELECTOR].len = 20;
159
160 d[SI_FORMAT].prefix = "format: ";
161 d[SI_FORMAT].postfix = "";
162 d[SI_FORMAT].fg = COLOR_RED;
163 d[SI_FORMAT].bg = COLOR_BLACK;
164 d[SI_FORMAT].align = CENTER;
165 d[SI_FORMAT].x = 42;
166 d[SI_FORMAT].y = 17;
167 d[SI_FORMAT].len = 14;
168
169
170 d[SI_NUM_PLAYED].prefix = "#";
171 d[SI_NUM_PLAYED].postfix = "";
172 d[SI_NUM_PLAYED].fg = COLOR_RED;
173 d[SI_NUM_PLAYED].bg = COLOR_BLACK;
174 d[SI_NUM_PLAYED].align = CENTER;
175 d[SI_NUM_PLAYED].x = 60;
176 d[SI_NUM_PLAYED].y = 17;
177 d[SI_NUM_PLAYED].len = 15;
178
179 d[SI_UPTIME].prefix = "SUp: ";
180 d[SI_UPTIME].postfix = "";
181 d[SI_UPTIME].fg = COLOR_RED;
182 d[SI_UPTIME].bg = COLOR_BLACK;
183 d[SI_UPTIME].align = CENTER;
184 d[SI_UPTIME].x = 75;
185 d[SI_UPTIME].y = 17;
186 d[SI_UPTIME].len = 25;
187
188 d[SI_AUDIOD_STATUS].prefix = "audiod: ";
189 d[SI_AUDIOD_STATUS].postfix = "";
190 d[SI_AUDIOD_STATUS].fg = COLOR_MAGENTA;
191 d[SI_AUDIOD_STATUS].bg = COLOR_BLACK;
192 d[SI_AUDIOD_STATUS].align = RIGHT;
193 d[SI_AUDIOD_STATUS].x = 0;
194 d[SI_AUDIOD_STATUS].y = 27;
195 d[SI_AUDIOD_STATUS].len = 13;
196
197
198 d[SI_DECODER_FLAGS].prefix = "[";
199 d[SI_DECODER_FLAGS].postfix = "]";
200 d[SI_DECODER_FLAGS].fg = COLOR_MAGENTA;
201 d[SI_DECODER_FLAGS].bg = COLOR_BLACK;
202 d[SI_DECODER_FLAGS].align = LEFT;
203 d[SI_DECODER_FLAGS].x = 14;
204 d[SI_DECODER_FLAGS].y = 27;
205 d[SI_DECODER_FLAGS].len = 8;
206
207 d[SI_MTIME].prefix = "Mtime: ";
208 d[SI_MTIME].postfix = "";
209 d[SI_MTIME].fg = COLOR_MAGENTA;
210 d[SI_MTIME].bg = COLOR_BLACK;
211 d[SI_MTIME].align = CENTER;
212 d[SI_MTIME].x = 22;
213 d[SI_MTIME].y = 27;
214 d[SI_MTIME].len = 30;
215
216 d[SI_FILE_SIZE].prefix = "Size: ";
217 d[SI_FILE_SIZE].postfix = " kb";
218 d[SI_FILE_SIZE].fg = COLOR_MAGENTA;
219 d[SI_FILE_SIZE].bg = COLOR_BLACK;
220 d[SI_FILE_SIZE].align = CENTER;
221 d[SI_FILE_SIZE].x = 52;
222 d[SI_FILE_SIZE].y = 27;
223 d[SI_FILE_SIZE].len = 26;
224
225 d[SI_AUDIOD_UPTIME].prefix = "AUp: ";
226 d[SI_AUDIOD_UPTIME].postfix = "";
227 d[SI_AUDIOD_UPTIME].fg = COLOR_MAGENTA;
228 d[SI_AUDIOD_UPTIME].bg = COLOR_BLACK;
229 d[SI_AUDIOD_UPTIME].align = CENTER;
230 d[SI_AUDIOD_UPTIME].x = 78;
231 d[SI_AUDIOD_UPTIME].y = 27;
232 d[SI_AUDIOD_UPTIME].len = 22;
233
234
235 d[SI_AUDIO_INFO1].prefix = "";
236 d[SI_AUDIO_INFO1].postfix = "";
237 d[SI_AUDIO_INFO1].fg = COLOR_GREEN;
238 d[SI_AUDIO_INFO1].bg = COLOR_BLACK;
239 d[SI_AUDIO_INFO1].align = CENTER;
240 d[SI_AUDIO_INFO1].x = 0;
241 d[SI_AUDIO_INFO1].y = 43;
242 d[SI_AUDIO_INFO1].len = 100;
243
244 d[SI_AUDIO_INFO2].prefix = "";
245 d[SI_AUDIO_INFO2].postfix = "";
246 d[SI_AUDIO_INFO2].fg = COLOR_GREEN;
247 d[SI_AUDIO_INFO2].bg = COLOR_BLACK;
248 d[SI_AUDIO_INFO2].align = CENTER;
249 d[SI_AUDIO_INFO2].x = 0;
250 d[SI_AUDIO_INFO2].y = 53;
251 d[SI_AUDIO_INFO2].len = 100;
252
253 d[SI_AUDIO_INFO3].prefix = "";
254 d[SI_AUDIO_INFO3].postfix = "";
255 d[SI_AUDIO_INFO3].fg = COLOR_GREEN;
256 d[SI_AUDIO_INFO3].bg = COLOR_BLACK;
257 d[SI_AUDIO_INFO3].align = CENTER;
258 d[SI_AUDIO_INFO3].x = 0;
259 d[SI_AUDIO_INFO3].y = 63;
260 d[SI_AUDIO_INFO3].len = 100;
261
262 d[SI_DBINFO1].prefix = "";
263 d[SI_DBINFO1].postfix = "";
264 d[SI_DBINFO1].fg = COLOR_YELLOW;
265 d[SI_DBINFO1].bg = COLOR_BLACK;
266 d[SI_DBINFO1].align = CENTER;
267 d[SI_DBINFO1].x = 0;
268 d[SI_DBINFO1].y = 77;
269 d[SI_DBINFO1].len = 100;
270
271 d[SI_DBINFO2].prefix = "";
272 d[SI_DBINFO2].postfix = "";
273 d[SI_DBINFO2].fg = COLOR_YELLOW;
274 d[SI_DBINFO2].bg = COLOR_BLACK;
275 d[SI_DBINFO2].align = CENTER;
276 d[SI_DBINFO2].x = 0;
277 d[SI_DBINFO2].y = 87;
278 d[SI_DBINFO2].len = 100;
279
280 d[SI_DBINFO3].prefix = "";
281 d[SI_DBINFO3].postfix = "";
282 d[SI_DBINFO3].fg = COLOR_YELLOW;
283 d[SI_DBINFO3].bg = COLOR_BLACK;
284 d[SI_DBINFO3].align = CENTER;
285 d[SI_DBINFO3].x = 0;
286 d[SI_DBINFO3].y = 97;
287 d[SI_DBINFO3].len = 100;
288 }
289
290 void init_theme(int num, struct gui_theme *t)
291 {
292 int i;
293
294 for (i = 0; i < NUM_STAT_ITEMS; i++)
295 t->data[i].len = 0;
296 current_theme_num = num;
297
298 return (num % NUM_THEMES)?
299 init_theme_simple(t) : init_theme_colorful_blackness(t);
300 }
301
302 void prev_theme(struct gui_theme *t)
303 {
304 return init_theme(++current_theme_num, t);
305 }
306
307 void next_theme(struct gui_theme *t)
308 {
309 return init_theme(--current_theme_num, t);
310 }
311