Mercurial > audlegacy-plugins
changeset 2584:c9e40418a74c
use plugin's own config
author | Tomasz Mon <desowin@gmail.com> |
---|---|
date | Tue, 20 May 2008 19:41:12 +0200 |
parents | 294232665cb0 |
children | 43bac1471075 |
files | src/skins/skins_cfg.c src/skins/skins_cfg.h src/skins/ui_skin.c src/skins/ui_skinned_window.c src/skins/ui_svis.c src/skins/ui_vis.c |
diffstat | 6 files changed, 124 insertions(+), 113 deletions(-) [+] |
line wrap: on
line diff
--- a/src/skins/skins_cfg.c Tue May 20 16:34:06 2008 +0200 +++ b/src/skins/skins_cfg.c Tue May 20 19:41:12 2008 +0200 @@ -40,6 +40,8 @@ .dim_titlebar = TRUE, .show_wm_decorations = FALSE, .easy_move = TRUE, + .allow_broken_skins = FALSE, + .disable_inline_gtk = FALSE, .timer_mode = 0, .vis_type = VIS_ANALYZER, .analyzer_mode = ANALYZER_NORMAL, @@ -65,6 +67,7 @@ .snap_distance = 10, .snap_windows = TRUE, .save_window_position = TRUE, + .analyzer_peaks = TRUE, }; typedef struct skins_cfg_boolent_t { @@ -84,8 +87,11 @@ {"dim_titlebar", &config.dim_titlebar, TRUE}, {"show_wm_decorations", &config.show_wm_decorations, TRUE}, {"easy_move", &config.easy_move, TRUE}, + {"allow_broken_skins", &config.allow_broken_skins, TRUE}, + {"disable_inline_gtk", &config.disable_inline_gtk, TRUE}, {"snap_windows", &config.snap_windows, TRUE}, {"save_window_positions", &config.save_window_position, TRUE}, + {"analyzer_peaks", &config.analyzer_peaks, TRUE}, }; static gint ncfgbent = G_N_ELEMENTS(skins_boolents);
--- a/src/skins/skins_cfg.h Tue May 20 16:34:06 2008 +0200 +++ b/src/skins/skins_cfg.h Tue May 20 19:41:12 2008 +0200 @@ -34,7 +34,7 @@ typedef struct { - gint player_x, player_y; + gint player_x, player_y; gint equalizer_x, equalizer_y; gint playlist_x, playlist_y; gint playlist_width, playlist_height; @@ -49,6 +49,9 @@ gboolean dim_titlebar; gboolean show_wm_decorations; gboolean easy_move; + gboolean allow_broken_skins; + gboolean disable_inline_gtk; + gboolean analyzer_peaks; gint timer_mode; gint vis_type; gint analyzer_mode, analyzer_type;
--- a/src/skins/ui_skin.c Tue May 20 16:34:06 2008 +0200 +++ b/src/skins/ui_skin.c Tue May 20 19:41:12 2008 +0200 @@ -407,7 +407,7 @@ pm = &skin->pixmaps[id]; GdkPixbuf *pix = gdk_pixbuf_new_from_file(filename, NULL); - pm->pixbuf = audacious_create_colorized_pixbuf(pix, aud_cfg->colorize_r, aud_cfg->colorize_g, aud_cfg->colorize_b); + pm->pixbuf = audacious_create_colorized_pixbuf(pix, config.colorize_r, aud_cfg->colorize_g, aud_cfg->colorize_b); g_object_unref(pix); pm->width = gdk_pixbuf_get_width(pm->pixbuf); pm->height = gdk_pixbuf_get_height(pm->pixbuf); @@ -552,7 +552,7 @@ } } #if 0 - if (aud_cfg->random_skin_on_play) + if (config.random_skin_on_play) skinlist_update(); #endif return TRUE; @@ -1305,10 +1305,10 @@ gpoints = g_new(GdkPoint, g_array_index(num, gint, i)); for (k = 0; k < g_array_index(num, gint, i); k++) { gpoints[k].x = - g_array_index(point, gint, j + k * 2) * (scale ? aud_cfg->scale_factor : 1 ); + g_array_index(point, gint, j + k * 2) * (scale ? config.scale_factor : 1 ); gpoints[k].y = g_array_index(point, gint, - j + k * 2 + 1) * (scale ? aud_cfg->scale_factor : 1); + j + k * 2 + 1) * (scale ? config.scale_factor : 1); } j += k * 2; gdk_draw_polygon(mask, gc, TRUE, gpoints, @@ -1411,7 +1411,7 @@ AUDDBG("Loading pixmaps in %s\n", path); for (i = 0; i < SKIN_PIXMAP_COUNT; i++) - if (!skin_load_pixmap_id(skin, i, path) && !aud_cfg->allow_broken_skins) + if (!skin_load_pixmap_id(skin, i, path) && !config.allow_broken_skins) return FALSE; text_pb = skin->pixmaps[SKIN_TEXT].pixbuf; @@ -1527,7 +1527,7 @@ } // Check if skin path has all necessary files. - if (!aud_cfg->allow_broken_skins && !skin_check_pixmaps(skin, skin_path)) { + if (!config.allow_broken_skins && !skin_check_pixmaps(skin, skin_path)) { if(archive) del_directory(skin_path); g_free(skin_path); AUDDBG("Skin path (%s) doesn't have all wanted pixmaps\n", skin_path); @@ -1565,7 +1565,7 @@ } #ifndef _WIN32 - if (!aud_cfg->disable_inline_gtk && !archive) { + if (!config.disable_inline_gtk && !archive) { gtkrcpath = find_path_recursively(skin->path, "gtkrc"); if (gtkrcpath != NULL) skin_set_gtk_theme(settings, skin); @@ -1576,9 +1576,9 @@ if(archive) del_directory(skin_path); g_free(skin_path); - gtk_widget_shape_combine_mask(mainwin, skin_get_mask(aud_active_skin, SKIN_MASK_MAIN + aud_cfg->player_shaded), 0, 0); + gtk_widget_shape_combine_mask(mainwin, skin_get_mask(aud_active_skin, SKIN_MASK_MAIN + config.player_shaded), 0, 0); #if 0 - gtk_widget_shape_combine_mask(equalizerwin, skin_get_mask(aud_active_skin, SKIN_MASK_EQ + aud_cfg->equalizer_shaded), 0, 0); + gtk_widget_shape_combine_mask(equalizerwin, skin_get_mask(aud_active_skin, SKIN_MASK_EQ + config.equalizer_shaded), 0, 0); #endif return TRUE; } @@ -1683,7 +1683,7 @@ g_return_val_if_fail(skin != NULL, NULL); g_return_val_if_fail(mi < SKIN_PIXMAP_COUNT, NULL); - masks = aud_cfg->scaled ? skin->scaled_masks : skin->masks; + masks = config.scaled ? skin->scaled_masks : skin->masks; return masks[mi]; } @@ -2056,8 +2056,8 @@ g_return_if_fail(obj != NULL); if (scale) { - GdkPixbuf *image = gdk_pixbuf_scale_simple(obj, width * aud_cfg->scale_factor, height* aud_cfg->scale_factor, GDK_INTERP_NEAREST); - 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); + GdkPixbuf *image = gdk_pixbuf_scale_simple(obj, width * config.scale_factor, height* aud_cfg->scale_factor, GDK_INTERP_NEAREST); + 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); g_object_unref(image); } else { gdk_draw_pixbuf(widget->window, NULL, obj, 0, 0, 0, 0, width, height, GDK_RGB_DITHER_NONE, 0, 0);
--- a/src/skins/ui_skinned_window.c Tue May 20 16:34:06 2008 +0200 +++ b/src/skins/ui_skinned_window.c Tue May 20 19:41:12 2008 +0200 @@ -136,7 +136,7 @@ case WINDOW_PLAYLIST: #if 0 width = playlistwin_get_width(); - height = aud_cfg->playlist_height; + height = config.playlist_height; #endif break; default: @@ -149,7 +149,7 @@ switch (window->type) { case WINDOW_MAIN: skin_draw_pixbuf(widget, aud_active_skin, obj,SKIN_MAIN, 0, 0, 0, 0, width, height); - skin_draw_mainwin_titlebar(aud_active_skin, obj, config.player_shaded, focus || !aud_cfg->dim_titlebar); + skin_draw_mainwin_titlebar(aud_active_skin, obj, config.player_shaded, focus || !config.dim_titlebar); break; case WINDOW_EQ: skin_draw_pixbuf(widget, aud_active_skin, obj, SKIN_EQMAIN, 0, 0, 0, 0, width, height); @@ -170,7 +170,7 @@ if (config.playlist_shaded) { skin_draw_playlistwin_shaded(aud_active_skin, obj, width, focus); } else { - skin_draw_playlistwin_frame(aud_active_skin, obj, width, aud_cfg->playlist_height, focus); + skin_draw_playlistwin_frame(aud_active_skin, obj, width, config.playlist_height, focus); } break; }
--- a/src/skins/ui_svis.c Tue May 20 16:34:06 2008 +0200 +++ b/src/skins/ui_svis.c Tue May 20 19:41:12 2008 +0200 @@ -28,6 +28,7 @@ #include "ui_svis.h" #include "ui_vis.h" #include "util.h" +#include "skins_cfg.h" #include <audacious/plugin.h> #include <string.h> #include <ctype.h> @@ -240,16 +241,16 @@ static void ui_svis_size_request(GtkWidget *widget, GtkRequisition *requisition) { UiSVis *svis = UI_SVIS(widget); - requisition->width = svis->width * (svis->scaled ? aud_cfg->scale_factor : 1); - requisition->height = svis->height*(svis->scaled ? aud_cfg->scale_factor : 1); + requisition->width = svis->width * (svis->scaled ? config.scale_factor : 1); + requisition->height = svis->height*(svis->scaled ? config.scale_factor : 1); } static void ui_svis_size_allocate(GtkWidget *widget, GtkAllocation *allocation) { UiSVis *svis = UI_SVIS (widget); widget->allocation = *allocation; - widget->allocation.x *= (svis->scaled ? aud_cfg->scale_factor : 1 ); - widget->allocation.y *= (svis->scaled ? aud_cfg->scale_factor : 1); + widget->allocation.x *= (svis->scaled ? config.scale_factor : 1 ); + widget->allocation.y *= (svis->scaled ? config.scale_factor : 1); if (GTK_WIDGET_REALIZED (widget)) { if (svis->event_window != NULL) @@ -258,8 +259,8 @@ gdk_window_move_resize(widget->window, widget->allocation.x, widget->allocation.y, allocation->width, allocation->height); } - svis->x = widget->allocation.x/(svis->scaled ? aud_cfg->scale_factor : 1); - svis->y = widget->allocation.y/(svis->scaled ? aud_cfg->scale_factor : 1); + svis->x = widget->allocation.x/(svis->scaled ? config.scale_factor : 1); + svis->y = widget->allocation.y/(svis->scaled ? config.scale_factor : 1); } static gboolean ui_svis_expose(GtkWidget *widget, GdkEventExpose *event) { @@ -288,11 +289,11 @@ } cmap = gdk_rgb_cmap_new(colors, 24); - if (!aud_cfg->scaled) { + if (!config.scaled) { memset(rgb_data, 0, SVIS_WIDTH * SVIS_HEIGHT); - if (aud_cfg->vis_type == VIS_ANALYZER && !audacious_drct_get_paused() && audacious_drct_get_playing()){ + if (config.vis_type == VIS_ANALYZER && !audacious_drct_get_paused() && audacious_drct_get_playing()){ for(y=0; y < SVIS_HEIGHT; y++){ - if (aud_cfg->analyzer_type == ANALYZER_BARS){ + if (config.analyzer_type == ANALYZER_BARS){ for(x=0;x< SVIS_WIDTH; x++){ if(svis->data[x] > y << 1) { @@ -312,8 +313,8 @@ } } } - else if (aud_cfg->vis_type == VIS_VOICEPRINT){ - switch (aud_cfg->vu_mode) { + else if (config.vis_type == VIS_VOICEPRINT){ + switch (config.vu_mode) { case VU_NORMAL: for (y = 0; y < 2; y++) { ptr = rgb_data + ((y * 3) * 38); @@ -341,7 +342,7 @@ break; } } - else if (aud_cfg->vis_type == VIS_SCOPE) { + else if (config.vis_type == VIS_SCOPE) { for (x = 0; x < 38; x++) { h = svis->data[x << 1] / 3; ptr = rgb_data + ((4 - h) * 38) + x; @@ -352,10 +353,10 @@ } else { /*svis scaling, this needs some work, since a lot of stuff is hardcoded --majeru*/ - memset(rgb_data, 0, SVIS_WIDTH * aud_cfg->scale_factor * SVIS_HEIGHT * aud_cfg->scale_factor); - if (aud_cfg->vis_type == VIS_ANALYZER && !audacious_drct_get_paused() && audacious_drct_get_playing()){ + memset(rgb_data, 0, SVIS_WIDTH * config.scale_factor * SVIS_HEIGHT * aud_cfg->scale_factor); + if (config.vis_type == VIS_ANALYZER && !audacious_drct_get_paused() && audacious_drct_get_playing()){ for(y=0; y < SVIS_HEIGHT; y++){ - if (aud_cfg->analyzer_type == ANALYZER_BARS){ + if (config.analyzer_type == ANALYZER_BARS){ for(x=0;x< SVIS_WIDTH; x++){ if(svis->data[x] > y << 1) { @@ -376,8 +377,8 @@ } } } - else if (aud_cfg->vis_type == VIS_VOICEPRINT){ - switch (aud_cfg->vu_mode) { + else if (config.vis_type == VIS_VOICEPRINT){ + switch (config.vu_mode) { case VU_NORMAL: for (y = 0; y < 2; y++) { ptr = rgb_data + ((y * 3) * 152); @@ -405,7 +406,7 @@ break; } } - else if (aud_cfg->vis_type == VIS_SCOPE) { + else if (config.vis_type == VIS_SCOPE) { for (x = 0; x < 38; x++) { h = svis->data[x << 1] / 3; ptr = rgb_data + ((4 - h) * 152) + (x << 1); @@ -421,8 +422,8 @@ GdkPixmap *obj = NULL; GdkGC *gc; - obj = gdk_pixmap_new(NULL, svis->width* ( svis->scaled ? aud_cfg->scale_factor : 1), - svis->height*(svis->scaled ? aud_cfg->scale_factor : 1), gdk_rgb_get_visual()->depth); + obj = gdk_pixmap_new(NULL, svis->width* ( svis->scaled ? config.scale_factor : 1), + svis->height*(svis->scaled ? config.scale_factor : 1), gdk_rgb_get_visual()->depth); gc = gdk_gc_new(obj); if (!svis->scaled) { @@ -439,8 +440,8 @@ gdk_rgb_cmap_free(cmap); gdk_draw_drawable (widget->window, gc, obj, 0, 0, 0, 0, - svis->width*(svis->scaled ? aud_cfg->scale_factor : 1), - svis->height*(svis->scaled ? aud_cfg->scale_factor : 1)); + svis->width*(svis->scaled ? config.scale_factor : 1), + svis->height*(svis->scaled ? config.scale_factor : 1)); g_object_unref(obj); g_object_unref(gc); @@ -451,7 +452,7 @@ GtkWidget *widget = GTK_WIDGET (svis); svis->scaled = !svis->scaled; - gtk_widget_set_size_request(widget, svis->width* aud_cfg->scale_factor, svis->height * aud_cfg->scale_factor); + gtk_widget_set_size_request(widget, svis->width* config.scale_factor, svis->height * aud_cfg->scale_factor); gtk_widget_queue_draw(widget); } @@ -490,7 +491,7 @@ UiSVis *svis = UI_SVIS (widget); for (i = 0; i < 75; i++) { - svis->data[i] = (aud_cfg->vis_type == VIS_SCOPE) ? 6 : 0; + svis->data[i] = (config.vis_type == VIS_SCOPE) ? 6 : 0; } } @@ -512,7 +513,7 @@ } - if (aud_cfg->vis_type == VIS_VOICEPRINT) { + if (config.vis_type == VIS_VOICEPRINT) { if (micros > 14000) falloff = TRUE; @@ -538,7 +539,7 @@ if (micros > 14000) { if (!svis->refresh_delay) { gtk_widget_queue_draw(widget); - svis->refresh_delay = svis_redraw_delays[aud_cfg->vis_refresh]; + svis->refresh_delay = svis_redraw_delays[config.vis_refresh]; } svis->refresh_delay--; }
--- a/src/skins/ui_vis.c Tue May 20 16:34:06 2008 +0200 +++ b/src/skins/ui_vis.c Tue May 20 19:41:12 2008 +0200 @@ -27,6 +27,7 @@ #include "ui_skin.h" #include "ui_vis.h" #include "util.h" +#include "skins_cfg.h" #include <audacious/plugin.h> static const gfloat vis_afalloff_speeds[] = { 0.34, 0.5, 1.0, 1.3, 1.6 }; @@ -224,16 +225,16 @@ static void ui_vis_size_request(GtkWidget *widget, GtkRequisition *requisition) { UiVis *vis = UI_VIS(widget); - requisition->width = vis->width*(vis->scaled ? aud_cfg->scale_factor : 1); - requisition->height = vis->height*(vis->scaled ? aud_cfg->scale_factor : 1); + requisition->width = vis->width*(vis->scaled ? config.scale_factor : 1); + requisition->height = vis->height*(vis->scaled ? config.scale_factor : 1); } static void ui_vis_size_allocate(GtkWidget *widget, GtkAllocation *allocation) { UiVis *vis = UI_VIS (widget); widget->allocation = *allocation; - widget->allocation.x *= (vis->scaled ? aud_cfg->scale_factor : 1); - widget->allocation.y *= (vis->scaled ? aud_cfg->scale_factor : 1); + widget->allocation.x *= (vis->scaled ? config.scale_factor : 1); + widget->allocation.y *= (vis->scaled ? config.scale_factor : 1); if (GTK_WIDGET_REALIZED (widget)) { if (vis->event_window != NULL) @@ -242,8 +243,8 @@ gdk_window_move_resize(widget->window, widget->allocation.x, widget->allocation.y, allocation->width, allocation->height); } - vis->x = widget->allocation.x/(vis->scaled ? aud_cfg->scale_factor : 1); - vis->y = widget->allocation.y/(vis->scaled ? aud_cfg->scale_factor : 1); + vis->x = widget->allocation.x/(vis->scaled ? config.scale_factor : 1); + vis->y = widget->allocation.y/(vis->scaled ? config.scale_factor : 1); } static gboolean ui_vis_expose(GtkWidget *widget, GdkEventExpose *event) { @@ -277,7 +278,7 @@ cmap = gdk_rgb_cmap_new(colors, 24); if (!vis->scaled) { - if(aud_cfg->vis_type == VIS_VOICEPRINT /*&& aud_cfg->voiceprint_mode != VOICEPRINT_NORMAL*/){ + if(config.vis_type == VIS_VOICEPRINT /*&& aud_cfg->voiceprint_mode != VOICEPRINT_NORMAL*/){ memset(rgb_data, 0, 76 * 16 * 3); } else{ @@ -290,33 +291,33 @@ } } else{ - if(aud_cfg->vis_type == VIS_VOICEPRINT /*&& aud_cfg->voiceprint_mode != VOICEPRINT_NORMAL*/){ + if(config.vis_type == VIS_VOICEPRINT /*&& aud_cfg->voiceprint_mode != VOICEPRINT_NORMAL*/){ memset(rgb_data, 0, 3 * 4 * 16 * 76); } else{ - memset(rgb_data, 0, (guint)(76 * aud_cfg->scale_factor) * 32); + memset(rgb_data, 0, (guint)(76 * config.scale_factor) * 32); for (y = 1; y < 16; y += 2) { - ptr = rgb_data + (y * (guint)(76 * 4 * aud_cfg->scale_factor)); + ptr = rgb_data + (y * (guint)(76 * 4 * config.scale_factor)); for (x = 0; x < 76; x += 2, ptr += 4) { *ptr = 1; *(ptr + 1) = 1; - *(ptr + (guint)(76 * aud_cfg->scale_factor)) = 1; - *(ptr + (guint)(76 * aud_cfg->scale_factor)+1) = 1; + *(ptr + (guint)(76 * config.scale_factor)) = 1; + *(ptr + (guint)(76 * config.scale_factor)+1) = 1; } } } } - if (aud_cfg->vis_type == VIS_ANALYZER) { + if (config.vis_type == VIS_ANALYZER) { for (x = 0; x < 75; x++) { - if (aud_cfg->analyzer_type == ANALYZER_BARS && (x % 4) == 0) + if (config.analyzer_type == ANALYZER_BARS && (x % 4) == 0) h = vis->data[x >> 2]; - else if (aud_cfg->analyzer_type == ANALYZER_LINES) + else if (config.analyzer_type == ANALYZER_LINES) h = vis->data[x]; - if (h && (aud_cfg->analyzer_type == ANALYZER_LINES || + if (h && (config.analyzer_type == ANALYZER_LINES || (x % 4) != 3)) { if (!vis->scaled) { ptr = rgb_data + ((16 - h) * 76) + x; - switch (aud_cfg->analyzer_mode) { + switch (config.analyzer_mode) { case ANALYZER_NORMAL: for (y = 0; y < h; y++, ptr += 76) *ptr = 18 - h + y; @@ -332,30 +333,30 @@ } } else{ - ptr = rgb_data + ((16 - h) * (guint)(76 * 4 * aud_cfg->scale_factor)) + (guint)(x * aud_cfg->scale_factor); - switch (aud_cfg->analyzer_mode) { + ptr = rgb_data + ((16 - h) * (guint)(76 * 4 * config.scale_factor)) + (guint)(x * aud_cfg->scale_factor); + switch (config.analyzer_mode) { case ANALYZER_NORMAL: - for (y = 0; y < h; y++, ptr += (guint)(76 * 4 * aud_cfg->scale_factor)) { + for (y = 0; y < h; y++, ptr += (guint)(76 * 4 * config.scale_factor)) { *ptr = 18 - h + y; *(ptr + 1) = 18 - h + y; - *(ptr + (guint)(76 * aud_cfg->scale_factor)) = 18 - h + y; - *(ptr + (guint)(76 * aud_cfg->scale_factor)+1) = 18 - h + y; + *(ptr + (guint)(76 * config.scale_factor)) = 18 - h + y; + *(ptr + (guint)(76 * config.scale_factor)+1) = 18 - h + y; } break; case ANALYZER_FIRE: - for (y = 0; y < h; y++, ptr += (guint)(76 * 4 * aud_cfg->scale_factor)) { + for (y = 0; y < h; y++, ptr += (guint)(76 * 4 * config.scale_factor)) { *ptr = y + 2; *(ptr + 1) = y + 2; - *(ptr + (guint)(76 * aud_cfg->scale_factor)) = y + 2; - *(ptr + (guint)(76 * aud_cfg->scale_factor)+1) = y + 2; + *(ptr + (guint)(76 * config.scale_factor)) = y + 2; + *(ptr + (guint)(76 * config.scale_factor)+1) = y + 2; } break; case ANALYZER_VLINES: - for (y = 0; y < h; y++, ptr += (guint)(76 * 4 * aud_cfg->scale_factor)) { + for (y = 0; y < h; y++, ptr += (guint)(76 * 4 * config.scale_factor)) { *ptr = 18 - h; *(ptr + 1) = 18 - h; - *(ptr + (guint)(76 * aud_cfg->scale_factor)) = 18 - h; - *(ptr + (guint)(76 * aud_cfg->scale_factor)+1) = 18 - h; + *(ptr + (guint)(76 * config.scale_factor)) = 18 - h; + *(ptr + (guint)(76 * config.scale_factor)+1) = 18 - h; } break; @@ -363,29 +364,29 @@ } } } - if (aud_cfg->analyzer_peaks) { + if (config.analyzer_peaks) { for (x = 0; x < 75; x++) { - if (aud_cfg->analyzer_type == ANALYZER_BARS && (x % 4) == 0) + if (config.analyzer_type == ANALYZER_BARS && (x % 4) == 0) h = vis->peak[x >> 2]; - else if (aud_cfg->analyzer_type == ANALYZER_LINES) + else if (config.analyzer_type == ANALYZER_LINES) h = vis->peak[x]; - if (h && (aud_cfg->analyzer_type == ANALYZER_LINES || (x % 4) != 3)){ + if (h && (config.analyzer_type == ANALYZER_LINES || (x % 4) != 3)){ if (!vis->scaled) { rgb_data[(16 - h) * 76 + x] = 23; } else{ - ptr = rgb_data + (16 - h) * (guint)(76 * 4 * aud_cfg->scale_factor) + (guint)(x * aud_cfg->scale_factor); + ptr = rgb_data + (16 - h) * (guint)(76 * 4 * config.scale_factor) + (guint)(x * aud_cfg->scale_factor); *ptr = 23; *(ptr + 1) = 23; - *(ptr + (guint)(76 * aud_cfg->scale_factor)) = 23; - *(ptr + (guint)(76 * aud_cfg->scale_factor)+1) = 23; + *(ptr + (guint)(76 * config.scale_factor)) = 23; + *(ptr + (guint)(76 * config.scale_factor)+1) = 23; } } } } } - else if (aud_cfg->vis_type == VIS_VOICEPRINT) { + else if (config.vis_type == VIS_VOICEPRINT) { if(!audacious_drct_get_paused() && audacious_drct_get_playing()){/*Don't scroll when it's paused or stopped*/ for (y = 0; y < 16; y ++) for (x = 75; x > 0; x--) @@ -394,7 +395,7 @@ voiceprint_data[y * 76] = vis->data[y]; } if(audacious_drct_get_playing()){ /*Only draw the data if we're playing*/ - if(aud_cfg->voiceprint_mode == VOICEPRINT_NORMAL){ + if(config.voiceprint_mode == VOICEPRINT_NORMAL){ /* Create color gradient from the skin's background- and foreground color*/ fgc = skin_get_color(aud_active_skin, SKIN_TEXTFG); bgc = skin_get_color(aud_active_skin, SKIN_TEXTBG); @@ -424,12 +425,12 @@ for (x = 0; x < 76; x++){ guint8 d = voiceprint_data[x + y*76]; - if(aud_cfg->voiceprint_mode == VOICEPRINT_NORMAL){ + if(config.voiceprint_mode == VOICEPRINT_NORMAL){ voice_c[0] = vis_voice_color[d][0]; voice_c[1] = vis_voice_color[d][1]; voice_c[2] = vis_voice_color[d][2]; } - else if(aud_cfg->voiceprint_mode == VOICEPRINT_FIRE){ + else if(config.voiceprint_mode == VOICEPRINT_FIRE){ voice_c[0] = d < 64 ? (d * 2) : 255; voice_c[1] = d < 64 ? 0 : (d < 128 ? (d-64) * 2 : 255); voice_c[2] = d < 128 ? 0 : (d-128) * 2; @@ -439,7 +440,7 @@ voice_c[2] = d < 64 ? d << 2 : (d < 128 ? (128 - d) << 2 : 0); */ } - else if(aud_cfg->voiceprint_mode == VOICEPRINT_ICE){ + else if(config.voiceprint_mode == VOICEPRINT_ICE){ voice_c[0] = d; voice_c[1] = d < 128 ? d * 2 : 255; voice_c[2] = d < 64 ? d * 4 : 255; @@ -449,33 +450,33 @@ rgb_data[x * 3 + y * 76*3+n] = voice_c[n]; } else{ - ptr = rgb_data + (guint)(x * 3 * aud_cfg->scale_factor) + (guint) (y * 76 * 3 * aud_cfg->scale_factor); + ptr = rgb_data + (guint)(x * 3 * config.scale_factor) + (guint) (y * 76 * 3 * aud_cfg->scale_factor); for(n=0;n<3;n++) { *(ptr + n) = voice_c[n]; *(ptr + n + 3) = voice_c[n]; - *(ptr + (guint)(n + 76 * aud_cfg->scale_factor * 3)) = voice_c[n]; - *(ptr + (guint)(n + 3 + 76 * aud_cfg->scale_factor * 3)) = voice_c[n]; + *(ptr + (guint)(n + 76 * config.scale_factor * 3)) = voice_c[n]; + *(ptr + (guint)(n + 3 + 76 * config.scale_factor * 3)) = voice_c[n]; } } } } } } - if (aud_cfg->vis_type == VIS_SCOPE) { + if (config.vis_type == VIS_SCOPE) { for (x = 0; x < 75; x++) { - switch (aud_cfg->scope_mode) { + switch (config.scope_mode) { case SCOPE_DOT: h = vis->data[x]; if (!vis->scaled) { ptr = rgb_data + ((14 - h) * 76) + x; *ptr = vis_scope_colors[h + 1]; }else{ - ptr = rgb_data + ((14 - h) * (guint)(76 * 4 * aud_cfg->scale_factor)) + (guint)(x * aud_cfg->scale_factor); + ptr = rgb_data + ((14 - h) * (guint)(76 * 4 * config.scale_factor)) + (guint)(x * aud_cfg->scale_factor); *ptr = vis_scope_colors[h + 1]; *(ptr + 1) = vis_scope_colors[h + 1]; - *(ptr + (guint)(76 * aud_cfg->scale_factor)) = vis_scope_colors[h + 1]; - *(ptr + (guint)(76 * aud_cfg->scale_factor)+1) = vis_scope_colors[h + 1]; + *(ptr + (guint)(76 * config.scale_factor)) = vis_scope_colors[h + 1]; + *(ptr + (guint)(76 * config.scale_factor)+1) = vis_scope_colors[h + 1]; } break; case SCOPE_LINE: @@ -493,12 +494,12 @@ *ptr = vis_scope_colors[y - 2]; } else{ - ptr = rgb_data + (h * (guint)(76 * 4 * aud_cfg->scale_factor)) + (guint)(x * aud_cfg->scale_factor); - for (y = h; y <= h2; y++, ptr += (guint)(76 * 4 * aud_cfg->scale_factor)) { + ptr = rgb_data + (h * (guint)(76 * 4 * config.scale_factor)) + (guint)(x * aud_cfg->scale_factor); + for (y = h; y <= h2; y++, ptr += (guint)(76 * 4 * config.scale_factor)) { *ptr = vis_scope_colors[y - 2]; *(ptr + 1) = vis_scope_colors[y - 2]; - *(ptr + (guint)(76 * aud_cfg->scale_factor)) = vis_scope_colors[y - 2]; - *(ptr + (guint)(76 * aud_cfg->scale_factor)+1) = vis_scope_colors[y - 2]; + *(ptr + (guint)(76 * config.scale_factor)) = vis_scope_colors[y - 2]; + *(ptr + (guint)(76 * config.scale_factor)+1) = vis_scope_colors[y - 2]; } } } @@ -508,11 +509,11 @@ ptr = rgb_data + (h * 76) + x; *ptr = vis_scope_colors[h + 1]; }else{ - ptr = rgb_data + (h * (guint)(76 * 4 * aud_cfg->scale_factor)) + (guint)(x * aud_cfg->scale_factor); + ptr = rgb_data + (h * (guint)(76 * 4 * config.scale_factor)) + (guint)(x * aud_cfg->scale_factor); *ptr = vis_scope_colors[h + 1]; *(ptr + 1) = vis_scope_colors[h + 1]; - *(ptr + (guint)(76 * aud_cfg->scale_factor)) = vis_scope_colors[h + 1]; - *(ptr + (guint)(76 * aud_cfg->scale_factor)+1) = vis_scope_colors[h + 1]; + *(ptr + (guint)(76 * config.scale_factor)) = vis_scope_colors[h + 1]; + *(ptr + (guint)(76 * config.scale_factor)+1) = vis_scope_colors[h + 1]; } } break; @@ -530,12 +531,12 @@ for (y = h; y <= h2; y++, ptr += 76) *ptr = c; }else{ - ptr = rgb_data + (h * (guint)(76 * 4 * aud_cfg->scale_factor)) + (guint)(x * aud_cfg->scale_factor); - for (y = h; y <= h2; y++, ptr += (guint)(76 * 4 * aud_cfg->scale_factor)) { + ptr = rgb_data + (h * (guint)(76 * 4 * config.scale_factor)) + (guint)(x * aud_cfg->scale_factor); + for (y = h; y <= h2; y++, ptr += (guint)(76 * 4 * config.scale_factor)) { *ptr = c; *(ptr + 1) = c; - *(ptr + (guint)(76 * aud_cfg->scale_factor)) = c; - *(ptr + (guint)(76 * aud_cfg->scale_factor)+1) = c; + *(ptr + (guint)(76 * config.scale_factor)) = c; + *(ptr + (guint)(76 * config.scale_factor)+1) = c; } } break; @@ -545,11 +546,11 @@ GdkPixmap *obj = NULL; GdkGC *gc; - obj = gdk_pixmap_new(NULL, vis->width*(vis->scaled ? aud_cfg->scale_factor : 1), vis->height*(vis->scaled ? aud_cfg->scale_factor : 1), gdk_rgb_get_visual()->depth); + obj = gdk_pixmap_new(NULL, vis->width*(vis->scaled ? config.scale_factor : 1), vis->height*(vis->scaled ? aud_cfg->scale_factor : 1), gdk_rgb_get_visual()->depth); gc = gdk_gc_new(obj); if (!vis->scaled) { - if (aud_cfg->vis_type == VIS_VOICEPRINT) { + if (config.vis_type == VIS_VOICEPRINT) { gdk_draw_rgb_image(obj, gc, 0, 0, vis->width, vis->height, GDK_RGB_DITHER_NORMAL, (guchar *) rgb_data, 76 * 3); @@ -559,7 +560,7 @@ 76 , cmap); } } else { - if (aud_cfg->vis_type == VIS_VOICEPRINT) { + if (config.vis_type == VIS_VOICEPRINT) { gdk_draw_rgb_image(obj, gc, 0 << 1, 0 << 1, vis->width << 1, vis->height << 1, GDK_RGB_DITHER_NONE, (guchar *) rgb_data, @@ -573,7 +574,7 @@ } gdk_draw_drawable (widget->window, gc, obj, 0, 0, 0, 0, - vis->width*(vis->scaled ? aud_cfg->scale_factor : 1), vis->height*(vis->scaled ? aud_cfg->scale_factor : 1)); + vis->width*(vis->scaled ? config.scale_factor : 1), vis->height*(vis->scaled ? aud_cfg->scale_factor : 1)); g_object_unref(obj); g_object_unref(gc); gdk_rgb_cmap_free(cmap); @@ -584,7 +585,7 @@ GtkWidget *widget = GTK_WIDGET (vis); vis->scaled = !vis->scaled; - gtk_widget_set_size_request(widget, vis->width*(vis->scaled ? aud_cfg->scale_factor : 1), vis->height*(vis->scaled ? aud_cfg->scale_factor : 1)); + gtk_widget_set_size_request(widget, vis->width*(vis->scaled ? config.scale_factor : 1), vis->height*(vis->scaled ? aud_cfg->scale_factor : 1)); gtk_widget_queue_draw(GTK_WIDGET(vis)); } @@ -635,7 +636,7 @@ memset(voiceprint_data, 0, 16*76); for (i = 0; i < 75; i++) { - vis->data[i] = (aud_cfg->vis_type == VIS_SCOPE) ? 6 : 0; + vis->data[i] = (config.vis_type == VIS_SCOPE) ? 6 : 0; vis->peak[i] = 0; } } @@ -656,7 +657,7 @@ if (micros > 14000) g_timer_reset(timer); } - if (aud_cfg->vis_type == VIS_ANALYZER) { + if (config.vis_type == VIS_ANALYZER) { if (micros > 14000) falloff = TRUE; if (data || falloff) { @@ -671,7 +672,7 @@ else if (vis->peak[i] > 0.0) { vis->peak[i] -= vis->peak_speed[i]; vis->peak_speed[i] *= - vis_pfalloff_speeds[aud_cfg->peaks_falloff]; + vis_pfalloff_speeds[config.peaks_falloff]; if (vis->peak[i] < vis->data[i]) vis->peak[i] = vis->data[i]; if (vis->peak[i] < 0.0) @@ -681,14 +682,14 @@ else if (falloff) { if (vis->data[i] > 0.0) { vis->data[i] -= - vis_afalloff_speeds[aud_cfg->analyzer_falloff]; + vis_afalloff_speeds[config.analyzer_falloff]; if (vis->data[i] < 0.0) vis->data[i] = 0.0; } if (vis->peak[i] > 0.0) { vis->peak[i] -= vis->peak_speed[i]; vis->peak_speed[i] *= - vis_pfalloff_speeds[aud_cfg->peaks_falloff]; + vis_pfalloff_speeds[config.peaks_falloff]; if (vis->peak[i] < vis->data[i]) vis->peak[i] = vis->data[i]; if (vis->peak[i] < 0.0) @@ -698,7 +699,7 @@ } } } - else if (aud_cfg->vis_type == VIS_VOICEPRINT && data){ + else if (config.vis_type == VIS_VOICEPRINT && data){ for(i = 0; i < 16; i++) { vis->data[i] = data[15 - i]; @@ -712,7 +713,7 @@ if (micros > 14000) { if (!vis->refresh_delay) { gtk_widget_queue_draw(widget); - vis->refresh_delay = vis_redraw_delays[aud_cfg->vis_refresh]; + vis->refresh_delay = vis_redraw_delays[config.vis_refresh]; } vis->refresh_delay--; }