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