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