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