comparison src/skins/ui_skin.c @ 2584:c9e40418a74c

use plugin's own config
author Tomasz Mon <desowin@gmail.com>
date Tue, 20 May 2008 19:41:12 +0200
parents 8fba3fbf1a0f
children 8f5999909416
comparison
equal deleted inserted replaced
2583:294232665cb0 2584:c9e40418a74c
405 405
406 AUDDBG("loaded %s\n", filename); 406 AUDDBG("loaded %s\n", filename);
407 407
408 pm = &skin->pixmaps[id]; 408 pm = &skin->pixmaps[id];
409 GdkPixbuf *pix = gdk_pixbuf_new_from_file(filename, NULL); 409 GdkPixbuf *pix = gdk_pixbuf_new_from_file(filename, NULL);
410 pm->pixbuf = audacious_create_colorized_pixbuf(pix, aud_cfg->colorize_r, aud_cfg->colorize_g, aud_cfg->colorize_b); 410 pm->pixbuf = audacious_create_colorized_pixbuf(pix, config.colorize_r, aud_cfg->colorize_g, aud_cfg->colorize_b);
411 g_object_unref(pix); 411 g_object_unref(pix);
412 pm->width = gdk_pixbuf_get_width(pm->pixbuf); 412 pm->width = gdk_pixbuf_get_width(pm->pixbuf);
413 pm->height = gdk_pixbuf_get_height(pm->pixbuf); 413 pm->height = gdk_pixbuf_get_height(pm->pixbuf);
414 pm->current_width = pm->width; 414 pm->current_width = pm->width;
415 pm->current_height = pm->height; 415 pm->current_height = pm->height;
550 BMP_DEFAULT_SKIN_PATH); 550 BMP_DEFAULT_SKIN_PATH);
551 return FALSE; 551 return FALSE;
552 } 552 }
553 } 553 }
554 #if 0 554 #if 0
555 if (aud_cfg->random_skin_on_play) 555 if (config.random_skin_on_play)
556 skinlist_update(); 556 skinlist_update();
557 #endif 557 #endif
558 return TRUE; 558 return TRUE;
559 } 559 }
560 560
1303 if ((int)(point->len - j) >= (g_array_index(num, gint, i) * 2)) { 1303 if ((int)(point->len - j) >= (g_array_index(num, gint, i) * 2)) {
1304 created_mask = TRUE; 1304 created_mask = TRUE;
1305 gpoints = g_new(GdkPoint, g_array_index(num, gint, i)); 1305 gpoints = g_new(GdkPoint, g_array_index(num, gint, i));
1306 for (k = 0; k < g_array_index(num, gint, i); k++) { 1306 for (k = 0; k < g_array_index(num, gint, i); k++) {
1307 gpoints[k].x = 1307 gpoints[k].x =
1308 g_array_index(point, gint, j + k * 2) * (scale ? aud_cfg->scale_factor : 1 ); 1308 g_array_index(point, gint, j + k * 2) * (scale ? config.scale_factor : 1 );
1309 gpoints[k].y = 1309 gpoints[k].y =
1310 g_array_index(point, gint, 1310 g_array_index(point, gint,
1311 j + k * 2 + 1) * (scale ? aud_cfg->scale_factor : 1); 1311 j + k * 2 + 1) * (scale ? config.scale_factor : 1);
1312 } 1312 }
1313 j += k * 2; 1313 j += k * 2;
1314 gdk_draw_polygon(mask, gc, TRUE, gpoints, 1314 gdk_draw_polygon(mask, gc, TRUE, gpoints,
1315 g_array_index(num, gint, i)); 1315 g_array_index(num, gint, i));
1316 g_free(gpoints); 1316 g_free(gpoints);
1409 if(!path) return FALSE; 1409 if(!path) return FALSE;
1410 1410
1411 AUDDBG("Loading pixmaps in %s\n", path); 1411 AUDDBG("Loading pixmaps in %s\n", path);
1412 1412
1413 for (i = 0; i < SKIN_PIXMAP_COUNT; i++) 1413 for (i = 0; i < SKIN_PIXMAP_COUNT; i++)
1414 if (!skin_load_pixmap_id(skin, i, path) && !aud_cfg->allow_broken_skins) 1414 if (!skin_load_pixmap_id(skin, i, path) && !config.allow_broken_skins)
1415 return FALSE; 1415 return FALSE;
1416 1416
1417 text_pb = skin->pixmaps[SKIN_TEXT].pixbuf; 1417 text_pb = skin->pixmaps[SKIN_TEXT].pixbuf;
1418 1418
1419 if (text_pb) 1419 if (text_pb)
1525 } else { 1525 } else {
1526 skin_path = g_strdup(path); 1526 skin_path = g_strdup(path);
1527 } 1527 }
1528 1528
1529 // Check if skin path has all necessary files. 1529 // Check if skin path has all necessary files.
1530 if (!aud_cfg->allow_broken_skins && !skin_check_pixmaps(skin, skin_path)) { 1530 if (!config.allow_broken_skins && !skin_check_pixmaps(skin, skin_path)) {
1531 if(archive) del_directory(skin_path); 1531 if(archive) del_directory(skin_path);
1532 g_free(skin_path); 1532 g_free(skin_path);
1533 AUDDBG("Skin path (%s) doesn't have all wanted pixmaps\n", skin_path); 1533 AUDDBG("Skin path (%s) doesn't have all wanted pixmaps\n", skin_path);
1534 return FALSE; 1534 return FALSE;
1535 } 1535 }
1563 g_free(original_gtk_theme); 1563 g_free(original_gtk_theme);
1564 original_gtk_theme = NULL; 1564 original_gtk_theme = NULL;
1565 } 1565 }
1566 1566
1567 #ifndef _WIN32 1567 #ifndef _WIN32
1568 if (!aud_cfg->disable_inline_gtk && !archive) { 1568 if (!config.disable_inline_gtk && !archive) {
1569 gtkrcpath = find_path_recursively(skin->path, "gtkrc"); 1569 gtkrcpath = find_path_recursively(skin->path, "gtkrc");
1570 if (gtkrcpath != NULL) 1570 if (gtkrcpath != NULL)
1571 skin_set_gtk_theme(settings, skin); 1571 skin_set_gtk_theme(settings, skin);
1572 g_free(gtkrcpath); 1572 g_free(gtkrcpath);
1573 } 1573 }
1574 #endif 1574 #endif
1575 1575
1576 if(archive) del_directory(skin_path); 1576 if(archive) del_directory(skin_path);
1577 g_free(skin_path); 1577 g_free(skin_path);
1578 1578
1579 gtk_widget_shape_combine_mask(mainwin, skin_get_mask(aud_active_skin, SKIN_MASK_MAIN + aud_cfg->player_shaded), 0, 0); 1579 gtk_widget_shape_combine_mask(mainwin, skin_get_mask(aud_active_skin, SKIN_MASK_MAIN + config.player_shaded), 0, 0);
1580 #if 0 1580 #if 0
1581 gtk_widget_shape_combine_mask(equalizerwin, skin_get_mask(aud_active_skin, SKIN_MASK_EQ + aud_cfg->equalizer_shaded), 0, 0); 1581 gtk_widget_shape_combine_mask(equalizerwin, skin_get_mask(aud_active_skin, SKIN_MASK_EQ + config.equalizer_shaded), 0, 0);
1582 #endif 1582 #endif
1583 return TRUE; 1583 return TRUE;
1584 } 1584 }
1585 1585
1586 void 1586 void
1681 GdkBitmap **masks; 1681 GdkBitmap **masks;
1682 1682
1683 g_return_val_if_fail(skin != NULL, NULL); 1683 g_return_val_if_fail(skin != NULL, NULL);
1684 g_return_val_if_fail(mi < SKIN_PIXMAP_COUNT, NULL); 1684 g_return_val_if_fail(mi < SKIN_PIXMAP_COUNT, NULL);
1685 1685
1686 masks = aud_cfg->scaled ? skin->scaled_masks : skin->masks; 1686 masks = config.scaled ? skin->scaled_masks : skin->masks;
1687 return masks[mi]; 1687 return masks[mi];
1688 } 1688 }
1689 1689
1690 GdkColor * 1690 GdkColor *
1691 skin_get_color(Skin * skin, SkinColorId color_id) 1691 skin_get_color(Skin * skin, SkinColorId color_id)
2054 void ui_skinned_widget_draw(GtkWidget *widget, GdkPixbuf *obj, gint width, gint height, gboolean scale) { 2054 void ui_skinned_widget_draw(GtkWidget *widget, GdkPixbuf *obj, gint width, gint height, gboolean scale) {
2055 g_return_if_fail(widget != NULL); 2055 g_return_if_fail(widget != NULL);
2056 g_return_if_fail(obj != NULL); 2056 g_return_if_fail(obj != NULL);
2057 2057
2058 if (scale) { 2058 if (scale) {
2059 GdkPixbuf *image = gdk_pixbuf_scale_simple(obj, width * aud_cfg->scale_factor, height* aud_cfg->scale_factor, GDK_INTERP_NEAREST); 2059 GdkPixbuf *image = gdk_pixbuf_scale_simple(obj, width * config.scale_factor, height* aud_cfg->scale_factor, GDK_INTERP_NEAREST);
2060 gdk_draw_pixbuf(widget->window, NULL, image, 0, 0, 0, 0, width * aud_cfg->scale_factor , height * aud_cfg->scale_factor, GDK_RGB_DITHER_NONE, 0, 0); 2060 gdk_draw_pixbuf(widget->window, NULL, image, 0, 0, 0, 0, width * config.scale_factor , height * aud_cfg->scale_factor, GDK_RGB_DITHER_NONE, 0, 0);
2061 g_object_unref(image); 2061 g_object_unref(image);
2062 } else { 2062 } else {
2063 gdk_draw_pixbuf(widget->window, NULL, obj, 0, 0, 0, 0, width, height, GDK_RGB_DITHER_NONE, 0, 0); 2063 gdk_draw_pixbuf(widget->window, NULL, obj, 0, 0, 0, 0, width, height, GDK_RGB_DITHER_NONE, 0, 0);
2064 } 2064 }
2065 } 2065 }