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