recv.c: Make rn_event_handler() static
[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 = 21;
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 = 18;
168
169 d[SI_NUM_PLAYED].prefix = "#";
170 d[SI_NUM_PLAYED].postfix = "";
171 d[SI_NUM_PLAYED].fg = COLOR_RED;
172 d[SI_NUM_PLAYED].bg = COLOR_BLACK;
173 d[SI_NUM_PLAYED].align = CENTER;
174 d[SI_NUM_PLAYED].x = 60;
175 d[SI_NUM_PLAYED].y = 17;
176 d[SI_NUM_PLAYED].len = 15;
177
178 d[SI_UPTIME].prefix = "SUp: ";
179 d[SI_UPTIME].postfix = "";
180 d[SI_UPTIME].fg = COLOR_RED;
181 d[SI_UPTIME].bg = COLOR_BLACK;
182 d[SI_UPTIME].align = CENTER;
183 d[SI_UPTIME].x = 75;
184 d[SI_UPTIME].y = 17;
185 d[SI_UPTIME].len = 25;
186
187 d[SI_AUDIOD_STATUS].prefix = "audiod: ";
188 d[SI_AUDIOD_STATUS].postfix = "";
189 d[SI_AUDIOD_STATUS].fg = COLOR_MAGENTA;
190 d[SI_AUDIOD_STATUS].bg = COLOR_BLACK;
191 d[SI_AUDIOD_STATUS].align = RIGHT;
192 d[SI_AUDIOD_STATUS].x = 0;
193 d[SI_AUDIOD_STATUS].y = 27;
194 d[SI_AUDIOD_STATUS].len = 14;
195
196
197 d[SI_DECODER_FLAGS].prefix = "[";
198 d[SI_DECODER_FLAGS].postfix = "]";
199 d[SI_DECODER_FLAGS].fg = COLOR_MAGENTA;
200 d[SI_DECODER_FLAGS].bg = COLOR_BLACK;
201 d[SI_DECODER_FLAGS].align = LEFT;
202 d[SI_DECODER_FLAGS].x = 15;
203 d[SI_DECODER_FLAGS].y = 27;
204 d[SI_DECODER_FLAGS].len = 10;
205
206 d[SI_MTIME].prefix = "Mtime: ";
207 d[SI_MTIME].postfix = "";
208 d[SI_MTIME].fg = COLOR_MAGENTA;
209 d[SI_MTIME].bg = COLOR_BLACK;
210 d[SI_MTIME].align = CENTER;
211 d[SI_MTIME].x = 25;
212 d[SI_MTIME].y = 27;
213 d[SI_MTIME].len = 29;
214
215 d[SI_FILE_SIZE].prefix = "Size: ";
216 d[SI_FILE_SIZE].postfix = " kb";
217 d[SI_FILE_SIZE].fg = COLOR_MAGENTA;
218 d[SI_FILE_SIZE].bg = COLOR_BLACK;
219 d[SI_FILE_SIZE].align = CENTER;
220 d[SI_FILE_SIZE].x = 54;
221 d[SI_FILE_SIZE].y = 27;
222 d[SI_FILE_SIZE].len = 24;
223
224 d[SI_AUDIOD_UPTIME].prefix = "AUp: ";
225 d[SI_AUDIOD_UPTIME].postfix = "";
226 d[SI_AUDIOD_UPTIME].fg = COLOR_MAGENTA;
227 d[SI_AUDIOD_UPTIME].bg = COLOR_BLACK;
228 d[SI_AUDIOD_UPTIME].align = CENTER;
229 d[SI_AUDIOD_UPTIME].x = 78;
230 d[SI_AUDIOD_UPTIME].y = 27;
231 d[SI_AUDIOD_UPTIME].len = 22;
232
233
234 d[SI_AUDIO_INFO1].prefix = "";
235 d[SI_AUDIO_INFO1].postfix = "";
236 d[SI_AUDIO_INFO1].fg = COLOR_GREEN;
237 d[SI_AUDIO_INFO1].bg = COLOR_BLACK;
238 d[SI_AUDIO_INFO1].align = CENTER;
239 d[SI_AUDIO_INFO1].x = 0;
240 d[SI_AUDIO_INFO1].y = 43;
241 d[SI_AUDIO_INFO1].len = 100;
242
243 d[SI_AUDIO_INFO2].prefix = "";
244 d[SI_AUDIO_INFO2].postfix = "";
245 d[SI_AUDIO_INFO2].fg = COLOR_GREEN;
246 d[SI_AUDIO_INFO2].bg = COLOR_BLACK;
247 d[SI_AUDIO_INFO2].align = CENTER;
248 d[SI_AUDIO_INFO2].x = 0;
249 d[SI_AUDIO_INFO2].y = 53;
250 d[SI_AUDIO_INFO2].len = 100;
251
252 d[SI_AUDIO_INFO3].prefix = "";
253 d[SI_AUDIO_INFO3].postfix = "";
254 d[SI_AUDIO_INFO3].fg = COLOR_GREEN;
255 d[SI_AUDIO_INFO3].bg = COLOR_BLACK;
256 d[SI_AUDIO_INFO3].align = CENTER;
257 d[SI_AUDIO_INFO3].x = 0;
258 d[SI_AUDIO_INFO3].y = 63;
259 d[SI_AUDIO_INFO3].len = 100;
260
261 d[SI_DBINFO1].prefix = "";
262 d[SI_DBINFO1].postfix = "";
263 d[SI_DBINFO1].fg = COLOR_YELLOW;
264 d[SI_DBINFO1].bg = COLOR_BLACK;
265 d[SI_DBINFO1].align = CENTER;
266 d[SI_DBINFO1].x = 0;
267 d[SI_DBINFO1].y = 77;
268 d[SI_DBINFO1].len = 100;
269
270 d[SI_DBINFO2].prefix = "";
271 d[SI_DBINFO2].postfix = "";
272 d[SI_DBINFO2].fg = COLOR_YELLOW;
273 d[SI_DBINFO2].bg = COLOR_BLACK;
274 d[SI_DBINFO2].align = CENTER;
275 d[SI_DBINFO2].x = 0;
276 d[SI_DBINFO2].y = 87;
277 d[SI_DBINFO2].len = 100;
278
279 d[SI_DBINFO3].prefix = "";
280 d[SI_DBINFO3].postfix = "";
281 d[SI_DBINFO3].fg = COLOR_YELLOW;
282 d[SI_DBINFO3].bg = COLOR_BLACK;
283 d[SI_DBINFO3].align = CENTER;
284 d[SI_DBINFO3].x = 0;
285 d[SI_DBINFO3].y = 97;
286 d[SI_DBINFO3].len = 100;
287 }
288
289 void init_theme(int num, struct gui_theme *t)
290 {
291 int i;
292
293 for (i = 0; i < NUM_STAT_ITEMS; i++)
294 t->data[i].len = 0;
295 current_theme_num = num;
296
297 return (num % NUM_THEMES)?
298 init_theme_simple(t) : init_theme_colorful_blackness(t);
299 }
300
301 void prev_theme(struct gui_theme *t)
302 {
303 return init_theme(++current_theme_num, t);
304 }
305
306 void next_theme(struct gui_theme *t)
307 {
308 return init_theme(--current_theme_num, t);
309 }
310