Mercurial > audlegacy
annotate audacious/widgets/skin.c @ 1788:80b6282a31ae trunk
[svn] - implement mainwinOthertextIsStatus property.
author | nenolod |
---|---|
date | Wed, 04 Oct 2006 18:48:49 -0700 |
parents | 4051f893f571 |
children | b8f082ddd9f1 |
rev | line source |
---|---|
1653 | 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 "equalizer.h" | |
37 #include "main.h" | |
38 #include "ui_playlist.h" | |
39 #include "skinwin.h" | |
40 #include "util.h" | |
41 | |
42 #include "debug.h" | |
43 | |
44 #include "platform/smartinclude.h" | |
1670 | 45 #include "libaudacious/vfs.h" |
1653 | 46 |
47 #define EXTENSION_TARGETS 7 | |
48 | |
49 static gchar *ext_targets[EXTENSION_TARGETS] = { "bmp", "xpm", "png", "svg", | |
50 "gif", "jpg", "jpeg" }; | |
51 | |
52 struct _SkinPixmapIdMapping { | |
53 SkinPixmapId id; | |
54 const gchar *name; | |
55 const gchar *alt_name; | |
56 gint width, height; | |
57 }; | |
58 | |
59 struct _SkinMaskInfo { | |
60 gint width, height; | |
61 gchar *inistr; | |
62 }; | |
63 | |
64 typedef struct _SkinPixmapIdMapping SkinPixmapIdMapping; | |
65 typedef struct _SkinMaskInfo SkinMaskInfo; | |
66 | |
67 | |
68 Skin *bmp_active_skin = NULL; | |
69 | |
70 static gint skin_current_num; | |
71 | |
72 static SkinMaskInfo skin_mask_info[] = { | |
73 {275, 116, "Normal"}, | |
74 {275, 16, "WindowShade"}, | |
75 {275, 116, "Equalizer"}, | |
76 {275, 16, "EqualizerWS"} | |
77 }; | |
78 | |
79 static SkinPixmapIdMapping skin_pixmap_id_map[] = { | |
80 {SKIN_MAIN, "main", NULL, 0, 0}, | |
81 {SKIN_CBUTTONS, "cbuttons", NULL, 0, 0}, | |
82 {SKIN_SHUFREP, "shufrep", NULL, 0, 0}, | |
83 {SKIN_TEXT, "text", NULL, 0, 0}, | |
84 {SKIN_TITLEBAR, "titlebar", NULL, 0, 0}, | |
85 {SKIN_VOLUME, "volume", NULL, 0, 0}, | |
86 {SKIN_BALANCE, "balance", "volume", 0, 0}, | |
87 {SKIN_MONOSTEREO, "monoster", NULL, 0, 0}, | |
88 {SKIN_PLAYPAUSE, "playpaus", NULL, 0, 0}, | |
89 {SKIN_NUMBERS, "nums_ex", "numbers", 0, 0}, | |
90 {SKIN_POSBAR, "posbar", NULL, 0, 0}, | |
91 {SKIN_EQMAIN, "eqmain", NULL, 0, 0}, | |
92 {SKIN_PLEDIT, "pledit", NULL, 0, 0}, | |
93 {SKIN_EQ_EX, "eq_ex", NULL, 0, 0} | |
94 }; | |
95 | |
96 static guint skin_pixmap_id_map_size = G_N_ELEMENTS(skin_pixmap_id_map); | |
97 | |
98 static const guchar skin_default_viscolor[24][3] = { | |
99 {9, 34, 53}, | |
100 {10, 18, 26}, | |
101 {0, 54, 108}, | |
102 {0, 58, 116}, | |
103 {0, 62, 124}, | |
104 {0, 66, 132}, | |
105 {0, 70, 140}, | |
106 {0, 74, 148}, | |
107 {0, 78, 156}, | |
108 {0, 82, 164}, | |
109 {0, 86, 172}, | |
110 {0, 92, 184}, | |
111 {0, 98, 196}, | |
112 {0, 104, 208}, | |
113 {0, 110, 220}, | |
114 {0, 116, 232}, | |
115 {0, 122, 244}, | |
116 {0, 128, 255}, | |
117 {0, 128, 255}, | |
118 {0, 104, 208}, | |
119 {0, 80, 160}, | |
120 {0, 56, 112}, | |
121 {0, 32, 64}, | |
122 {200, 200, 200} | |
123 }; | |
124 | |
125 static GdkBitmap * | |
126 skin_create_transparent_mask(const gchar *, | |
127 const gchar *, | |
128 const gchar *, | |
129 GdkWindow *, | |
130 gint, gint); | |
131 | |
132 static void | |
133 skin_setup_masks(Skin * skin); | |
134 | |
135 static void | |
136 skin_set_default_vis_color(Skin * skin); | |
137 | |
138 | |
139 void | |
140 skin_lock(Skin * skin) | |
141 { | |
142 g_mutex_lock(skin->lock); | |
143 } | |
144 | |
145 void | |
146 skin_unlock(Skin * skin) | |
147 { | |
148 g_mutex_unlock(skin->lock); | |
149 } | |
150 | |
151 gboolean | |
152 bmp_active_skin_reload(void) | |
153 { | |
154 return bmp_active_skin_load(bmp_active_skin->path); | |
155 } | |
156 | |
157 gboolean | |
158 bmp_active_skin_load(const gchar * path) | |
159 { | |
160 g_return_val_if_fail(bmp_active_skin != NULL, FALSE); | |
161 | |
162 memset(&bmp_active_skin->properties, 0, sizeof(SkinProperties)); | |
163 | |
164 if (!skin_load(bmp_active_skin, path)) | |
165 return FALSE; | |
166 | |
167 skin_setup_masks(bmp_active_skin); | |
168 | |
169 if (cfg.playlist_transparent) | |
170 { | |
171 if (rootpix != NULL) | |
172 g_object_unref(rootpix); | |
173 | |
174 rootpix = shade_pixmap(get_transparency_pixmap(), 0, 0, 0, 0, gdk_screen_width(), gdk_screen_height(), | |
175 skin_get_color(bmp_active_skin, SKIN_PLEDIT_NORMALBG)); | |
176 } | |
177 | |
178 draw_main_window(TRUE); | |
179 draw_playlist_window(TRUE); | |
180 draw_equalizer_window(TRUE); | |
181 | |
182 vis_set_window(mainwin_vis, mainwin->window); | |
183 playlistwin_update_list(); | |
184 | |
185 return TRUE; | |
186 } | |
187 | |
188 void | |
189 skin_pixmap_free(SkinPixmap * p) | |
190 { | |
191 g_return_if_fail(p != NULL); | |
192 g_return_if_fail(p->pixmap != NULL); | |
193 | |
194 g_object_unref(p->pixmap); | |
195 p->pixmap = NULL; | |
196 } | |
197 | |
198 Skin * | |
199 skin_new(void) | |
200 { | |
201 Skin *skin; | |
202 skin = g_new0(Skin, 1); | |
203 skin->lock = g_mutex_new(); | |
204 return skin; | |
205 } | |
206 | |
207 void | |
208 skin_free(Skin * skin) | |
209 { | |
210 gint i; | |
211 | |
212 g_return_if_fail(skin != NULL); | |
213 | |
214 skin_lock(skin); | |
215 | |
216 for (i = 0; i < SKIN_PIXMAP_COUNT; i++) | |
217 skin_pixmap_free(&skin->pixmaps[i]); | |
218 | |
219 for (i = 0; i < SKIN_PIXMAP_COUNT; i++) { | |
220 if (skin->masks[i]) | |
221 g_object_unref(skin->masks[i]); | |
222 | |
223 skin->masks[i] = NULL; | |
224 } | |
225 | |
226 skin_set_default_vis_color(skin); | |
227 skin_unlock(skin); | |
228 } | |
229 | |
230 void | |
231 skin_destroy(Skin * skin) | |
232 { | |
233 g_return_if_fail(skin != NULL); | |
234 skin_free(skin); | |
235 g_mutex_free(skin->lock); | |
236 g_free(skin); | |
237 } | |
238 | |
239 const SkinPixmapIdMapping * | |
240 skin_pixmap_id_lookup(guint id) | |
241 { | |
242 guint i; | |
243 | |
244 for (i = 0; i < skin_pixmap_id_map_size; i++) { | |
245 if (id == skin_pixmap_id_map[i].id) { | |
246 return &skin_pixmap_id_map[i]; | |
247 } | |
248 } | |
249 | |
250 return NULL; | |
251 } | |
252 | |
253 const gchar * | |
254 skin_pixmap_id_to_name(SkinPixmapId id) | |
255 { | |
256 guint i; | |
257 | |
258 for (i = 0; i < skin_pixmap_id_map_size; i++) { | |
259 if (id == skin_pixmap_id_map[i].id) | |
260 return skin_pixmap_id_map[i].name; | |
261 } | |
262 return NULL; | |
263 } | |
264 | |
265 static void | |
266 skin_set_default_vis_color(Skin * skin) | |
267 { | |
268 memcpy(skin->vis_color, skin_default_viscolor, | |
269 sizeof(skin_default_viscolor)); | |
270 } | |
271 | |
272 /* | |
273 * I have rewritten this to take an array of possible targets, | |
274 * once we find a matching target we now return, instead of loop | |
275 * recursively. This allows for us to support many possible format | |
276 * targets for our skinning engine than just the original winamp | |
277 * formats. | |
278 * | |
279 * -- nenolod, 16 January 2006 | |
280 */ | |
281 gchar * | |
282 skin_pixmap_locate(const gchar * dirname, gchar ** basenames) | |
283 { | |
284 gchar *filename; | |
285 gint i; | |
286 | |
287 for (i = 0; basenames[i]; i++) | |
288 if (!(filename = find_file_recursively(dirname, basenames[i]))) | |
289 g_free(filename); | |
290 else | |
291 return filename; | |
292 | |
293 /* can't find any targets -- sorry */ | |
294 return NULL; | |
295 } | |
296 | |
297 /* FIXME: this function is temporary. It will be removed when the skinning system | |
298 uses GdkPixbuf in place of GdkPixmap */ | |
299 | |
300 static GdkPixmap * | |
301 pixmap_new_from_file(const gchar * filename) | |
302 { | |
303 GdkPixbuf *pixbuf; | |
304 GdkPixmap *pixmap; | |
305 gint width, height; | |
306 | |
307 if (!(pixbuf = gdk_pixbuf_new_from_file(filename, NULL))) | |
308 return NULL; | |
309 | |
310 width = gdk_pixbuf_get_width(pixbuf); | |
311 height = gdk_pixbuf_get_height(pixbuf); | |
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 gdk_pixbuf_render_to_drawable(pixbuf, pixmap, mainwin_gc, 0, 0, 0, 0, | |
320 width, height, GDK_RGB_DITHER_MAX, 0, 0); | |
321 g_object_unref(pixbuf); | |
322 | |
323 return pixmap; | |
324 } | |
325 | |
326 static gboolean | |
327 skin_load_pixmap_id(Skin * skin, SkinPixmapId id, const gchar * path_p) | |
328 { | |
329 const gchar *path; | |
330 gchar *filename; | |
331 gint width, height; | |
332 const SkinPixmapIdMapping *pixmap_id_mapping; | |
333 GdkPixmap *gpm; | |
334 SkinPixmap *pm = NULL; | |
335 gchar *basenames[EXTENSION_TARGETS * 2 + 1]; /* alternate basenames */ | |
336 gint i, y; | |
337 | |
338 g_return_val_if_fail(skin != NULL, FALSE); | |
339 g_return_val_if_fail(id < SKIN_PIXMAP_COUNT, FALSE); | |
340 | |
341 pixmap_id_mapping = skin_pixmap_id_lookup(id); | |
342 g_return_val_if_fail(pixmap_id_mapping != NULL, FALSE); | |
343 | |
344 memset(&basenames, 0, sizeof(basenames)); | |
345 | |
346 for (i = 0, y = 0; i < EXTENSION_TARGETS; i++, y++) | |
347 { | |
348 basenames[y] = g_strdup_printf("%s.%s", pixmap_id_mapping->name, | |
349 ext_targets[i]); | |
350 | |
351 if (pixmap_id_mapping->alt_name) | |
352 basenames[++y] = g_strdup_printf("%s.%s", | |
353 pixmap_id_mapping->alt_name, ext_targets[i]); | |
354 } | |
355 | |
356 path = path_p ? path_p : skin->path; | |
357 filename = skin_pixmap_locate(path, basenames); | |
358 | |
359 for (i = 0; basenames[i] != NULL; i++) | |
360 { | |
361 g_free(basenames[i]); | |
362 basenames[i] = NULL; | |
363 } | |
364 | |
365 if (!(gpm = pixmap_new_from_file(filename))) { | |
366 g_warning("loading of %s failed", filename); | |
367 g_free(filename); | |
368 return FALSE; | |
369 } | |
370 | |
371 g_free(filename); | |
372 | |
373 gdk_drawable_get_size(GDK_DRAWABLE(gpm), &width, &height); | |
374 pm = &skin->pixmaps[id]; | |
375 pm->pixmap = gpm; | |
376 pm->width = width; | |
377 pm->height = height; | |
378 pm->current_width = width; | |
379 pm->current_height = height; | |
380 | |
381 return TRUE; | |
382 } | |
383 | |
384 void | |
385 skin_mask_create(Skin * skin, | |
386 const gchar * path, | |
387 gint id, | |
388 GdkWindow * window) | |
389 { | |
390 skin->masks[id] = | |
391 skin_create_transparent_mask(path, "region.txt", | |
392 skin_mask_info[id].inistr, window, | |
393 skin_mask_info[id].width, | |
394 skin_mask_info[id].height); | |
395 } | |
396 | |
397 static void | |
398 skin_setup_masks(Skin * skin) | |
399 { | |
400 GdkBitmap *mask; | |
401 | |
402 if (cfg.show_wm_decorations) | |
403 return; | |
404 | |
405 if (cfg.player_visible) { | |
406 mask = skin_get_mask(skin, SKIN_MASK_MAIN + cfg.player_shaded); | |
407 gtk_widget_shape_combine_mask(mainwin, mask, 0, 0); | |
408 } | |
409 | |
410 mask = skin_get_mask(skin, SKIN_MASK_EQ + cfg.equalizer_shaded); | |
411 gtk_widget_shape_combine_mask(equalizerwin, mask, 0, 0); | |
412 } | |
413 | |
414 static GdkBitmap * | |
415 create_default_mask(GdkWindow * parent, gint w, gint h) | |
416 { | |
417 GdkBitmap *ret; | |
418 GdkGC *gc; | |
419 GdkColor pattern; | |
420 | |
421 ret = gdk_pixmap_new(parent, w, h, 1); | |
422 gc = gdk_gc_new(ret); | |
423 pattern.pixel = 1; | |
424 gdk_gc_set_foreground(gc, &pattern); | |
425 gdk_draw_rectangle(ret, gc, TRUE, 0, 0, w, h); | |
426 gdk_gc_destroy(gc); | |
427 | |
428 return ret; | |
429 } | |
430 | |
431 static void | |
432 skin_query_color(GdkColormap * cm, GdkColor * c) | |
433 { | |
434 #ifdef GDK_WINDOWING_X11 | |
435 XColor xc = { 0,0,0,0,0,0 }; | |
436 | |
437 xc.pixel = c->pixel; | |
438 XQueryColor(GDK_COLORMAP_XDISPLAY(cm), GDK_COLORMAP_XCOLORMAP(cm), &xc); | |
439 c->red = xc.red; | |
440 c->green = xc.green; | |
441 c->blue = xc.blue; | |
442 #else | |
443 /* do nothing. see what breaks? */ | |
444 #endif | |
445 } | |
446 | |
447 static glong | |
448 skin_calc_luminance(GdkColor * c) | |
449 { | |
450 return (0.212671 * c->red + 0.715160 * c->green + 0.072169 * c->blue); | |
451 } | |
452 | |
453 static void | |
454 skin_get_textcolors(GdkPixmap * text, GdkColor * bgc, GdkColor * fgc) | |
455 { | |
456 /* | |
457 * Try to extract reasonable background and foreground colors | |
458 * from the font pixmap | |
459 */ | |
460 | |
461 GdkImage *gi; | |
462 GdkColormap *cm; | |
463 gint i; | |
464 | |
465 g_return_if_fail(text != NULL); | |
466 | |
467 /* Get the first line of text */ | |
468 gi = gdk_drawable_get_image(text, 0, 0, 152, 6); | |
469 cm = gdk_window_get_colormap(playlistwin->window); | |
470 g_return_if_fail(GDK_IS_WINDOW(playlistwin->window)); | |
471 | |
472 for (i = 0; i < 6; i++) { | |
473 GdkColor c; | |
474 gint x; | |
475 glong d, max_d; | |
476 | |
477 /* Get a pixel from the middle of the space character */ | |
478 bgc[i].pixel = gdk_image_get_pixel(gi, 151, i); | |
479 skin_query_color(cm, &bgc[i]); | |
480 | |
481 max_d = 0; | |
482 for (x = 1; x < 150; x++) { | |
483 c.pixel = gdk_image_get_pixel(gi, x, i); | |
484 skin_query_color(cm, &c); | |
485 | |
486 d = labs(skin_calc_luminance(&c) - skin_calc_luminance(&bgc[i])); | |
487 if (d > max_d) { | |
488 memcpy(&fgc[i], &c, sizeof(GdkColor)); | |
489 max_d = d; | |
490 } | |
491 } | |
492 } | |
493 gdk_image_destroy(gi); | |
494 } | |
495 | |
496 gboolean | |
497 init_skins(const gchar * path) | |
498 { | |
499 bmp_active_skin = skin_new(); | |
500 | |
501 if (!bmp_active_skin_load(path)) { | |
502 /* FIXME: Oddly, g_message() causes a crash if path is NULL on | |
503 * Solaris (see bug #165) */ | |
504 if (path) | |
505 g_message("Unable to load skin (%s), trying default...", path); | |
506 | |
507 /* can't load configured skin, retry with default */ | |
508 if (!bmp_active_skin_load(BMP_DEFAULT_SKIN_PATH)) { | |
509 g_message("Unable to load default skin (%s)! Giving up.", | |
510 BMP_DEFAULT_SKIN_PATH); | |
511 return FALSE; | |
512 } | |
513 } | |
514 | |
515 if (cfg.random_skin_on_play) | |
516 skinlist_update(); | |
517 | |
518 return TRUE; | |
519 } | |
520 | |
521 /* | |
522 * Opens and parses a skin's hints file. | |
523 * Hints files are somewhat like "scripts" in Winamp3/5. | |
524 * We'll probably add scripts to it next. | |
525 */ | |
526 void | |
527 skin_parse_hints(Skin * skin, gchar *path_p) | |
528 { | |
529 gchar *filename, *tmp; | |
530 | |
531 path_p = path_p ? path_p : skin->path; | |
532 | |
1784 | 533 skin->properties.mainwin_othertext = FALSE; |
534 skin->properties.mainwin_vis_x = 24; | |
535 skin->properties.mainwin_vis_y = 43; | |
536 skin->properties.mainwin_vis_width = 76; | |
1785 | 537 skin->properties.mainwin_text_x = 112; |
538 skin->properties.mainwin_text_y = 27; | |
539 skin->properties.mainwin_text_width = 153; | |
1784 | 540 |
541 skin->properties.mainwin_menurow_visible = TRUE; | |
1772
cb216af25b55
[svn] - framework for repositioning the vis element on the skin.
nenolod
parents:
1751
diff
changeset
|
542 |
1653 | 543 filename = find_file_recursively(path_p, "skin.hints"); |
544 | |
545 if (filename == NULL) | |
546 return; | |
547 | |
548 #if 0 | |
549 skin->description = read_ini_string(filename, "skin", "skinDescription"); | |
550 #endif | |
551 | |
552 tmp = read_ini_string(filename, "skin", "mainwinOthertext"); | |
553 | |
554 if (tmp != NULL) | |
1772
cb216af25b55
[svn] - framework for repositioning the vis element on the skin.
nenolod
parents:
1751
diff
changeset
|
555 { |
1653 | 556 skin->properties.mainwin_othertext = atoi(tmp); |
1772
cb216af25b55
[svn] - framework for repositioning the vis element on the skin.
nenolod
parents:
1751
diff
changeset
|
557 g_free(tmp); |
cb216af25b55
[svn] - framework for repositioning the vis element on the skin.
nenolod
parents:
1751
diff
changeset
|
558 } |
cb216af25b55
[svn] - framework for repositioning the vis element on the skin.
nenolod
parents:
1751
diff
changeset
|
559 |
cb216af25b55
[svn] - framework for repositioning the vis element on the skin.
nenolod
parents:
1751
diff
changeset
|
560 tmp = read_ini_string(filename, "skin", "mainwinVisX"); |
1751
a5fcf96e33fe
[svn] - properly free the path to skin.hints once we locate it
nenolod
parents:
1670
diff
changeset
|
561 |
1772
cb216af25b55
[svn] - framework for repositioning the vis element on the skin.
nenolod
parents:
1751
diff
changeset
|
562 if (tmp != NULL) |
cb216af25b55
[svn] - framework for repositioning the vis element on the skin.
nenolod
parents:
1751
diff
changeset
|
563 { |
cb216af25b55
[svn] - framework for repositioning the vis element on the skin.
nenolod
parents:
1751
diff
changeset
|
564 skin->properties.mainwin_vis_x = atoi(tmp); |
cb216af25b55
[svn] - framework for repositioning the vis element on the skin.
nenolod
parents:
1751
diff
changeset
|
565 g_free(tmp); |
cb216af25b55
[svn] - framework for repositioning the vis element on the skin.
nenolod
parents:
1751
diff
changeset
|
566 } |
cb216af25b55
[svn] - framework for repositioning the vis element on the skin.
nenolod
parents:
1751
diff
changeset
|
567 |
cb216af25b55
[svn] - framework for repositioning the vis element on the skin.
nenolod
parents:
1751
diff
changeset
|
568 tmp = read_ini_string(filename, "skin", "mainwinVisY"); |
cb216af25b55
[svn] - framework for repositioning the vis element on the skin.
nenolod
parents:
1751
diff
changeset
|
569 |
cb216af25b55
[svn] - framework for repositioning the vis element on the skin.
nenolod
parents:
1751
diff
changeset
|
570 if (tmp != NULL) |
cb216af25b55
[svn] - framework for repositioning the vis element on the skin.
nenolod
parents:
1751
diff
changeset
|
571 { |
cb216af25b55
[svn] - framework for repositioning the vis element on the skin.
nenolod
parents:
1751
diff
changeset
|
572 skin->properties.mainwin_vis_y = atoi(tmp); |
cb216af25b55
[svn] - framework for repositioning the vis element on the skin.
nenolod
parents:
1751
diff
changeset
|
573 g_free(tmp); |
cb216af25b55
[svn] - framework for repositioning the vis element on the skin.
nenolod
parents:
1751
diff
changeset
|
574 } |
cb216af25b55
[svn] - framework for repositioning the vis element on the skin.
nenolod
parents:
1751
diff
changeset
|
575 |
1780
be1de1dd7262
[svn] - implement [skin.hints:mainwinVisWidth] property.
nenolod
parents:
1779
diff
changeset
|
576 tmp = read_ini_string(filename, "skin", "mainwinVisWidth"); |
be1de1dd7262
[svn] - implement [skin.hints:mainwinVisWidth] property.
nenolod
parents:
1779
diff
changeset
|
577 |
be1de1dd7262
[svn] - implement [skin.hints:mainwinVisWidth] property.
nenolod
parents:
1779
diff
changeset
|
578 if (tmp != NULL) |
be1de1dd7262
[svn] - implement [skin.hints:mainwinVisWidth] property.
nenolod
parents:
1779
diff
changeset
|
579 { |
be1de1dd7262
[svn] - implement [skin.hints:mainwinVisWidth] property.
nenolod
parents:
1779
diff
changeset
|
580 skin->properties.mainwin_vis_width = atoi(tmp); |
be1de1dd7262
[svn] - implement [skin.hints:mainwinVisWidth] property.
nenolod
parents:
1779
diff
changeset
|
581 g_free(tmp); |
be1de1dd7262
[svn] - implement [skin.hints:mainwinVisWidth] property.
nenolod
parents:
1779
diff
changeset
|
582 } |
be1de1dd7262
[svn] - implement [skin.hints:mainwinVisWidth] property.
nenolod
parents:
1779
diff
changeset
|
583 |
1773 | 584 tmp = read_ini_string(filename, "skin", "mainwinTextX"); |
585 | |
586 if (tmp != NULL) | |
587 { | |
588 skin->properties.mainwin_text_x = atoi(tmp); | |
589 g_free(tmp); | |
590 } | |
591 | |
592 tmp = read_ini_string(filename, "skin", "mainwinTextY"); | |
593 | |
594 if (tmp != NULL) | |
595 { | |
596 skin->properties.mainwin_text_y = atoi(tmp); | |
597 g_free(tmp); | |
598 } | |
599 | |
1777
17e38b5c8e2f
[svn] - support for the [skin.hints:mainwinTextWidth] property.
nenolod
parents:
1773
diff
changeset
|
600 tmp = read_ini_string(filename, "skin", "mainwinTextWidth"); |
17e38b5c8e2f
[svn] - support for the [skin.hints:mainwinTextWidth] property.
nenolod
parents:
1773
diff
changeset
|
601 |
17e38b5c8e2f
[svn] - support for the [skin.hints:mainwinTextWidth] property.
nenolod
parents:
1773
diff
changeset
|
602 if (tmp != NULL) |
17e38b5c8e2f
[svn] - support for the [skin.hints:mainwinTextWidth] property.
nenolod
parents:
1773
diff
changeset
|
603 { |
17e38b5c8e2f
[svn] - support for the [skin.hints:mainwinTextWidth] property.
nenolod
parents:
1773
diff
changeset
|
604 skin->properties.mainwin_text_width = atoi(tmp); |
17e38b5c8e2f
[svn] - support for the [skin.hints:mainwinTextWidth] property.
nenolod
parents:
1773
diff
changeset
|
605 g_free(tmp); |
17e38b5c8e2f
[svn] - support for the [skin.hints:mainwinTextWidth] property.
nenolod
parents:
1773
diff
changeset
|
606 } |
17e38b5c8e2f
[svn] - support for the [skin.hints:mainwinTextWidth] property.
nenolod
parents:
1773
diff
changeset
|
607 |
1773 | 608 tmp = read_ini_string(filename, "skin", "mainwinInfoBarX"); |
609 | |
610 if (tmp != NULL) | |
611 { | |
612 skin->properties.mainwin_infobar_x = atoi(tmp); | |
613 g_free(tmp); | |
614 } | |
615 | |
616 tmp = read_ini_string(filename, "skin", "mainwinInfoBarY"); | |
617 | |
618 if (tmp != NULL) | |
619 { | |
620 skin->properties.mainwin_infobar_y = atoi(tmp); | |
621 g_free(tmp); | |
622 } | |
623 | |
1778
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
624 tmp = read_ini_string(filename, "skin", "mainwinNumber0X"); |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
625 |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
626 if (tmp != NULL) |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
627 { |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
628 skin->properties.mainwin_number_0_x = atoi(tmp); |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
629 g_free(tmp); |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
630 } |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
631 |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
632 tmp = read_ini_string(filename, "skin", "mainwinNumber0Y"); |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
633 |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
634 if (tmp != NULL) |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
635 { |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
636 skin->properties.mainwin_number_0_y = atoi(tmp); |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
637 g_free(tmp); |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
638 } |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
639 |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
640 tmp = read_ini_string(filename, "skin", "mainwinNumber1X"); |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
641 |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
642 if (tmp != NULL) |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
643 { |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
644 skin->properties.mainwin_number_1_x = atoi(tmp); |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
645 g_free(tmp); |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
646 } |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
647 |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
648 tmp = read_ini_string(filename, "skin", "mainwinNumber1Y"); |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
649 |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
650 if (tmp != NULL) |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
651 { |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
652 skin->properties.mainwin_number_1_y = atoi(tmp); |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
653 g_free(tmp); |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
654 } |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
655 |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
656 tmp = read_ini_string(filename, "skin", "mainwinNumber2X"); |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
657 |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
658 if (tmp != NULL) |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
659 { |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
660 skin->properties.mainwin_number_2_x = atoi(tmp); |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
661 g_free(tmp); |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
662 } |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
663 |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
664 tmp = read_ini_string(filename, "skin", "mainwinNumber2Y"); |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
665 |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
666 if (tmp != NULL) |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
667 { |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
668 skin->properties.mainwin_number_2_y = atoi(tmp); |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
669 g_free(tmp); |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
670 } |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
671 |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
672 tmp = read_ini_string(filename, "skin", "mainwinNumber3X"); |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
673 |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
674 if (tmp != NULL) |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
675 { |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
676 skin->properties.mainwin_number_3_x = atoi(tmp); |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
677 g_free(tmp); |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
678 } |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
679 |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
680 tmp = read_ini_string(filename, "skin", "mainwinNumber3Y"); |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
681 |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
682 if (tmp != NULL) |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
683 { |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
684 skin->properties.mainwin_number_3_y = atoi(tmp); |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
685 g_free(tmp); |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
686 } |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
687 |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
688 tmp = read_ini_string(filename, "skin", "mainwinNumber4X"); |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
689 |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
690 if (tmp != NULL) |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
691 { |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
692 skin->properties.mainwin_number_4_x = atoi(tmp); |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
693 g_free(tmp); |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
694 } |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
695 |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
696 tmp = read_ini_string(filename, "skin", "mainwinNumber4Y"); |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
697 |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
698 if (tmp != NULL) |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
699 { |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
700 skin->properties.mainwin_number_4_y = atoi(tmp); |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
701 g_free(tmp); |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
702 } |
1d3d05c541d3
[svn] - support for: [skin.hints:mainwinNumber(0-4)(X,Y)] properties.
nenolod
parents:
1777
diff
changeset
|
703 |
1779
87d4da9b31ea
[svn] - implement [skin.hints:mainwinPlayStatus(X,Y)] properties.
nenolod
parents:
1778
diff
changeset
|
704 tmp = read_ini_string(filename, "skin", "mainwinPlayStatusX"); |
87d4da9b31ea
[svn] - implement [skin.hints:mainwinPlayStatus(X,Y)] properties.
nenolod
parents:
1778
diff
changeset
|
705 |
87d4da9b31ea
[svn] - implement [skin.hints:mainwinPlayStatus(X,Y)] properties.
nenolod
parents:
1778
diff
changeset
|
706 if (tmp != NULL) |
87d4da9b31ea
[svn] - implement [skin.hints:mainwinPlayStatus(X,Y)] properties.
nenolod
parents:
1778
diff
changeset
|
707 { |
87d4da9b31ea
[svn] - implement [skin.hints:mainwinPlayStatus(X,Y)] properties.
nenolod
parents:
1778
diff
changeset
|
708 skin->properties.mainwin_playstatus_x = atoi(tmp); |
87d4da9b31ea
[svn] - implement [skin.hints:mainwinPlayStatus(X,Y)] properties.
nenolod
parents:
1778
diff
changeset
|
709 g_free(tmp); |
87d4da9b31ea
[svn] - implement [skin.hints:mainwinPlayStatus(X,Y)] properties.
nenolod
parents:
1778
diff
changeset
|
710 } |
87d4da9b31ea
[svn] - implement [skin.hints:mainwinPlayStatus(X,Y)] properties.
nenolod
parents:
1778
diff
changeset
|
711 |
87d4da9b31ea
[svn] - implement [skin.hints:mainwinPlayStatus(X,Y)] properties.
nenolod
parents:
1778
diff
changeset
|
712 tmp = read_ini_string(filename, "skin", "mainwinPlayStatusY"); |
87d4da9b31ea
[svn] - implement [skin.hints:mainwinPlayStatus(X,Y)] properties.
nenolod
parents:
1778
diff
changeset
|
713 |
87d4da9b31ea
[svn] - implement [skin.hints:mainwinPlayStatus(X,Y)] properties.
nenolod
parents:
1778
diff
changeset
|
714 if (tmp != NULL) |
87d4da9b31ea
[svn] - implement [skin.hints:mainwinPlayStatus(X,Y)] properties.
nenolod
parents:
1778
diff
changeset
|
715 { |
87d4da9b31ea
[svn] - implement [skin.hints:mainwinPlayStatus(X,Y)] properties.
nenolod
parents:
1778
diff
changeset
|
716 skin->properties.mainwin_playstatus_y = atoi(tmp); |
87d4da9b31ea
[svn] - implement [skin.hints:mainwinPlayStatus(X,Y)] properties.
nenolod
parents:
1778
diff
changeset
|
717 g_free(tmp); |
87d4da9b31ea
[svn] - implement [skin.hints:mainwinPlayStatus(X,Y)] properties.
nenolod
parents:
1778
diff
changeset
|
718 } |
87d4da9b31ea
[svn] - implement [skin.hints:mainwinPlayStatus(X,Y)] properties.
nenolod
parents:
1778
diff
changeset
|
719 |
1784 | 720 tmp = read_ini_string(filename, "skin", "mainwinMenurowVisible"); |
721 | |
722 if (tmp != NULL) | |
723 { | |
724 skin->properties.mainwin_menurow_visible = atoi(tmp); | |
725 g_free(tmp); | |
726 } | |
727 | |
1786 | 728 tmp = read_ini_string(filename, "skin", "mainwinVolumeX"); |
729 | |
730 if (tmp != NULL) | |
731 { | |
732 skin->properties.mainwin_volume_x = atoi(tmp); | |
733 g_free(tmp); | |
734 } | |
735 | |
736 tmp = read_ini_string(filename, "skin", "mainwinVolumeY"); | |
737 | |
738 if (tmp != NULL) | |
739 { | |
740 skin->properties.mainwin_volume_y = atoi(tmp); | |
741 g_free(tmp); | |
742 } | |
743 | |
744 tmp = read_ini_string(filename, "skin", "mainwinBalanceX"); | |
745 | |
746 if (tmp != NULL) | |
747 { | |
748 skin->properties.mainwin_balance_x = atoi(tmp); | |
749 g_free(tmp); | |
750 } | |
751 | |
752 tmp = read_ini_string(filename, "skin", "mainwinBalanceY"); | |
753 | |
754 if (tmp != NULL) | |
755 { | |
756 skin->properties.mainwin_balance_y = atoi(tmp); | |
757 g_free(tmp); | |
758 } | |
759 | |
760 tmp = read_ini_string(filename, "skin", "mainwinPositionX"); | |
761 | |
762 if (tmp != NULL) | |
763 { | |
764 skin->properties.mainwin_position_x = atoi(tmp); | |
765 g_free(tmp); | |
766 } | |
767 | |
1788
80b6282a31ae
[svn] - implement mainwinOthertextIsStatus property.
nenolod
parents:
1786
diff
changeset
|
768 tmp = read_ini_string(filename, "skin", "mainwinPositionY"); |
1786 | 769 |
770 if (tmp != NULL) | |
771 { | |
772 skin->properties.mainwin_position_y = atoi(tmp); | |
773 g_free(tmp); | |
774 } | |
775 | |
1788
80b6282a31ae
[svn] - implement mainwinOthertextIsStatus property.
nenolod
parents:
1786
diff
changeset
|
776 tmp = read_ini_string(filename, "skin", "mainwinOthertextIsStatus"); |
80b6282a31ae
[svn] - implement mainwinOthertextIsStatus property.
nenolod
parents:
1786
diff
changeset
|
777 |
80b6282a31ae
[svn] - implement mainwinOthertextIsStatus property.
nenolod
parents:
1786
diff
changeset
|
778 if (tmp != NULL) |
80b6282a31ae
[svn] - implement mainwinOthertextIsStatus property.
nenolod
parents:
1786
diff
changeset
|
779 { |
80b6282a31ae
[svn] - implement mainwinOthertextIsStatus property.
nenolod
parents:
1786
diff
changeset
|
780 skin->properties.mainwin_othertext_is_status = atoi(tmp); |
80b6282a31ae
[svn] - implement mainwinOthertextIsStatus property.
nenolod
parents:
1786
diff
changeset
|
781 g_free(tmp); |
80b6282a31ae
[svn] - implement mainwinOthertextIsStatus property.
nenolod
parents:
1786
diff
changeset
|
782 } |
80b6282a31ae
[svn] - implement mainwinOthertextIsStatus property.
nenolod
parents:
1786
diff
changeset
|
783 |
1751
a5fcf96e33fe
[svn] - properly free the path to skin.hints once we locate it
nenolod
parents:
1670
diff
changeset
|
784 g_free(filename); |
1653 | 785 } |
786 | |
787 static guint | |
788 hex_chars_to_int(gchar hi, gchar lo) | |
789 { | |
790 /* | |
791 * Converts a value in the range 0x00-0xFF | |
792 * to a integer in the range 0-65535 | |
793 */ | |
794 gchar str[3]; | |
795 | |
796 str[0] = hi; | |
797 str[1] = lo; | |
798 str[2] = 0; | |
799 | |
800 return (CLAMP(strtol(str, NULL, 16), 0, 0xFF) << 8); | |
801 } | |
802 | |
803 GdkColor * | |
804 skin_load_color(const gchar * path, const gchar * file, | |
805 const gchar * section, const gchar * key, | |
806 gchar * default_hex) | |
807 { | |
808 gchar *filename, *value; | |
809 GdkColor *color = NULL; | |
810 | |
811 filename = find_file_recursively(path, file); | |
812 if (filename || default_hex) { | |
813 if (filename) { | |
814 value = read_ini_string(filename, section, key); | |
815 if (value == NULL) { | |
816 value = g_strdup(default_hex); | |
817 } | |
818 } else { | |
819 value = g_strdup(default_hex); | |
820 } | |
821 if (value) { | |
822 gchar *ptr = value; | |
823 gint len; | |
824 | |
825 color = g_new0(GdkColor, 1); | |
826 g_strstrip(value); | |
827 | |
828 if (value[0] == '#') | |
829 ptr++; | |
830 len = strlen(ptr); | |
831 /* | |
832 * The handling of incomplete values is done this way | |
833 * to maximize winamp compatibility | |
834 */ | |
835 if (len >= 6) { | |
836 color->red = hex_chars_to_int(*ptr, *(ptr + 1)); | |
837 ptr += 2; | |
838 } | |
839 if (len >= 4) { | |
840 color->green = hex_chars_to_int(*ptr, *(ptr + 1)); | |
841 ptr += 2; | |
842 } | |
843 if (len >= 2) | |
844 color->blue = hex_chars_to_int(*ptr, *(ptr + 1)); | |
845 | |
846 gdk_color_alloc(gdk_window_get_colormap(playlistwin->window), | |
847 color); | |
848 g_free(value); | |
849 } | |
850 if (filename) | |
851 g_free(filename); | |
852 } | |
853 return color; | |
854 } | |
855 | |
856 | |
857 | |
858 GdkBitmap * | |
859 skin_create_transparent_mask(const gchar * path, | |
860 const gchar * file, | |
861 const gchar * section, | |
862 GdkWindow * window, | |
863 gint width, | |
864 gint height) | |
865 { | |
866 GdkBitmap *mask = NULL; | |
867 GdkGC *gc = NULL; | |
868 GdkColor pattern; | |
869 GdkPoint *gpoints; | |
870 | |
871 gchar *filename = NULL; | |
872 gboolean created_mask = FALSE; | |
873 GArray *num, *point; | |
874 guint i, j; | |
875 gint k; | |
876 | |
877 if (path) | |
878 filename = find_file_recursively(path, file); | |
879 | |
880 /* filename will be null if path wasn't set */ | |
881 if (!filename) { | |
882 return create_default_mask(window, width, height); | |
883 } | |
884 | |
885 if ((num = read_ini_array(filename, section, "NumPoints")) == NULL) { | |
886 g_free(filename); | |
887 return NULL; | |
888 } | |
889 | |
890 if ((point = read_ini_array(filename, section, "PointList")) == NULL) { | |
891 g_array_free(num, TRUE); | |
892 g_free(filename); | |
893 return NULL; | |
894 } | |
895 | |
896 mask = gdk_pixmap_new(window, width, height, 1); | |
897 gc = gdk_gc_new(mask); | |
898 | |
899 pattern.pixel = 0; | |
900 gdk_gc_set_foreground(gc, &pattern); | |
901 gdk_draw_rectangle(mask, gc, TRUE, 0, 0, width, height); | |
902 pattern.pixel = 1; | |
903 gdk_gc_set_foreground(gc, &pattern); | |
904 | |
905 j = 0; | |
906 for (i = 0; i < num->len; i++) { | |
907 if ((int)(point->len - j) >= (g_array_index(num, gint, i) * 2)) { | |
908 created_mask = TRUE; | |
909 gpoints = g_new(GdkPoint, g_array_index(num, gint, i)); | |
910 for (k = 0; k < g_array_index(num, gint, i); k++) { | |
911 gpoints[k].x = g_array_index(point, gint, j + k * 2); | |
912 gpoints[k].y = g_array_index(point, gint, j + k * 2 + 1); | |
913 } | |
914 j += k * 2; | |
915 gdk_draw_polygon(mask, gc, TRUE, gpoints, | |
916 g_array_index(num, gint, i)); | |
917 g_free(gpoints); | |
918 } | |
919 } | |
920 g_array_free(num, TRUE); | |
921 g_array_free(point, TRUE); | |
922 g_free(filename); | |
923 | |
924 if (!created_mask) | |
925 gdk_draw_rectangle(mask, gc, TRUE, 0, 0, width, height); | |
926 | |
927 gdk_gc_destroy(gc); | |
928 | |
929 return mask; | |
930 } | |
931 | |
932 void | |
933 skin_load_viscolor(Skin * skin, const gchar * path, const gchar * basename) | |
934 { | |
1670 | 935 VFSFile *file; |
1653 | 936 gint i, c; |
937 gchar line[256], *filename; | |
938 GArray *a; | |
939 | |
940 g_return_if_fail(skin != NULL); | |
941 g_return_if_fail(path != NULL); | |
942 g_return_if_fail(basename != NULL); | |
943 | |
944 skin_set_default_vis_color(skin); | |
945 | |
946 filename = find_file_recursively(path, basename); | |
947 if (!filename) | |
948 return; | |
949 | |
1670 | 950 if (!(file = vfs_fopen(filename, "r"))) { |
1653 | 951 g_free(filename); |
952 return; | |
953 } | |
954 | |
955 g_free(filename); | |
956 | |
957 for (i = 0; i < 24; i++) { | |
1670 | 958 if (vfs_fgets(line, 255, file)) { |
1653 | 959 a = string_to_garray(line); |
960 if (a->len > 2) { | |
961 for (c = 0; c < 3; c++) | |
962 skin->vis_color[i][c] = g_array_index(a, gint, c); | |
963 } | |
964 g_array_free(a, TRUE); | |
965 } | |
966 else | |
967 break; | |
968 } | |
969 | |
1670 | 970 vfs_fclose(file); |
1653 | 971 } |
972 | |
973 #if 0 | |
974 static void | |
975 skin_numbers_generate_dash(Skin * skin) | |
976 { | |
977 GdkGC *gc; | |
978 GdkPixmap *pixmap; | |
979 SkinPixmap *numbers; | |
980 | |
981 g_return_if_fail(skin != NULL); | |
982 | |
983 numbers = &skin->pixmaps[SKIN_NUMBERS]; | |
984 if (!numbers->pixmap || numbers->current_width < 99) | |
985 return; | |
986 | |
987 gc = gdk_gc_new(numbers->pixmap); | |
988 pixmap = gdk_pixmap_new(mainwin->window, 108, | |
989 numbers->current_height, | |
990 -1); | |
991 | |
992 skin_draw_pixmap(skin, pixmap, gc, SKIN_NUMBERS, 0, 0, 0, 0, 99, 13); | |
993 skin_draw_pixmap(skin, pixmap, gc, SKIN_NUMBERS, 90, 0, 99, 0, 9, 13); | |
994 skin_draw_pixmap(skin, pixmap, gc, SKIN_NUMBERS, 20, 6, 101, 6, 5, 1); | |
995 | |
996 g_object_unref(numbers->pixmap); | |
997 g_object_unref(gc); | |
998 | |
999 numbers->pixmap = pixmap; | |
1000 numbers->current_width = 108; | |
1001 } | |
1002 #endif | |
1003 | |
1004 static void | |
1005 skin_load_cursor(Skin * skin, const gchar * dirname) | |
1006 { | |
1007 const gchar * basename = "normal.cur"; | |
1008 gchar * filename = NULL; | |
1009 GdkPixbuf * cursor_pixbuf = NULL; | |
1010 GdkPixbufAnimation * cursor_animated = NULL; | |
1011 GdkCursor * cursor_gdk = NULL; | |
1012 GError * error = NULL; | |
1013 | |
1014 filename = find_file_recursively(dirname, basename); | |
1015 | |
1016 if (filename && cfg.custom_cursors) { | |
1017 cursor_animated = gdk_pixbuf_animation_new_from_file(filename, &error); | |
1018 cursor_pixbuf = gdk_pixbuf_animation_get_static_image(cursor_animated); | |
1019 cursor_gdk = gdk_cursor_new_from_pixbuf(gdk_display_get_default(), | |
1020 cursor_pixbuf, 0, 0); | |
1021 } else { | |
1022 cursor_gdk = gdk_cursor_new(GDK_LEFT_PTR); | |
1023 } | |
1024 | |
1025 gdk_window_set_cursor(mainwin->window, cursor_gdk); | |
1026 gdk_window_set_cursor(playlistwin->window, cursor_gdk); | |
1027 gdk_window_set_cursor(equalizerwin->window, cursor_gdk); | |
1028 gdk_cursor_unref(cursor_gdk); | |
1029 } | |
1030 | |
1031 static void | |
1032 skin_load_pixmaps(Skin * skin, const gchar * path) | |
1033 { | |
1034 GdkPixmap *text_pm; | |
1035 guint i; | |
1036 | |
1037 for (i = 0; i < SKIN_PIXMAP_COUNT; i++) | |
1038 skin_load_pixmap_id(skin, i, path); | |
1039 | |
1040 text_pm = skin->pixmaps[SKIN_TEXT].pixmap; | |
1041 | |
1042 if (text_pm) | |
1043 skin_get_textcolors(text_pm, skin->textbg, skin->textfg); | |
1044 | |
1045 #if 0 | |
1046 if (skin->pixmaps[SKIN_NUMBERS].pixmap) | |
1047 skin_numbers_generate_dash(skin); | |
1048 #endif | |
1049 | |
1050 skin->colors[SKIN_PLEDIT_NORMAL] = | |
1051 skin_load_color(path, "pledit.txt", "text", "normal", "#2499ff"); | |
1052 skin->colors[SKIN_PLEDIT_CURRENT] = | |
1053 skin_load_color(path, "pledit.txt", "text", "current", "#ffeeff"); | |
1054 skin->colors[SKIN_PLEDIT_NORMALBG] = | |
1055 skin_load_color(path, "pledit.txt", "text", "normalbg", "#0a120a"); | |
1056 skin->colors[SKIN_PLEDIT_SELECTEDBG] = | |
1057 skin_load_color(path, "pledit.txt", "text", "selectedbg", "#0a124a"); | |
1058 | |
1059 skin_mask_create(skin, path, SKIN_MASK_MAIN, mainwin->window); | |
1060 skin_mask_create(skin, path, SKIN_MASK_MAIN_SHADE, mainwin->window); | |
1061 | |
1062 skin_mask_create(skin, path, SKIN_MASK_EQ, equalizerwin->window); | |
1063 skin_mask_create(skin, path, SKIN_MASK_EQ_SHADE, equalizerwin->window); | |
1064 | |
1065 skin_load_viscolor(skin, path, "viscolor.txt"); | |
1066 } | |
1067 | |
1068 static gboolean | |
1069 skin_load_nolock(Skin * skin, const gchar * path, gboolean force) | |
1070 { | |
1071 gchar *cpath; | |
1072 | |
1073 g_return_val_if_fail(skin != NULL, FALSE); | |
1074 g_return_val_if_fail(path != NULL, FALSE); | |
1075 REQUIRE_LOCK(skin->lock); | |
1076 | |
1077 if (!g_file_test(path, G_FILE_TEST_IS_REGULAR | G_FILE_TEST_IS_DIR)) | |
1078 return FALSE; | |
1079 | |
1080 if (!force) { | |
1081 if (skin->path) | |
1082 if (!strcmp(skin->path, path)) | |
1083 return FALSE; | |
1084 } | |
1085 | |
1086 skin_current_num++; | |
1087 | |
1088 skin->path = g_strdup(path); | |
1089 | |
1090 if (!file_is_archive(path)) { | |
1091 skin_load_pixmaps(skin, path); | |
1092 skin_load_cursor(skin, path); | |
1093 | |
1094 /* Parse the hints for this skin. */ | |
1095 skin_parse_hints(skin, NULL); | |
1096 | |
1097 return TRUE; | |
1098 } | |
1099 | |
1100 if (!(cpath = archive_decompress(path))) { | |
1101 g_message("Unable to extract skin archive (%s)", path); | |
1102 return FALSE; | |
1103 } | |
1104 | |
1105 skin_load_pixmaps(skin, cpath); | |
1106 skin_load_cursor(skin, cpath); | |
1107 | |
1108 /* Parse the hints for this skin. */ | |
1109 skin_parse_hints(skin, cpath); | |
1110 | |
1111 del_directory(cpath); | |
1112 g_free(cpath); | |
1113 | |
1114 return TRUE; | |
1115 } | |
1116 | |
1117 void | |
1118 skin_install_skin(const gchar * path) | |
1119 { | |
1120 gchar *command; | |
1121 | |
1122 g_return_if_fail(path != NULL); | |
1123 | |
1124 command = g_strdup_printf("cp %s %s", path, bmp_paths[BMP_PATH_USER_SKIN_DIR]); | |
1125 if (system(command)) { | |
1126 g_message("Unable to install skin (%s) into user directory (%s)", | |
1127 path, bmp_paths[BMP_PATH_USER_SKIN_DIR]); | |
1128 } | |
1129 g_free(command); | |
1130 } | |
1131 | |
1132 | |
1133 gboolean | |
1134 skin_load(Skin * skin, const gchar * path) | |
1135 { | |
1136 gboolean error; | |
1137 | |
1138 g_return_val_if_fail(skin != NULL, FALSE); | |
1139 | |
1140 if (!path) | |
1141 return FALSE; | |
1142 | |
1143 skin_lock(skin); | |
1144 error = skin_load_nolock(skin, path, FALSE); | |
1145 skin_unlock(skin); | |
1146 | |
1147 return error; | |
1148 } | |
1149 | |
1150 gboolean | |
1151 skin_reload_forced(void) | |
1152 { | |
1153 gboolean error; | |
1154 | |
1155 skin_lock(bmp_active_skin); | |
1156 error = skin_load_nolock(bmp_active_skin, bmp_active_skin->path, TRUE); | |
1157 skin_unlock(bmp_active_skin); | |
1158 | |
1159 return error; | |
1160 } | |
1161 | |
1162 void | |
1163 skin_reload(Skin * skin) | |
1164 { | |
1165 g_return_if_fail(skin != NULL); | |
1166 skin_load_nolock(skin, skin->path, TRUE); | |
1167 } | |
1168 | |
1169 | |
1170 static SkinPixmap * | |
1171 skin_get_pixmap(Skin * skin, SkinPixmapId map_id) | |
1172 { | |
1173 g_return_val_if_fail(skin != NULL, NULL); | |
1174 g_return_val_if_fail(map_id < SKIN_PIXMAP_COUNT, NULL); | |
1175 | |
1176 return &skin->pixmaps[map_id]; | |
1177 } | |
1178 | |
1179 GdkBitmap * | |
1180 skin_get_mask(Skin * skin, SkinMaskId mi) | |
1181 { | |
1182 g_return_val_if_fail(skin != NULL, NULL); | |
1183 g_return_val_if_fail(mi < SKIN_PIXMAP_COUNT, NULL); | |
1184 | |
1185 return skin->masks[mi]; | |
1186 } | |
1187 | |
1188 GdkColor * | |
1189 skin_get_color(Skin * skin, SkinColorId color_id) | |
1190 { | |
1191 GdkColor *ret = NULL; | |
1192 | |
1193 g_return_val_if_fail(skin != NULL, NULL); | |
1194 | |
1195 switch (color_id) { | |
1196 case SKIN_TEXTBG: | |
1197 if (skin->pixmaps[SKIN_TEXT].pixmap) | |
1198 ret = skin->textbg; | |
1199 else | |
1200 ret = skin->def_textbg; | |
1201 break; | |
1202 case SKIN_TEXTFG: | |
1203 if (skin->pixmaps[SKIN_TEXT].pixmap) | |
1204 ret = skin->textfg; | |
1205 else | |
1206 ret = skin->def_textfg; | |
1207 break; | |
1208 default: | |
1209 if (color_id < SKIN_COLOR_COUNT) | |
1210 ret = skin->colors[color_id]; | |
1211 break; | |
1212 } | |
1213 return ret; | |
1214 } | |
1215 | |
1216 void | |
1217 skin_get_viscolor(Skin * skin, guchar vis_color[24][3]) | |
1218 { | |
1219 gint i; | |
1220 | |
1221 g_return_if_fail(skin != NULL); | |
1222 | |
1223 for (i = 0; i < 24; i++) { | |
1224 vis_color[i][0] = skin->vis_color[i][0]; | |
1225 vis_color[i][1] = skin->vis_color[i][1]; | |
1226 vis_color[i][2] = skin->vis_color[i][2]; | |
1227 } | |
1228 } | |
1229 | |
1230 gint | |
1231 skin_get_id(void) | |
1232 { | |
1233 return skin_current_num; | |
1234 } | |
1235 | |
1236 void | |
1237 skin_draw_pixmap(Skin * skin, GdkDrawable * drawable, GdkGC * gc, | |
1238 SkinPixmapId pixmap_id, | |
1239 gint xsrc, gint ysrc, gint xdest, gint ydest, | |
1240 gint width, gint height) | |
1241 { | |
1242 SkinPixmap *pixmap; | |
1243 | |
1244 g_return_if_fail(skin != NULL); | |
1245 | |
1246 pixmap = skin_get_pixmap(skin, pixmap_id); | |
1247 g_return_if_fail(pixmap != NULL); | |
1248 g_return_if_fail(pixmap->pixmap != NULL); | |
1249 | |
1250 if (xsrc > pixmap->width || ysrc > pixmap->height) | |
1251 return; | |
1252 | |
1253 width = MIN(width, pixmap->width - xsrc); | |
1254 height = MIN(height, pixmap->height - ysrc); | |
1255 gdk_draw_pixmap(drawable, gc, pixmap->pixmap, xsrc, ysrc, | |
1256 xdest, ydest, width, height); | |
1257 } | |
1258 | |
1259 void | |
1260 skin_get_eq_spline_colors(Skin * skin, guint32 colors[19]) | |
1261 { | |
1262 gint i; | |
1263 GdkPixmap *pixmap; | |
1264 GdkImage *img; | |
1265 SkinPixmap *eqmainpm; | |
1266 | |
1267 g_return_if_fail(skin != NULL); | |
1268 | |
1269 eqmainpm = &skin->pixmaps[SKIN_EQMAIN]; | |
1270 if (eqmainpm->pixmap && | |
1271 eqmainpm->current_width >= 116 && eqmainpm->current_height >= 313) | |
1272 pixmap = eqmainpm->pixmap; | |
1273 else | |
1274 return; | |
1275 | |
1276 if (!GDK_IS_DRAWABLE(pixmap)) | |
1277 return; | |
1278 | |
1279 if (!(img = gdk_drawable_get_image(pixmap, 115, 294, 1, 19))) | |
1280 return; | |
1281 | |
1282 for (i = 0; i < 19; i++) | |
1283 colors[i] = gdk_image_get_pixel(img, 0, i); | |
1284 | |
1285 gdk_image_destroy(img); | |
1286 } | |
1287 | |
1288 | |
1289 static void | |
1290 skin_draw_playlistwin_frame_top(Skin * skin, | |
1291 GdkDrawable * drawable, | |
1292 GdkGC * gc, | |
1293 gint width, gint height, gboolean focus) | |
1294 { | |
1295 /* The title bar skin consists of 2 sets of 4 images, 1 set | |
1296 * for focused state and the other for unfocused. The 4 images | |
1297 * are: | |
1298 * | |
1299 * a. right corner (25,20) | |
1300 * b. left corner (25,20) | |
1301 * c. tiler (25,20) | |
1302 * d. title (100,20) | |
1303 * | |
1304 * min allowed width = 100+25+25 = 150 | |
1305 */ | |
1306 | |
1307 gint i, y, c; | |
1308 | |
1309 /* get y offset of the pixmap set to use */ | |
1310 if (focus) | |
1311 y = 0; | |
1312 else | |
1313 y = 21; | |
1314 | |
1315 /* left corner */ | |
1316 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT, 0, y, 0, 0, 25, 20); | |
1317 | |
1318 /* titlebar title */ | |
1319 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT, 26, y, | |
1320 (width - 100) / 2, 0, 100, 20); | |
1321 | |
1322 /* titlebar right corner */ | |
1323 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT, 153, y, | |
1324 width - 25, 0, 25, 20); | |
1325 | |
1326 /* tile draw the remaining frame */ | |
1327 | |
1328 /* compute tile count */ | |
1329 c = (width - (100 + 25 + 25)) / 25; | |
1330 | |
1331 for (i = 0; i < c / 2; i++) { | |
1332 /* left of title */ | |
1333 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT, 127, y, | |
1334 25 + i * 25, 0, 25, 20); | |
1335 | |
1336 /* right of title */ | |
1337 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT, 127, y, | |
1338 (width + 100) / 2 + i * 25, 0, 25, 20); | |
1339 } | |
1340 | |
1341 if (c & 1) { | |
1342 /* Odd tile count, so one remaining to draw. Here we split | |
1343 * it into two and draw half on either side of the title */ | |
1344 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT, 127, y, | |
1345 ((c / 2) * 25) + 25, 0, 12, 20); | |
1346 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT, 127, y, | |
1347 (width / 2) + ((c / 2) * 25) + 50, 0, 13, 20); | |
1348 } | |
1349 } | |
1350 | |
1351 static void | |
1352 skin_draw_playlistwin_frame_bottom(Skin * skin, | |
1353 GdkDrawable * drawable, | |
1354 GdkGC * gc, | |
1355 gint width, gint height, gboolean focus) | |
1356 { | |
1357 /* The bottom frame skin consists of 1 set of 4 images. The 4 | |
1358 * images are: | |
1359 * | |
1360 * a. left corner with menu buttons (125,38) | |
1361 * b. visualization window (75,38) | |
1362 * c. right corner with play buttons (150,38) | |
1363 * d. frame tile (25,38) | |
1364 * | |
1365 * (min allowed width = 125+150+25=300 | |
1366 */ | |
1367 | |
1368 gint i, c; | |
1369 | |
1370 /* bottom left corner (menu buttons) */ | |
1371 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT, 0, 72, | |
1372 0, height - 38, 125, 38); | |
1373 | |
1374 c = (width - 275) / 25; | |
1375 | |
1376 /* draw visualization window, if width allows */ | |
1377 if (c >= 3) { | |
1378 c -= 3; | |
1379 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT, 205, 0, | |
1380 width - (150 + 75), height - 38, 75, 38); | |
1381 } | |
1382 | |
1383 /* Bottom right corner (playbuttons etc) */ | |
1384 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT, | |
1385 126, 72, width - 150, height - 38, 150, 38); | |
1386 | |
1387 /* Tile draw the remaining undrawn portions */ | |
1388 for (i = 0; i < c; i++) | |
1389 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT, 179, 0, | |
1390 125 + i * 25, height - 38, 25, 38); | |
1391 } | |
1392 | |
1393 static void | |
1394 skin_draw_playlistwin_frame_sides(Skin * skin, | |
1395 GdkDrawable * drawable, | |
1396 GdkGC * gc, | |
1397 gint width, gint height, gboolean focus) | |
1398 { | |
1399 /* The side frames consist of 2 tile images. 1 for the left, 1 for | |
1400 * the right. | |
1401 * a. left (12,29) | |
1402 * b. right (19,29) | |
1403 */ | |
1404 | |
1405 gint i; | |
1406 | |
1407 /* frame sides */ | |
1408 for (i = 0; i < (height - (20 + 38)) / 29; i++) { | |
1409 /* left */ | |
1410 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT, 0, 42, | |
1411 0, 20 + i * 29, 12, 29); | |
1412 | |
1413 /* right */ | |
1414 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT, 32, 42, | |
1415 width - 19, 20 + i * 29, 19, 29); | |
1416 } | |
1417 } | |
1418 | |
1419 | |
1420 void | |
1421 skin_draw_playlistwin_frame(Skin * skin, | |
1422 GdkDrawable * drawable, GdkGC * gc, | |
1423 gint width, gint height, gboolean focus) | |
1424 { | |
1425 skin_draw_playlistwin_frame_top(skin, drawable, gc, width, height, focus); | |
1426 skin_draw_playlistwin_frame_bottom(skin, drawable, gc, width, height, | |
1427 focus); | |
1428 skin_draw_playlistwin_frame_sides(skin, drawable, gc, width, height, | |
1429 focus); | |
1430 } | |
1431 | |
1432 | |
1433 void | |
1434 skin_draw_playlistwin_shaded(Skin * skin, | |
1435 GdkDrawable * drawable, GdkGC * gc, | |
1436 gint width, gboolean focus) | |
1437 { | |
1438 /* The shade mode titlebar skin consists of 4 images: | |
1439 * a) left corner offset (72,42) size (25,14) | |
1440 * b) right corner, focused offset (99,57) size (50,14) | |
1441 * c) right corner, unfocused offset (99,42) size (50,14) | |
1442 * d) bar tile offset (72,57) size (25,14) | |
1443 */ | |
1444 | |
1445 gint i; | |
1446 | |
1447 /* left corner */ | |
1448 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT, 72, 42, 0, 0, 25, 14); | |
1449 | |
1450 /* bar tile */ | |
1451 for (i = 0; i < (width - 75) / 25; i++) | |
1452 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT, 72, 57, | |
1453 (i * 25) + 25, 0, 25, 14); | |
1454 | |
1455 /* right corner */ | |
1456 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT, 99, focus ? 57 : 42, | |
1457 width - 50, 0, 50, 14); | |
1458 } | |
1459 | |
1460 | |
1461 void | |
1462 skin_draw_mainwin_titlebar(Skin * skin, | |
1463 GdkDrawable * drawable, GdkGC * gc, | |
1464 gboolean shaded, gboolean focus) | |
1465 { | |
1466 /* The titlebar skin consists of 2 sets of 2 images, one for for | |
1467 * shaded and the other for unshaded mode, giving a total of 4. | |
1468 * The images are exactly 275x14 pixels, aligned and arranged | |
1469 * vertically on each other in the pixmap in the following order: | |
1470 * | |
1471 * a) unshaded, focused offset (27, 0) | |
1472 * b) unshaded, unfocused offset (27, 15) | |
1473 * c) shaded, focused offset (27, 29) | |
1474 * d) shaded, unfocused offset (27, 42) | |
1475 */ | |
1476 | |
1477 gint y_offset; | |
1478 | |
1479 if (shaded) { | |
1480 if (focus) | |
1481 y_offset = 29; | |
1482 else | |
1483 y_offset = 42; | |
1484 } | |
1485 else { | |
1486 if (focus) | |
1487 y_offset = 0; | |
1488 else | |
1489 y_offset = 15; | |
1490 } | |
1491 | |
1492 skin_draw_pixmap(skin, drawable, gc, SKIN_TITLEBAR, 27, y_offset, | |
1493 0, 0, MAINWIN_WIDTH, MAINWIN_TITLEBAR_HEIGHT); | |
1494 } |