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