Mercurial > audlegacy
changeset 3055:3a754f73c8f9
remove dead files
author | Tomasz Mon <desowin@gmail.com> |
---|---|
date | Fri, 13 Jul 2007 11:42:02 +0200 |
parents | 34f37c59e87b |
children | 41d3854f3625 |
files | src/audacious/widgets/hslider.c src/audacious/widgets/hslider.h src/audacious/widgets/svis.c src/audacious/widgets/svis.h |
diffstat | 4 files changed, 0 insertions(+), 624 deletions(-) [+] |
line wrap: on
line diff
--- a/src/audacious/widgets/hslider.c Fri Jul 13 11:40:00 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,203 +0,0 @@ -/* XMMS - Cross-platform multimedia player - * Copyright (C) 1998-2000 Peter Alm, Mikael Alm, Olle Hallnas, Thomas Nilsson and 4Front Technologies - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "widgetcore.h" - -#include <glib.h> -#include <gdk/gdk.h> -#include <gtk/gtk.h> - -#include "skin.h" - -void -hslider_set_position(HSlider * hs, - gint pos) -{ - if (pos == hs->hs_position || hs->hs_pressed) - return; - - hs->hs_position = pos; - - if (hs->hs_frame_cb) - hs->hs_frame = hs->hs_frame_cb(hs->hs_position); - - widget_draw(WIDGET(hs)); -} - -gint -hslider_get_position(HSlider * hs) -{ - return hs->hs_position; -} - -void -hslider_draw(Widget * w) -{ - HSlider *hs = (HSlider *) w; - GdkPixmap *obj; - - obj = hs->hs_widget.parent; - - skin_draw_pixmap(bmp_active_skin, obj, hs->hs_widget.gc, - hs->hs_skin_index, hs->hs_frame_offset, - hs->hs_frame * hs->hs_frame_height, hs->hs_widget.x, - hs->hs_widget.y, hs->hs_widget.width, - hs->hs_widget.height); - if (hs->hs_pressed) - skin_draw_pixmap(bmp_active_skin, obj, hs->hs_widget.gc, - hs->hs_skin_index, hs->hs_knob_px, - hs->hs_knob_py, hs->hs_widget.x + hs->hs_position, - hs->hs_widget.y + - ((hs->hs_widget.height - hs->hs_knob_height) / 2), - hs->hs_knob_width, hs->hs_knob_height); - else - skin_draw_pixmap(bmp_active_skin, obj, hs->hs_widget.gc, - hs->hs_skin_index, hs->hs_knob_nx, hs->hs_knob_ny, - hs->hs_widget.x + hs->hs_position, - hs->hs_widget.y + - ((hs->hs_widget.height - hs->hs_knob_height) / 2), - hs->hs_knob_width, hs->hs_knob_height); -} - -void -hslider_button_press_cb(GtkWidget * w, - GdkEventButton * event, - gpointer data) -{ - HSlider *hs = HSLIDER(data); - gint x; - - if (event->button != 1) - return; - - if (widget_contains(&hs->hs_widget, event->x, event->y)) { - x = event->x - hs->hs_widget.x; - hs->hs_pressed = TRUE; - - if (x >= hs->hs_position && x < hs->hs_position + hs->hs_knob_width) - hs->hs_pressed_x = x - hs->hs_position; - else { - hs->hs_position = x - (hs->hs_knob_width / 2); - hs->hs_pressed_x = hs->hs_knob_width / 2; - if (hs->hs_position < hs->hs_min) - hs->hs_position = hs->hs_min; - if (hs->hs_position > hs->hs_max) - hs->hs_position = hs->hs_max; - if (hs->hs_frame_cb) - hs->hs_frame = hs->hs_frame_cb(hs->hs_position); - - } - - if (hs->hs_motion_cb) - hs->hs_motion_cb(hs->hs_position); - - widget_draw(WIDGET(hs)); - } -} - -void -hslider_motion_cb(GtkWidget * w, GdkEventMotion * event, gpointer data) -{ - HSlider *hs = (HSlider *) data; - gint x; - - if (hs->hs_pressed) { - if (!hs->hs_widget.visible) { - hs->hs_pressed = FALSE; - return; - } - - x = event->x - hs->hs_widget.x; - hs->hs_position = x - hs->hs_pressed_x; - - if (hs->hs_position < hs->hs_min) - hs->hs_position = hs->hs_min; - - if (hs->hs_position > hs->hs_max) - hs->hs_position = hs->hs_max; - - if (hs->hs_frame_cb) - hs->hs_frame = hs->hs_frame_cb(hs->hs_position); - - if (hs->hs_motion_cb) - hs->hs_motion_cb(hs->hs_position); - - widget_draw(WIDGET(hs)); - } -} - -void -hslider_button_release_cb(GtkWidget * w, - GdkEventButton * event, - gpointer data) -{ - HSlider *hs = HSLIDER(data); - - if (hs->hs_pressed) { - hs->hs_pressed = FALSE; - - if (hs->hs_release_cb) - hs->hs_release_cb(hs->hs_position); - - widget_draw(WIDGET(hs)); - } -} - -HSlider * -create_hslider(GList ** wlist, GdkPixmap * parent, GdkGC * gc, - gint x, gint y, gint w, gint h, gint knx, gint kny, - gint kpx, gint kpy, gint kw, gint kh, gint fh, - gint fo, gint min, gint max, gint(*fcb) (gint), - void (*mcb) (gint), void (*rcb) (gint), SkinPixmapId si) -{ - HSlider *hs; - - hs = g_new0(HSlider, 1); - widget_init(&hs->hs_widget, parent, gc, x, y, w, h, 1); - hs->hs_widget.button_press_cb = - (void (*)(GtkWidget *, GdkEventButton *, gpointer)) - hslider_button_press_cb; - hs->hs_widget.button_release_cb = - (void (*)(GtkWidget *, GdkEventButton *, gpointer)) - hslider_button_release_cb; - hs->hs_widget.motion_cb = - (void (*)(GtkWidget *, GdkEventMotion *, gpointer)) - hslider_motion_cb; - hs->hs_widget.draw = hslider_draw; - hs->hs_knob_nx = knx; - hs->hs_knob_ny = kny; - hs->hs_knob_px = kpx; - hs->hs_knob_py = kpy; - hs->hs_knob_width = kw; - hs->hs_knob_height = kh; - hs->hs_frame_height = fh; - hs->hs_frame_offset = fo; - hs->hs_min = min; - hs->hs_position = min; - hs->hs_max = max; - hs->hs_frame_cb = fcb; - hs->hs_motion_cb = mcb; - hs->hs_release_cb = rcb; - if (hs->hs_frame_cb) - hs->hs_frame = hs->hs_frame_cb(0); - hs->hs_skin_index = si; - - widget_list_add(wlist, WIDGET(hs)); - - return hs; -}
--- a/src/audacious/widgets/hslider.h Fri Jul 13 11:40:00 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* XMMS - Cross-platform multimedia player - * Copyright (C) 1998-2000 Peter Alm, Mikael Alm, Olle Hallnas, Thomas Nilsson and 4Front Technologies - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef _WIDGETCORE_H_ -#error Please do not include me directly! Use widgetcore.h instead! -#endif - -#ifndef HSLIDER_H -#define HSLIDER_H - -#include <glib.h> -#include <gdk/gdk.h> - -#include "skin.h" -#include "widget.h" - -#define HSLIDER(x) ((HSlider *)(x)) -struct _HSlider { - Widget hs_widget; - gint hs_frame, hs_frame_offset, hs_frame_height, hs_min, hs_max; - gint hs_knob_nx, hs_knob_ny, hs_knob_px, hs_knob_py; - gint hs_knob_width, hs_knob_height; - gint hs_position; - gboolean hs_pressed; - gint hs_pressed_x, hs_pressed_y; - gint(*hs_frame_cb) (gint); - void (*hs_motion_cb) (gint); - void (*hs_release_cb) (gint); - SkinPixmapId hs_skin_index; -}; - -typedef struct _HSlider HSlider; - -HSlider *create_hslider(GList ** wlist, GdkPixmap * parent, GdkGC * gc, - gint x, gint y, gint w, gint h, gint knx, gint kny, - gint kpx, gint kpy, gint kw, gint kh, gint fh, - gint fo, gint min, gint max, gint(*fcb) (gint), - void (*mcb) (gint), void (*rcb) (gint), - SkinPixmapId si); - -void hslider_set_position(HSlider * hs, gint pos); -gint hslider_get_position(HSlider * hs); - -#endif
--- a/src/audacious/widgets/svis.c Fri Jul 13 11:40:00 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,310 +0,0 @@ -/* BMP - Cross-platform multimedia player - * Copyright (C) 2003-2004 BMP development team. - * - * Based on XMMS: - * Copyright (C) 1998-2003 XMMS development team. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "widgetcore.h" - -#include <glib.h> -#include <gdk/gdk.h> -#include <string.h> - -#include "main.h" -#include "ui_main.h" -#include "plugin.h" -#include "widget.h" -#include "playback.h" -#include "../ui_vis.h" - -#include "ui_skinned_window.h" - -static gint svis_redraw_delays[] = { 1, 2, 4, 8 }; - -/* FIXME: Are the svis_scope_colors correct? */ -static guint8 svis_scope_colors[] = { 20, 19, 18, 19, 20 }; -static guint8 svis_vu_normal_colors[] = { 17, 17, 17, 12, 12, 12, 2, 2 }; - -#define DRAW_DS_PIXEL(ptr,value) \ - *(ptr) = (value); \ - *((ptr) + 1) = (value); \ - *((ptr) + 76) = (value); \ - *((ptr) + 77) = (value); - -#define SVIS_HEIGHT 5 -#define SVIS_WIDTH 38 - -void -svis_timeout_func(SVis * svis, guchar * data) -{ - static GTimer *timer = NULL; - gulong micros = 9999999; - gboolean falloff = FALSE; - gint i; - - if (!timer) { - timer = g_timer_new(); - g_timer_start(timer); - } - else { - g_timer_elapsed(timer, µs); - if (micros > 14000) - g_timer_reset(timer); - - } - - if (cfg.vis_type == VIS_VOICEPRINT) { - if (micros > 14000) - falloff = TRUE; - - for (i = 0; i < 2; i++) { - if (falloff || data) { - if (data && data[i] > svis->vs_data[i]) - svis->vs_data[i] = data[i]; - else if (falloff) { - if (svis->vs_data[i] >= 2) - svis->vs_data[i] -= 2; - else - svis->vs_data[i] = 0; - } - } - - } - } - else if (data) { - for (i = 0; i < 75; i++) - svis->vs_data[i] = data[i]; - } - - if (micros > 14000) { - if (!svis->vs_refresh_delay) { - svis_draw((Widget *) svis); - svis->vs_refresh_delay = svis_redraw_delays[cfg.vis_refresh]; - - } - svis->vs_refresh_delay--; - } -} - -void -svis_draw(Widget * w) -{ - SVis *svis = (SVis *) w; - gint x, y, h; - guchar svis_color[24][3]; - guchar rgb_data[SVIS_WIDTH * 2 * SVIS_HEIGHT * 2], *ptr, c; - guint32 colors[24]; - GdkRgbCmap *cmap; - - GDK_THREADS_ENTER(); - - skin_get_viscolor(bmp_active_skin, svis_color); - for (y = 0; y < 24; y++) { - colors[y] = - svis_color[y][0] << 16 | svis_color[y][1] << 8 | svis_color[y][2]; - } - cmap = gdk_rgb_cmap_new(colors, 24); - - if (!cfg.doublesize) { - memset(rgb_data, 0, SVIS_WIDTH * SVIS_HEIGHT); - if (cfg.vis_type == VIS_ANALYZER && !playback_get_paused() && playback_get_playing()){ - for(y=0; y < SVIS_HEIGHT; y++){ - if (cfg.analyzer_type == ANALYZER_BARS){ - for(x=0;x< SVIS_WIDTH; x++){ - if(svis->vs_data[x] > y << 1) - { - rgb_data[x*3+ (SVIS_HEIGHT - y) * SVIS_WIDTH] = 23; - rgb_data[x*3+1 + (SVIS_HEIGHT - y) * SVIS_WIDTH] = 23; - - } - } - } - else{ - for(x=0;x< SVIS_WIDTH; x++){ - if(svis->vs_data[x] > y << 1) - { - rgb_data[x + (SVIS_HEIGHT - y) * SVIS_WIDTH] = 23; - } - } - } - } - } - else if (cfg.vis_type == VIS_VOICEPRINT){ - switch (cfg.vu_mode) { - case VU_NORMAL: - for (y = 0; y < 2; y++) { - ptr = rgb_data + ((y * 3) * 38); - h = (svis->vs_data[y] * 7) / 37; - for (x = 0; x < h; x++, ptr += 5) { - c = svis_vu_normal_colors[x]; - *(ptr) = c; - *(ptr + 1) = c; - *(ptr + 2) = c; - *(ptr + 38) = c; - *(ptr + 39) = c; - *(ptr + 40) = c; - } - } - break; - case VU_SMOOTH: - for (y = 0; y < 2; y++) { - ptr = rgb_data + ((y * 3) * SVIS_WIDTH); - for (x = 0; x < svis->vs_data[y]; x++, ptr++) { - c = 17 - ((x * 15) / 37); - *(ptr) = c; - *(ptr + 38) = c; - } - } - break; - } - } - else if (cfg.vis_type == VIS_SCOPE) { - for (x = 0; x < 38; x++) { - h = svis->vs_data[x << 1] / 3; - ptr = rgb_data + ((4 - h) * 38) + x; - *ptr = svis_scope_colors[h]; - } - } - - gdk_draw_indexed_image(mainwin->window, SKINNED_WINDOW(mainwin)->gc, - svis->vs_widget.x, svis->vs_widget.y, - svis->vs_widget.width, - svis->vs_widget.height, - GDK_RGB_DITHER_NORMAL, (guchar *) rgb_data, - 38, cmap); - } - else { /* doublesize */ - - memset(rgb_data, 0, SVIS_WIDTH * 2 * SVIS_HEIGHT * 2); - if (cfg.vis_type == VIS_ANALYZER && !playback_get_paused() && playback_get_playing()){ - for(y=0; y < SVIS_HEIGHT; y++){ - if (cfg.analyzer_type == ANALYZER_BARS){ - for(x=0;x< SVIS_WIDTH; x++){ - if(svis->vs_data[x] > y << 1) - { - ptr = rgb_data + x * 6 + (SVIS_HEIGHT * 2 - y * 2) * SVIS_WIDTH * 2; - DRAW_DS_PIXEL(ptr, 23); - DRAW_DS_PIXEL(ptr + 2, 23); - } - } - } - else{ - for(x=0;x< SVIS_WIDTH; x++){ - if(svis->vs_data[x] > y << 1) - { - ptr = rgb_data + x * 2 + (SVIS_HEIGHT * 2 - y * 2) * SVIS_WIDTH * 2; - DRAW_DS_PIXEL(ptr, 23); - } - } - } - } - } - else if (cfg.vis_type == VIS_VOICEPRINT){ - switch (cfg.vu_mode) { - case VU_NORMAL: - for (y = 0; y < 2; y++) { - ptr = rgb_data + ((y * 3) * 152); - h = (svis->vs_data[y] * 8) / 37; - for (x = 0; x < h; x++, ptr += 10) { - c = svis_vu_normal_colors[x]; - DRAW_DS_PIXEL(ptr, c); - DRAW_DS_PIXEL(ptr + 2, c); - DRAW_DS_PIXEL(ptr + 4, c); - DRAW_DS_PIXEL(ptr + 152, c); - DRAW_DS_PIXEL(ptr + 154, c); - DRAW_DS_PIXEL(ptr + 156, c); - } - } - break; - case VU_SMOOTH: - for (y = 0; y < 2; y++) { - ptr = rgb_data + ((y * 3) * 152); - for (x = 0; x < svis->vs_data[y]; x++, ptr += 2) { - c = 17 - ((x * 15) / 37); - DRAW_DS_PIXEL(ptr, c); - DRAW_DS_PIXEL(ptr + 152, c); - } - } - break; - } - } - else if (cfg.vis_type == VIS_SCOPE) { - for (x = 0; x < 38; x++) { - h = svis->vs_data[x << 1] / 3; - ptr = rgb_data + ((4 - h) * 152) + (x << 1); - *ptr = svis_scope_colors[h]; - *(ptr + 1) = svis_scope_colors[h]; - *(ptr + 76) = svis_scope_colors[h]; - *(ptr + 77) = svis_scope_colors[h]; - } - } - - gdk_draw_indexed_image(mainwin->window, SKINNED_WINDOW(mainwin)->gc, - svis->vs_widget.x << 1, - svis->vs_widget.y << 1, - svis->vs_widget.width << 1, - svis->vs_widget.height << 1, - GDK_RGB_DITHER_NONE, (guchar *) rgb_data, - 76, cmap); - } - gdk_rgb_cmap_free(cmap); - GDK_THREADS_LEAVE(); -} - -void -svis_clear_data(SVis * svis) -{ - gint i; - - if (!svis) - return; - - for (i = 0; i < 75; i++) { - svis->vs_data[i] = (cfg.vis_type == VIS_SCOPE) ? 6 : 0; - } -} - -void -svis_clear(SVis * svis) -{ - if (!cfg.doublesize) - gdk_window_clear_area(mainwin->window, svis->vs_widget.x, - svis->vs_widget.y, svis->vs_widget.width, - svis->vs_widget.height); - else - gdk_window_clear_area(mainwin->window, svis->vs_widget.x << 1, - svis->vs_widget.y << 1, - svis->vs_widget.width << 1, - svis->vs_widget.height << 1); -} - -SVis * -create_svis(GList ** wlist, - GdkPixmap * parent, - GdkGC * gc, - gint x, gint y) -{ - SVis *svis; - - svis = g_new0(SVis, 1); - widget_init(&svis->vs_widget, parent, gc, x, y, SVIS_WIDTH, SVIS_HEIGHT, - 1); - - widget_list_add(wlist, WIDGET(svis)); - return svis; -}
--- a/src/audacious/widgets/svis.h Fri Jul 13 11:40:00 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -/* BMP - Cross-platform multimedia player - * Copyright (C) 2003-2004 BMP development team. - * - * Based on XMMS: - * Copyright (C) 1998-2003 XMMS development team. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef _WIDGETCORE_H_ -#error Please do not include me directly! Use widgetcore.h instead! -#endif - -#ifndef SVIS_H -#define SVIS_H - -#include <glib.h> -#include <gdk/gdk.h> - -#include "svis.h" -#include "widget.h" - -#define SVIS(x) ((SVis *)(x)) -struct _SVis { - Widget vs_widget; - gint vs_data[75]; - gint vs_refresh_delay; -}; - -typedef struct _SVis SVis; - -void svis_draw(Widget * w); -void svis_timeout_func(SVis * svis, guchar * data); -SVis *create_svis(GList ** wlist, GdkPixmap * parent, GdkGC * gc, gint x, - gint y); -void svis_set_data(SVis * vis, guchar * data); -void svis_clear_data(SVis * vis); -void svis_clear(SVis * vis); - -#endif