Mercurial > audlegacy
annotate src/audacious/widgets/skin.c @ 3123:f1c756f39e6c trunk audacious-1.4.0-DR1
Invoke "Plugins are not derived work" clause provided by GPL3.
author | William Pitcock <nenolod@atheme-project.org> |
---|---|
date | Fri, 20 Jul 2007 09:09:58 -0500 |
parents | 3b6d316f8b09 |
children | f08ce8cf0c7f |
rev | line source |
---|---|
3121
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
3076
diff
changeset
|
1 /* Audacious |
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
3076
diff
changeset
|
2 * Copyright (C) 2005-2007 Audacious development team. |
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
3076
diff
changeset
|
3 * |
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
3076
diff
changeset
|
4 * BMP - Cross-platform multimedia player |
2313 | 5 * Copyright (C) 2003-2004 BMP development team. |
6 * | |
7 * Based on XMMS: | |
8 * Copyright (C) 1998-2003 XMMS development team. | |
9 * | |
10 * This program is free software; you can redistribute it and/or modify | |
11 * it under the terms of the GNU General Public License as published by | |
3121
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
3076
diff
changeset
|
12 * the Free Software Foundation; under version 3 of the License. |
2313 | 13 * |
14 * This program is distributed in the hope that it will be useful, | |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 * GNU General Public License for more details. | |
18 * | |
19 * You should have received a copy of the GNU General Public License | |
3121
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
3076
diff
changeset
|
20 * along with this program. If not, see <http://www.gnu.org/licenses>. |
3123
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
21 * |
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
22 * The Audacious team does not consider modular code linking to |
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
23 * Audacious or using our public API to be a derived work. |
2313 | 24 */ |
25 | |
26 #ifdef HAVE_CONFIG_H | |
27 # include "config.h" | |
28 #endif | |
29 | |
30 /* TODO: enforce default sizes! */ | |
31 | |
32 #include <glib.h> | |
33 #include <stdio.h> | |
34 #include <stdlib.h> | |
35 #include <string.h> | |
36 #include <ctype.h> | |
37 | |
38 #include "widgetcore.h" | |
39 | |
40 #include "ui_equalizer.h" | |
41 #include "main.h" | |
42 #include "ui_playlist.h" | |
43 #include "ui_skinselector.h" | |
44 #include "util.h" | |
45 | |
46 #include "debug.h" | |
47 | |
48 #include "platform/smartinclude.h" | |
49 #include "vfs.h" | |
50 | |
2525 | 51 #include "ui_skinned_window.h" |
52 | |
2313 | 53 #define EXTENSION_TARGETS 7 |
54 | |
2529 | 55 static gchar *ext_targets[EXTENSION_TARGETS] = |
56 { "bmp", "xpm", "png", "svg", "gif", "jpg", "jpeg" }; | |
2313 | 57 |
58 struct _SkinPixmapIdMapping { | |
59 SkinPixmapId id; | |
60 const gchar *name; | |
61 const gchar *alt_name; | |
62 gint width, height; | |
63 }; | |
64 | |
65 struct _SkinMaskInfo { | |
66 gint width, height; | |
67 gchar *inistr; | |
68 }; | |
69 | |
70 typedef struct _SkinPixmapIdMapping SkinPixmapIdMapping; | |
71 typedef struct _SkinMaskInfo SkinMaskInfo; | |
72 | |
73 | |
74 Skin *bmp_active_skin = NULL; | |
75 | |
76 static gint skin_current_num; | |
77 | |
78 static SkinMaskInfo skin_mask_info[] = { | |
79 {275, 116, "Normal"}, | |
80 {275, 16, "WindowShade"}, | |
81 {275, 116, "Equalizer"}, | |
82 {275, 16, "EqualizerWS"} | |
83 }; | |
84 | |
85 static SkinPixmapIdMapping skin_pixmap_id_map[] = { | |
86 {SKIN_MAIN, "main", NULL, 0, 0}, | |
87 {SKIN_CBUTTONS, "cbuttons", NULL, 0, 0}, | |
88 {SKIN_SHUFREP, "shufrep", NULL, 0, 0}, | |
89 {SKIN_TEXT, "text", NULL, 0, 0}, | |
90 {SKIN_TITLEBAR, "titlebar", NULL, 0, 0}, | |
91 {SKIN_VOLUME, "volume", NULL, 0, 0}, | |
92 {SKIN_BALANCE, "balance", "volume", 0, 0}, | |
93 {SKIN_MONOSTEREO, "monoster", NULL, 0, 0}, | |
94 {SKIN_PLAYPAUSE, "playpaus", NULL, 0, 0}, | |
95 {SKIN_NUMBERS, "nums_ex", "numbers", 0, 0}, | |
96 {SKIN_POSBAR, "posbar", NULL, 0, 0}, | |
97 {SKIN_EQMAIN, "eqmain", NULL, 0, 0}, | |
98 {SKIN_PLEDIT, "pledit", NULL, 0, 0}, | |
99 {SKIN_EQ_EX, "eq_ex", NULL, 0, 0} | |
100 }; | |
101 | |
102 static guint skin_pixmap_id_map_size = G_N_ELEMENTS(skin_pixmap_id_map); | |
103 | |
104 static const guchar skin_default_viscolor[24][3] = { | |
105 {9, 34, 53}, | |
106 {10, 18, 26}, | |
107 {0, 54, 108}, | |
108 {0, 58, 116}, | |
109 {0, 62, 124}, | |
110 {0, 66, 132}, | |
111 {0, 70, 140}, | |
112 {0, 74, 148}, | |
113 {0, 78, 156}, | |
114 {0, 82, 164}, | |
115 {0, 86, 172}, | |
116 {0, 92, 184}, | |
117 {0, 98, 196}, | |
118 {0, 104, 208}, | |
119 {0, 110, 220}, | |
120 {0, 116, 232}, | |
121 {0, 122, 244}, | |
122 {0, 128, 255}, | |
123 {0, 128, 255}, | |
124 {0, 104, 208}, | |
125 {0, 80, 160}, | |
126 {0, 56, 112}, | |
127 {0, 32, 64}, | |
128 {200, 200, 200} | |
129 }; | |
130 | |
131 static GdkBitmap *skin_create_transparent_mask(const gchar *, | |
132 const gchar *, | |
133 const gchar *, | |
134 GdkWindow *, | |
135 gint, gint, gboolean); | |
136 | |
137 static void skin_setup_masks(Skin * skin); | |
138 | |
139 static void skin_set_default_vis_color(Skin * skin); | |
140 | |
141 void | |
142 skin_lock(Skin * skin) | |
143 { | |
144 g_mutex_lock(skin->lock); | |
145 } | |
146 | |
147 void | |
148 skin_unlock(Skin * skin) | |
149 { | |
150 g_mutex_unlock(skin->lock); | |
151 } | |
152 | |
153 gboolean | |
154 bmp_active_skin_reload(void) | |
155 { | |
2529 | 156 return bmp_active_skin_load(bmp_active_skin->path); |
2313 | 157 } |
158 | |
159 gboolean | |
160 bmp_active_skin_load(const gchar * path) | |
161 { | |
162 g_return_val_if_fail(bmp_active_skin != NULL, FALSE); | |
163 | |
164 memset(&bmp_active_skin->properties, 0, sizeof(SkinProperties)); | |
165 | |
166 if (!skin_load(bmp_active_skin, path)) | |
167 return FALSE; | |
168 | |
169 skin_setup_masks(bmp_active_skin); | |
170 | |
171 draw_main_window(TRUE); | |
172 draw_playlist_window(TRUE); | |
173 draw_equalizer_window(TRUE); | |
174 | |
175 playlistwin_update_list(playlist_get_active()); | |
176 | |
177 return TRUE; | |
178 } | |
179 | |
180 void | |
181 skin_pixmap_free(SkinPixmap * p) | |
182 { | |
183 g_return_if_fail(p != NULL); | |
184 g_return_if_fail(p->pixmap != NULL); | |
185 | |
186 g_object_unref(p->pixmap); | |
187 p->pixmap = NULL; | |
188 } | |
189 | |
190 Skin * | |
191 skin_new(void) | |
192 { | |
193 Skin *skin; | |
194 skin = g_new0(Skin, 1); | |
195 skin->lock = g_mutex_new(); | |
196 return skin; | |
197 } | |
198 | |
199 void | |
200 skin_free(Skin * skin) | |
201 { | |
202 gint i; | |
203 | |
204 g_return_if_fail(skin != NULL); | |
205 | |
206 skin_lock(skin); | |
207 | |
208 for (i = 0; i < SKIN_PIXMAP_COUNT; i++) | |
209 skin_pixmap_free(&skin->pixmaps[i]); | |
210 | |
211 for (i = 0; i < SKIN_PIXMAP_COUNT; i++) { | |
212 if (skin->masks[i]) | |
213 g_object_unref(skin->masks[i]); | |
214 if (skin->ds_masks[i]) | |
215 g_object_unref(skin->ds_masks[i]); | |
216 | |
217 skin->masks[i] = NULL; | |
218 skin->ds_masks[i] = NULL; | |
219 } | |
220 | |
221 skin_set_default_vis_color(skin); | |
222 skin_unlock(skin); | |
223 } | |
224 | |
225 void | |
226 skin_destroy(Skin * skin) | |
227 { | |
228 g_return_if_fail(skin != NULL); | |
229 skin_free(skin); | |
230 g_mutex_free(skin->lock); | |
231 g_free(skin); | |
232 } | |
233 | |
234 const SkinPixmapIdMapping * | |
235 skin_pixmap_id_lookup(guint id) | |
236 { | |
237 guint i; | |
238 | |
239 for (i = 0; i < skin_pixmap_id_map_size; i++) { | |
240 if (id == skin_pixmap_id_map[i].id) { | |
241 return &skin_pixmap_id_map[i]; | |
242 } | |
243 } | |
244 | |
245 return NULL; | |
246 } | |
247 | |
248 const gchar * | |
249 skin_pixmap_id_to_name(SkinPixmapId id) | |
250 { | |
251 guint i; | |
252 | |
253 for (i = 0; i < skin_pixmap_id_map_size; i++) { | |
254 if (id == skin_pixmap_id_map[i].id) | |
255 return skin_pixmap_id_map[i].name; | |
256 } | |
257 return NULL; | |
258 } | |
259 | |
260 static void | |
261 skin_set_default_vis_color(Skin * skin) | |
262 { | |
263 memcpy(skin->vis_color, skin_default_viscolor, | |
264 sizeof(skin_default_viscolor)); | |
265 } | |
266 | |
267 /* | |
268 * I have rewritten this to take an array of possible targets, | |
269 * once we find a matching target we now return, instead of loop | |
270 * recursively. This allows for us to support many possible format | |
271 * targets for our skinning engine than just the original winamp | |
272 * formats. | |
273 * | |
274 * -- nenolod, 16 January 2006 | |
275 */ | |
276 gchar * | |
277 skin_pixmap_locate(const gchar * dirname, gchar ** basenames) | |
278 { | |
279 gchar *filename; | |
280 gint i; | |
281 | |
282 for (i = 0; basenames[i]; i++) | |
2989
15f6c9949cde
Add and use find_path_recursively() which search the FS without using VFS (for GTK).
William Pitcock <nenolod@atheme-project.org>
parents:
2654
diff
changeset
|
283 if (!(filename = find_path_recursively(dirname, basenames[i]))) |
2529 | 284 g_free(filename); |
285 else | |
286 return filename; | |
2313 | 287 |
288 /* can't find any targets -- sorry */ | |
289 return NULL; | |
290 } | |
291 | |
292 /* FIXME: this function is temporary. It will be removed when the skinning system | |
293 uses GdkPixbuf in place of GdkPixmap */ | |
294 | |
295 static GdkPixmap * | |
296 pixmap_new_from_file(const gchar * filename) | |
297 { | |
298 GdkPixbuf *pixbuf, *pixbuf2; | |
299 GdkPixmap *pixmap; | |
300 gint width, height; | |
301 | |
302 if (!(pixbuf = gdk_pixbuf_new_from_file(filename, NULL))) | |
303 return NULL; | |
304 | |
305 width = gdk_pixbuf_get_width(pixbuf); | |
306 height = gdk_pixbuf_get_height(pixbuf); | |
307 | |
308 /* create the windows if they haven't been created yet, needed for bootstrapping */ | |
309 if (mainwin == NULL) | |
310 { | |
311 mainwin_create(); | |
312 equalizerwin_create(); | |
313 playlistwin_create(); | |
314 } | |
315 | |
316 if (!(pixmap = gdk_pixmap_new(mainwin->window, width, height, | |
317 gdk_rgb_get_visual()->depth))) { | |
318 g_object_unref(pixbuf); | |
319 return NULL; | |
320 } | |
321 | |
322 pixbuf2 = audacious_create_colorized_pixbuf(pixbuf, cfg.colorize_r, cfg.colorize_g, cfg.colorize_b); | |
323 g_object_unref(pixbuf); | |
324 | |
2525 | 325 gdk_draw_pixbuf(pixmap, SKINNED_WINDOW(mainwin)->gc, pixbuf2, 0, 0, 0, 0, width, height, |
2529 | 326 GDK_RGB_DITHER_MAX, 0, 0); |
2313 | 327 g_object_unref(pixbuf2); |
328 | |
329 return pixmap; | |
330 } | |
331 | |
332 static gboolean | |
333 skin_load_pixmap_id(Skin * skin, SkinPixmapId id, const gchar * path_p) | |
334 { | |
335 const gchar *path; | |
336 gchar *filename; | |
337 gint width, height; | |
338 const SkinPixmapIdMapping *pixmap_id_mapping; | |
339 GdkPixmap *gpm; | |
340 SkinPixmap *pm = NULL; | |
341 gchar *basenames[EXTENSION_TARGETS * 2 + 1]; /* alternate basenames */ | |
342 gint i, y; | |
343 | |
344 g_return_val_if_fail(skin != NULL, FALSE); | |
345 g_return_val_if_fail(id < SKIN_PIXMAP_COUNT, FALSE); | |
346 | |
347 pixmap_id_mapping = skin_pixmap_id_lookup(id); | |
348 g_return_val_if_fail(pixmap_id_mapping != NULL, FALSE); | |
349 | |
350 memset(&basenames, 0, sizeof(basenames)); | |
351 | |
352 for (i = 0, y = 0; i < EXTENSION_TARGETS; i++, y++) | |
353 { | |
2529 | 354 basenames[y] = |
355 g_strdup_printf("%s.%s", pixmap_id_mapping->name, ext_targets[i]); | |
2313 | 356 |
357 if (pixmap_id_mapping->alt_name) | |
2529 | 358 basenames[++y] = |
359 g_strdup_printf("%s.%s", pixmap_id_mapping->alt_name, | |
360 ext_targets[i]); | |
2313 | 361 } |
362 | |
363 path = path_p ? path_p : skin->path; | |
364 filename = skin_pixmap_locate(path, basenames); | |
365 | |
366 for (i = 0; basenames[i] != NULL; i++) | |
367 { | |
368 g_free(basenames[i]); | |
369 basenames[i] = NULL; | |
370 } | |
371 | |
372 if (!(gpm = pixmap_new_from_file(filename))) { | |
373 g_warning("loading of %s failed", filename); | |
374 g_free(filename); | |
375 return FALSE; | |
376 } | |
377 | |
378 g_free(filename); | |
379 | |
380 gdk_drawable_get_size(GDK_DRAWABLE(gpm), &width, &height); | |
381 pm = &skin->pixmaps[id]; | |
382 pm->pixmap = gpm; | |
383 pm->width = width; | |
384 pm->height = height; | |
385 pm->current_width = width; | |
386 pm->current_height = height; | |
387 | |
388 return TRUE; | |
389 } | |
390 | |
391 void | |
392 skin_mask_create(Skin * skin, | |
393 const gchar * path, | |
394 gint id, | |
395 GdkWindow * window) | |
396 { | |
397 skin->masks[id] = | |
398 skin_create_transparent_mask(path, "region.txt", | |
399 skin_mask_info[id].inistr, window, | |
400 skin_mask_info[id].width, | |
401 skin_mask_info[id].height, FALSE); | |
402 | |
403 skin->ds_masks[id] = | |
404 skin_create_transparent_mask(path, "region.txt", | |
405 skin_mask_info[id].inistr, window, | |
406 skin_mask_info[id].width * 2, | |
407 skin_mask_info[id].height * 2, TRUE); | |
408 } | |
409 | |
410 static void | |
411 skin_setup_masks(Skin * skin) | |
412 { | |
413 GdkBitmap *mask; | |
414 | |
415 if (cfg.show_wm_decorations) | |
416 return; | |
417 | |
418 if (cfg.player_visible) { | |
419 mask = skin_get_mask(skin, SKIN_MASK_MAIN + cfg.player_shaded); | |
420 gtk_widget_shape_combine_mask(mainwin, mask, 0, 0); | |
421 } | |
422 | |
423 mask = skin_get_mask(skin, SKIN_MASK_EQ + cfg.equalizer_shaded); | |
424 gtk_widget_shape_combine_mask(equalizerwin, mask, 0, 0); | |
425 } | |
426 | |
427 static GdkBitmap * | |
428 create_default_mask(GdkWindow * parent, gint w, gint h) | |
429 { | |
430 GdkBitmap *ret; | |
431 GdkGC *gc; | |
432 GdkColor pattern; | |
433 | |
434 ret = gdk_pixmap_new(parent, w, h, 1); | |
435 gc = gdk_gc_new(ret); | |
436 pattern.pixel = 1; | |
437 gdk_gc_set_foreground(gc, &pattern); | |
438 gdk_draw_rectangle(ret, gc, TRUE, 0, 0, w, h); | |
439 g_object_unref(gc); | |
440 | |
441 return ret; | |
442 } | |
443 | |
444 static void | |
445 skin_query_color(GdkColormap * cm, GdkColor * c) | |
446 { | |
447 #ifdef GDK_WINDOWING_X11 | |
448 XColor xc = { 0,0,0,0,0,0 }; | |
449 | |
450 xc.pixel = c->pixel; | |
451 XQueryColor(GDK_COLORMAP_XDISPLAY(cm), GDK_COLORMAP_XCOLORMAP(cm), &xc); | |
452 c->red = xc.red; | |
453 c->green = xc.green; | |
454 c->blue = xc.blue; | |
455 #else | |
456 /* do nothing. see what breaks? */ | |
457 #endif | |
458 } | |
459 | |
460 static glong | |
461 skin_calc_luminance(GdkColor * c) | |
462 { | |
463 return (0.212671 * c->red + 0.715160 * c->green + 0.072169 * c->blue); | |
464 } | |
465 | |
466 static void | |
467 skin_get_textcolors(GdkPixmap * text, GdkColor * bgc, GdkColor * fgc) | |
468 { | |
469 /* | |
470 * Try to extract reasonable background and foreground colors | |
471 * from the font pixmap | |
472 */ | |
473 | |
474 GdkImage *gi; | |
475 GdkColormap *cm; | |
476 gint i; | |
477 | |
478 g_return_if_fail(text != NULL); | |
479 g_return_if_fail(GDK_IS_WINDOW(playlistwin->window)); | |
480 | |
481 /* Get the first line of text */ | |
482 gi = gdk_drawable_get_image(text, 0, 0, 152, 6); | |
483 cm = gdk_drawable_get_colormap(playlistwin->window); | |
484 | |
485 for (i = 0; i < 6; i++) { | |
486 GdkColor c; | |
487 gint x; | |
488 glong d, max_d; | |
489 | |
490 /* Get a pixel from the middle of the space character */ | |
491 bgc[i].pixel = gdk_image_get_pixel(gi, 151, i); | |
492 skin_query_color(cm, &bgc[i]); | |
493 | |
494 max_d = 0; | |
495 for (x = 1; x < 150; x++) { | |
496 c.pixel = gdk_image_get_pixel(gi, x, i); | |
497 skin_query_color(cm, &c); | |
498 | |
499 d = labs(skin_calc_luminance(&c) - skin_calc_luminance(&bgc[i])); | |
500 if (d > max_d) { | |
501 memcpy(&fgc[i], &c, sizeof(GdkColor)); | |
502 max_d = d; | |
503 } | |
504 } | |
505 } | |
506 g_object_unref(gi); | |
507 } | |
508 | |
509 gboolean | |
510 init_skins(const gchar * path) | |
511 { | |
512 bmp_active_skin = skin_new(); | |
513 | |
514 if (!bmp_active_skin_load(path)) { | |
515 /* FIXME: Oddly, g_message() causes a crash if path is NULL on | |
516 * Solaris (see bug #165) */ | |
517 if (path) | |
518 g_message("Unable to load skin (%s), trying default...", path); | |
519 | |
520 /* can't load configured skin, retry with default */ | |
521 if (!bmp_active_skin_load(BMP_DEFAULT_SKIN_PATH)) { | |
522 g_message("Unable to load default skin (%s)! Giving up.", | |
523 BMP_DEFAULT_SKIN_PATH); | |
524 return FALSE; | |
525 } | |
526 } | |
527 | |
528 if (cfg.random_skin_on_play) | |
529 skinlist_update(); | |
530 | |
531 return TRUE; | |
532 } | |
533 | |
534 /* | |
535 * Opens and parses a skin's hints file. | |
536 * Hints files are somewhat like "scripts" in Winamp3/5. | |
537 * We'll probably add scripts to it next. | |
538 */ | |
539 void | |
540 skin_parse_hints(Skin * skin, gchar *path_p) | |
541 { | |
542 gchar *filename, *tmp; | |
2529 | 543 INIFile *inifile; |
2313 | 544 |
545 path_p = path_p ? path_p : skin->path; | |
546 | |
2578
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
547 skin->properties.mainwin_othertext = FALSE; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
548 skin->properties.mainwin_vis_x = 24; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
549 skin->properties.mainwin_vis_y = 43; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
550 skin->properties.mainwin_vis_width = 76; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
551 skin->properties.mainwin_text_x = 112; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
552 skin->properties.mainwin_text_y = 27; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
553 skin->properties.mainwin_text_width = 153; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
554 skin->properties.mainwin_infobar_x = 112; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
555 skin->properties.mainwin_infobar_y = 43; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
556 skin->properties.mainwin_number_0_x = 36; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
557 skin->properties.mainwin_number_0_y = 26; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
558 skin->properties.mainwin_number_1_x = 48; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
559 skin->properties.mainwin_number_1_y = 26; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
560 skin->properties.mainwin_number_2_x = 60; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
561 skin->properties.mainwin_number_2_y = 26; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
562 skin->properties.mainwin_number_3_x = 78; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
563 skin->properties.mainwin_number_3_y = 26; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
564 skin->properties.mainwin_number_4_x = 90; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
565 skin->properties.mainwin_number_4_y = 26; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
566 skin->properties.mainwin_playstatus_x = 24; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
567 skin->properties.mainwin_playstatus_y = 28; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
568 skin->properties.mainwin_menurow_visible = TRUE; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
569 skin->properties.mainwin_volume_x = 107; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
570 skin->properties.mainwin_volume_y = 57; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
571 skin->properties.mainwin_balance_x = 177; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
572 skin->properties.mainwin_balance_y = 57; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
573 skin->properties.mainwin_position_x = 16; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
574 skin->properties.mainwin_position_y = 72; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
575 skin->properties.mainwin_othertext_is_status = FALSE; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
576 skin->properties.mainwin_othertext_visible = skin->properties.mainwin_othertext; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
577 skin->properties.mainwin_text_visible = TRUE; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
578 skin->properties.mainwin_vis_visible = TRUE; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
579 skin->properties.mainwin_previous_x = 16; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
580 skin->properties.mainwin_previous_y = 88; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
581 skin->properties.mainwin_play_x = 39; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
582 skin->properties.mainwin_play_y = 88; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
583 skin->properties.mainwin_pause_x = 62; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
584 skin->properties.mainwin_pause_y = 88; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
585 skin->properties.mainwin_stop_x = 85; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
586 skin->properties.mainwin_stop_y = 88; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
587 skin->properties.mainwin_next_x = 108; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
588 skin->properties.mainwin_next_y = 88; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
589 skin->properties.mainwin_eject_x = 136; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
590 skin->properties.mainwin_eject_y = 89; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
591 skin->properties.mainwin_width = 275; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
592 skin_mask_info[0].width = skin->properties.mainwin_width; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
593 skin->properties.mainwin_height = 116; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
594 skin_mask_info[0].height = skin->properties.mainwin_height; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
595 skin->properties.mainwin_about_x = 247; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
596 skin->properties.mainwin_about_y = 83; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
597 skin->properties.mainwin_shuffle_x = 164; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
598 skin->properties.mainwin_shuffle_y = 89; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
599 skin->properties.mainwin_repeat_x = 210; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
600 skin->properties.mainwin_repeat_y = 89; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
601 skin->properties.mainwin_eqbutton_x = 219; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
602 skin->properties.mainwin_eqbutton_y = 58; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
603 skin->properties.mainwin_plbutton_x = 242; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
604 skin->properties.mainwin_plbutton_y = 58; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
605 skin->properties.textbox_bitmap_font_width = 5; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
606 skin->properties.textbox_bitmap_font_height = 6; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
607 skin->properties.mainwin_minimize_x = 244; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
608 skin->properties.mainwin_minimize_y = 3; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
609 skin->properties.mainwin_shade_x = 254; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
610 skin->properties.mainwin_shade_y = 3; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
611 skin->properties.mainwin_close_x = 264; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
612 skin->properties.mainwin_close_y = 3; |
33911de063cb
[svn] - change the order that hints are processed in.
nenolod
parents:
2577
diff
changeset
|
613 |
2313 | 614 filename = find_file_recursively(path_p, "skin.hints"); |
2577 | 615 |
616 if (filename == NULL) | |
617 return; | |
618 | |
2529 | 619 inifile = open_ini_file(filename); |
2313 | 620 |
2529 | 621 tmp = read_ini_string(inifile, "skin", "mainwinOthertext"); |
2313 | 622 |
623 if (tmp != NULL) | |
624 { | |
625 skin->properties.mainwin_othertext = atoi(tmp); | |
626 g_free(tmp); | |
627 } | |
628 | |
2529 | 629 tmp = read_ini_string(inifile, "skin", "mainwinVisX"); |
2313 | 630 |
631 if (tmp != NULL) | |
632 { | |
633 skin->properties.mainwin_vis_x = atoi(tmp); | |
634 g_free(tmp); | |
635 } | |
636 | |
2529 | 637 tmp = read_ini_string(inifile, "skin", "mainwinVisY"); |
2313 | 638 |
639 if (tmp != NULL) | |
640 { | |
641 skin->properties.mainwin_vis_y = atoi(tmp); | |
642 g_free(tmp); | |
643 } | |
644 | |
2529 | 645 tmp = read_ini_string(inifile, "skin", "mainwinVisWidth"); |
2313 | 646 |
647 if (tmp != NULL) | |
648 { | |
649 skin->properties.mainwin_vis_width = atoi(tmp); | |
650 g_free(tmp); | |
651 } | |
652 | |
2529 | 653 tmp = read_ini_string(inifile, "skin", "mainwinTextX"); |
2313 | 654 |
655 if (tmp != NULL) | |
656 { | |
657 skin->properties.mainwin_text_x = atoi(tmp); | |
658 g_free(tmp); | |
659 } | |
660 | |
2529 | 661 tmp = read_ini_string(inifile, "skin", "mainwinTextY"); |
2313 | 662 |
663 if (tmp != NULL) | |
664 { | |
665 skin->properties.mainwin_text_y = atoi(tmp); | |
666 g_free(tmp); | |
667 } | |
668 | |
2529 | 669 tmp = read_ini_string(inifile, "skin", "mainwinTextWidth"); |
2313 | 670 |
671 if (tmp != NULL) | |
672 { | |
673 skin->properties.mainwin_text_width = atoi(tmp); | |
674 g_free(tmp); | |
675 } | |
676 | |
2529 | 677 tmp = read_ini_string(inifile, "skin", "mainwinInfoBarX"); |
2313 | 678 |
679 if (tmp != NULL) | |
680 { | |
681 skin->properties.mainwin_infobar_x = atoi(tmp); | |
682 g_free(tmp); | |
683 } | |
684 | |
2529 | 685 tmp = read_ini_string(inifile, "skin", "mainwinInfoBarY"); |
2313 | 686 |
687 if (tmp != NULL) | |
688 { | |
689 skin->properties.mainwin_infobar_y = atoi(tmp); | |
690 g_free(tmp); | |
691 } | |
692 | |
2529 | 693 tmp = read_ini_string(inifile, "skin", "mainwinNumber0X"); |
2313 | 694 |
695 if (tmp != NULL) | |
696 { | |
697 skin->properties.mainwin_number_0_x = atoi(tmp); | |
698 g_free(tmp); | |
699 } | |
700 | |
2529 | 701 tmp = read_ini_string(inifile, "skin", "mainwinNumber0Y"); |
2313 | 702 |
703 if (tmp != NULL) | |
704 { | |
705 skin->properties.mainwin_number_0_y = atoi(tmp); | |
706 g_free(tmp); | |
707 } | |
708 | |
2529 | 709 tmp = read_ini_string(inifile, "skin", "mainwinNumber1X"); |
2313 | 710 |
711 if (tmp != NULL) | |
712 { | |
713 skin->properties.mainwin_number_1_x = atoi(tmp); | |
714 g_free(tmp); | |
715 } | |
716 | |
2529 | 717 tmp = read_ini_string(inifile, "skin", "mainwinNumber1Y"); |
2313 | 718 |
719 if (tmp != NULL) | |
720 { | |
721 skin->properties.mainwin_number_1_y = atoi(tmp); | |
722 g_free(tmp); | |
723 } | |
724 | |
2529 | 725 tmp = read_ini_string(inifile, "skin", "mainwinNumber2X"); |
2313 | 726 |
727 if (tmp != NULL) | |
728 { | |
729 skin->properties.mainwin_number_2_x = atoi(tmp); | |
730 g_free(tmp); | |
731 } | |
732 | |
2529 | 733 tmp = read_ini_string(inifile, "skin", "mainwinNumber2Y"); |
2313 | 734 |
735 if (tmp != NULL) | |
736 { | |
737 skin->properties.mainwin_number_2_y = atoi(tmp); | |
738 g_free(tmp); | |
739 } | |
740 | |
2529 | 741 tmp = read_ini_string(inifile, "skin", "mainwinNumber3X"); |
2313 | 742 |
743 if (tmp != NULL) | |
744 { | |
745 skin->properties.mainwin_number_3_x = atoi(tmp); | |
746 g_free(tmp); | |
747 } | |
748 | |
2529 | 749 tmp = read_ini_string(inifile, "skin", "mainwinNumber3Y"); |
2313 | 750 |
751 if (tmp != NULL) | |
752 { | |
753 skin->properties.mainwin_number_3_y = atoi(tmp); | |
754 g_free(tmp); | |
755 } | |
756 | |
2529 | 757 tmp = read_ini_string(inifile, "skin", "mainwinNumber4X"); |
2313 | 758 |
759 if (tmp != NULL) | |
760 { | |
761 skin->properties.mainwin_number_4_x = atoi(tmp); | |
762 g_free(tmp); | |
763 } | |
764 | |
2529 | 765 tmp = read_ini_string(inifile, "skin", "mainwinNumber4Y"); |
2313 | 766 |
767 if (tmp != NULL) | |
768 { | |
769 skin->properties.mainwin_number_4_y = atoi(tmp); | |
770 g_free(tmp); | |
771 } | |
772 | |
2529 | 773 tmp = read_ini_string(inifile, "skin", "mainwinPlayStatusX"); |
2313 | 774 |
775 if (tmp != NULL) | |
776 { | |
777 skin->properties.mainwin_playstatus_x = atoi(tmp); | |
778 g_free(tmp); | |
779 } | |
780 | |
2529 | 781 tmp = read_ini_string(inifile, "skin", "mainwinPlayStatusY"); |
2313 | 782 |
783 if (tmp != NULL) | |
784 { | |
785 skin->properties.mainwin_playstatus_y = atoi(tmp); | |
786 g_free(tmp); | |
787 } | |
788 | |
2529 | 789 tmp = read_ini_string(inifile, "skin", "mainwinMenurowVisible"); |
2313 | 790 |
791 if (tmp != NULL) | |
792 { | |
793 skin->properties.mainwin_menurow_visible = atoi(tmp); | |
794 g_free(tmp); | |
795 } | |
796 | |
2529 | 797 tmp = read_ini_string(inifile, "skin", "mainwinVolumeX"); |
2313 | 798 |
799 if (tmp != NULL) | |
800 { | |
801 skin->properties.mainwin_volume_x = atoi(tmp); | |
802 g_free(tmp); | |
803 } | |
804 | |
2529 | 805 tmp = read_ini_string(inifile, "skin", "mainwinVolumeY"); |
2313 | 806 |
807 if (tmp != NULL) | |
808 { | |
809 skin->properties.mainwin_volume_y = atoi(tmp); | |
810 g_free(tmp); | |
811 } | |
812 | |
2529 | 813 tmp = read_ini_string(inifile, "skin", "mainwinBalanceX"); |
2313 | 814 |
815 if (tmp != NULL) | |
816 { | |
817 skin->properties.mainwin_balance_x = atoi(tmp); | |
818 g_free(tmp); | |
819 } | |
820 | |
2529 | 821 tmp = read_ini_string(inifile, "skin", "mainwinBalanceY"); |
2313 | 822 |
823 if (tmp != NULL) | |
824 { | |
825 skin->properties.mainwin_balance_y = atoi(tmp); | |
826 g_free(tmp); | |
827 } | |
828 | |
2529 | 829 tmp = read_ini_string(inifile, "skin", "mainwinPositionX"); |
2313 | 830 |
831 if (tmp != NULL) | |
832 { | |
833 skin->properties.mainwin_position_x = atoi(tmp); | |
834 g_free(tmp); | |
835 } | |
836 | |
2529 | 837 tmp = read_ini_string(inifile, "skin", "mainwinPositionY"); |
2313 | 838 |
839 if (tmp != NULL) | |
840 { | |
841 skin->properties.mainwin_position_y = atoi(tmp); | |
842 g_free(tmp); | |
843 } | |
844 | |
2529 | 845 tmp = read_ini_string(inifile, "skin", "mainwinOthertextIsStatus"); |
2313 | 846 |
847 if (tmp != NULL) | |
848 { | |
849 skin->properties.mainwin_othertext_is_status = atoi(tmp); | |
850 g_free(tmp); | |
851 } | |
852 | |
2529 | 853 tmp = read_ini_string(inifile, "skin", "mainwinOthertextVisible"); |
2313 | 854 |
855 if (tmp != NULL) | |
856 { | |
857 skin->properties.mainwin_othertext_visible = atoi(tmp); | |
858 g_free(tmp); | |
859 } | |
860 | |
2529 | 861 tmp = read_ini_string(inifile, "skin", "mainwinTextVisible"); |
2313 | 862 |
863 if (tmp != NULL) | |
864 { | |
865 skin->properties.mainwin_text_visible = atoi(tmp); | |
866 g_free(tmp); | |
867 } | |
868 | |
2529 | 869 tmp = read_ini_string(inifile, "skin", "mainwinVisVisible"); |
2313 | 870 |
871 if (tmp != NULL) | |
872 { | |
873 skin->properties.mainwin_vis_visible = atoi(tmp); | |
874 g_free(tmp); | |
875 } | |
876 | |
2529 | 877 tmp = read_ini_string(inifile, "skin", "mainwinPreviousX"); |
2313 | 878 |
879 if (tmp != NULL) | |
880 { | |
881 skin->properties.mainwin_previous_x = atoi(tmp); | |
882 g_free(tmp); | |
883 } | |
884 | |
2529 | 885 tmp = read_ini_string(inifile, "skin", "mainwinPreviousY"); |
2313 | 886 |
887 if (tmp != NULL) | |
888 { | |
889 skin->properties.mainwin_previous_y = atoi(tmp); | |
890 g_free(tmp); | |
891 } | |
892 | |
2529 | 893 tmp = read_ini_string(inifile, "skin", "mainwinPlayX"); |
2313 | 894 |
895 if (tmp != NULL) | |
896 { | |
897 skin->properties.mainwin_play_x = atoi(tmp); | |
898 g_free(tmp); | |
899 } | |
900 | |
2529 | 901 tmp = read_ini_string(inifile, "skin", "mainwinPlayY"); |
2313 | 902 |
903 if (tmp != NULL) | |
904 { | |
905 skin->properties.mainwin_play_y = atoi(tmp); | |
906 g_free(tmp); | |
907 } | |
908 | |
2529 | 909 tmp = read_ini_string(inifile, "skin", "mainwinPauseX"); |
2313 | 910 |
911 if (tmp != NULL) | |
912 { | |
913 skin->properties.mainwin_pause_x = atoi(tmp); | |
914 g_free(tmp); | |
915 } | |
916 | |
2529 | 917 tmp = read_ini_string(inifile, "skin", "mainwinPauseY"); |
2313 | 918 |
919 if (tmp != NULL) | |
920 { | |
921 skin->properties.mainwin_pause_y = atoi(tmp); | |
922 g_free(tmp); | |
923 } | |
924 | |
2529 | 925 tmp = read_ini_string(inifile, "skin", "mainwinStopX"); |
2313 | 926 |
927 if (tmp != NULL) | |
928 { | |
929 skin->properties.mainwin_stop_x = atoi(tmp); | |
930 g_free(tmp); | |
931 } | |
932 | |
2529 | 933 tmp = read_ini_string(inifile, "skin", "mainwinStopY"); |
2313 | 934 |
935 if (tmp != NULL) | |
936 { | |
937 skin->properties.mainwin_stop_y = atoi(tmp); | |
938 g_free(tmp); | |
939 } | |
940 | |
2529 | 941 tmp = read_ini_string(inifile, "skin", "mainwinNextX"); |
2313 | 942 |
943 if (tmp != NULL) | |
944 { | |
945 skin->properties.mainwin_next_x = atoi(tmp); | |
946 g_free(tmp); | |
947 } | |
948 | |
2529 | 949 tmp = read_ini_string(inifile, "skin", "mainwinNextY"); |
2313 | 950 |
951 if (tmp != NULL) | |
952 { | |
953 skin->properties.mainwin_next_y = atoi(tmp); | |
954 g_free(tmp); | |
955 } | |
956 | |
2529 | 957 tmp = read_ini_string(inifile, "skin", "mainwinEjectX"); |
2313 | 958 |
959 if (tmp != NULL) | |
960 { | |
961 skin->properties.mainwin_eject_x = atoi(tmp); | |
962 g_free(tmp); | |
963 } | |
964 | |
2529 | 965 tmp = read_ini_string(inifile, "skin", "mainwinEjectY"); |
2313 | 966 |
967 if (tmp != NULL) | |
968 { | |
969 skin->properties.mainwin_eject_y = atoi(tmp); | |
970 g_free(tmp); | |
971 } | |
972 | |
2529 | 973 tmp = read_ini_string(inifile, "skin", "mainwinWidth"); |
2313 | 974 |
975 if (tmp != NULL) | |
976 { | |
977 skin->properties.mainwin_width = atoi(tmp); | |
978 g_free(tmp); | |
979 } | |
980 | |
2581 | 981 skin_mask_info[0].width = skin->properties.mainwin_width; |
982 | |
2529 | 983 tmp = read_ini_string(inifile, "skin", "mainwinHeight"); |
2313 | 984 |
985 if (tmp != NULL) | |
986 { | |
987 skin->properties.mainwin_height = atoi(tmp); | |
988 g_free(tmp); | |
989 } | |
990 | |
2581 | 991 skin_mask_info[0].height = skin->properties.mainwin_height; |
992 | |
2529 | 993 tmp = read_ini_string(inifile, "skin", "mainwinAboutX"); |
2313 | 994 |
995 if (tmp != NULL) | |
996 { | |
997 skin->properties.mainwin_about_x = atoi(tmp); | |
998 g_free(tmp); | |
999 } | |
1000 | |
2529 | 1001 tmp = read_ini_string(inifile, "skin", "mainwinAboutY"); |
2313 | 1002 |
1003 if (tmp != NULL) | |
1004 { | |
1005 skin->properties.mainwin_about_y = atoi(tmp); | |
1006 g_free(tmp); | |
1007 } | |
1008 | |
2529 | 1009 tmp = read_ini_string(inifile, "skin", "mainwinShuffleX"); |
2313 | 1010 |
1011 if (tmp != NULL) | |
1012 { | |
1013 skin->properties.mainwin_shuffle_x = atoi(tmp); | |
1014 g_free(tmp); | |
1015 } | |
1016 | |
2529 | 1017 tmp = read_ini_string(inifile, "skin", "mainwinShuffleY"); |
2313 | 1018 |
1019 if (tmp != NULL) | |
1020 { | |
1021 skin->properties.mainwin_shuffle_y = atoi(tmp); | |
1022 g_free(tmp); | |
1023 } | |
1024 | |
2529 | 1025 tmp = read_ini_string(inifile, "skin", "mainwinRepeatX"); |
2313 | 1026 |
1027 if (tmp != NULL) | |
1028 { | |
1029 skin->properties.mainwin_repeat_x = atoi(tmp); | |
1030 g_free(tmp); | |
1031 } | |
1032 | |
2529 | 1033 tmp = read_ini_string(inifile, "skin", "mainwinRepeatY"); |
2313 | 1034 |
1035 if (tmp != NULL) | |
1036 { | |
1037 skin->properties.mainwin_repeat_y = atoi(tmp); | |
1038 g_free(tmp); | |
1039 } | |
1040 | |
2529 | 1041 tmp = read_ini_string(inifile, "skin", "mainwinEQButtonX"); |
2313 | 1042 |
1043 if (tmp != NULL) | |
1044 { | |
1045 skin->properties.mainwin_eqbutton_x = atoi(tmp); | |
1046 g_free(tmp); | |
1047 } | |
1048 | |
2529 | 1049 tmp = read_ini_string(inifile, "skin", "mainwinEQButtonY"); |
2313 | 1050 |
1051 if (tmp != NULL) | |
1052 { | |
1053 skin->properties.mainwin_eqbutton_y = atoi(tmp); | |
1054 g_free(tmp); | |
1055 } | |
1056 | |
2529 | 1057 tmp = read_ini_string(inifile, "skin", "mainwinPLButtonX"); |
2313 | 1058 |
1059 if (tmp != NULL) | |
1060 { | |
1061 skin->properties.mainwin_plbutton_x = atoi(tmp); | |
1062 g_free(tmp); | |
1063 } | |
1064 | |
2529 | 1065 tmp = read_ini_string(inifile, "skin", "mainwinPLButtonY"); |
2313 | 1066 |
1067 if (tmp != NULL) | |
1068 { | |
1069 skin->properties.mainwin_plbutton_y = atoi(tmp); | |
1070 g_free(tmp); | |
1071 } | |
1072 | |
2529 | 1073 tmp = read_ini_string(inifile, "skin", "textboxBitmapFontWidth"); |
2313 | 1074 |
1075 if (tmp != NULL) | |
1076 { | |
1077 skin->properties.textbox_bitmap_font_width = atoi(tmp); | |
1078 g_free(tmp); | |
1079 } | |
1080 | |
2529 | 1081 tmp = read_ini_string(inifile, "skin", "textboxBitmapFontHeight"); |
2313 | 1082 |
1083 if (tmp != NULL) | |
1084 { | |
1085 skin->properties.textbox_bitmap_font_height = atoi(tmp); | |
1086 g_free(tmp); | |
1087 } | |
1088 | |
2529 | 1089 tmp = read_ini_string(inifile, "skin", "mainwinMinimizeX"); |
2313 | 1090 |
1091 if (tmp != NULL) | |
1092 { | |
1093 skin->properties.mainwin_minimize_x = atoi(tmp); | |
1094 g_free(tmp); | |
1095 } | |
1096 | |
2529 | 1097 tmp = read_ini_string(inifile, "skin", "mainwinMinimizeY"); |
2313 | 1098 |
1099 if (tmp != NULL) | |
1100 { | |
1101 skin->properties.mainwin_minimize_y = atoi(tmp); | |
1102 g_free(tmp); | |
1103 } | |
1104 | |
2529 | 1105 tmp = read_ini_string(inifile, "skin", "mainwinShadeX"); |
2313 | 1106 |
1107 if (tmp != NULL) | |
1108 { | |
1109 skin->properties.mainwin_shade_x = atoi(tmp); | |
1110 g_free(tmp); | |
1111 } | |
1112 | |
2529 | 1113 tmp = read_ini_string(inifile, "skin", "mainwinShadeY"); |
2313 | 1114 |
1115 if (tmp != NULL) | |
1116 { | |
1117 skin->properties.mainwin_shade_y = atoi(tmp); | |
1118 g_free(tmp); | |
1119 } | |
1120 | |
2529 | 1121 tmp = read_ini_string(inifile, "skin", "mainwinCloseX"); |
2313 | 1122 |
1123 if (tmp != NULL) | |
1124 { | |
1125 skin->properties.mainwin_close_x = atoi(tmp); | |
1126 g_free(tmp); | |
1127 } | |
1128 | |
2529 | 1129 tmp = read_ini_string(inifile, "skin", "mainwinCloseY"); |
2313 | 1130 |
1131 if (tmp != NULL) | |
1132 { | |
1133 skin->properties.mainwin_close_y = atoi(tmp); | |
1134 g_free(tmp); | |
1135 } | |
1136 | |
1137 if (filename != NULL) | |
1138 g_free(filename); | |
2529 | 1139 |
1140 close_ini_file(inifile); | |
2313 | 1141 } |
1142 | |
1143 static guint | |
1144 hex_chars_to_int(gchar hi, gchar lo) | |
1145 { | |
1146 /* | |
1147 * Converts a value in the range 0x00-0xFF | |
1148 * to a integer in the range 0-65535 | |
1149 */ | |
1150 gchar str[3]; | |
1151 | |
1152 str[0] = hi; | |
1153 str[1] = lo; | |
1154 str[2] = 0; | |
1155 | |
1156 return (CLAMP(strtol(str, NULL, 16), 0, 0xFF) << 8); | |
1157 } | |
1158 | |
2529 | 1159 static GdkColor * |
1160 skin_load_color(INIFile *inifile, | |
2313 | 1161 const gchar * section, const gchar * key, |
1162 gchar * default_hex) | |
1163 { | |
2529 | 1164 gchar *value; |
2313 | 1165 GdkColor *color = NULL; |
1166 | |
2529 | 1167 if (inifile || default_hex) { |
1168 if (inifile) { | |
2587
2ef492ad3904
[svn] - always make sure we are operating on a copy of the ini string
nenolod
parents:
2581
diff
changeset
|
1169 value = g_strdup(read_ini_string(inifile, section, key)); |
2313 | 1170 if (value == NULL) { |
1171 value = g_strdup(default_hex); | |
1172 } | |
1173 } else { | |
1174 value = g_strdup(default_hex); | |
1175 } | |
1176 if (value) { | |
1177 gchar *ptr = value; | |
1178 gint len; | |
1179 | |
1180 color = g_new0(GdkColor, 1); | |
1181 g_strstrip(value); | |
1182 | |
1183 if (value[0] == '#') | |
1184 ptr++; | |
1185 len = strlen(ptr); | |
1186 /* | |
1187 * The handling of incomplete values is done this way | |
1188 * to maximize winamp compatibility | |
1189 */ | |
1190 if (len >= 6) { | |
1191 color->red = hex_chars_to_int(*ptr, *(ptr + 1)); | |
1192 ptr += 2; | |
1193 } | |
1194 if (len >= 4) { | |
1195 color->green = hex_chars_to_int(*ptr, *(ptr + 1)); | |
1196 ptr += 2; | |
1197 } | |
1198 if (len >= 2) | |
1199 color->blue = hex_chars_to_int(*ptr, *(ptr + 1)); | |
1200 | |
1201 gdk_colormap_alloc_color(gdk_drawable_get_colormap(playlistwin->window), | |
1202 color, TRUE, TRUE); | |
1203 g_free(value); | |
1204 } | |
1205 } | |
1206 return color; | |
1207 } | |
1208 | |
1209 | |
1210 | |
1211 GdkBitmap * | |
1212 skin_create_transparent_mask(const gchar * path, | |
1213 const gchar * file, | |
1214 const gchar * section, | |
1215 GdkWindow * window, | |
1216 gint width, | |
1217 gint height, gboolean doublesize) | |
1218 { | |
1219 GdkBitmap *mask = NULL; | |
1220 GdkGC *gc = NULL; | |
1221 GdkColor pattern; | |
1222 GdkPoint *gpoints; | |
1223 | |
1224 gchar *filename = NULL; | |
2529 | 1225 INIFile *inifile = NULL; |
2313 | 1226 gboolean created_mask = FALSE; |
1227 GArray *num, *point; | |
1228 guint i, j; | |
1229 gint k; | |
1230 | |
1231 if (path) | |
1232 filename = find_file_recursively(path, file); | |
1233 | |
1234 /* filename will be null if path wasn't set */ | |
2529 | 1235 if (!filename) |
2313 | 1236 return create_default_mask(window, width, height); |
2529 | 1237 |
1238 inifile = open_ini_file(filename); | |
2313 | 1239 |
2529 | 1240 if ((num = read_ini_array(inifile, section, "NumPoints")) == NULL) { |
2313 | 1241 g_free(filename); |
2529 | 1242 close_ini_file(inifile); |
2313 | 1243 return NULL; |
1244 } | |
1245 | |
2529 | 1246 if ((point = read_ini_array(inifile, section, "PointList")) == NULL) { |
2313 | 1247 g_array_free(num, TRUE); |
1248 g_free(filename); | |
2529 | 1249 close_ini_file(inifile); |
2313 | 1250 return NULL; |
1251 } | |
1252 | |
2529 | 1253 close_ini_file(inifile); |
1254 | |
2313 | 1255 mask = gdk_pixmap_new(window, width, height, 1); |
1256 gc = gdk_gc_new(mask); | |
1257 | |
1258 pattern.pixel = 0; | |
1259 gdk_gc_set_foreground(gc, &pattern); | |
1260 gdk_draw_rectangle(mask, gc, TRUE, 0, 0, width, height); | |
1261 pattern.pixel = 1; | |
1262 gdk_gc_set_foreground(gc, &pattern); | |
1263 | |
1264 j = 0; | |
1265 for (i = 0; i < num->len; i++) { | |
1266 if ((int)(point->len - j) >= (g_array_index(num, gint, i) * 2)) { | |
1267 created_mask = TRUE; | |
1268 gpoints = g_new(GdkPoint, g_array_index(num, gint, i)); | |
1269 for (k = 0; k < g_array_index(num, gint, i); k++) { | |
1270 gpoints[k].x = | |
1271 g_array_index(point, gint, j + k * 2) * (1 + doublesize); | |
1272 gpoints[k].y = | |
1273 g_array_index(point, gint, | |
1274 j + k * 2 + 1) * (1 + doublesize); | |
1275 } | |
1276 j += k * 2; | |
1277 gdk_draw_polygon(mask, gc, TRUE, gpoints, | |
1278 g_array_index(num, gint, i)); | |
1279 g_free(gpoints); | |
1280 } | |
1281 } | |
1282 g_array_free(num, TRUE); | |
1283 g_array_free(point, TRUE); | |
1284 g_free(filename); | |
1285 | |
1286 if (!created_mask) | |
1287 gdk_draw_rectangle(mask, gc, TRUE, 0, 0, width, height); | |
1288 | |
1289 g_object_unref(gc); | |
1290 | |
1291 return mask; | |
1292 } | |
1293 | |
1294 void | |
1295 skin_load_viscolor(Skin * skin, const gchar * path, const gchar * basename) | |
1296 { | |
1297 VFSFile *file; | |
1298 gint i, c; | |
1299 gchar line[256], *filename; | |
1300 GArray *a; | |
1301 | |
1302 g_return_if_fail(skin != NULL); | |
1303 g_return_if_fail(path != NULL); | |
1304 g_return_if_fail(basename != NULL); | |
1305 | |
1306 skin_set_default_vis_color(skin); | |
1307 | |
1308 filename = find_file_recursively(path, basename); | |
1309 if (!filename) | |
1310 return; | |
1311 | |
1312 if (!(file = vfs_fopen(filename, "r"))) { | |
1313 g_free(filename); | |
1314 return; | |
1315 } | |
1316 | |
1317 g_free(filename); | |
1318 | |
1319 for (i = 0; i < 24; i++) { | |
1320 if (vfs_fgets(line, 255, file)) { | |
1321 a = string_to_garray(line); | |
1322 if (a->len > 2) { | |
1323 for (c = 0; c < 3; c++) | |
1324 skin->vis_color[i][c] = g_array_index(a, gint, c); | |
1325 } | |
1326 g_array_free(a, TRUE); | |
1327 } | |
1328 else | |
1329 break; | |
1330 } | |
1331 | |
1332 vfs_fclose(file); | |
1333 } | |
1334 | |
1335 #if 0 | |
1336 static void | |
1337 skin_numbers_generate_dash(Skin * skin) | |
1338 { | |
1339 GdkGC *gc; | |
1340 GdkPixmap *pixmap; | |
1341 SkinPixmap *numbers; | |
1342 | |
1343 g_return_if_fail(skin != NULL); | |
1344 | |
1345 numbers = &skin->pixmaps[SKIN_NUMBERS]; | |
1346 if (!numbers->pixmap || numbers->current_width < 99) | |
1347 return; | |
1348 | |
1349 gc = gdk_gc_new(numbers->pixmap); | |
1350 pixmap = gdk_pixmap_new(mainwin->window, 108, | |
1351 numbers->current_height, | |
1352 -1); | |
1353 | |
1354 skin_draw_pixmap(skin, pixmap, gc, SKIN_NUMBERS, 0, 0, 0, 0, 99, 13); | |
1355 skin_draw_pixmap(skin, pixmap, gc, SKIN_NUMBERS, 90, 0, 99, 0, 9, 13); | |
1356 skin_draw_pixmap(skin, pixmap, gc, SKIN_NUMBERS, 20, 6, 101, 6, 5, 1); | |
1357 | |
1358 g_object_unref(numbers->pixmap); | |
1359 g_object_unref(gc); | |
1360 | |
1361 numbers->pixmap = pixmap; | |
1362 numbers->current_width = 108; | |
1363 } | |
1364 #endif | |
1365 | |
1366 static void | |
1367 skin_load_cursor(Skin * skin, const gchar * dirname) | |
1368 { | |
1369 const gchar * basename = "normal.cur"; | |
1370 gchar * filename = NULL; | |
1371 GdkPixbuf * cursor_pixbuf = NULL; | |
1372 GdkPixbufAnimation * cursor_animated = NULL; | |
1373 GdkCursor * cursor_gdk = NULL; | |
1374 GError * error = NULL; | |
1375 | |
1376 filename = find_file_recursively(dirname, basename); | |
1377 | |
2529 | 1378 if (filename && cfg.custom_cursors) { |
1379 cursor_animated = gdk_pixbuf_animation_new_from_file(filename, &error); | |
2313 | 1380 cursor_pixbuf = gdk_pixbuf_animation_get_static_image(cursor_animated); |
1381 cursor_gdk = gdk_cursor_new_from_pixbuf(gdk_display_get_default(), | |
1382 cursor_pixbuf, 0, 0); | |
1383 } else { | |
1384 cursor_gdk = gdk_cursor_new(GDK_LEFT_PTR); | |
1385 } | |
1386 | |
1387 gdk_window_set_cursor(mainwin->window, cursor_gdk); | |
1388 gdk_window_set_cursor(playlistwin->window, cursor_gdk); | |
1389 gdk_window_set_cursor(equalizerwin->window, cursor_gdk); | |
1390 gdk_cursor_unref(cursor_gdk); | |
1391 } | |
1392 | |
1393 static void | |
1394 skin_load_pixmaps(Skin * skin, const gchar * path) | |
1395 { | |
1396 GdkPixmap *text_pm; | |
1397 guint i; | |
2654 | 1398 gchar *filename; |
1399 INIFile *inifile; | |
2313 | 1400 |
1401 for (i = 0; i < SKIN_PIXMAP_COUNT; i++) | |
1402 skin_load_pixmap_id(skin, i, path); | |
1403 | |
1404 text_pm = skin->pixmaps[SKIN_TEXT].pixmap; | |
1405 | |
1406 if (text_pm) | |
1407 skin_get_textcolors(text_pm, skin->textbg, skin->textfg); | |
1408 | |
1409 #if 0 | |
1410 if (skin->pixmaps[SKIN_NUMBERS].pixmap) | |
1411 skin_numbers_generate_dash(skin); | |
1412 #endif | |
1413 | |
2654 | 1414 filename = find_file_recursively(path, "pledit.txt"); |
1415 inifile = open_ini_file(filename); | |
2529 | 1416 |
2313 | 1417 skin->colors[SKIN_PLEDIT_NORMAL] = |
2529 | 1418 skin_load_color(inifile, "Text", "Normal", "#2499ff"); |
2313 | 1419 skin->colors[SKIN_PLEDIT_CURRENT] = |
2529 | 1420 skin_load_color(inifile, "Text", "Current", "#ffeeff"); |
2313 | 1421 skin->colors[SKIN_PLEDIT_NORMALBG] = |
2529 | 1422 skin_load_color(inifile, "Text", "NormalBG", "#0a120a"); |
2313 | 1423 skin->colors[SKIN_PLEDIT_SELECTEDBG] = |
2529 | 1424 skin_load_color(inifile, "Text", "SelectedBG", "#0a124a"); |
1425 | |
1426 if (filename) | |
1427 g_free(filename); | |
1428 close_ini_file(inifile); | |
2313 | 1429 |
1430 skin_mask_create(skin, path, SKIN_MASK_MAIN, mainwin->window); | |
1431 skin_mask_create(skin, path, SKIN_MASK_MAIN_SHADE, mainwin->window); | |
1432 | |
1433 skin_mask_create(skin, path, SKIN_MASK_EQ, equalizerwin->window); | |
1434 skin_mask_create(skin, path, SKIN_MASK_EQ_SHADE, equalizerwin->window); | |
1435 | |
1436 skin_load_viscolor(skin, path, "viscolor.txt"); | |
1437 } | |
1438 | |
1439 static gboolean | |
1440 skin_load_nolock(Skin * skin, const gchar * path, gboolean force) | |
1441 { | |
1442 gchar *cpath; | |
1443 | |
1444 g_return_val_if_fail(skin != NULL, FALSE); | |
1445 g_return_val_if_fail(path != NULL, FALSE); | |
1446 REQUIRE_LOCK(skin->lock); | |
1447 | |
1448 if (!g_file_test(path, G_FILE_TEST_IS_REGULAR | G_FILE_TEST_IS_DIR)) | |
2529 | 1449 return FALSE; |
2313 | 1450 |
1451 if (!force) { | |
1452 if (skin->path) | |
1453 if (!strcmp(skin->path, path)) | |
1454 return FALSE; | |
1455 } | |
1456 | |
1457 skin_current_num++; | |
1458 | |
1459 skin->path = g_strdup(path); | |
1460 | |
1461 if (!file_is_archive(path)) { | |
1462 /* Parse the hints for this skin. */ | |
1463 skin_parse_hints(skin, NULL); | |
1464 | |
1465 skin_load_pixmaps(skin, path); | |
1466 skin_load_cursor(skin, path); | |
1467 | |
1468 return TRUE; | |
1469 } | |
1470 | |
1471 if (!(cpath = archive_decompress(path))) { | |
1472 g_message("Unable to extract skin archive (%s)", path); | |
1473 return FALSE; | |
1474 } | |
1475 | |
1476 /* Parse the hints for this skin. */ | |
1477 skin_parse_hints(skin, cpath); | |
1478 | |
1479 skin_load_pixmaps(skin, cpath); | |
1480 skin_load_cursor(skin, cpath); | |
1481 | |
1482 del_directory(cpath); | |
1483 g_free(cpath); | |
1484 | |
1485 return TRUE; | |
1486 } | |
1487 | |
1488 void | |
1489 skin_install_skin(const gchar * path) | |
1490 { | |
1491 gchar *command; | |
1492 | |
1493 g_return_if_fail(path != NULL); | |
1494 | |
2529 | 1495 command = g_strdup_printf("cp %s %s", |
1496 path, bmp_paths[BMP_PATH_USER_SKIN_DIR]); | |
2313 | 1497 if (system(command)) { |
1498 g_message("Unable to install skin (%s) into user directory (%s)", | |
1499 path, bmp_paths[BMP_PATH_USER_SKIN_DIR]); | |
1500 } | |
1501 g_free(command); | |
1502 } | |
1503 | |
1504 | |
1505 gboolean | |
1506 skin_load(Skin * skin, const gchar * path) | |
1507 { | |
1508 gboolean error; | |
1509 | |
1510 g_return_val_if_fail(skin != NULL, FALSE); | |
1511 | |
1512 if (!path) | |
1513 return FALSE; | |
1514 | |
1515 skin_lock(skin); | |
1516 error = skin_load_nolock(skin, path, FALSE); | |
1517 skin_unlock(skin); | |
1518 | |
1519 return error; | |
1520 } | |
1521 | |
1522 gboolean | |
1523 skin_reload_forced(void) | |
1524 { | |
1525 gboolean error; | |
1526 | |
1527 skin_lock(bmp_active_skin); | |
1528 error = skin_load_nolock(bmp_active_skin, bmp_active_skin->path, TRUE); | |
1529 skin_unlock(bmp_active_skin); | |
1530 | |
1531 return error; | |
1532 } | |
1533 | |
1534 void | |
1535 skin_reload(Skin * skin) | |
1536 { | |
1537 g_return_if_fail(skin != NULL); | |
1538 skin_load_nolock(skin, skin->path, TRUE); | |
1539 } | |
1540 | |
1541 | |
1542 static SkinPixmap * | |
1543 skin_get_pixmap(Skin * skin, SkinPixmapId map_id) | |
1544 { | |
1545 g_return_val_if_fail(skin != NULL, NULL); | |
1546 g_return_val_if_fail(map_id < SKIN_PIXMAP_COUNT, NULL); | |
1547 | |
1548 return &skin->pixmaps[map_id]; | |
1549 } | |
1550 | |
1551 GdkBitmap * | |
1552 skin_get_mask(Skin * skin, SkinMaskId mi) | |
1553 { | |
1554 GdkBitmap **masks; | |
1555 | |
1556 g_return_val_if_fail(skin != NULL, NULL); | |
1557 g_return_val_if_fail(mi < SKIN_PIXMAP_COUNT, NULL); | |
1558 | |
1559 masks = cfg.doublesize ? skin->ds_masks : skin->masks; | |
1560 return masks[mi]; | |
1561 } | |
1562 | |
1563 GdkColor * | |
1564 skin_get_color(Skin * skin, SkinColorId color_id) | |
1565 { | |
1566 GdkColor *ret = NULL; | |
1567 | |
1568 g_return_val_if_fail(skin != NULL, NULL); | |
1569 | |
1570 switch (color_id) { | |
1571 case SKIN_TEXTBG: | |
1572 if (skin->pixmaps[SKIN_TEXT].pixmap) | |
1573 ret = skin->textbg; | |
1574 else | |
1575 ret = skin->def_textbg; | |
1576 break; | |
1577 case SKIN_TEXTFG: | |
1578 if (skin->pixmaps[SKIN_TEXT].pixmap) | |
1579 ret = skin->textfg; | |
1580 else | |
1581 ret = skin->def_textfg; | |
1582 break; | |
1583 default: | |
1584 if (color_id < SKIN_COLOR_COUNT) | |
1585 ret = skin->colors[color_id]; | |
1586 break; | |
1587 } | |
1588 return ret; | |
1589 } | |
1590 | |
1591 void | |
1592 skin_get_viscolor(Skin * skin, guchar vis_color[24][3]) | |
1593 { | |
1594 gint i; | |
1595 | |
1596 g_return_if_fail(skin != NULL); | |
1597 | |
1598 for (i = 0; i < 24; i++) { | |
1599 vis_color[i][0] = skin->vis_color[i][0]; | |
1600 vis_color[i][1] = skin->vis_color[i][1]; | |
1601 vis_color[i][2] = skin->vis_color[i][2]; | |
1602 } | |
1603 } | |
1604 | |
1605 gint | |
1606 skin_get_id(void) | |
1607 { | |
1608 return skin_current_num; | |
1609 } | |
1610 | |
1611 void | |
1612 skin_draw_pixmap(Skin * skin, GdkDrawable * drawable, GdkGC * gc, | |
1613 SkinPixmapId pixmap_id, | |
1614 gint xsrc, gint ysrc, gint xdest, gint ydest, | |
1615 gint width, gint height) | |
1616 { | |
1617 SkinPixmap *pixmap; | |
1618 | |
1619 g_return_if_fail(skin != NULL); | |
1620 | |
1621 pixmap = skin_get_pixmap(skin, pixmap_id); | |
1622 g_return_if_fail(pixmap != NULL); | |
1623 g_return_if_fail(pixmap->pixmap != NULL); | |
1624 | |
3001
6d4b7b739232
fully implement UiSkinnedNumber, number.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2989
diff
changeset
|
1625 if (xsrc+width > pixmap->width || ysrc+height > pixmap->height) { |
6d4b7b739232
fully implement UiSkinnedNumber, number.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2989
diff
changeset
|
1626 if (pixmap_id == SKIN_NUMBERS) |
6d4b7b739232
fully implement UiSkinnedNumber, number.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2989
diff
changeset
|
1627 xsrc = 90; |
3045
464ae313343c
mainwin_volume and mainwin_balance are UiSkinnedHorizontalSliders now; add workaround for skins with too strait SKIN_VOLUME
Tomasz Mon <desowin@gmail.com>
parents:
3020
diff
changeset
|
1628 else if (pixmap_id == SKIN_VOLUME) { |
464ae313343c
mainwin_volume and mainwin_balance are UiSkinnedHorizontalSliders now; add workaround for skins with too strait SKIN_VOLUME
Tomasz Mon <desowin@gmail.com>
parents:
3020
diff
changeset
|
1629 /* some winamp skins have too strait SKIN_VOLUME, so let's copy what's remain from SKIN_MAIN */ |
464ae313343c
mainwin_volume and mainwin_balance are UiSkinnedHorizontalSliders now; add workaround for skins with too strait SKIN_VOLUME
Tomasz Mon <desowin@gmail.com>
parents:
3020
diff
changeset
|
1630 gdk_draw_drawable(drawable, gc, skin_get_pixmap(bmp_active_skin, SKIN_MAIN)->pixmap, |
464ae313343c
mainwin_volume and mainwin_balance are UiSkinnedHorizontalSliders now; add workaround for skins with too strait SKIN_VOLUME
Tomasz Mon <desowin@gmail.com>
parents:
3020
diff
changeset
|
1631 skin->properties.mainwin_volume_x, skin->properties.mainwin_volume_y, |
464ae313343c
mainwin_volume and mainwin_balance are UiSkinnedHorizontalSliders now; add workaround for skins with too strait SKIN_VOLUME
Tomasz Mon <desowin@gmail.com>
parents:
3020
diff
changeset
|
1632 pixmap->width, ydest, width - pixmap->width, height); |
464ae313343c
mainwin_volume and mainwin_balance are UiSkinnedHorizontalSliders now; add workaround for skins with too strait SKIN_VOLUME
Tomasz Mon <desowin@gmail.com>
parents:
3020
diff
changeset
|
1633 width = pixmap->width; |
3075
5854741efa0d
some skins have SKIN_MONOSTEREO with size 58x20
Tomasz Mon <desowin@gmail.com>
parents:
3056
diff
changeset
|
1634 } else if (pixmap_id == SKIN_MONOSTEREO) { |
5854741efa0d
some skins have SKIN_MONOSTEREO with size 58x20
Tomasz Mon <desowin@gmail.com>
parents:
3056
diff
changeset
|
1635 /* XMMS skins seems to have SKIN_MONOSTEREO with size 58x20 instead of 58x24 */ |
5854741efa0d
some skins have SKIN_MONOSTEREO with size 58x20
Tomasz Mon <desowin@gmail.com>
parents:
3056
diff
changeset
|
1636 gdk_draw_drawable(drawable, gc, skin_get_pixmap(bmp_active_skin, SKIN_MAIN)->pixmap, |
5854741efa0d
some skins have SKIN_MONOSTEREO with size 58x20
Tomasz Mon <desowin@gmail.com>
parents:
3056
diff
changeset
|
1637 212 + xdest, 41, xdest, ydest, width, height); |
3076 | 1638 height = pixmap->height/2; |
3045
464ae313343c
mainwin_volume and mainwin_balance are UiSkinnedHorizontalSliders now; add workaround for skins with too strait SKIN_VOLUME
Tomasz Mon <desowin@gmail.com>
parents:
3020
diff
changeset
|
1639 } else |
3001
6d4b7b739232
fully implement UiSkinnedNumber, number.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2989
diff
changeset
|
1640 return; |
6d4b7b739232
fully implement UiSkinnedNumber, number.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2989
diff
changeset
|
1641 } |
2313 | 1642 |
1643 width = MIN(width, pixmap->width - xsrc); | |
1644 height = MIN(height, pixmap->height - ysrc); | |
1645 gdk_draw_drawable(drawable, gc, pixmap->pixmap, xsrc, ysrc, | |
1646 xdest, ydest, width, height); | |
1647 } | |
1648 | |
1649 void | |
1650 skin_get_eq_spline_colors(Skin * skin, guint32 colors[19]) | |
1651 { | |
1652 gint i; | |
1653 GdkPixmap *pixmap; | |
1654 GdkImage *img; | |
1655 SkinPixmap *eqmainpm; | |
1656 | |
1657 g_return_if_fail(skin != NULL); | |
1658 | |
1659 eqmainpm = &skin->pixmaps[SKIN_EQMAIN]; | |
1660 if (eqmainpm->pixmap && | |
1661 eqmainpm->current_width >= 116 && eqmainpm->current_height >= 313) | |
1662 pixmap = eqmainpm->pixmap; | |
1663 else | |
1664 return; | |
1665 | |
1666 if (!GDK_IS_DRAWABLE(pixmap)) | |
1667 return; | |
1668 | |
1669 if (!(img = gdk_drawable_get_image(pixmap, 115, 294, 1, 19))) | |
1670 return; | |
1671 | |
1672 for (i = 0; i < 19; i++) | |
1673 colors[i] = gdk_image_get_pixel(img, 0, i); | |
1674 | |
1675 g_object_unref(img); | |
1676 } | |
1677 | |
1678 | |
1679 static void | |
1680 skin_draw_playlistwin_frame_top(Skin * skin, | |
1681 GdkDrawable * drawable, | |
1682 GdkGC * gc, | |
1683 gint width, gint height, gboolean focus) | |
1684 { | |
1685 /* The title bar skin consists of 2 sets of 4 images, 1 set | |
1686 * for focused state and the other for unfocused. The 4 images | |
1687 * are: | |
1688 * | |
1689 * a. right corner (25,20) | |
1690 * b. left corner (25,20) | |
1691 * c. tiler (25,20) | |
1692 * d. title (100,20) | |
1693 * | |
1694 * min allowed width = 100+25+25 = 150 | |
1695 */ | |
1696 | |
1697 gint i, y, c; | |
1698 | |
1699 /* get y offset of the pixmap set to use */ | |
1700 if (focus) | |
1701 y = 0; | |
1702 else | |
1703 y = 21; | |
1704 | |
1705 /* left corner */ | |
1706 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT, 0, y, 0, 0, 25, 20); | |
1707 | |
1708 /* titlebar title */ | |
1709 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT, 26, y, | |
1710 (width - 100) / 2, 0, 100, 20); | |
1711 | |
1712 /* titlebar right corner */ | |
1713 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT, 153, y, | |
1714 width - 25, 0, 25, 20); | |
1715 | |
1716 /* tile draw the remaining frame */ | |
1717 | |
1718 /* compute tile count */ | |
1719 c = (width - (100 + 25 + 25)) / 25; | |
1720 | |
1721 for (i = 0; i < c / 2; i++) { | |
1722 /* left of title */ | |
1723 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT, 127, y, | |
1724 25 + i * 25, 0, 25, 20); | |
1725 | |
1726 /* right of title */ | |
1727 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT, 127, y, | |
1728 (width + 100) / 2 + i * 25, 0, 25, 20); | |
1729 } | |
1730 | |
1731 if (c & 1) { | |
1732 /* Odd tile count, so one remaining to draw. Here we split | |
1733 * it into two and draw half on either side of the title */ | |
1734 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT, 127, y, | |
1735 ((c / 2) * 25) + 25, 0, 12, 20); | |
1736 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT, 127, y, | |
1737 (width / 2) + ((c / 2) * 25) + 50, 0, 13, 20); | |
1738 } | |
1739 } | |
1740 | |
1741 static void | |
1742 skin_draw_playlistwin_frame_bottom(Skin * skin, | |
1743 GdkDrawable * drawable, | |
1744 GdkGC * gc, | |
1745 gint width, gint height, gboolean focus) | |
1746 { | |
1747 /* The bottom frame skin consists of 1 set of 4 images. The 4 | |
1748 * images are: | |
1749 * | |
1750 * a. left corner with menu buttons (125,38) | |
1751 * b. visualization window (75,38) | |
1752 * c. right corner with play buttons (150,38) | |
1753 * d. frame tile (25,38) | |
1754 * | |
1755 * (min allowed width = 125+150+25=300 | |
1756 */ | |
1757 | |
1758 gint i, c; | |
1759 | |
1760 /* bottom left corner (menu buttons) */ | |
1761 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT, 0, 72, | |
1762 0, height - 38, 125, 38); | |
1763 | |
1764 c = (width - 275) / 25; | |
1765 | |
1766 /* draw visualization window, if width allows */ | |
1767 if (c >= 3) { | |
1768 c -= 3; | |
1769 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT, 205, 0, | |
1770 width - (150 + 75), height - 38, 75, 38); | |
1771 } | |
1772 | |
1773 /* Bottom right corner (playbuttons etc) */ | |
1774 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT, | |
1775 126, 72, width - 150, height - 38, 150, 38); | |
1776 | |
1777 /* Tile draw the remaining undrawn portions */ | |
1778 for (i = 0; i < c; i++) | |
1779 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT, 179, 0, | |
1780 125 + i * 25, height - 38, 25, 38); | |
1781 } | |
1782 | |
1783 static void | |
1784 skin_draw_playlistwin_frame_sides(Skin * skin, | |
1785 GdkDrawable * drawable, | |
1786 GdkGC * gc, | |
1787 gint width, gint height, gboolean focus) | |
1788 { | |
1789 /* The side frames consist of 2 tile images. 1 for the left, 1 for | |
1790 * the right. | |
1791 * a. left (12,29) | |
1792 * b. right (19,29) | |
1793 */ | |
1794 | |
1795 gint i; | |
1796 | |
1797 /* frame sides */ | |
1798 for (i = 0; i < (height - (20 + 38)) / 29; i++) { | |
1799 /* left */ | |
1800 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT, 0, 42, | |
1801 0, 20 + i * 29, 12, 29); | |
1802 | |
1803 /* right */ | |
1804 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT, 32, 42, | |
1805 width - 19, 20 + i * 29, 19, 29); | |
1806 } | |
1807 } | |
1808 | |
1809 | |
1810 void | |
1811 skin_draw_playlistwin_frame(Skin * skin, | |
1812 GdkDrawable * drawable, GdkGC * gc, | |
1813 gint width, gint height, gboolean focus) | |
1814 { | |
1815 skin_draw_playlistwin_frame_top(skin, drawable, gc, width, height, focus); | |
1816 skin_draw_playlistwin_frame_bottom(skin, drawable, gc, width, height, | |
1817 focus); | |
1818 skin_draw_playlistwin_frame_sides(skin, drawable, gc, width, height, | |
1819 focus); | |
1820 } | |
1821 | |
1822 | |
1823 void | |
1824 skin_draw_playlistwin_shaded(Skin * skin, | |
1825 GdkDrawable * drawable, GdkGC * gc, | |
1826 gint width, gboolean focus) | |
1827 { | |
1828 /* The shade mode titlebar skin consists of 4 images: | |
1829 * a) left corner offset (72,42) size (25,14) | |
1830 * b) right corner, focused offset (99,57) size (50,14) | |
1831 * c) right corner, unfocused offset (99,42) size (50,14) | |
1832 * d) bar tile offset (72,57) size (25,14) | |
1833 */ | |
1834 | |
1835 gint i; | |
1836 | |
1837 /* left corner */ | |
1838 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT, 72, 42, 0, 0, 25, 14); | |
1839 | |
1840 /* bar tile */ | |
1841 for (i = 0; i < (width - 75) / 25; i++) | |
1842 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT, 72, 57, | |
1843 (i * 25) + 25, 0, 25, 14); | |
1844 | |
1845 /* right corner */ | |
1846 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT, 99, focus ? 42 : 57, | |
1847 width - 50, 0, 50, 14); | |
1848 } | |
1849 | |
1850 | |
1851 void | |
1852 skin_draw_mainwin_titlebar(Skin * skin, | |
1853 GdkDrawable * drawable, GdkGC * gc, | |
1854 gboolean shaded, gboolean focus) | |
1855 { | |
1856 /* The titlebar skin consists of 2 sets of 2 images, one for for | |
1857 * shaded and the other for unshaded mode, giving a total of 4. | |
1858 * The images are exactly 275x14 pixels, aligned and arranged | |
1859 * vertically on each other in the pixmap in the following order: | |
1860 * | |
1861 * a) unshaded, focused offset (27, 0) | |
1862 * b) unshaded, unfocused offset (27, 15) | |
1863 * c) shaded, focused offset (27, 29) | |
1864 * d) shaded, unfocused offset (27, 42) | |
1865 */ | |
1866 | |
1867 gint y_offset; | |
1868 | |
1869 if (shaded) { | |
1870 if (focus) | |
1871 y_offset = 29; | |
1872 else | |
1873 y_offset = 42; | |
1874 } | |
1875 else { | |
1876 if (focus) | |
1877 y_offset = 0; | |
1878 else | |
1879 y_offset = 15; | |
1880 } | |
1881 | |
1882 skin_draw_pixmap(skin, drawable, gc, SKIN_TITLEBAR, 27, y_offset, | |
1883 0, 0, bmp_active_skin->properties.mainwin_width, MAINWIN_TITLEBAR_HEIGHT); | |
1884 } | |
2443
93686e8815a4
[svn] - Changed playback_set_random_skin() to skin_set_random_skin()
mf0102
parents:
2313
diff
changeset
|
1885 |
93686e8815a4
[svn] - Changed playback_set_random_skin() to skin_set_random_skin()
mf0102
parents:
2313
diff
changeset
|
1886 |
93686e8815a4
[svn] - Changed playback_set_random_skin() to skin_set_random_skin()
mf0102
parents:
2313
diff
changeset
|
1887 void |
93686e8815a4
[svn] - Changed playback_set_random_skin() to skin_set_random_skin()
mf0102
parents:
2313
diff
changeset
|
1888 skin_set_random_skin(void) |
93686e8815a4
[svn] - Changed playback_set_random_skin() to skin_set_random_skin()
mf0102
parents:
2313
diff
changeset
|
1889 { |
93686e8815a4
[svn] - Changed playback_set_random_skin() to skin_set_random_skin()
mf0102
parents:
2313
diff
changeset
|
1890 SkinNode *node; |
93686e8815a4
[svn] - Changed playback_set_random_skin() to skin_set_random_skin()
mf0102
parents:
2313
diff
changeset
|
1891 guint32 randval; |
93686e8815a4
[svn] - Changed playback_set_random_skin() to skin_set_random_skin()
mf0102
parents:
2313
diff
changeset
|
1892 |
93686e8815a4
[svn] - Changed playback_set_random_skin() to skin_set_random_skin()
mf0102
parents:
2313
diff
changeset
|
1893 /* Get a random value to select the skin to use */ |
93686e8815a4
[svn] - Changed playback_set_random_skin() to skin_set_random_skin()
mf0102
parents:
2313
diff
changeset
|
1894 randval = g_random_int_range(0, g_list_length(skinlist)); |
93686e8815a4
[svn] - Changed playback_set_random_skin() to skin_set_random_skin()
mf0102
parents:
2313
diff
changeset
|
1895 node = g_list_nth(skinlist, randval)->data; |
93686e8815a4
[svn] - Changed playback_set_random_skin() to skin_set_random_skin()
mf0102
parents:
2313
diff
changeset
|
1896 bmp_active_skin_load(node->path); |
93686e8815a4
[svn] - Changed playback_set_random_skin() to skin_set_random_skin()
mf0102
parents:
2313
diff
changeset
|
1897 } |