Mercurial > audlegacy
changeset 3095:5a7dea5211f3
branch merge
author | Yoshiki Yazawa <yaz@cc.rim.or.jp> |
---|---|
date | Tue, 17 Jul 2007 18:33:49 +0900 |
parents | 7fbe8ada95ca (current diff) a7e596cf1c3a (diff) |
children | 8e4da6a4ab91 821a712c08a3 |
files | src/audacious/ui_main.c src/audacious/widgets/hslider.c src/audacious/widgets/hslider.h src/audacious/widgets/menurow.c src/audacious/widgets/menurow.h src/audacious/widgets/monostereo.c src/audacious/widgets/monostereo.h src/audacious/widgets/playstatus.c src/audacious/widgets/playstatus.h src/audacious/widgets/svis.c src/audacious/widgets/svis.h |
diffstat | 55 files changed, 3009 insertions(+), 1560 deletions(-) [+] |
line wrap: on
line diff
--- a/src/audacious/Makefile Tue Jul 17 18:28:54 2007 +0900 +++ b/src/audacious/Makefile Tue Jul 17 18:33:49 2007 +0900 @@ -113,6 +113,10 @@ ui_skinned_number.c \ ui_skinned_horizontal_slider.c \ ui_vis.c \ + ui_svis.c \ + ui_skinned_menurow.c \ + ui_skinned_playstatus.c \ + ui_skinned_monostereo.c \ ui_skinselector.c \ ui_urlopener.c \ util.c \
--- a/src/audacious/input.c Tue Jul 17 18:28:54 2007 +0900 +++ b/src/audacious/input.c Tue Jul 17 18:33:49 2007 +0900 @@ -42,6 +42,7 @@ #include "util.h" #include "visualization.h" #include "widgets/widgetcore.h" +#include "ui_skinned_playstatus.h" #include "hook.h" #include "vfs.h" @@ -531,12 +532,14 @@ gchar *title, *fileinfo, *basename, *iplugin; gchar *filename_utf8; + gchar *realfn = NULL; window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_resizable(GTK_WINDOW(window), FALSE); gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); - basename = g_path_get_basename(filename); + realfn = g_filename_from_uri(filename, NULL, NULL); + basename = g_path_get_basename(realfn ? realfn : filename); fileinfo = filename_to_utf8(basename); title = g_strdup_printf(_("audacious: %s"), fileinfo); @@ -558,7 +561,8 @@ gtk_box_pack_start(GTK_BOX(filename_hbox), label, FALSE, TRUE, 0); filename_entry = gtk_entry_new(); - filename_utf8 = filename_to_utf8(filename); + filename_utf8 = filename_to_utf8(realfn ? realfn : filename); + g_free(realfn); realfn = NULL; gtk_entry_set_text(GTK_ENTRY(filename_entry), filename_utf8); gtk_editable_set_editable(GTK_EDITABLE(filename_entry), FALSE); @@ -747,10 +751,10 @@ g_return_if_fail(mainwin_playstatus != NULL); - if (ip_data.buffering == TRUE && mainwin_playstatus != NULL && mainwin_playstatus->ps_status == STATUS_STOP) - mainwin_playstatus->ps_status = STATUS_PLAY; + if (ip_data.buffering == TRUE && mainwin_playstatus != NULL && UI_SKINNED_PLAYSTATUS(mainwin_playstatus)->status == STATUS_STOP) + UI_SKINNED_PLAYSTATUS(mainwin_playstatus)->status = STATUS_PLAY; - playstatus_set_status_buffering(mainwin_playstatus, ip_data.buffering); + ui_skinned_playstatus_set_buffering(mainwin_playstatus, ip_data.buffering); } void
--- a/src/audacious/intl/Makefile Tue Jul 17 18:28:54 2007 +0900 +++ b/src/audacious/intl/Makefile Tue Jul 17 18:33:49 2007 +0900 @@ -8,13 +8,13 @@ OBJECTIVE_LIBS_NOINST = libintl.a DEFS += -DLOCALEDIR=\"$(localedir)\" -DLOCALE_ALIAS_PATH=\"$(aliaspath)\" \ --DLIBDIR=\"$(libdir)\" -DIN_LIBINTL \ --DENABLE_RELOCATABLE=1 -DIN_LIBRARY -DINSTALLDIR=\"$(libdir)\" -DINSTALLPREFIX=\"$(libdir)\" -DNO_XMALLOC \ --Dset_relocation_prefix=libintl_set_relocation_prefix \ --Drelocate=libintl_relocate \ --DDEPENDS_ON_LIBICONV=1 + -DLIBDIR=\"$(libdir)\" -DIN_LIBINTL \ + -DENABLE_RELOCATABLE=1 -DIN_LIBRARY -DINSTALLDIR=\"$(libdir)\" -DINSTALLPREFIX=\"$(libdir)\" -DNO_XMALLOC \ + -Dset_relocation_prefix=libintl_set_relocation_prefix \ + -Drelocate=libintl_relocate \ + -DDEPENDS_ON_LIBICONV=1 -CFLAGS += $(PICFLAGS) -I../.. -I. $(DEFS) +CFLAGS += $(PICFLAGS) -I../../.. -I../.. -I. $(DEFS) SOURCES = \ bindtextdom.c \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audacious/intl/ui_skinned_textbox.c Tue Jul 17 18:33:49 2007 +0900 @@ -0,0 +1,912 @@ +/* + * Audacious - a cross-platform multimedia player + * Copyright (c) 2007 Audacious development team. + * + * Based on: + * BMP - Cross-platform multimedia player + * Copyright (C) 2003-2004 BMP development team. + * 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; under version 2 of the License. + * + * 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 "widgets/widgetcore.h" +#include "ui_skinned_textbox.h" +#include "main.h" +#include "util.h" +#include "strings.h" +#include <string.h> +#include <ctype.h> +#include <gtk/gtkmain.h> +#include <gtk/gtkmarshal.h> +#include <gtk/gtkimage.h> + +#define UI_TYPE_SKINNED_TEXTBOX (ui_skinned_textbox_get_type()) +#define UI_SKINNED_TEXTBOX_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UI_TYPE_SKINNED_TEXTBOX, UiSkinnedTextboxPrivate)) +typedef struct _UiSkinnedTextboxPrivate UiSkinnedTextboxPrivate; + +static GMutex *mutex = NULL; + +#define TEXTBOX_SCROLL_SMOOTH_TIMEOUT 30 +#define TEXTBOX_SCROLL_WAIT 80 + +enum { + CLICKED, + DOUBLE_CLICKED, + RIGHT_CLICKED, + DOUBLED, + REDRAW, + LAST_SIGNAL +}; + +struct _UiSkinnedTextboxPrivate { + SkinPixmapId skin_index; + GtkWidget *fixed; + gboolean double_size; + gboolean scroll_back; + gint nominal_y, nominal_height; + gint scroll_timeout; + gint font_ascent, font_descent; + PangoFontDescription *font; + gchar *fontname; + gchar *pixmap_text; + gint skin_id; + gint drag_x, drag_off, offset; + gboolean is_scrollable, is_dragging; + gint pixmap_width; + GdkPixmap *pixmap; + gboolean scroll_allowed, scroll_enabled; + gint scroll_dummy; + gint resize_width, resize_height; + gint move_x, move_y; +}; + +static void ui_skinned_textbox_class_init (UiSkinnedTextboxClass *klass); +static void ui_skinned_textbox_init (UiSkinnedTextbox *textbox); +static void ui_skinned_textbox_destroy (GtkObject *object); +static void ui_skinned_textbox_realize (GtkWidget *widget); +static void ui_skinned_textbox_size_request (GtkWidget *widget, GtkRequisition *requisition); +static void ui_skinned_textbox_size_allocate (GtkWidget *widget, GtkAllocation *allocation); +static gboolean ui_skinned_textbox_expose (GtkWidget *widget, GdkEventExpose *event); +static gboolean ui_skinned_textbox_button_press (GtkWidget *widget, GdkEventButton *event); +static gboolean ui_skinned_textbox_button_release (GtkWidget *widget, GdkEventButton *event); +static gboolean ui_skinned_textbox_motion_notify (GtkWidget *widget, GdkEventMotion *event); +static void ui_skinned_textbox_toggle_doublesize (UiSkinnedTextbox *textbox); +static void ui_skinned_textbox_redraw (UiSkinnedTextbox *textbox); +static gboolean ui_skinned_textbox_should_scroll (UiSkinnedTextbox *textbox); +static void textbox_generate_xfont_pixmap (UiSkinnedTextbox *textbox, const gchar *pixmaptext); +static gboolean textbox_scroll (gpointer data); +static void textbox_generate_pixmap (UiSkinnedTextbox *textbox); +static void textbox_handle_special_char (gchar *c, gint * x, gint * y); + +static GtkWidgetClass *parent_class = NULL; +static guint textbox_signals[LAST_SIGNAL] = { 0 }; + +GType ui_skinned_textbox_get_type() { + static GType textbox_type = 0; + if (!textbox_type) { + static const GTypeInfo textbox_info = { + sizeof (UiSkinnedTextboxClass), + NULL, + NULL, + (GClassInitFunc) ui_skinned_textbox_class_init, + NULL, + NULL, + sizeof (UiSkinnedTextbox), + 0, + (GInstanceInitFunc) ui_skinned_textbox_init, + }; + textbox_type = g_type_register_static (GTK_TYPE_WIDGET, "UiSkinnedTextbox", &textbox_info, 0); + } + + return textbox_type; +} + +static void ui_skinned_textbox_class_init(UiSkinnedTextboxClass *klass) { + GObjectClass *gobject_class; + GtkObjectClass *object_class; + GtkWidgetClass *widget_class; + + gobject_class = G_OBJECT_CLASS(klass); + object_class = (GtkObjectClass*) klass; + widget_class = (GtkWidgetClass*) klass; + parent_class = gtk_type_class (gtk_widget_get_type ()); + + object_class->destroy = ui_skinned_textbox_destroy; + + widget_class->realize = ui_skinned_textbox_realize; + widget_class->expose_event = ui_skinned_textbox_expose; + widget_class->size_request = ui_skinned_textbox_size_request; + widget_class->size_allocate = ui_skinned_textbox_size_allocate; + widget_class->button_press_event = ui_skinned_textbox_button_press; + widget_class->button_release_event = ui_skinned_textbox_button_release; + widget_class->motion_notify_event = ui_skinned_textbox_motion_notify; + + klass->clicked = NULL; + klass->double_clicked = NULL; + klass->right_clicked = NULL; + klass->doubled = ui_skinned_textbox_toggle_doublesize; + klass->redraw = ui_skinned_textbox_redraw; + + textbox_signals[CLICKED] = + g_signal_new ("clicked", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET (UiSkinnedTextboxClass, clicked), NULL, NULL, + gtk_marshal_VOID__VOID, G_TYPE_NONE, 0); + + textbox_signals[DOUBLE_CLICKED] = + g_signal_new ("double-clicked", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET (UiSkinnedTextboxClass, double_clicked), NULL, NULL, + gtk_marshal_VOID__VOID, G_TYPE_NONE, 0); + + textbox_signals[RIGHT_CLICKED] = + g_signal_new ("right-clicked", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET (UiSkinnedTextboxClass, right_clicked), NULL, NULL, + gtk_marshal_VOID__VOID, G_TYPE_NONE, 0); + + textbox_signals[DOUBLED] = + g_signal_new ("toggle-double-size", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET (UiSkinnedTextboxClass, doubled), NULL, NULL, + gtk_marshal_VOID__VOID, G_TYPE_NONE, 0); + + textbox_signals[REDRAW] = + g_signal_new ("redraw", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET (UiSkinnedTextboxClass, redraw), NULL, NULL, + gtk_marshal_VOID__VOID, G_TYPE_NONE, 0); + + g_type_class_add_private (gobject_class, sizeof (UiSkinnedTextboxPrivate)); +} + +static void ui_skinned_textbox_init(UiSkinnedTextbox *textbox) { + UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE(textbox); + mutex = g_mutex_new(); + priv->resize_width = 0; + priv->resize_height = 0; + priv->move_x = 0; + priv->move_y = 0; +} + +GtkWidget* ui_skinned_textbox_new(GtkWidget *fixed, gint x, gint y, gint w, gboolean allow_scroll, SkinPixmapId si) { + UiSkinnedTextbox *textbox = g_object_new (ui_skinned_textbox_get_type (), NULL); + UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE(textbox); + + textbox->height = bmp_active_skin->properties.textbox_bitmap_font_height; + textbox->x = x; + textbox->y = y; + textbox->text = g_strdup(""); + textbox->width = w; + priv->scroll_allowed = allow_scroll; + priv->scroll_enabled = TRUE; + priv->skin_index = si; + priv->nominal_y = y; + priv->nominal_height = textbox->height; + priv->scroll_timeout = 0; + priv->scroll_dummy = 0; + + priv->fixed = fixed; + priv->double_size = FALSE; + + gtk_fixed_put(GTK_FIXED(priv->fixed), GTK_WIDGET(textbox), textbox->x, textbox->y); + + return GTK_WIDGET(textbox); +} + +static void ui_skinned_textbox_destroy(GtkObject *object) { + UiSkinnedTextbox *textbox; + + g_return_if_fail (object != NULL); + g_return_if_fail (UI_SKINNED_IS_TEXTBOX (object)); + + textbox = UI_SKINNED_TEXTBOX (object); + + if (GTK_OBJECT_CLASS (parent_class)->destroy) + (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); +} + +static void ui_skinned_textbox_realize(GtkWidget *widget) { + UiSkinnedTextbox *textbox; + GdkWindowAttr attributes; + gint attributes_mask; + + g_return_if_fail (widget != NULL); + g_return_if_fail (UI_SKINNED_IS_TEXTBOX(widget)); + + GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED); + textbox = UI_SKINNED_TEXTBOX(widget); + + attributes.x = widget->allocation.x; + attributes.y = widget->allocation.y; + attributes.width = widget->allocation.width; + attributes.height = widget->allocation.height; + attributes.wclass = GDK_INPUT_OUTPUT; + attributes.window_type = GDK_WINDOW_CHILD; + attributes.event_mask = gtk_widget_get_events(widget); + attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | + GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | + GDK_POINTER_MOTION_HINT_MASK; + attributes.visual = gtk_widget_get_visual(widget); + attributes.colormap = gtk_widget_get_colormap(widget); + + attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; + widget->window = gdk_window_new(widget->parent->window, &attributes, attributes_mask); + + widget->style = gtk_style_attach(widget->style, widget->window); + + gdk_window_set_user_data(widget->window, widget); +} + +static void ui_skinned_textbox_size_request(GtkWidget *widget, GtkRequisition *requisition) { + UiSkinnedTextbox *textbox = UI_SKINNED_TEXTBOX(widget); + UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE(textbox); + + requisition->width = textbox->width*(1+priv->double_size); + requisition->height = textbox->height*(1+priv->double_size); +} + +static void ui_skinned_textbox_size_allocate(GtkWidget *widget, GtkAllocation *allocation) { + g_mutex_lock(mutex); + UiSkinnedTextbox *textbox = UI_SKINNED_TEXTBOX (widget); + UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE(textbox); + + widget->allocation = *allocation; + widget->allocation.x *= (1+priv->double_size); + widget->allocation.y *= (1+priv->double_size); + if (GTK_WIDGET_REALIZED (widget)) + gdk_window_move_resize(widget->window, widget->allocation.x, widget->allocation.y, allocation->width, allocation->height); + + textbox->x = widget->allocation.x/(priv->double_size ? 2 : 1); + textbox->y = widget->allocation.y/(priv->double_size ? 2 : 1); + priv->move_x = 0; + priv->move_y = 0; + + if (textbox->width != widget->allocation.width/(priv->double_size ? 2 : 1)) { + textbox->width = widget->allocation.width/(priv->double_size ? 2 : 1); + priv->resize_width = 0; + priv->resize_height = 0; + if (priv->pixmap_text) g_free(priv->pixmap_text); + priv->pixmap_text = NULL; + priv->offset = 0; + gtk_widget_queue_draw(GTK_WIDGET(textbox)); + } + g_mutex_unlock(mutex); +} + +static gboolean ui_skinned_textbox_expose(GtkWidget *widget, GdkEventExpose *event) { + g_return_val_if_fail (widget != NULL, FALSE); + g_return_val_if_fail (UI_SKINNED_IS_TEXTBOX (widget), FALSE); + g_return_val_if_fail (event != NULL, FALSE); + + UiSkinnedTextbox *textbox = UI_SKINNED_TEXTBOX (widget); + UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE(textbox); + + GdkPixmap *obj = NULL; + GdkGC *gc; + gint cw; + + if (textbox->text && (!priv->pixmap_text || strcmp(textbox->text, priv->pixmap_text))) + textbox_generate_pixmap(textbox); + + if (priv->pixmap) { + if (skin_get_id() != priv->skin_id) { + priv->skin_id = skin_get_id(); + textbox_generate_pixmap(textbox); + } + obj = gdk_pixmap_new(NULL, textbox->width, textbox->height, gdk_rgb_get_visual()->depth); + gc = gdk_gc_new(obj); + + if (cfg.twoway_scroll) { // twoway scroll + cw = priv->pixmap_width - priv->offset; + if (cw > textbox->width) + cw = textbox->width; + gdk_draw_drawable(obj, gc, priv->pixmap, priv->offset, 0, 0, 0, cw, textbox->height); + if (cw < textbox->width) + gdk_draw_drawable(obj, gc, priv->pixmap, 0, 0, + textbox->x + cw, textbox->y, + textbox->width - cw, textbox->height); + } else { // oneway scroll + int cw1, cw2; + + if (priv->offset >= priv->pixmap_width) + priv->offset = 0; + + if (priv->pixmap_width - priv->offset > textbox->width) { // case1 + cw1 = textbox->width; + gdk_draw_drawable(obj, gc, priv->pixmap, priv->offset, 0, + 0, 0, cw1, textbox->height); + } else { // case 2 + cw1 = priv->pixmap_width - priv->offset; + gdk_draw_drawable(obj, gc, priv->pixmap, priv->offset, 0, + 0, 0, cw1, textbox->height); + cw2 = textbox->width - cw1; + gdk_draw_drawable(obj, gc, priv->pixmap, 0, 0, cw1, 0, cw2, textbox->height); + } + + } + + GdkPixmap *image; + image = gdk_pixmap_new(NULL, textbox->width*(1+priv->double_size), + textbox->height*(1+priv->double_size), + gdk_rgb_get_visual()->depth); + + if (priv->double_size) { + GdkImage *img, *img2x; + img = gdk_drawable_get_image(obj, 0, 0, textbox->width, textbox->height); + img2x = create_dblsize_image(img); + gdk_draw_image (image, gc, img2x, 0, 0, 0, 0, textbox->width*2, textbox->height*2); + g_object_unref(img2x); + g_object_unref(img); + } else + gdk_draw_drawable (image, gc, obj, 0, 0, 0, 0, textbox->width, textbox->height); + + + g_object_unref(obj); + + gdk_draw_drawable (widget->window, gc, image, 0, 0, 0, 0, + textbox->width*(1+priv->double_size), textbox->height*(1+priv->double_size)); + g_object_unref(gc); + g_object_unref(image); + } + + return FALSE; +} + +static gboolean ui_skinned_textbox_button_press(GtkWidget *widget, GdkEventButton *event) { + g_return_val_if_fail (widget != NULL, FALSE); + g_return_val_if_fail (UI_SKINNED_IS_TEXTBOX (widget), FALSE); + g_return_val_if_fail (event != NULL, FALSE); + + UiSkinnedTextbox *textbox = UI_SKINNED_TEXTBOX (widget); + UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE(textbox); + + if (event->type == GDK_BUTTON_PRESS) { + textbox = UI_SKINNED_TEXTBOX(widget); + if (event->button == 1) { + if (priv->scroll_allowed) { + if ((priv->pixmap_width > textbox->width) && priv->is_scrollable) { + priv->is_dragging = TRUE; + priv->drag_off = priv->offset; + priv->drag_x = event->x; + } + } else + g_signal_emit(widget, textbox_signals[CLICKED], 0); + + } else + priv->is_dragging = FALSE; + } else if (event->type == GDK_2BUTTON_PRESS) { + if (event->button == 1) { + g_signal_emit(widget, textbox_signals[DOUBLE_CLICKED], 0); + } + } + + return TRUE; +} + +static gboolean ui_skinned_textbox_button_release(GtkWidget *widget, GdkEventButton *event) { + UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE(widget); + + if (event->button == 1) { + priv->is_dragging = FALSE; + } else if (event->button == 3) { + g_signal_emit(widget, textbox_signals[RIGHT_CLICKED], 0); + } + + return TRUE; +} + +static gboolean ui_skinned_textbox_motion_notify(GtkWidget *widget, GdkEventMotion *event) { + g_return_val_if_fail (widget != NULL, FALSE); + g_return_val_if_fail (UI_SKINNED_IS_TEXTBOX (widget), FALSE); + g_return_val_if_fail (event != NULL, FALSE); + UiSkinnedTextbox *textbox = UI_SKINNED_TEXTBOX(widget); + UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE(widget); + + if (priv->is_dragging) { + if (priv->scroll_allowed && + priv->pixmap_width > textbox->width) { + priv->offset = priv->drag_off - (event->x - priv->drag_x); + + while (priv->offset < 0) + priv->offset = 0; + + while (priv->offset > (priv->pixmap_width - textbox->width)) + priv->offset = (priv->pixmap_width - textbox->width); + + gtk_widget_queue_draw(widget); + } + } + + return TRUE; +} + +static void ui_skinned_textbox_toggle_doublesize(UiSkinnedTextbox *textbox) { + GtkWidget *widget = GTK_WIDGET (textbox); + UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE(textbox); + + priv->double_size = !priv->double_size; + + gtk_widget_set_size_request(widget, textbox->width*(1+priv->double_size), textbox->height*(1+priv->double_size)); + + gtk_widget_queue_draw(GTK_WIDGET(textbox)); +} + +static void ui_skinned_textbox_redraw(UiSkinnedTextbox *textbox) { + g_mutex_lock(mutex); + UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE(textbox); + + if (priv->resize_width || priv->resize_height) + gtk_widget_set_size_request(GTK_WIDGET(textbox), + (textbox->width+priv->resize_width)*(1+priv->double_size), + (textbox->height+priv->resize_height)*(1+priv->double_size)); + if (priv->move_x || priv->move_y) + gtk_fixed_move(GTK_FIXED(priv->fixed), GTK_WIDGET(textbox), textbox->x+priv->move_x, textbox->y+priv->move_y); + + gtk_widget_queue_draw(GTK_WIDGET(textbox)); + g_mutex_unlock(mutex); +} + +static gboolean ui_skinned_textbox_should_scroll(UiSkinnedTextbox *textbox) { + UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE(textbox); + + if (!priv->scroll_allowed) + return FALSE; + + if (priv->font) { + gint width; + text_get_extents(priv->fontname, textbox->text, &width, NULL, NULL, NULL); + + if (width <= textbox->width) + return FALSE; + else + return TRUE; + } + + if (g_utf8_strlen(textbox->text, -1) * bmp_active_skin->properties.textbox_bitmap_font_width > textbox->width) + return TRUE; + + return FALSE; +} + +void ui_skinned_textbox_set_xfont(GtkWidget *widget, gboolean use_xfont, const gchar * fontname) { + UiSkinnedTextbox *textbox = UI_SKINNED_TEXTBOX (widget); + UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE(textbox); + + gint ascent, descent; + + g_return_if_fail(textbox != NULL); + + if (priv->font) { + pango_font_description_free(priv->font); + priv->font = NULL; + } + + textbox->y = priv->nominal_y; + textbox->height = priv->nominal_height; + + /* Make sure the pixmap is regenerated */ + if (priv->pixmap_text) { + g_free(priv->pixmap_text); + priv->pixmap_text = NULL; + } + + if (!use_xfont || strlen(fontname) == 0) + return; + + priv->font = pango_font_description_from_string(fontname); + priv->fontname = g_strdup(fontname); + + text_get_extents(fontname, + "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz ", + NULL, NULL, &ascent, &descent); + priv->font_ascent = ascent; + priv->font_descent = descent; + + + if (priv->font == NULL) + return; + + textbox->height = priv->font_ascent; + if (textbox->height > priv->nominal_height) + textbox->y -= (textbox->height - priv->nominal_height) / 2; + else + textbox->height = priv->nominal_height; +} + +void ui_skinned_textbox_set_text(GtkWidget *widget, const gchar *text) { + g_return_if_fail(text != NULL); + UiSkinnedTextbox *textbox = UI_SKINNED_TEXTBOX (widget); + UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE(textbox); + + if (!strcmp(textbox->text, text)) + return; + if (textbox->text) + g_free(textbox->text); + + textbox->text = str_to_utf8(text); + priv->scroll_back = FALSE; + gtk_widget_queue_draw(GTK_WIDGET(textbox)); +} + +static void textbox_generate_xfont_pixmap(UiSkinnedTextbox *textbox, const gchar *pixmaptext) { + gint length, i; + GdkGC *gc, *maskgc; + GdkColor *c, pattern; + GdkBitmap *mask; + PangoLayout *layout; + gint width; + + g_return_if_fail(textbox != NULL); + g_return_if_fail(pixmaptext != NULL); + + UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE(textbox); + + length = g_utf8_strlen(pixmaptext, -1); + + text_get_extents(priv->fontname, pixmaptext, &width, NULL, NULL, NULL); + + priv->pixmap_width = MAX(width, textbox->width); + priv->pixmap = gdk_pixmap_new(mainwin->window, priv->pixmap_width, + textbox->height, + gdk_rgb_get_visual()->depth); + gc = gdk_gc_new(priv->pixmap); + c = skin_get_color(bmp_active_skin, SKIN_TEXTBG); + for (i = 0; i < textbox->height; i++) { + gdk_gc_set_foreground(gc, &c[6 * i / textbox->height]); + gdk_draw_line(priv->pixmap, gc, 0, i, priv->pixmap_width, i); + } + + mask = gdk_pixmap_new(mainwin->window, priv->pixmap_width, textbox->height, 1); + maskgc = gdk_gc_new(mask); + pattern.pixel = 0; + gdk_gc_set_foreground(maskgc, &pattern); + + gdk_draw_rectangle(mask, maskgc, TRUE, 0, 0, priv->pixmap_width, textbox->height); + pattern.pixel = 1; + gdk_gc_set_foreground(maskgc, &pattern); + + gdk_gc_set_foreground(gc, skin_get_color(bmp_active_skin, SKIN_TEXTFG)); + + layout = gtk_widget_create_pango_layout(mainwin, pixmaptext); + pango_layout_set_font_description(layout, priv->font); + + gdk_draw_layout(priv->pixmap, gc, 0, (priv->font_descent / 2), layout); + g_object_unref(layout); + + g_object_unref(maskgc); + + gdk_gc_set_clip_mask(gc, mask); + c = skin_get_color(bmp_active_skin, SKIN_TEXTFG); + for (i = 0; i < textbox->height; i++) { + gdk_gc_set_foreground(gc, &c[6 * i / textbox->height]); + gdk_draw_line(priv->pixmap, gc, 0, i, priv->pixmap_width, i); + } + g_object_unref(mask); + g_object_unref(gc); +} + +static gboolean textbox_scroll(gpointer data) { + UiSkinnedTextbox *textbox = UI_SKINNED_TEXTBOX(data); + UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE(textbox); + + if (!priv->is_dragging) { + if (priv->scroll_dummy < TEXTBOX_SCROLL_WAIT) + priv->scroll_dummy++; + else { + if(cfg.twoway_scroll) { + if (priv->scroll_back) + priv->offset -= 1; + else + priv->offset += 1; + + if (priv->offset >= (priv->pixmap_width - textbox->width)) { + priv->scroll_back = TRUE; + priv->scroll_dummy = 0; + } + if (priv->offset <= 0) { + priv->scroll_back = FALSE; + priv->scroll_dummy = 0; + } + } + else { // oneway scroll + priv->scroll_back = FALSE; + priv->offset += 1; + } + gtk_widget_queue_draw(GTK_WIDGET(textbox)); + } + } + return TRUE; +} + +static void textbox_generate_pixmap(UiSkinnedTextbox *textbox) { + gint length, i, x, y, wl; + gchar *pixmaptext; + gchar *tmp, *stxt; + GdkGC *gc; + + g_return_if_fail(textbox != NULL); + UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE(textbox); + + if (priv->pixmap) { + g_object_unref(priv->pixmap); + priv->pixmap = NULL; + } + + /* + * Don't reset the offset if only text after the last '(' has + * changed. This is a hack to avoid visual noice on vbr files + * where we guess the length. + */ + if (!(priv->pixmap_text && strrchr(textbox->text, '(') && + !strncmp(priv->pixmap_text, textbox->text, + strrchr(textbox->text, '(') - textbox->text))) + priv->offset = 0; + + g_free(priv->pixmap_text); + priv->pixmap_text = g_strdup(textbox->text); + + /* + * wl is the number of (partial) letters visible. Only makes + * sense when using skinned font. + */ + wl = textbox->width / 5; + if (wl * 5 != textbox->width) + wl++; + + length = g_utf8_strlen(textbox->text, -1); + + priv->is_scrollable = FALSE; + + priv->is_scrollable = ui_skinned_textbox_should_scroll(textbox); + + if (priv->is_scrollable) { + if(!cfg.twoway_scroll) { + pixmaptext = g_strdup_printf("%s *** ", priv->pixmap_text); + length += 5; + } else + pixmaptext = g_strdup(priv->pixmap_text); + } else + if (!priv->font && length <= wl) { + gint pad = wl - length; + gchar *padchars = g_strnfill(pad, ' '); + + pixmaptext = g_strconcat(priv->pixmap_text, padchars, NULL); + g_free(padchars); + length += pad; + } else + pixmaptext = g_strdup(priv->pixmap_text); + + if (priv->is_scrollable) { + if (priv->scroll_enabled && !priv->scroll_timeout) { + gint tag; + tag = TEXTBOX_SCROLL_SMOOTH_TIMEOUT; + priv->scroll_timeout = g_timeout_add(tag, textbox_scroll, textbox); + } + } else { + if (priv->scroll_timeout) { + g_source_remove(priv->scroll_timeout); + priv->scroll_timeout = 0; + } + priv->offset = 0; + } + + if (priv->font) { + textbox_generate_xfont_pixmap(textbox, pixmaptext); + g_free(pixmaptext); + return; + } + + priv->pixmap_width = length * bmp_active_skin->properties.textbox_bitmap_font_width; + priv->pixmap = gdk_pixmap_new(NULL, + priv->pixmap_width, bmp_active_skin->properties.textbox_bitmap_font_height, + gdk_rgb_get_visual()->depth); + gc = gdk_gc_new(priv->pixmap); + + for (tmp = stxt = g_utf8_strup(pixmaptext, -1), i = 0; + tmp != NULL && i < length; i++, tmp = g_utf8_next_char(tmp)) { + gchar c = *tmp; + x = y = -1; + if (c >= 'A' && c <= 'Z') { + x = bmp_active_skin->properties.textbox_bitmap_font_width * (c - 'A'); + y = 0; + } + else if (c >= '0' && c <= '9') { + x = bmp_active_skin->properties.textbox_bitmap_font_width * (c - '0'); + y = bmp_active_skin->properties.textbox_bitmap_font_height; + } + else + textbox_handle_special_char(tmp, &x, &y); + + skin_draw_pixmap(bmp_active_skin, + priv->pixmap, gc, priv->skin_index, + x, y, i * bmp_active_skin->properties.textbox_bitmap_font_width, 0, + bmp_active_skin->properties.textbox_bitmap_font_width, + bmp_active_skin->properties.textbox_bitmap_font_height); + } + g_free(stxt); + g_free(pixmaptext); + g_object_unref(gc); +} + +void ui_skinned_textbox_set_scroll(GtkWidget *widget, gboolean scroll) { + g_return_if_fail(widget != NULL); + UiSkinnedTextbox *textbox = UI_SKINNED_TEXTBOX(widget); + UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE(textbox); + + priv->scroll_enabled = scroll; + if (priv->scroll_enabled && priv->is_scrollable && priv->scroll_allowed) { + gint tag; + tag = TEXTBOX_SCROLL_SMOOTH_TIMEOUT; + if (priv->scroll_timeout) { + g_source_remove(priv->scroll_timeout); + priv->scroll_timeout = 0; + } + priv->scroll_timeout = g_timeout_add(tag, textbox_scroll, textbox); + + } else { + + if (priv->scroll_timeout) { + g_source_remove(priv->scroll_timeout); + priv->scroll_timeout = 0; + } + + priv->offset = 0; + gtk_widget_queue_draw(GTK_WIDGET(textbox)); + } +} + +static void textbox_handle_special_char(gchar *c, gint * x, gint * y) { + gint tx, ty; + + switch (*c) { + case '"': + tx = 26; + ty = 0; + break; + case '\r': + tx = 10; + ty = 1; + break; + case ':': + case ';': + tx = 12; + ty = 1; + break; + case '(': + tx = 13; + ty = 1; + break; + case ')': + tx = 14; + ty = 1; + break; + case '-': + tx = 15; + ty = 1; + break; + case '`': + case '\'': + tx = 16; + ty = 1; + break; + case '!': + tx = 17; + ty = 1; + break; + case '_': + tx = 18; + ty = 1; + break; + case '+': + tx = 19; + ty = 1; + break; + case '\\': + tx = 20; + ty = 1; + break; + case '/': + tx = 21; + ty = 1; + break; + case '[': + tx = 22; + ty = 1; + break; + case ']': + tx = 23; + ty = 1; + break; + case '^': + tx = 24; + ty = 1; + break; + case '&': + tx = 25; + ty = 1; + break; + case '%': + tx = 26; + ty = 1; + break; + case '.': + case ',': + tx = 27; + ty = 1; + break; + case '=': + tx = 28; + ty = 1; + break; + case '$': + tx = 29; + ty = 1; + break; + case '#': + tx = 30; + ty = 1; + break; + case '?': + tx = 3; + ty = 2; + break; + case '*': + tx = 4; + ty = 2; + break; + default: + tx = 29; + ty = 0; + break; + } + + const gchar *change[] = {"Ą", "A", "Ę", "E", "Ć", "C", "Ł", "L", "Ó", "O", "Ś", "S", "Ż", "Z", "Ź", "Z", + "Ü", "U", NULL}; + int i; + for (i = 0; change[i]; i+=2) { + if (!strncmp(c, change[i], strlen(change[i]))) { + tx = (*change[i+1] - 'A'); + break; + } + } + + /* those are commonly included into skins */ + if (!strncmp(c, "Å", strlen("Å"))) { + tx = 0; + ty = 2; + } else if (!strncmp(c, "Ö", strlen("Ö"))) { + tx = 1; + ty = 2; + } else if (!strncmp(c, "Ä", strlen("Ä"))) { + tx = 2; + ty = 2; + } + + *x = tx * bmp_active_skin->properties.textbox_bitmap_font_width; + *y = ty * bmp_active_skin->properties.textbox_bitmap_font_height; +} + +void ui_skinned_textbox_move_relative(GtkWidget *widget, gint x, gint y) { + g_mutex_lock(mutex); + UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE(widget); + priv->move_x += x; + priv->move_y += y; + g_mutex_unlock(mutex); +} + +void ui_skinned_textbox_resize_relative(GtkWidget *widget, gint w, gint h) { + g_mutex_lock(mutex); + UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE(widget); + priv->resize_width += w; + priv->resize_height += h; + g_mutex_unlock(mutex); +}
--- a/src/audacious/playback.c Tue Jul 17 18:28:54 2007 +0900 +++ b/src/audacious/playback.c Tue Jul 17 18:33:49 2007 +0900 @@ -48,6 +48,7 @@ #include "ui_main.h" #include "ui_playlist.h" #include "ui_skinselector.h" +#include "ui_skinned_playstatus.h" #include "util.h" #include "visualization.h" @@ -85,7 +86,7 @@ playback_stop(); ui_vis_clear_data(mainwin_vis); - svis_clear_data(mainwin_svis); + ui_svis_clear_data(mainwin_svis); mainwin_disable_seekbar(); entry = playlist_get_entry_to_play(playlist); @@ -149,9 +150,9 @@ g_return_if_fail(mainwin_playstatus != NULL); if (ip_data.paused) - playstatus_set_status(mainwin_playstatus, STATUS_PAUSE); + ui_skinned_playstatus_set_status(mainwin_playstatus, STATUS_PAUSE); else - playstatus_set_status(mainwin_playstatus, STATUS_PLAY); + ui_skinned_playstatus_set_status(mainwin_playstatus, STATUS_PLAY); } void @@ -192,7 +193,7 @@ vis_playback_stop(); g_return_if_fail(mainwin_playstatus != NULL); - playstatus_set_status_buffering(mainwin_playstatus, FALSE); + ui_skinned_playstatus_set_buffering(mainwin_playstatus, FALSE); } static void
--- a/src/audacious/playlist.c Tue Jul 17 18:28:54 2007 +0900 +++ b/src/audacious/playlist.c Tue Jul 17 18:33:49 2007 +0900 @@ -352,6 +352,7 @@ return playlist->title; } +/* filename is real filename here. --yaz */ gboolean playlist_set_current_name(Playlist *playlist, const gchar * filename) { @@ -823,6 +824,9 @@ struct stat statbuf; DeviceInode *devino; + if (!path) + return NULL; + if (!vfs_file_test(path, G_FILE_TEST_IS_DIR)) return NULL; @@ -848,6 +852,7 @@ return list; } + /* g_dir_open does not handle URI, so path should come here not-urified. --giacomo */ if (!(dir = g_dir_open(path, 0, NULL))) return NULL; @@ -863,7 +868,9 @@ if (vfs_file_test(filename, G_FILE_TEST_IS_DIR)) { GList *sub; - sub = playlist_dir_find_files(filename, background, htab); + gchar *dirfilename = g_filename_from_uri(filename, NULL, NULL); + sub = playlist_dir_find_files(dirfilename, background, htab); + g_free(dirfilename); g_free(filename); list = g_list_concat(list, sub); } @@ -1595,8 +1602,8 @@ filename = g_strchug(g_strdup(filename_p)); if(cfg.convert_slash) - while ((tmp = strchr(filename, '\\')) != NULL) - *tmp = '/'; + while ((tmp = strchr(filename, '\\')) != NULL) + *tmp = '/'; if (filename[0] != '/' && !strstr(filename, "://")) { path = g_strdup(playlist_name); @@ -1657,8 +1664,9 @@ filename = g_strchug(g_strdup(filename_p)); - while ((tmp = strchr(filename, '\\')) != NULL) - *tmp = '/'; + if(cfg.convert_slash) + while ((tmp = strchr(filename, '\\')) != NULL) + *tmp = '/'; if (filename[0] != '/' && !strstr(filename, "://")) { path = g_strdup(playlist_name); @@ -1811,7 +1819,10 @@ PLAYLIST_UNLOCK(playlist->mutex); if (!title) { - title = g_path_get_basename(entry->filename); + gchar *realfn = NULL; + realfn = g_filename_from_uri(entry->filename, NULL, NULL); + title = g_path_get_basename(realfn ? realfn : entry->filename); + g_free(realfn); realfn = NULL; return str_replace(title, filename_to_utf8(title)); } @@ -2063,8 +2074,12 @@ { struct stat buf; gint rv; - - rv = stat(filename, &buf); + gchar *realfn = NULL; + + /* stat() does not accept file:// --yaz */ + realfn = g_filename_from_uri(filename, NULL, NULL); + rv = stat(realfn ? realfn : filename, &buf); + g_free(realfn); realfn = NULL; if (rv == 0) { return buf.st_mtime;
--- a/src/audacious/plugin.h Tue Jul 17 18:28:54 2007 +0900 +++ b/src/audacious/plugin.h Tue Jul 17 18:33:49 2007 +0900 @@ -110,7 +110,7 @@ static PluginHeader _pluginInfo = { PLUGIN_MAGIC, __AUDACIOUS_PLUGIN_API__, \ (gchar *)#name, init, fini, NULL, ip_list, op_list, ep_list, gp_list, \ vp_list }; \ - PluginHeader *get_plugin_info(void) { \ + G_MODULE_EXPORT PluginHeader *get_plugin_info(void) { \ return &_pluginInfo; \ } \ G_END_DECLS
--- a/src/audacious/ui_credits.c Tue Jul 17 18:28:54 2007 +0900 +++ b/src/audacious/ui_credits.c Tue Jul 17 18:33:49 2007 +0900 @@ -326,7 +326,7 @@ { static GtkWidget *about_window = NULL; - GdkPixmap *beep_logo_pmap = NULL, *beep_logo_mask = NULL; + GdkPixbuf *logo_pixbuf; GtkWidget *about_vbox; GtkWidget *about_credits_logo_box, *about_credits_logo_frame; GtkWidget *about_credits_logo; @@ -357,10 +357,7 @@ about_vbox = gtk_vbox_new(FALSE, 5); gtk_container_add(GTK_CONTAINER(about_window), about_vbox); - if (!beep_logo_pmap) - beep_logo_pmap = - gdk_pixmap_create_from_xpm_d(about_window->window, - &beep_logo_mask, NULL, audacious_logo_xpm); + logo_pixbuf = gdk_pixbuf_new_from_xpm_data(audacious_logo_xpm); about_credits_logo_box = gtk_hbox_new(TRUE, 0); gtk_box_pack_start(GTK_BOX(about_vbox), about_credits_logo_box, @@ -372,9 +369,10 @@ gtk_box_pack_start(GTK_BOX(about_credits_logo_box), about_credits_logo_frame, FALSE, FALSE, 0); - about_credits_logo = gtk_pixmap_new(beep_logo_pmap, beep_logo_mask); + about_credits_logo = gtk_image_new_from_pixbuf(logo_pixbuf); gtk_container_add(GTK_CONTAINER(about_credits_logo_frame), about_credits_logo); + g_object_unref(logo_pixbuf); label = gtk_label_new(NULL); text = g_strdup_printf(_(bmp_brief), VERSION);
--- a/src/audacious/ui_equalizer.c Tue Jul 17 18:28:54 2007 +0900 +++ b/src/audacious/ui_equalizer.c Tue Jul 17 18:33:49 2007 +0900 @@ -54,6 +54,7 @@ #include "ui_skinned_window.h" #include "ui_skinned_button.h" +#include "ui_skinned_horizontal_slider.h" enum PresetViewCols { PRESET_VIEW_COL_NAME, @@ -88,7 +89,7 @@ static GtkWidget *equalizerwin_close, *equalizerwin_presets, *equalizerwin_shade; static EqGraph *equalizerwin_graph; static EqSlider *equalizerwin_preamp, *equalizerwin_bands[10]; -static HSlider *equalizerwin_volume, *equalizerwin_balance; +static GtkWidget *equalizerwin_volume, *equalizerwin_balance; static GList *equalizer_presets = NULL, *equalizer_auto_presets = NULL; @@ -171,8 +172,8 @@ ui_skinned_button_set_skin_index1(equalizerwin_shade, SKIN_EQ_EX); ui_skinned_set_push_button_data(equalizerwin_close, 11, 38, 11, 47); ui_skinned_button_set_skin_index(equalizerwin_close, SKIN_EQ_EX); - widget_show(WIDGET(equalizerwin_volume)); - widget_show(WIDGET(equalizerwin_balance)); + gtk_widget_show(equalizerwin_volume); + gtk_widget_show(equalizerwin_balance); } else { dock_shade(dock_window_list, GTK_WINDOW(equalizerwin), @@ -181,8 +182,8 @@ ui_skinned_button_set_skin_index1(equalizerwin_shade, SKIN_EQMAIN); ui_skinned_set_push_button_data(equalizerwin_close, 0, 116, 0, 125); ui_skinned_button_set_skin_index(equalizerwin_close, SKIN_EQMAIN); - widget_hide(WIDGET(equalizerwin_volume)); - widget_hide(WIDGET(equalizerwin_balance)); + gtk_widget_hide(equalizerwin_volume); + gtk_widget_hide(equalizerwin_balance); } draw_equalizer_window(TRUE); @@ -306,12 +307,10 @@ if (force || redraw) { if (cfg.doublesize && cfg.eq_doublesize_linked) { if (force) { - img = gdk_drawable_get_image(equalizerwin_bg, 0, 0, 275, 116); - img2x = create_dblsize_image(img); - gdk_draw_image(equalizerwin_bg_x2, SKINNED_WINDOW(equalizerwin)->gc, - img2x, 0, 0, 0, 0, 550, 232); - g_object_unref(img2x); - g_object_unref(img); + GdkPixmap *img2; + img2 = create_dblsize_pixmap(equalizerwin_bg); + gdk_draw_drawable(equalizerwin_bg_x2, SKINNED_WINDOW(equalizerwin)->gc, img2, 0, 0, 0, 0, 550, 232); + g_object_unref(img2); } else { for (wl = equalizerwin_wlist; wl; wl = g_list_next(wl)) { @@ -572,21 +571,22 @@ equalizerwin_volume_frame_cb(gint pos) { if (equalizerwin_volume) { + gint x; if (pos < 32) - equalizerwin_volume->hs_knob_nx = - equalizerwin_volume->hs_knob_px = 1; + x = 1; else if (pos < 63) - equalizerwin_volume->hs_knob_nx = - equalizerwin_volume->hs_knob_px = 4; + x = 4; else - equalizerwin_volume->hs_knob_nx = - equalizerwin_volume->hs_knob_px = 7; + x = 7; + + UI_SKINNED_HORIZONTAL_SLIDER(equalizerwin_volume)->knob_nx = x; + UI_SKINNED_HORIZONTAL_SLIDER(equalizerwin_volume)->knob_px = x; } return 1; } static void -equalizerwin_volume_motion_cb(gint pos) +equalizerwin_volume_motion_cb(GtkWidget *widget, gint pos) { gint v = (gint) rint(pos * 100 / 94.0); mainwin_adjust_volume_motion(v); @@ -594,7 +594,7 @@ } static void -equalizerwin_volume_release_cb(gint pos) +equalizerwin_volume_release_cb(GtkWidget *widget, gint pos) { mainwin_adjust_volume_release(); } @@ -603,22 +603,23 @@ equalizerwin_balance_frame_cb(gint pos) { if (equalizerwin_balance) { + gint x; if (pos < 13) - equalizerwin_balance->hs_knob_nx = - equalizerwin_balance->hs_knob_px = 11; + x = 11; else if (pos < 26) - equalizerwin_balance->hs_knob_nx = - equalizerwin_balance->hs_knob_px = 14; + x = 14; else - equalizerwin_balance->hs_knob_nx = - equalizerwin_balance->hs_knob_px = 17; + x = 17; + + UI_SKINNED_HORIZONTAL_SLIDER(equalizerwin_balance)->knob_nx = x; + UI_SKINNED_HORIZONTAL_SLIDER(equalizerwin_balance)->knob_px = x; } return 1; } static void -equalizerwin_balance_motion_cb(gint pos) +equalizerwin_balance_motion_cb(GtkWidget *widget, gint pos) { gint b; pos = MIN(pos, 38); /* The skin uses a even number of pixels @@ -629,7 +630,7 @@ } static void -equalizerwin_balance_release_cb(gint pos) +equalizerwin_balance_release_cb(GtkWidget *widget, gint pos) { mainwin_adjust_balance_release(); } @@ -637,14 +638,14 @@ void equalizerwin_set_balance_slider(gint percent) { - hslider_set_position(equalizerwin_balance, + ui_skinned_horizontal_slider_set_position(equalizerwin_balance, (gint) rint((percent * 19 / 100.0) + 19)); } void equalizerwin_set_volume_slider(gint percent) { - hslider_set_position(equalizerwin_volume, + ui_skinned_horizontal_slider_set_position(equalizerwin_volume, (gint) rint(percent * 94 / 100.0)); } @@ -704,33 +705,19 @@ } equalizerwin_volume = - create_hslider(&equalizerwin_wlist, equalizerwin_bg, - SKINNED_WINDOW(equalizerwin)->gc, 61, 4, 97, 8, 1, 30, 1, 30, 3, 7, - 4, 61, 0, 94, equalizerwin_volume_frame_cb, - equalizerwin_volume_motion_cb, - equalizerwin_volume_release_cb, SKIN_EQ_EX); - ui_skinned_window_widgetlist_associate(equalizerwin, - WIDGET(equalizerwin_volume)); + ui_skinned_horizontal_slider_new(SKINNED_WINDOW(equalizerwin)->fixed, + 61, 4, 97, 8, 1, 30, 1, 30, 3, 7, 4, 61, 0, 94, + equalizerwin_volume_frame_cb, SKIN_EQ_EX); + g_signal_connect(equalizerwin_volume, "motion", G_CALLBACK(equalizerwin_volume_motion_cb), NULL); + g_signal_connect(equalizerwin_volume, "release", G_CALLBACK(equalizerwin_volume_release_cb), NULL); + equalizerwin_balance = - create_hslider(&equalizerwin_wlist, equalizerwin_bg, - SKINNED_WINDOW(equalizerwin)->gc, 164, 4, 42, 8, 11, 30, 11, 30, 3, - 7, 4, 164, 0, 39, equalizerwin_balance_frame_cb, - equalizerwin_balance_motion_cb, - equalizerwin_balance_release_cb, SKIN_EQ_EX); - ui_skinned_window_widgetlist_associate(equalizerwin, - WIDGET(equalizerwin_balance)); - - if (!cfg.equalizer_shaded) { - widget_hide(WIDGET(equalizerwin_volume)); - widget_hide(WIDGET(equalizerwin_balance)); - } - else { - ui_skinned_set_push_button_data(equalizerwin_shade, -1, 3, -1, 47); - ui_skinned_button_set_skin_index1(equalizerwin_shade, SKIN_EQ_EX); - ui_skinned_set_push_button_data(equalizerwin_close, 11, 38, 11, 47); - ui_skinned_button_set_skin_index(equalizerwin_close, SKIN_EQ_EX); - } + ui_skinned_horizontal_slider_new(SKINNED_WINDOW(equalizerwin)->fixed, + 164, 4, 42, 8, 11, 30, 11, 30, 3, 7, 4, 164, 0, 39, + equalizerwin_balance_frame_cb, SKIN_EQ_EX); + g_signal_connect(equalizerwin_balance, "motion", G_CALLBACK(equalizerwin_balance_motion_cb), NULL); + g_signal_connect(equalizerwin_balance, "release", G_CALLBACK(equalizerwin_balance_release_cb), NULL); } @@ -743,7 +730,7 @@ width = 275; height = cfg.equalizer_shaded ? 14 : 116; - equalizerwin = ui_skinned_window_new(GTK_WINDOW_TOPLEVEL, "equalizer"); + equalizerwin = ui_skinned_window_new("equalizer"); gtk_window_set_title(GTK_WINDOW(equalizerwin), _("Audacious Equalizer")); gtk_window_set_role(GTK_WINDOW(equalizerwin), "equalizer"); gtk_window_set_resizable(GTK_WINDOW(equalizerwin), FALSE); @@ -837,9 +824,19 @@ draw_equalizer_window(TRUE); cfg.equalizer_visible = TRUE; UI_SKINNED_BUTTON(mainwin_eq)->inside = TRUE; - gtk_widget_queue_draw(mainwin_eq); + gtk_widget_show_all(equalizerwin); - gtk_widget_show_all(equalizerwin); + if (!cfg.equalizer_shaded) { + gtk_widget_hide(equalizerwin_volume); + gtk_widget_hide(equalizerwin_balance); + } + else { + ui_skinned_set_push_button_data(equalizerwin_shade, -1, 3, -1, 47); + ui_skinned_button_set_skin_index1(equalizerwin_shade, SKIN_EQ_EX); + ui_skinned_set_push_button_data(equalizerwin_close, 11, 38, 11, 47); + ui_skinned_button_set_skin_index(equalizerwin_close, SKIN_EQ_EX); + } + gtk_window_present(GTK_WINDOW(equalizerwin)); }
--- a/src/audacious/ui_jumptotrack.c Tue Jul 17 18:28:54 2007 +0900 +++ b/src/audacious/ui_jumptotrack.c Tue Jul 17 18:33:49 2007 +0900 @@ -450,8 +450,15 @@ if (entry->title) desc_buf = g_strdup(entry->title); - else if (strchr(entry->filename, '/')) - desc_buf = str_to_utf8(strrchr(entry->filename, '/') + 1); + else if (strchr(entry->filename, '/')) { + gchar *realfn = NULL; + realfn = g_filename_from_uri(entry->filename, NULL, NULL); + if(realfn) + desc_buf = str_to_utf8(strrchr(realfn, '/') + 1); + else + desc_buf = str_to_utf8(strrchr(entry->filename, '/') + 1); + g_free(realfn); realfn = NULL; + } else desc_buf = str_to_utf8(entry->filename);
--- a/src/audacious/ui_main.c Tue Jul 17 18:28:54 2007 +0900 +++ b/src/audacious/ui_main.c Tue Jul 17 18:33:49 2007 +0900 @@ -85,6 +85,9 @@ #include "ui_skinned_textbox.h" #include "ui_skinned_number.h" #include "ui_skinned_horizontal_slider.h" +#include "ui_skinned_menurow.h" +#include "ui_skinned_playstatus.h" +#include "ui_skinned_monostereo.h" #include "ui_jumptotrack.h" static GTimeVal cb_time; /* click delay for tristate is defined by TRISTATE_THRESHOLD */ @@ -109,8 +112,6 @@ gint n_channels; }; -static GList *mainwin_wlist = NULL; - GtkWidget *mainwin = NULL; GtkWidget *err = NULL; /* an error dialog for miscellaneous error messages */ @@ -140,7 +141,7 @@ static GtkWidget *mainwin_rate_text, *mainwin_freq_text, *mainwin_othertext; -PlayStatus *mainwin_playstatus; +GtkWidget *mainwin_playstatus; GtkWidget *mainwin_minus_num, *mainwin_10min_num, *mainwin_min_num; GtkWidget *mainwin_10sec_num, *mainwin_sec_num; @@ -148,15 +149,15 @@ static gboolean setting_volume = FALSE; GtkWidget *mainwin_vis; -SVis *mainwin_svis; +GtkWidget *mainwin_svis; GtkWidget *mainwin_sposition = NULL; -static MenuRow *mainwin_menurow; -static HSlider *mainwin_volume, *mainwin_balance; +static GtkWidget *mainwin_menurow; +static GtkWidget *mainwin_volume, *mainwin_balance; GtkWidget *mainwin_position; -static MonoStereo *mainwin_monostereo; +static GtkWidget *mainwin_monostereo; static GtkWidget *mainwin_srew, *mainwin_splay, *mainwin_spause; static GtkWidget *mainwin_sstop, *mainwin_sfwd, *mainwin_seject, *mainwin_about; @@ -269,8 +270,12 @@ dock_shade(dock_window_list, GTK_WINDOW(mainwin), MAINWIN_SHADED_HEIGHT * (cfg.doublesize + 1)); - widget_show(WIDGET(mainwin_svis)); - ui_vis_clear_data(mainwin_vis); + gtk_widget_show(mainwin_svis); + ui_svis_clear_data(mainwin_svis); + if (cfg.vis_type != VIS_OFF) + ui_svis_set_visible(mainwin_svis, TRUE); + else + ui_svis_set_visible(mainwin_svis, FALSE); gtk_widget_show(mainwin_srew); gtk_widget_show(mainwin_splay); @@ -300,8 +305,14 @@ dock_shade(dock_window_list, GTK_WINDOW(mainwin), height * (cfg.doublesize + 1)); - widget_hide(WIDGET(mainwin_svis)); - svis_clear_data(mainwin_svis); + gtk_widget_hide(mainwin_svis); + ui_svis_clear_data(mainwin_svis); + + gtk_widget_show(mainwin_vis); + if (cfg.vis_type != VIS_OFF) + ui_vis_set_visible(mainwin_vis, TRUE); + else + ui_vis_set_visible(mainwin_vis, FALSE); gtk_widget_hide(mainwin_srew); gtk_widget_hide(mainwin_splay); @@ -395,16 +406,26 @@ cfg.vis_type = mode; if (mode == VIS_OFF) { - if (cfg.player_shaded && cfg.player_visible) - svis_clear(mainwin_svis); - else { + if (cfg.player_shaded) { + ui_svis_set_visible(mainwin_svis, FALSE); + ui_vis_set_visible(mainwin_vis, TRUE); + } else { + ui_svis_set_visible(mainwin_svis, TRUE); ui_vis_set_visible(mainwin_vis, FALSE); } } if (mode == VIS_ANALYZER || mode == VIS_SCOPE || mode == VIS_VOICEPRINT) { - ui_vis_clear_data(mainwin_vis); - ui_vis_set_visible(mainwin_vis, TRUE); - svis_clear_data(mainwin_svis); + if (cfg.player_shaded) { + ui_svis_clear_data(mainwin_svis); + ui_svis_set_visible(mainwin_svis, TRUE); + ui_vis_clear_data(mainwin_vis); + ui_vis_set_visible(mainwin_vis, FALSE); + } else { + ui_svis_clear_data(mainwin_svis); + ui_svis_set_visible(mainwin_svis, FALSE); + ui_vis_clear_data(mainwin_vis); + ui_vis_set_visible(mainwin_vis, TRUE); + } } } @@ -528,19 +549,12 @@ void draw_main_window(gboolean force) { - GdkImage *img, *img2x; - GList *wl; - Widget *w; - gboolean redraw; - if (!cfg.player_visible) return; if (force) mainwin_refresh_hints(); - widget_list_lock(mainwin_wlist); - if (force) { if (!cfg.player_shaded) skin_draw_pixmap(bmp_active_skin, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, @@ -550,70 +564,25 @@ (GTK_WINDOW(mainwin))); } - widget_list_draw(mainwin_wlist, &redraw, force); - - if (redraw || force) { - if (force) { - if (cfg.doublesize) { - img = gdk_drawable_get_image(mainwin_bg, 0, 0, bmp_active_skin->properties.mainwin_width, - cfg.player_shaded ? - MAINWIN_SHADED_HEIGHT : - bmp_active_skin->properties.mainwin_height); - img2x = create_dblsize_image(img); - gdk_draw_image(mainwin_bg_x2, SKINNED_WINDOW(mainwin)->gc, img2x, 0, 0, - 0, 0, bmp_active_skin->properties.mainwin_width * 2, - cfg.player_shaded ? MAINWIN_SHADED_HEIGHT * - 2 : bmp_active_skin->properties.mainwin_height * 2); - g_object_unref(img2x); - g_object_unref(img); - } - GList *iter; - for (iter = GTK_FIXED (SKINNED_WINDOW(mainwin)->fixed)->children; iter; iter = g_list_next (iter)) { - GtkFixedChild *child_data = (GtkFixedChild *) iter->data; - GtkWidget *child = child_data->widget; - gtk_widget_queue_draw(child); - } + if (force) { + if (cfg.doublesize) { + GdkPixmap *img2x = NULL; + img2x = create_dblsize_pixmap(mainwin_bg); + gdk_draw_drawable(mainwin_bg_x2, SKINNED_WINDOW(mainwin)->gc, img2x, 0, 0, + 0, 0, bmp_active_skin->properties.mainwin_width * 2, + cfg.player_shaded ? MAINWIN_SHADED_HEIGHT * + 2 : bmp_active_skin->properties.mainwin_height * 2); + g_object_unref(img2x); } - else { - for (wl = mainwin_wlist; wl; wl = g_list_next(wl)) { - w = WIDGET(wl->data); - - if (!w->redraw || !w->visible) - continue; - - if (w->x > bmp_active_skin->properties.mainwin_width || - w->y > bmp_active_skin->properties.mainwin_height) - continue; - - if (cfg.doublesize) { - gint width, height; - - width = w->x + w->width <= bmp_active_skin->properties.mainwin_width ? w->width : (w->width - ((w->x + w->width) - bmp_active_skin->properties.mainwin_width)); - height = w->y + w->height <= bmp_active_skin->properties.mainwin_width ? w->height : (w->height - ((w->y + w->height) - bmp_active_skin->properties.mainwin_height)); - - img = gdk_drawable_get_image(mainwin_bg, w->x, w->y, - width, height); - img2x = create_dblsize_image(img); - gdk_draw_image(mainwin_bg_x2, SKINNED_WINDOW(mainwin)->gc, - img2x, 0, 0, w->x << 1, w->y << 1, - width << 1, height << 1); - g_object_unref(img2x); - g_object_unref(img); - gdk_window_clear_area(mainwin->window, w->x << 1, - w->y << 1, width << 1, - height << 1); - } - else - gdk_window_clear_area(mainwin->window, w->x, w->y, - w->width, w->height); - w->redraw = FALSE; - } + GList *iter; + for (iter = GTK_FIXED (SKINNED_WINDOW(mainwin)->fixed)->children; iter; iter = g_list_next (iter)) { + GtkFixedChild *child_data = (GtkFixedChild *) iter->data; + GtkWidget *child = child_data->widget; + gtk_widget_queue_draw(child); } gdk_flush(); } - - widget_list_unlock(mainwin_wlist); } @@ -696,7 +665,7 @@ { gtk_widget_hide(mainwin_rate_text); gtk_widget_hide(mainwin_freq_text); - widget_hide(WIDGET(mainwin_monostereo)); + gtk_widget_hide(mainwin_monostereo); if (bmp_active_skin->properties.mainwin_othertext_visible) gtk_widget_show(mainwin_othertext); @@ -708,10 +677,15 @@ { gtk_widget_show(mainwin_rate_text); gtk_widget_show(mainwin_freq_text); - widget_show(WIDGET(mainwin_monostereo)); + gtk_widget_show(mainwin_monostereo); gtk_widget_hide(mainwin_othertext); } + if (bmp_active_skin->properties.mainwin_vis_visible) + gtk_widget_show(mainwin_vis); + else + gtk_widget_hide(mainwin_vis); + /* positioning and size attributes */ if (bmp_active_skin->properties.mainwin_vis_x && bmp_active_skin->properties.mainwin_vis_y) gtk_fixed_move(GTK_FIXED(SKINNED_WINDOW(mainwin)->fixed), GTK_WIDGET(mainwin_vis), bmp_active_skin->properties.mainwin_vis_x, @@ -754,15 +728,15 @@ bmp_active_skin->properties.mainwin_number_4_y); if (bmp_active_skin->properties.mainwin_playstatus_x && bmp_active_skin->properties.mainwin_playstatus_y) - widget_move(WIDGET(mainwin_playstatus), bmp_active_skin->properties.mainwin_playstatus_x, + gtk_fixed_move(GTK_FIXED(SKINNED_WINDOW(mainwin)->fixed), mainwin_playstatus, bmp_active_skin->properties.mainwin_playstatus_x, bmp_active_skin->properties.mainwin_playstatus_y); if (bmp_active_skin->properties.mainwin_volume_x && bmp_active_skin->properties.mainwin_volume_y) - widget_move(WIDGET(mainwin_volume), bmp_active_skin->properties.mainwin_volume_x, + gtk_fixed_move(GTK_FIXED(SKINNED_WINDOW(mainwin)->fixed), GTK_WIDGET(mainwin_volume), bmp_active_skin->properties.mainwin_volume_x, bmp_active_skin->properties.mainwin_volume_y); if (bmp_active_skin->properties.mainwin_balance_x && bmp_active_skin->properties.mainwin_balance_y) - widget_move(WIDGET(mainwin_balance), bmp_active_skin->properties.mainwin_balance_x, + gtk_fixed_move(GTK_FIXED(SKINNED_WINDOW(mainwin)->fixed), GTK_WIDGET(mainwin_balance), bmp_active_skin->properties.mainwin_balance_x, bmp_active_skin->properties.mainwin_balance_y); if (bmp_active_skin->properties.mainwin_position_x && bmp_active_skin->properties.mainwin_position_y) @@ -827,9 +801,9 @@ /* visibility attributes */ if (bmp_active_skin->properties.mainwin_menurow_visible) - widget_show(WIDGET(mainwin_menurow)); + gtk_widget_show(mainwin_menurow); else - widget_hide(WIDGET(mainwin_menurow)); + gtk_widget_hide(mainwin_menurow); /* window size, mainwinWidth && mainwinHeight properties */ if (bmp_active_skin->properties.mainwin_height && bmp_active_skin->properties.mainwin_width) @@ -856,7 +830,6 @@ bmp_active_skin->properties.mainwin_width * 2, bmp_active_skin->properties.mainwin_height * 2, -1); mainwin_set_back_pixmap(); - widget_list_change_pixmap(mainwin_wlist, mainwin_bg); gdk_flush(); } } @@ -893,10 +866,10 @@ text = g_strdup_printf("%2d", frequency / 1000); ui_skinned_textbox_set_text(mainwin_freq_text, text); - monostereo_set_num_channels(mainwin_monostereo, n_channels); + ui_skinned_monostereo_set_num_channels(mainwin_monostereo, n_channels); if (!playback_get_paused() && mainwin_playstatus != NULL) - playstatus_set_status(mainwin_playstatus, STATUS_PLAY); + ui_skinned_playstatus_set_status(mainwin_playstatus, STATUS_PLAY); if (bmp_active_skin && bmp_active_skin->properties.mainwin_othertext == TRUE) @@ -913,11 +886,11 @@ ui_skinned_textbox_set_text(mainwin_othertext, text); - widget_hide(WIDGET(mainwin_monostereo)); + gtk_widget_hide(mainwin_monostereo); } else { - widget_show(WIDGET(mainwin_monostereo)); + gtk_widget_show(mainwin_monostereo); } title = playlist_get_info_text(playlist); @@ -947,10 +920,10 @@ /* clear sampling parameter displays */ ui_skinned_textbox_set_text(mainwin_rate_text, " "); ui_skinned_textbox_set_text(mainwin_freq_text, " "); - monostereo_set_num_channels(mainwin_monostereo, 0); + ui_skinned_monostereo_set_num_channels(mainwin_monostereo, 0); if (mainwin_playstatus != NULL) - playstatus_set_status(mainwin_playstatus, STATUS_STOP); + ui_skinned_playstatus_set_status(mainwin_playstatus, STATUS_STOP); /* hide playback time */ gtk_widget_hide(mainwin_minus_num); @@ -969,7 +942,7 @@ playlistwin_hide_timer(); ui_vis_clear_data(mainwin_vis); - draw_main_window(TRUE); + ui_svis_clear_data(mainwin_svis); } void @@ -1002,13 +975,6 @@ draw_playlist_window(TRUE); } - if (mainwin_menurow->mr_doublesize_selected) { - event->x /= 2; - event->y /= 2; - } - - handle_release_cb(mainwin_wlist, widget, event); - draw_main_window(FALSE); return FALSE; @@ -1044,7 +1010,6 @@ event->y /= 2; } - handle_motion_cb(mainwin_wlist, widget, event); draw_main_window(FALSE); gdk_flush(); @@ -1110,22 +1075,11 @@ dock_move_release(GTK_WINDOW(mainwin)); } else { - handle_press_cb(mainwin_wlist, widget, event); draw_main_window(FALSE); } - if ((event->button == 1) && event->type != GDK_2BUTTON_PRESS && - widget_contains(WIDGET(mainwin_svis), event->x, event->y) ) { - /* it'll get sorted out when svis will become UiSvis */ - } - if (event->button == 3) { - if (widget_contains(WIDGET(mainwin_svis), event->x, event->y)) { - ui_manager_popup_menu_show(GTK_MENU(mainwin_visualization_menu), event->x_root, - event->y_root, 3, event->time); - grab = FALSE; - } - else if ( (event->y > 70) && (event->x < 128) ) + if ( (event->y > 70) && (event->x < 128) ) { ui_manager_popup_menu_show(GTK_MENU(mainwin_playback_menu), @@ -1159,27 +1113,6 @@ } static gboolean -mainwin_focus_in(GtkWidget * window, - GdkEventFocus * event, - gpointer data) -{ - draw_main_window(TRUE); - - return TRUE; -} - - -static gboolean -mainwin_focus_out(GtkWidget * widget, - GdkEventFocus * event, - gpointer callback_data) -{ - draw_main_window(TRUE); - - return TRUE; -} - -static gboolean mainwin_keypress(GtkWidget * grab_widget, GdkEventKey * event, gpointer data) @@ -1836,18 +1769,17 @@ void mainwin_set_volume_slider(gint percent) { - hslider_set_position(mainwin_volume, (gint) rint((percent * 51) / 100.0)); + ui_skinned_horizontal_slider_set_position(mainwin_volume, (gint) rint((percent * 51) / 100.0)); } void mainwin_set_balance_slider(gint percent) { - hslider_set_position(mainwin_balance, - (gint) rint(((percent * 12) / 100.0) + 12)); + ui_skinned_horizontal_slider_set_position(mainwin_balance, (gint) rint(((percent * 12) / 100.0) + 12)); } void -mainwin_volume_motion_cb(gint pos) +mainwin_volume_motion_cb(GtkWidget *widget, gint pos) { gint vol = (pos * 100) / 51; mainwin_adjust_volume_motion(vol); @@ -1855,7 +1787,7 @@ } void -mainwin_volume_release_cb(gint pos) +mainwin_volume_release_cb(GtkWidget *widget, gint pos) { mainwin_adjust_volume_release(); } @@ -1867,7 +1799,7 @@ } void -mainwin_balance_motion_cb(gint pos) +mainwin_balance_motion_cb(GtkWidget *widget, gint pos) { gint bal = ((pos - 12) * 100) / 12; mainwin_adjust_balance_motion(bal); @@ -1875,7 +1807,7 @@ } void -mainwin_balance_release_cb(gint pos) +mainwin_balance_release_cb(GtkWidget *widget, gint pos) { mainwin_adjust_volume_release(); } @@ -1966,7 +1898,7 @@ check_set( toggleaction_group_others , "show player", FALSE); if (cfg.player_shaded) - svis_clear_data(mainwin_svis); + ui_svis_clear_data(mainwin_svis); if (!cfg.show_wm_decorations) { nullmask = gdk_pixmap_new(mainwin->window, 20, 20, 1); @@ -2172,7 +2104,7 @@ } static void -mainwin_mr_change(MenuRowItem i) +mainwin_mr_change(GtkWidget *widget, MenuRowItem i) { switch (i) { case MENUROW_NONE: @@ -2182,7 +2114,7 @@ mainwin_lock_info_text(_("OPTIONS MENU")); break; case MENUROW_ALWAYS: - if (mainwin_menurow->mr_always_selected) + if (UI_SKINNED_MENUROW(mainwin_menurow)->always_selected) mainwin_lock_info_text(_("DISABLE ALWAYS ON TOP")); else mainwin_lock_info_text(_("ENABLE ALWAYS ON TOP")); @@ -2191,7 +2123,7 @@ mainwin_lock_info_text(_("FILE INFO BOX")); break; case MENUROW_DOUBLESIZE: - if (mainwin_menurow->mr_doublesize_selected) + if (UI_SKINNED_MENUROW(mainwin_menurow)->doublesize_selected) mainwin_lock_info_text(_("DISABLE DOUBLESIZE")); else mainwin_lock_info_text(_("ENABLE DOUBLESIZE")); @@ -2203,7 +2135,7 @@ } static void -mainwin_mr_release(MenuRowItem i) +mainwin_mr_release(GtkWidget *widget, MenuRowItem i) { GdkModifierType modmask; gint x, y; @@ -2218,7 +2150,7 @@ gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(gtk_action_group_get_action( toggleaction_group_others , "view always on top" )) , - mainwin_menurow->mr_always_selected ); + UI_SKINNED_MENUROW(mainwin_menurow)->always_selected ); break; case MENUROW_FILEINFOBOX: playlist_fileinfo_current(playlist_get_active()); @@ -2227,7 +2159,7 @@ gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(gtk_action_group_get_action( toggleaction_group_others , "view doublesize" )) , - mainwin_menurow->mr_doublesize_selected ); + UI_SKINNED_MENUROW(mainwin_menurow)->doublesize_selected ); break; case MENUROW_VISUALIZATION: gdk_window_get_pointer(NULL, &x, &y, &modmask); @@ -2804,30 +2736,25 @@ mainwin_freq_text = ui_skinned_textbox_new(SKINNED_WINDOW(mainwin)->fixed, 156, 43, 10, 0, SKIN_TEXT); - mainwin_menurow = - create_menurow(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 10, 22, 304, - 0, 304, 44, mainwin_mr_change, mainwin_mr_release, - SKIN_TITLEBAR); - mainwin_menurow->mr_doublesize_selected = cfg.doublesize; - mainwin_menurow->mr_always_selected = cfg.always_on_top; - - mainwin_volume = - create_hslider(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 107, 57, 68, - 13, 15, 422, 0, 422, 14, 11, 15, 0, 0, 51, - mainwin_volume_frame_cb, mainwin_volume_motion_cb, - mainwin_volume_release_cb, SKIN_VOLUME); - mainwin_balance = - create_hslider(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 177, 57, 38, - 13, 15, 422, 0, 422, 14, 11, 15, 9, 0, 24, - mainwin_balance_frame_cb, mainwin_balance_motion_cb, - mainwin_balance_release_cb, SKIN_BALANCE); - - mainwin_monostereo = - create_monostereo(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 212, 41, - SKIN_MONOSTEREO); - - mainwin_playstatus = - create_playstatus(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 24, 28); + mainwin_menurow = ui_skinned_menurow_new(SKINNED_WINDOW(mainwin)->fixed, 10, 22, 304, 0, 304, 44, SKIN_TITLEBAR); + g_signal_connect(mainwin_menurow, "change", G_CALLBACK(mainwin_mr_change), NULL); + g_signal_connect(mainwin_menurow, "release", G_CALLBACK(mainwin_mr_release), NULL); + + mainwin_volume = ui_skinned_horizontal_slider_new(SKINNED_WINDOW(mainwin)->fixed, 107, 57, 68, + 13, 15, 422, 0, 422, 14, 11, 15, 0, 0, 51, + mainwin_volume_frame_cb, SKIN_VOLUME); + g_signal_connect(mainwin_volume, "motion", G_CALLBACK(mainwin_volume_motion_cb), NULL); + g_signal_connect(mainwin_volume, "release", G_CALLBACK(mainwin_volume_release_cb), NULL); + + mainwin_balance = ui_skinned_horizontal_slider_new(SKINNED_WINDOW(mainwin)->fixed, 177, 57, 38, + 13, 15, 422, 0, 422, 14, 11, 15, 9, 0, 24, + mainwin_balance_frame_cb, SKIN_BALANCE); + g_signal_connect(mainwin_balance, "motion", G_CALLBACK(mainwin_balance_motion_cb), NULL); + g_signal_connect(mainwin_balance, "release", G_CALLBACK(mainwin_balance_release_cb), NULL); + + mainwin_monostereo = ui_skinned_monostereo_new(SKINNED_WINDOW(mainwin)->fixed, 212, 41, SKIN_MONOSTEREO); + + mainwin_playstatus = ui_skinned_playstatus_new(SKINNED_WINDOW(mainwin)->fixed, 24, 28); mainwin_minus_num = ui_skinned_number_new(SKINNED_WINDOW(mainwin)->fixed, 36, 26, SKIN_NUMBERS); g_signal_connect(mainwin_minus_num, "button-press-event", G_CALLBACK(mainwin_num_clicked), NULL); @@ -2851,7 +2778,8 @@ mainwin_vis = ui_vis_new(SKINNED_WINDOW(mainwin)->fixed, 24, 43, 76); g_signal_connect(mainwin_vis, "button-press-event", G_CALLBACK(mainwin_vis_cb), NULL); - mainwin_svis = create_svis(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 79, 5); + mainwin_svis = ui_svis_new(SKINNED_WINDOW(mainwin)->fixed, 79, 5); + g_signal_connect(mainwin_svis, "button-press-event", G_CALLBACK(mainwin_vis_cb), NULL); mainwin_position = ui_skinned_horizontal_slider_new(SKINNED_WINDOW(mainwin)->fixed, 16, 72, 248, 10, 248, 0, 278, 0, 29, 10, 10, 0, 0, 219, @@ -2879,18 +2807,6 @@ /* Dang well better set an error message or you'll see this */ gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(err), "Boo! Bad stuff! Booga Booga!"); - - /* XXX: eventually update widgetcore API to not need this */ - - ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_menurow)); - - ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_volume)); - ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_balance)); - - ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_monostereo)); - ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_playstatus)); - - ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_svis)); } static void @@ -2898,7 +2814,7 @@ { gint width, height; - mainwin = ui_skinned_window_new(GTK_WINDOW_TOPLEVEL, "player"); + mainwin = ui_skinned_window_new("player"); gtk_window_set_title(GTK_WINDOW(mainwin), _("Audacious")); gtk_window_set_role(GTK_WINDOW(mainwin), "player"); gtk_window_set_resizable(GTK_WINDOW(mainwin), FALSE); @@ -2925,10 +2841,6 @@ G_CALLBACK(mainwin_mouse_button_release), NULL); g_signal_connect(mainwin, "motion_notify_event", G_CALLBACK(mainwin_motion), NULL); - g_signal_connect_after(mainwin, "focus_in_event", - G_CALLBACK(mainwin_focus_in), NULL); - g_signal_connect_after(mainwin, "focus_out_event", - G_CALLBACK(mainwin_focus_out), NULL); g_signal_connect(mainwin, "configure_event", G_CALLBACK(mainwin_configure), NULL); g_signal_connect(mainwin, "style_set", @@ -2969,6 +2881,7 @@ gtk_widget_hide(mainwin_seject); gtk_widget_hide(mainwin_stime_min); gtk_widget_hide(mainwin_stime_sec); + gtk_widget_hide(mainwin_svis); } gtk_widget_hide(mainwin_minus_num); @@ -3223,18 +3136,18 @@ void action_view_always_on_top( GtkToggleAction * action ) { - mainwin_menurow->mr_always_selected = gtk_toggle_action_get_active( action ); - cfg.always_on_top = mainwin_menurow->mr_always_selected; - widget_draw(WIDGET(mainwin_menurow)); + UI_SKINNED_MENUROW(mainwin_menurow)->always_selected = gtk_toggle_action_get_active( action ); + cfg.always_on_top = UI_SKINNED_MENUROW(mainwin_menurow)->always_selected; + gtk_widget_queue_draw(mainwin_menurow); hint_set_always(cfg.always_on_top); } void action_view_doublesize( GtkToggleAction * action ) { - mainwin_menurow->mr_doublesize_selected = gtk_toggle_action_get_active( action ); - widget_draw(WIDGET(mainwin_menurow)); - set_doublesize(mainwin_menurow->mr_doublesize_selected); + UI_SKINNED_MENUROW(mainwin_menurow)->doublesize_selected = gtk_toggle_action_get_active( action ); + gtk_widget_queue_draw(mainwin_menurow); + set_doublesize(UI_SKINNED_MENUROW(mainwin_menurow)->doublesize_selected); gdk_flush(); }
--- a/src/audacious/ui_main.h Tue Jul 17 18:28:54 2007 +0900 +++ b/src/audacious/ui_main.h Tue Jul 17 18:33:49 2007 +0900 @@ -25,6 +25,7 @@ #include "widgets/widgetcore.h" #include "ui_vis.h" +#include "ui_svis.h" /* yes, main window size is fixed */ #define MAINWIN_WIDTH (gint)275 @@ -106,9 +107,9 @@ extern GtkWidget *mainwin_stime_min, *mainwin_stime_sec; extern GtkWidget *mainwin_vis; -extern SVis *mainwin_svis; +extern GtkWidget *mainwin_svis; -extern PlayStatus *mainwin_playstatus; +extern GtkWidget *mainwin_playstatus; extern GtkWidget *mainwin_minus_num, *mainwin_10min_num, *mainwin_min_num; extern GtkWidget *mainwin_10sec_num, *mainwin_sec_num;
--- a/src/audacious/ui_playlist.c Tue Jul 17 18:28:54 2007 +0900 +++ b/src/audacious/ui_playlist.c Tue Jul 17 18:33:49 2007 +0900 @@ -1679,7 +1679,7 @@ { GdkPixbuf *icon; - playlistwin = ui_skinned_window_new(GTK_WINDOW_TOPLEVEL, "playlist"); + playlistwin = ui_skinned_window_new("playlist"); gtk_window_set_title(GTK_WINDOW(playlistwin), _("Audacious Playlist Editor")); gtk_window_set_role(GTK_WINDOW(playlistwin), "playlist"); gtk_window_set_default_size(GTK_WINDOW(playlistwin),
--- a/src/audacious/ui_skinned_button.c Tue Jul 17 18:28:54 2007 +0900 +++ b/src/audacious/ui_skinned_button.c Tue Jul 17 18:33:49 2007 +0900 @@ -61,6 +61,9 @@ static void ui_skinned_button_init(UiSkinnedButton *button); static void ui_skinned_button_destroy(GtkObject *object); static void ui_skinned_button_realize(GtkWidget *widget); +static void ui_skinned_button_unrealize(GtkWidget *widget); +static void ui_skinned_button_map(GtkWidget *widget); +static void ui_skinned_button_unmap(GtkWidget *widget); static void ui_skinned_button_size_request(GtkWidget *widget, GtkRequisition *requisition); static gint ui_skinned_button_expose(GtkWidget *widget,GdkEventExpose *event); @@ -116,6 +119,9 @@ object_class->destroy = ui_skinned_button_destroy; widget_class->realize = ui_skinned_button_realize; + widget_class->unrealize = ui_skinned_button_unrealize; + widget_class->map = ui_skinned_button_map; + widget_class->unmap = ui_skinned_button_unmap; widget_class->expose_event = ui_skinned_button_expose; widget_class->size_request = ui_skinned_button_size_request; widget_class->size_allocate = ui_skinned_button_size_allocate; @@ -171,6 +177,7 @@ button->type = TYPE_NOT_SET; priv->move_x = 0; priv->move_y = 0; + button->event_window = NULL; } static void ui_skinned_button_destroy (GtkObject *object) { @@ -200,24 +207,64 @@ attributes.height = widget->allocation.height; attributes.window_type = GDK_WINDOW_CHILD; attributes.event_mask = gtk_widget_get_events(widget); - attributes.visual = gtk_widget_get_visual(widget); - attributes.colormap = gtk_widget_get_colormap(widget); attributes.event_mask |= GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK; if (button->type == TYPE_SMALL || button->type == TYPE_NOT_SET) { + widget->window = gtk_widget_get_parent_window (widget); + g_object_ref (widget->window); attributes.wclass = GDK_INPUT_ONLY; attributes_mask = GDK_WA_X | GDK_WA_Y; + button->event_window = gdk_window_new (widget->window, &attributes, attributes_mask); + GTK_WIDGET_SET_FLAGS (widget, GTK_NO_WINDOW); + gdk_window_set_user_data(button->event_window, widget); } else { + attributes.visual = gtk_widget_get_visual(widget); + attributes.colormap = gtk_widget_get_colormap(widget); attributes.wclass = GDK_INPUT_OUTPUT; attributes.event_mask |= GDK_EXPOSURE_MASK; attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; + widget->window = gdk_window_new(widget->parent->window, &attributes, attributes_mask); + GTK_WIDGET_UNSET_FLAGS (widget, GTK_NO_WINDOW); + gdk_window_set_user_data(widget->window, widget); + } + + widget->style = gtk_style_attach(widget->style, widget->window); +} + +static void ui_skinned_button_unrealize (GtkWidget *widget) { + UiSkinnedButton *button = UI_SKINNED_BUTTON (widget); + + if ( button->event_window != NULL ) + { + gdk_window_set_user_data( button->event_window , NULL ); + gdk_window_destroy( button->event_window ); + button->event_window = NULL; } - widget->window = gdk_window_new(widget->parent->window, &attributes, attributes_mask); + if (GTK_WIDGET_CLASS (parent_class)->unrealize) + (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget); +} + +static void ui_skinned_button_map (GtkWidget *widget) +{ + UiSkinnedButton *button = UI_SKINNED_BUTTON (widget); + + if (button->event_window != NULL) + gdk_window_show (button->event_window); - widget->style = gtk_style_attach(widget->style, widget->window); + if (GTK_WIDGET_CLASS (parent_class)->map) + (* GTK_WIDGET_CLASS (parent_class)->map) (widget); +} - gdk_window_set_user_data(widget->window, widget); +static void ui_skinned_button_unmap (GtkWidget *widget) +{ + UiSkinnedButton *button = UI_SKINNED_BUTTON (widget); + + if (button->event_window != NULL) + gdk_window_hide (button->event_window); + + if (GTK_WIDGET_CLASS (parent_class)->unmap) + (* GTK_WIDGET_CLASS (parent_class)->unmap) (widget); } static void ui_skinned_button_size_request(GtkWidget *widget, GtkRequisition *requisition) { @@ -235,7 +282,12 @@ widget->allocation.y *= (1+priv->double_size); if (GTK_WIDGET_REALIZED (widget)) - gdk_window_move_resize(widget->window, allocation->x*(1+priv->double_size), allocation->y*(1+priv->double_size), allocation->width, allocation->height); + { + if ( button->event_window != NULL ) + gdk_window_move_resize(button->event_window, allocation->x*(1+priv->double_size), allocation->y*(1+priv->double_size), allocation->width, allocation->height); + else + gdk_window_move_resize(widget->window, allocation->x*(1+priv->double_size), allocation->y*(1+priv->double_size), allocation->width, allocation->height); + } button->x = widget->allocation.x/(priv->double_size ? 2 : 1); button->y = widget->allocation.y/(priv->double_size ? 2 : 1); @@ -257,6 +309,10 @@ if (button->type == TYPE_SMALL || button->type == TYPE_NOT_SET) return FALSE; + /* paranoia */ + if (button->event_window != NULL) + return FALSE; + GdkPixmap *obj; GdkGC *gc; obj = gdk_pixmap_new(NULL, priv->w, priv->h, gdk_rgb_get_visual()->depth); @@ -288,23 +344,14 @@ break; } - GdkPixmap *image; - image = gdk_pixmap_new(NULL, priv->w*(1+priv->double_size), - priv->h*(1+priv->double_size), - gdk_rgb_get_visual()->depth); + GdkPixmap *image = NULL; if (priv->double_size) { - GdkPixbuf *img, *img2x; - GdkColormap *colormap = gdk_colormap_get_system(); - img = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, priv->w, priv->h); - gdk_pixbuf_get_from_drawable(img, obj, colormap, 0, 0, 0, 0, priv->w, priv->h); - img2x = gdk_pixbuf_scale_simple(img, priv->w*2, priv->h*2, GDK_INTERP_NEAREST); - gdk_draw_pixbuf (image, gc, img2x, 0, 0, 0, 0, priv->w*2, priv->h*2, GDK_RGB_DITHER_NONE, 0, 0); - g_object_unref(img); - g_object_unref(img2x); - g_object_unref(colormap); - } else + image = create_dblsize_pixmap(obj); + } else { + image = gdk_pixmap_new(NULL, priv->w, priv->h, gdk_rgb_get_visual()->depth); gdk_draw_drawable (image, gc, obj, 0, 0, 0, 0, priv->w, priv->h); + } g_object_unref(obj);
--- a/src/audacious/ui_skinned_horizontal_slider.c Tue Jul 17 18:28:54 2007 +0900 +++ b/src/audacious/ui_skinned_horizontal_slider.c Tue Jul 17 18:33:49 2007 +0900 @@ -25,6 +25,7 @@ #include "widgets/widgetcore.h" #include "ui_skinned_horizontal_slider.h" #include "main.h" +#include "util.h" #include <gtk/gtkmain.h> #include <gtk/gtkmarshal.h> #include <gtk/gtkimage.h> @@ -196,14 +197,14 @@ attributes.window_type = GDK_WINDOW_CHILD; attributes.event_mask = gtk_widget_get_events(widget); attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | - GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | - GDK_POINTER_MOTION_HINT_MASK; + GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK; attributes.visual = gtk_widget_get_visual(widget); attributes.colormap = gtk_widget_get_colormap(widget); attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; widget->window = gdk_window_new(widget->parent->window, &attributes, attributes_mask); + widget->style = gtk_style_attach(widget->style, widget->window); gdk_window_set_user_data(widget->window, widget); } @@ -239,6 +240,9 @@ GdkPixmap *obj = NULL; GdkGC *gc; + if (priv->position > priv->max) priv->position = priv->max; + else if (priv->position < priv->min) priv->position = priv->min; + obj = gdk_pixmap_new(NULL, priv->width, priv->height, gdk_rgb_get_visual()->depth); gc = gdk_gc_new(obj); @@ -259,24 +263,14 @@ ((priv->height - priv->knob_height) / 2), priv->knob_width, priv->knob_height); - GdkPixmap *image; - image = gdk_pixmap_new(NULL, priv->width*(1+priv->double_size), - priv->height*(1+priv->double_size), - gdk_rgb_get_visual()->depth); + GdkPixmap *image = NULL; if (priv->double_size) { - GdkPixbuf *img, *img2x; - GdkColormap *colormap = gdk_colormap_get_system(); - img = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, priv->width, priv->height); - gdk_pixbuf_get_from_drawable(img, obj, colormap, 0, 0, 0, 0, priv->width, priv->height); - img2x = gdk_pixbuf_scale_simple(img, priv->width*2, priv->height*2, GDK_INTERP_NEAREST); - gdk_draw_pixbuf (image, gc, img2x, 0, 0, 0, 0, priv->width*2, priv->height*2, GDK_RGB_DITHER_NONE, 0, 0); - g_object_unref(img); - g_object_unref(img2x); - g_object_unref(colormap); - } else + image = create_dblsize_pixmap(obj); + } else { + image = gdk_pixmap_new(NULL, priv->width, priv->height, gdk_rgb_get_visual()->depth); gdk_draw_drawable (image, gc, obj, 0, 0, 0, 0, priv->width, priv->height); - + } g_object_unref(obj); @@ -300,10 +294,10 @@ if (event->button == 1) { gint x; - x = event->x - priv->knob_width / 2; + x = event->x - (priv->knob_width / (priv->double_size ? 1 : 2)); hs->pressed = TRUE; - priv->position = x; + priv->position = x/(1+priv->double_size); if (priv->position < priv->min) priv->position = priv->min; if (priv->position > priv->max) @@ -340,8 +334,8 @@ if (hs->pressed) { gint x; - x = event->x; - priv->position = x; + x = event->x - (priv->knob_width / (priv->double_size ? 1 : 2)); + priv->position = x/(1+priv->double_size); if (priv->position < priv->min) priv->position = priv->min;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audacious/ui_skinned_menurow.c Tue Jul 17 18:33:49 2007 +0900 @@ -0,0 +1,350 @@ +/* + * Audacious - a cross-platform multimedia player + * Copyright (c) 2007 Audacious development team. + * + * Based on: + * BMP - Cross-platform multimedia player + * Copyright (C) 2003-2004 BMP development team. + * 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; under version 2 of the License. + * + * 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 "widgets/widgetcore.h" +#include "ui_skinned_menurow.h" +#include "main.h" +#include "util.h" +#include <gtk/gtkmain.h> +#include <gtk/gtkmarshal.h> +#include <gtk/gtkimage.h> + +#define UI_TYPE_SKINNED_MENUROW (ui_skinned_menurow_get_type()) + +enum { + DOUBLED, + CHANGE, + RELEASE, + LAST_SIGNAL +}; + +static void ui_skinned_menurow_class_init (UiSkinnedMenurowClass *klass); +static void ui_skinned_menurow_init (UiSkinnedMenurow *menurow); +static void ui_skinned_menurow_destroy (GtkObject *object); +static void ui_skinned_menurow_realize (GtkWidget *widget); +static void ui_skinned_menurow_size_request (GtkWidget *widget, GtkRequisition *requisition); +static void ui_skinned_menurow_size_allocate (GtkWidget *widget, GtkAllocation *allocation); +static gboolean ui_skinned_menurow_expose (GtkWidget *widget, GdkEventExpose *event); +static MenuRowItem menurow_find_selected (UiSkinnedMenurow * mr, gint x, gint y); +static gboolean ui_skinned_menurow_button_press (GtkWidget *widget, GdkEventButton *event); +static gboolean ui_skinned_menurow_button_release (GtkWidget *widget, GdkEventButton *event); +static gboolean ui_skinned_menurow_motion_notify (GtkWidget *widget, GdkEventMotion *event); +static void ui_skinned_menurow_toggle_doublesize (UiSkinnedMenurow *menurow); + +static GtkWidgetClass *parent_class = NULL; +static guint menurow_signals[LAST_SIGNAL] = { 0 }; + +GType ui_skinned_menurow_get_type() { + static GType menurow_type = 0; + if (!menurow_type) { + static const GTypeInfo menurow_info = { + sizeof (UiSkinnedMenurowClass), + NULL, + NULL, + (GClassInitFunc) ui_skinned_menurow_class_init, + NULL, + NULL, + sizeof (UiSkinnedMenurow), + 0, + (GInstanceInitFunc) ui_skinned_menurow_init, + }; + menurow_type = g_type_register_static (GTK_TYPE_WIDGET, "UiSkinnedMenurow", &menurow_info, 0); + } + + return menurow_type; +} + +static void ui_skinned_menurow_class_init(UiSkinnedMenurowClass *klass) { + GObjectClass *gobject_class; + GtkObjectClass *object_class; + GtkWidgetClass *widget_class; + + gobject_class = G_OBJECT_CLASS(klass); + object_class = (GtkObjectClass*) klass; + widget_class = (GtkWidgetClass*) klass; + parent_class = gtk_type_class (gtk_widget_get_type ()); + + object_class->destroy = ui_skinned_menurow_destroy; + + widget_class->realize = ui_skinned_menurow_realize; + widget_class->expose_event = ui_skinned_menurow_expose; + widget_class->size_request = ui_skinned_menurow_size_request; + widget_class->size_allocate = ui_skinned_menurow_size_allocate; + widget_class->button_press_event = ui_skinned_menurow_button_press; + widget_class->button_release_event = ui_skinned_menurow_button_release; + widget_class->motion_notify_event = ui_skinned_menurow_motion_notify; + + klass->doubled = ui_skinned_menurow_toggle_doublesize; + klass->change = NULL; + klass->release = NULL; + + menurow_signals[DOUBLED] = + g_signal_new ("toggle-double-size", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET (UiSkinnedMenurowClass, doubled), NULL, NULL, + gtk_marshal_VOID__VOID, G_TYPE_NONE, 0); + + + menurow_signals[CHANGE] = + g_signal_new ("change", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET (UiSkinnedMenurowClass, change), NULL, NULL, + gtk_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT); + + menurow_signals[RELEASE] = + g_signal_new ("release", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET (UiSkinnedMenurowClass, release), NULL, NULL, + gtk_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT); + +} + +static void ui_skinned_menurow_init(UiSkinnedMenurow *menurow) { + menurow->doublesize_selected = cfg.doublesize; + menurow->always_selected = cfg.always_on_top; +} + +GtkWidget* ui_skinned_menurow_new(GtkWidget *fixed, gint x, gint y, gint nx, gint ny, gint sx, gint sy, SkinPixmapId si) { + UiSkinnedMenurow *menurow = g_object_new (ui_skinned_menurow_get_type (), NULL); + + menurow->x = x; + menurow->y = y; + menurow->width = 8; + menurow->height = 43; + menurow->nx = nx; + menurow->ny = ny; + menurow->sx = sx; + menurow->sy = sy; + menurow->selected = MENUROW_NONE; + + menurow->skin_index = si; + + menurow->fixed = fixed; + menurow->double_size = FALSE; + + gtk_fixed_put(GTK_FIXED(menurow->fixed), GTK_WIDGET(menurow), menurow->x, menurow->y); + + return GTK_WIDGET(menurow); +} + +static void ui_skinned_menurow_destroy(GtkObject *object) { + UiSkinnedMenurow *menurow; + + g_return_if_fail (object != NULL); + g_return_if_fail (UI_SKINNED_IS_MENUROW (object)); + + menurow = UI_SKINNED_MENUROW (object); + + if (GTK_OBJECT_CLASS (parent_class)->destroy) + (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); +} + +static void ui_skinned_menurow_realize(GtkWidget *widget) { + UiSkinnedMenurow *menurow; + GdkWindowAttr attributes; + gint attributes_mask; + + g_return_if_fail (widget != NULL); + g_return_if_fail (UI_SKINNED_IS_MENUROW(widget)); + + GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED); + menurow = UI_SKINNED_MENUROW(widget); + + attributes.x = widget->allocation.x; + attributes.y = widget->allocation.y; + attributes.width = widget->allocation.width; + attributes.height = widget->allocation.height; + attributes.wclass = GDK_INPUT_OUTPUT; + attributes.window_type = GDK_WINDOW_CHILD; + attributes.event_mask = gtk_widget_get_events(widget); + attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | + GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK; + attributes.visual = gtk_widget_get_visual(widget); + attributes.colormap = gtk_widget_get_colormap(widget); + + attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; + widget->window = gdk_window_new(widget->parent->window, &attributes, attributes_mask); + + widget->style = gtk_style_attach(widget->style, widget->window); + + gdk_window_set_user_data(widget->window, widget); +} + +static void ui_skinned_menurow_size_request(GtkWidget *widget, GtkRequisition *requisition) { + UiSkinnedMenurow *menurow = UI_SKINNED_MENUROW(widget); + + requisition->width = menurow->width*(1+menurow->double_size); + requisition->height = menurow->height*(1+menurow->double_size); +} + +static void ui_skinned_menurow_size_allocate(GtkWidget *widget, GtkAllocation *allocation) { + UiSkinnedMenurow *menurow = UI_SKINNED_MENUROW (widget); + + widget->allocation = *allocation; + widget->allocation.x *= (1+menurow->double_size); + widget->allocation.y *= (1+menurow->double_size); + if (GTK_WIDGET_REALIZED (widget)) + gdk_window_move_resize(widget->window, widget->allocation.x, widget->allocation.y, allocation->width, allocation->height); + + menurow->x = widget->allocation.x/(menurow->double_size ? 2 : 1); + menurow->y = widget->allocation.y/(menurow->double_size ? 2 : 1); +} + +static gboolean ui_skinned_menurow_expose(GtkWidget *widget, GdkEventExpose *event) { + g_return_val_if_fail (widget != NULL, FALSE); + g_return_val_if_fail (UI_SKINNED_IS_MENUROW (widget), FALSE); + g_return_val_if_fail (event != NULL, FALSE); + + UiSkinnedMenurow *menurow = UI_SKINNED_MENUROW (widget); + + GdkPixmap *obj = NULL; + GdkGC *gc; + + obj = gdk_pixmap_new(NULL, menurow->width, menurow->height, gdk_rgb_get_visual()->depth); + gc = gdk_gc_new(obj); + + if (menurow->selected == MENUROW_NONE) { + if (cfg.always_show_cb || menurow->pushed) + skin_draw_pixmap(bmp_active_skin, obj, gc, menurow->skin_index, + menurow->nx, menurow->ny, 0, 0, 8, 43); + else + skin_draw_pixmap(bmp_active_skin, obj, gc, menurow->skin_index, + menurow->nx + 8, menurow->ny, 0, 0, 8, 43); + } + else { + skin_draw_pixmap(bmp_active_skin, obj, gc, menurow->skin_index, + menurow->sx + ((menurow->selected - 1) * 8), + menurow->sy, 0, 0, 8, 43); + } + if (cfg.always_show_cb || menurow->pushed) { + if (menurow->always_selected) + skin_draw_pixmap(bmp_active_skin, obj, gc, menurow->skin_index, + menurow->sx + 8, menurow->sy + 10, 0, 10, 8, 8); + if (menurow->doublesize_selected) + skin_draw_pixmap(bmp_active_skin, obj, gc, menurow->skin_index, + menurow->sx + 24, menurow->sy + 26, 0, 26, 8, 8); + } + + GdkPixmap *image = NULL; + + if (menurow->double_size) { + image = create_dblsize_pixmap(obj); + } else { + image = gdk_pixmap_new(NULL, menurow->width, menurow->height, gdk_rgb_get_visual()->depth); + gdk_draw_drawable(image, gc, obj, 0, 0, 0, 0, menurow->width, menurow->height); + } + + g_object_unref(obj); + + gdk_draw_drawable (widget->window, gc, image, 0, 0, 0, 0, + menurow->width*(1+menurow->double_size), menurow->height*(1+menurow->double_size)); + g_object_unref(gc); + g_object_unref(image); + + return FALSE; +} + +static MenuRowItem menurow_find_selected(UiSkinnedMenurow * mr, gint x, gint y) { + MenuRowItem ret = MENUROW_NONE; + + x = x/(mr->double_size ? 2 : 1); + y = y/(mr->double_size ? 2 : 1); + if (x > 0 && x < 8) { + if (y >= 0 && y <= 10) + ret = MENUROW_OPTIONS; + if (y >= 10 && y <= 17) + ret = MENUROW_ALWAYS; + if (y >= 18 && y <= 25) + ret = MENUROW_FILEINFOBOX; + if (y >= 26 && y <= 33) + ret = MENUROW_DOUBLESIZE; + if (y >= 34 && y <= 42) + ret = MENUROW_VISUALIZATION; + } + return ret; +} + +static gboolean ui_skinned_menurow_button_press(GtkWidget *widget, GdkEventButton *event) { + g_return_val_if_fail (widget != NULL, FALSE); + g_return_val_if_fail (UI_SKINNED_IS_MENUROW (widget), FALSE); + g_return_val_if_fail (event != NULL, FALSE); + + UiSkinnedMenurow *menurow = UI_SKINNED_MENUROW (widget); + + if (event->type == GDK_BUTTON_PRESS) { + if (event->button == 1) { + + menurow->pushed = TRUE; + menurow->selected = menurow_find_selected(menurow, event->x, event->y); + + gtk_widget_queue_draw(widget); + g_signal_emit_by_name(widget, "change", menurow->selected); + } + } + + return TRUE; +} + +static gboolean ui_skinned_menurow_button_release(GtkWidget *widget, GdkEventButton *event) { + UiSkinnedMenurow *menurow = UI_SKINNED_MENUROW(widget); + if (menurow->pushed) { + menurow->pushed = FALSE; + + if (menurow->selected == MENUROW_ALWAYS) + menurow->always_selected = !menurow->always_selected; + + if (menurow->selected == MENUROW_DOUBLESIZE) + menurow->doublesize_selected = !menurow->doublesize_selected; + + if ((int)(menurow->selected) != -1) + g_signal_emit_by_name(widget, "release", menurow->selected); + + menurow->selected = MENUROW_NONE; + gtk_widget_queue_draw(widget); + } + + return TRUE; +} + +static gboolean ui_skinned_menurow_motion_notify(GtkWidget *widget, GdkEventMotion *event) { + g_return_val_if_fail (widget != NULL, FALSE); + g_return_val_if_fail (UI_SKINNED_IS_MENUROW (widget), FALSE); + g_return_val_if_fail (event != NULL, FALSE); + UiSkinnedMenurow *menurow = UI_SKINNED_MENUROW(widget); + + if (menurow->pushed) { + menurow->selected = menurow_find_selected(menurow, event->x, event->y); + + gtk_widget_queue_draw(widget); + g_signal_emit_by_name(widget, "change", menurow->selected); + } + + return TRUE; +} + +static void ui_skinned_menurow_toggle_doublesize(UiSkinnedMenurow *menurow) { + GtkWidget *widget = GTK_WIDGET (menurow); + + menurow->double_size = !menurow->double_size; + gtk_widget_set_size_request(widget, menurow->width*(1+menurow->double_size), menurow->height*(1+menurow->double_size)); + + gtk_widget_queue_draw(GTK_WIDGET(menurow)); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audacious/ui_skinned_menurow.h Tue Jul 17 18:33:49 2007 +0900 @@ -0,0 +1,77 @@ +/* + * Audacious - a cross-platform multimedia player + * Copyright (c) 2007 Audacious development team. + * + * Based on: + * BMP - Cross-platform multimedia player + * Copyright (C) 2003-2004 BMP development team. + * 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; under version 2 of the License. + * + * 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 UISKINNEDMENUROW_H +#define UISKINNEDMENUROW_H + +#include <gdk/gdk.h> +#include <gtk/gtkadjustment.h> +#include <gtk/gtkwidget.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define UI_SKINNED_MENUROW(obj) GTK_CHECK_CAST (obj, ui_skinned_menurow_get_type (), UiSkinnedMenurow) +#define UI_SKINNED_MENUROW_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, ui_skinned_menurow_get_type (), UiSkinnedMenurowClass) +#define UI_SKINNED_IS_MENUROW(obj) GTK_CHECK_TYPE (obj, ui_skinned_menurow_get_type ()) + +typedef struct _UiSkinnedMenurow UiSkinnedMenurow; +typedef struct _UiSkinnedMenurowClass UiSkinnedMenurowClass; + +typedef enum { + MENUROW_NONE, MENUROW_OPTIONS, MENUROW_ALWAYS, MENUROW_FILEINFOBOX, + MENUROW_DOUBLESIZE, MENUROW_VISUALIZATION +} MenuRowItem; + +struct _UiSkinnedMenurow { + GtkWidget widget; + + gint x, y, width, height; + GtkWidget *fixed; + gboolean double_size; + gint nx, ny; + gint sx, sy; + MenuRowItem selected; + gboolean always_selected; + gboolean doublesize_selected; + gboolean pushed; + SkinPixmapId skin_index; +}; + +struct _UiSkinnedMenurowClass { + GtkWidgetClass parent_class; + void (* doubled) (UiSkinnedMenurow *menurow); + void (* change) (UiSkinnedMenurow *menurow); + void (* release) (UiSkinnedMenurow *menurow); +}; + +GtkWidget* ui_skinned_menurow_new (GtkWidget *fixed, gint x, gint y, gint nx, gint ny, gint sx, gint sy, SkinPixmapId si); +GtkType ui_skinned_menurow_get_type(void); + +#ifdef __cplusplus +} +#endif + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audacious/ui_skinned_monostereo.c Tue Jul 17 18:33:49 2007 +0900 @@ -0,0 +1,241 @@ +/* + * Audacious - a cross-platform multimedia player + * Copyright (c) 2007 Audacious development team. + * + * Based on: + * BMP - Cross-platform multimedia player + * Copyright (C) 2003-2004 BMP development team. + * 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; under version 2 of the License. + * + * 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 "widgets/widgetcore.h" +#include "ui_skinned_monostereo.h" +#include "main.h" +#include "util.h" +#include <gtk/gtkmain.h> +#include <gtk/gtkmarshal.h> +#include <gtk/gtkimage.h> + +#define UI_TYPE_SKINNED_MONOSTEREO (ui_skinned_monostereo_get_type()) + +enum { + DOUBLED, + LAST_SIGNAL +}; + +static void ui_skinned_monostereo_class_init (UiSkinnedMonoStereoClass *klass); +static void ui_skinned_monostereo_init (UiSkinnedMonoStereo *monostereo); +static void ui_skinned_monostereo_destroy (GtkObject *object); +static void ui_skinned_monostereo_realize (GtkWidget *widget); +static void ui_skinned_monostereo_size_request (GtkWidget *widget, GtkRequisition *requisition); +static void ui_skinned_monostereo_size_allocate (GtkWidget *widget, GtkAllocation *allocation); +static gboolean ui_skinned_monostereo_expose (GtkWidget *widget, GdkEventExpose *event); +static void ui_skinned_monostereo_toggle_doublesize (UiSkinnedMonoStereo *monostereo); + +static GtkWidgetClass *parent_class = NULL; +static guint monostereo_signals[LAST_SIGNAL] = { 0 }; + +GType ui_skinned_monostereo_get_type() { + static GType monostereo_type = 0; + if (!monostereo_type) { + static const GTypeInfo monostereo_info = { + sizeof (UiSkinnedMonoStereoClass), + NULL, + NULL, + (GClassInitFunc) ui_skinned_monostereo_class_init, + NULL, + NULL, + sizeof (UiSkinnedMonoStereo), + 0, + (GInstanceInitFunc) ui_skinned_monostereo_init, + }; + monostereo_type = g_type_register_static (GTK_TYPE_WIDGET, "UiSkinnedMonoStereo", &monostereo_info, 0); + } + + return monostereo_type; +} + +static void ui_skinned_monostereo_class_init(UiSkinnedMonoStereoClass *klass) { + GObjectClass *gobject_class; + GtkObjectClass *object_class; + GtkWidgetClass *widget_class; + + gobject_class = G_OBJECT_CLASS(klass); + object_class = (GtkObjectClass*) klass; + widget_class = (GtkWidgetClass*) klass; + parent_class = gtk_type_class (gtk_widget_get_type ()); + + object_class->destroy = ui_skinned_monostereo_destroy; + + widget_class->realize = ui_skinned_monostereo_realize; + widget_class->expose_event = ui_skinned_monostereo_expose; + widget_class->size_request = ui_skinned_monostereo_size_request; + widget_class->size_allocate = ui_skinned_monostereo_size_allocate; + + klass->doubled = ui_skinned_monostereo_toggle_doublesize; + + monostereo_signals[DOUBLED] = + g_signal_new ("toggle-double-size", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET (UiSkinnedMonoStereoClass, doubled), NULL, NULL, + gtk_marshal_VOID__VOID, G_TYPE_NONE, 0); +} + +static void ui_skinned_monostereo_init(UiSkinnedMonoStereo *monostereo) { + monostereo->width = 56; + monostereo->height = 12; +} + +GtkWidget* ui_skinned_monostereo_new(GtkWidget *fixed, gint x, gint y, SkinPixmapId si) { + UiSkinnedMonoStereo *monostereo = g_object_new (ui_skinned_monostereo_get_type (), NULL); + + monostereo->x = x; + monostereo->y = y; + monostereo->skin_index = si; + monostereo->fixed = fixed; + monostereo->double_size = FALSE; + + gtk_fixed_put(GTK_FIXED(monostereo->fixed), GTK_WIDGET(monostereo), monostereo->x, monostereo->y); + + return GTK_WIDGET(monostereo); +} + +static void ui_skinned_monostereo_destroy(GtkObject *object) { + UiSkinnedMonoStereo *monostereo; + + g_return_if_fail (object != NULL); + g_return_if_fail (UI_SKINNED_IS_MONOSTEREO (object)); + + monostereo = UI_SKINNED_MONOSTEREO (object); + + if (GTK_OBJECT_CLASS (parent_class)->destroy) + (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); +} + +static void ui_skinned_monostereo_realize(GtkWidget *widget) { + UiSkinnedMonoStereo *monostereo; + GdkWindowAttr attributes; + gint attributes_mask; + + g_return_if_fail (widget != NULL); + g_return_if_fail (UI_SKINNED_IS_MONOSTEREO(widget)); + + GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED); + monostereo = UI_SKINNED_MONOSTEREO(widget); + + attributes.x = widget->allocation.x; + attributes.y = widget->allocation.y; + attributes.width = widget->allocation.width; + attributes.height = widget->allocation.height; + attributes.wclass = GDK_INPUT_OUTPUT; + attributes.window_type = GDK_WINDOW_CHILD; + attributes.event_mask = gtk_widget_get_events(widget); + attributes.event_mask |= GDK_EXPOSURE_MASK; + attributes.visual = gtk_widget_get_visual(widget); + attributes.colormap = gtk_widget_get_colormap(widget); + + attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; + widget->window = gdk_window_new(widget->parent->window, &attributes, attributes_mask); + + widget->style = gtk_style_attach(widget->style, widget->window); + + gdk_window_set_user_data(widget->window, widget); +} + +static void ui_skinned_monostereo_size_request(GtkWidget *widget, GtkRequisition *requisition) { + UiSkinnedMonoStereo *monostereo = UI_SKINNED_MONOSTEREO(widget); + + requisition->width = monostereo->width*(1+monostereo->double_size); + requisition->height = monostereo->height*(1+monostereo->double_size); +} + +static void ui_skinned_monostereo_size_allocate(GtkWidget *widget, GtkAllocation *allocation) { + UiSkinnedMonoStereo *monostereo = UI_SKINNED_MONOSTEREO (widget); + + widget->allocation = *allocation; + widget->allocation.x *= (1+monostereo->double_size); + widget->allocation.y *= (1+monostereo->double_size); + if (GTK_WIDGET_REALIZED (widget)) + gdk_window_move_resize(widget->window, widget->allocation.x, widget->allocation.y, allocation->width, allocation->height); + + monostereo->x = widget->allocation.x/(monostereo->double_size ? 2 : 1); + monostereo->y = widget->allocation.y/(monostereo->double_size ? 2 : 1); +} + +static gboolean ui_skinned_monostereo_expose(GtkWidget *widget, GdkEventExpose *event) { + g_return_val_if_fail (widget != NULL, FALSE); + g_return_val_if_fail (UI_SKINNED_IS_MONOSTEREO (widget), FALSE); + g_return_val_if_fail (event != NULL, FALSE); + + UiSkinnedMonoStereo *monostereo = UI_SKINNED_MONOSTEREO (widget); + + GdkPixmap *obj = NULL; + GdkGC *gc; + + obj = gdk_pixmap_new(NULL, monostereo->width, monostereo->height, gdk_rgb_get_visual()->depth); + gc = gdk_gc_new(obj); + + switch (monostereo->num_channels) { + case 1: + skin_draw_pixmap(bmp_active_skin, obj, gc, monostereo->skin_index, 29, 0, 0, 0, 27, 12); + skin_draw_pixmap(bmp_active_skin, obj, gc, monostereo->skin_index, 0, 12, 27, 0, 29, 12); + break; + case 2: + skin_draw_pixmap(bmp_active_skin, obj, gc, monostereo->skin_index, 29, 12, 0, 0, 27, 12); + skin_draw_pixmap(bmp_active_skin, obj, gc, monostereo->skin_index, 0, 0, 27, 0, 29, 12); + break; + default: + case 0: + skin_draw_pixmap(bmp_active_skin, obj, gc, monostereo->skin_index, 29, 12, 0, 0, 27, 12); + skin_draw_pixmap(bmp_active_skin, obj, gc, monostereo->skin_index, 0, 12, 27, 0, 29, 12); + break; + } + + GdkPixmap *image = NULL; + + if (monostereo->double_size) { + image = create_dblsize_pixmap(obj); + } else { + image = gdk_pixmap_new(NULL, monostereo->width, monostereo->height, gdk_rgb_get_visual()->depth); + gdk_draw_drawable (image, gc, obj, 0, 0, 0, 0, monostereo->width, monostereo->height); + } + + g_object_unref(obj); + + gdk_draw_drawable (widget->window, gc, image, 0, 0, 0, 0, + monostereo->width*(1+monostereo->double_size), monostereo->height*(1+monostereo->double_size)); + g_object_unref(gc); + g_object_unref(image); + + return FALSE; +} + +static void ui_skinned_monostereo_toggle_doublesize(UiSkinnedMonoStereo *monostereo) { + GtkWidget *widget = GTK_WIDGET (monostereo); + + monostereo->double_size = !monostereo->double_size; + gtk_widget_set_size_request(widget, monostereo->width*(1+monostereo->double_size), monostereo->height*(1+monostereo->double_size)); + + gtk_widget_queue_draw(GTK_WIDGET(monostereo)); +} + +void ui_skinned_monostereo_set_num_channels(GtkWidget *widget, gint nch) { + g_return_if_fail (UI_SKINNED_IS_MONOSTEREO (widget)); + UiSkinnedMonoStereo *monostereo = UI_SKINNED_MONOSTEREO (widget); + + monostereo->num_channels = nch; + gtk_widget_queue_draw(widget); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audacious/ui_skinned_monostereo.h Tue Jul 17 18:33:49 2007 +0900 @@ -0,0 +1,66 @@ +/* + * Audacious - a cross-platform multimedia player + * Copyright (c) 2007 Audacious development team. + * + * Based on: + * BMP - Cross-platform multimedia player + * Copyright (C) 2003-2004 BMP development team. + * 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; under version 2 of the License. + * + * 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 UISKINNEDMONOSTEREO_H +#define UISKINNEDMONOSTEREO_H + +#include <gdk/gdk.h> +#include <gtk/gtkadjustment.h> +#include <gtk/gtkwidget.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define UI_SKINNED_MONOSTEREO(obj) GTK_CHECK_CAST (obj, ui_skinned_monostereo_get_type (), UiSkinnedMonoStereo) +#define UI_SKINNED_MONOSTEREO_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, ui_skinned_monostereo_get_type (), UiSkinnedMonoStereoClass) +#define UI_SKINNED_IS_MONOSTEREO(obj) GTK_CHECK_TYPE (obj, ui_skinned_monostereo_get_type ()) + +typedef struct _UiSkinnedMonoStereo UiSkinnedMonoStereo; +typedef struct _UiSkinnedMonoStereoClass UiSkinnedMonoStereoClass; + +struct _UiSkinnedMonoStereo { + GtkWidget widget; + + gint x, y, width, height; + gint num_channels; + SkinPixmapId skin_index; + GtkWidget *fixed; + gboolean double_size; +}; + +struct _UiSkinnedMonoStereoClass { + GtkWidgetClass parent_class; + void (* doubled) (UiSkinnedMonoStereo *menurow); +}; + +GtkWidget* ui_skinned_monostereo_new (GtkWidget *fixed, gint x, gint y, SkinPixmapId si); +GtkType ui_skinned_monostereo_get_type(void); +void ui_skinned_monostereo_set_num_channels(GtkWidget *widget, gint nch); + +#ifdef __cplusplus +} +#endif + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audacious/ui_skinned_playstatus.c Tue Jul 17 18:33:49 2007 +0900 @@ -0,0 +1,253 @@ +/* + * Audacious - a cross-platform multimedia player + * Copyright (c) 2007 Audacious development team. + * + * Based on: + * BMP - Cross-platform multimedia player + * Copyright (C) 2003-2004 BMP development team. + * 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; under version 2 of the License. + * + * 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 "widgets/widgetcore.h" +#include "ui_skinned_playstatus.h" +#include "main.h" +#include "util.h" +#include <gtk/gtkmain.h> +#include <gtk/gtkmarshal.h> +#include <gtk/gtkimage.h> + +#define UI_TYPE_SKINNED_PLAYSTATUS (ui_skinned_playstatus_get_type()) + +enum { + DOUBLED, + LAST_SIGNAL +}; + +static void ui_skinned_playstatus_class_init (UiSkinnedPlaystatusClass *klass); +static void ui_skinned_playstatus_init (UiSkinnedPlaystatus *playstatus); +static void ui_skinned_playstatus_destroy (GtkObject *object); +static void ui_skinned_playstatus_realize (GtkWidget *widget); +static void ui_skinned_playstatus_size_request (GtkWidget *widget, GtkRequisition *requisition); +static void ui_skinned_playstatus_size_allocate (GtkWidget *widget, GtkAllocation *allocation); +static gboolean ui_skinned_playstatus_expose (GtkWidget *widget, GdkEventExpose *event); +static void ui_skinned_playstatus_toggle_doublesize (UiSkinnedPlaystatus *playstatus); + +static GtkWidgetClass *parent_class = NULL; +static guint playstatus_signals[LAST_SIGNAL] = { 0 }; + +GType ui_skinned_playstatus_get_type() { + static GType playstatus_type = 0; + if (!playstatus_type) { + static const GTypeInfo playstatus_info = { + sizeof (UiSkinnedPlaystatusClass), + NULL, + NULL, + (GClassInitFunc) ui_skinned_playstatus_class_init, + NULL, + NULL, + sizeof (UiSkinnedPlaystatus), + 0, + (GInstanceInitFunc) ui_skinned_playstatus_init, + }; + playstatus_type = g_type_register_static (GTK_TYPE_WIDGET, "UiSkinnedPlaystatus", &playstatus_info, 0); + } + + return playstatus_type; +} + +static void ui_skinned_playstatus_class_init(UiSkinnedPlaystatusClass *klass) { + GObjectClass *gobject_class; + GtkObjectClass *object_class; + GtkWidgetClass *widget_class; + + gobject_class = G_OBJECT_CLASS(klass); + object_class = (GtkObjectClass*) klass; + widget_class = (GtkWidgetClass*) klass; + parent_class = gtk_type_class (gtk_widget_get_type ()); + + object_class->destroy = ui_skinned_playstatus_destroy; + + widget_class->realize = ui_skinned_playstatus_realize; + widget_class->expose_event = ui_skinned_playstatus_expose; + widget_class->size_request = ui_skinned_playstatus_size_request; + widget_class->size_allocate = ui_skinned_playstatus_size_allocate; + + klass->doubled = ui_skinned_playstatus_toggle_doublesize; + + playstatus_signals[DOUBLED] = + g_signal_new ("toggle-double-size", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET (UiSkinnedPlaystatusClass, doubled), NULL, NULL, + gtk_marshal_VOID__VOID, G_TYPE_NONE, 0); +} + +static void ui_skinned_playstatus_init(UiSkinnedPlaystatus *playstatus) { + playstatus->width = 11; + playstatus->height = 9; +} + +GtkWidget* ui_skinned_playstatus_new(GtkWidget *fixed, gint x, gint y) { + UiSkinnedPlaystatus *playstatus = g_object_new (ui_skinned_playstatus_get_type (), NULL); + + playstatus->x = x; + playstatus->y = y; + + playstatus->fixed = fixed; + playstatus->double_size = FALSE; + + gtk_fixed_put(GTK_FIXED(playstatus->fixed), GTK_WIDGET(playstatus), playstatus->x, playstatus->y); + + return GTK_WIDGET(playstatus); +} + +static void ui_skinned_playstatus_destroy(GtkObject *object) { + UiSkinnedPlaystatus *playstatus; + + g_return_if_fail (object != NULL); + g_return_if_fail (UI_SKINNED_IS_PLAYSTATUS (object)); + + playstatus = UI_SKINNED_PLAYSTATUS (object); + + if (GTK_OBJECT_CLASS (parent_class)->destroy) + (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); +} + +static void ui_skinned_playstatus_realize(GtkWidget *widget) { + UiSkinnedPlaystatus *playstatus; + GdkWindowAttr attributes; + gint attributes_mask; + + g_return_if_fail (widget != NULL); + g_return_if_fail (UI_SKINNED_IS_PLAYSTATUS(widget)); + + GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED); + playstatus = UI_SKINNED_PLAYSTATUS(widget); + + attributes.x = widget->allocation.x; + attributes.y = widget->allocation.y; + attributes.width = widget->allocation.width; + attributes.height = widget->allocation.height; + attributes.wclass = GDK_INPUT_OUTPUT; + attributes.window_type = GDK_WINDOW_CHILD; + attributes.event_mask = gtk_widget_get_events(widget); + attributes.event_mask |= GDK_EXPOSURE_MASK; + attributes.visual = gtk_widget_get_visual(widget); + attributes.colormap = gtk_widget_get_colormap(widget); + + attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; + widget->window = gdk_window_new(widget->parent->window, &attributes, attributes_mask); + + widget->style = gtk_style_attach(widget->style, widget->window); + + gdk_window_set_user_data(widget->window, widget); +} + +static void ui_skinned_playstatus_size_request(GtkWidget *widget, GtkRequisition *requisition) { + UiSkinnedPlaystatus *playstatus = UI_SKINNED_PLAYSTATUS(widget); + + requisition->width = playstatus->width*(1+playstatus->double_size); + requisition->height = playstatus->height*(1+playstatus->double_size); +} + +static void ui_skinned_playstatus_size_allocate(GtkWidget *widget, GtkAllocation *allocation) { + UiSkinnedPlaystatus *playstatus = UI_SKINNED_PLAYSTATUS (widget); + + widget->allocation = *allocation; + widget->allocation.x *= (1+playstatus->double_size); + widget->allocation.y *= (1+playstatus->double_size); + if (GTK_WIDGET_REALIZED (widget)) + gdk_window_move_resize(widget->window, widget->allocation.x, widget->allocation.y, allocation->width, allocation->height); + + playstatus->x = widget->allocation.x/(playstatus->double_size ? 2 : 1); + playstatus->y = widget->allocation.y/(playstatus->double_size ? 2 : 1); +} + +static gboolean ui_skinned_playstatus_expose(GtkWidget *widget, GdkEventExpose *event) { + g_return_val_if_fail (widget != NULL, FALSE); + g_return_val_if_fail (UI_SKINNED_IS_PLAYSTATUS (widget), FALSE); + g_return_val_if_fail (event != NULL, FALSE); + + UiSkinnedPlaystatus *playstatus = UI_SKINNED_PLAYSTATUS (widget); + + GdkPixmap *obj = NULL; + GdkGC *gc; + + obj = gdk_pixmap_new(NULL, playstatus->width, playstatus->height, gdk_rgb_get_visual()->depth); + gc = gdk_gc_new(obj); + + if (playstatus->status == STATUS_STOP && playstatus->buffering == TRUE) + playstatus->buffering = FALSE; + if (playstatus->status == STATUS_PLAY && playstatus->buffering == TRUE) + skin_draw_pixmap(bmp_active_skin, obj, gc, SKIN_PLAYPAUSE, 39, 0, 0, 0, 3, 9); + else if (playstatus->status == STATUS_PLAY) + skin_draw_pixmap(bmp_active_skin, obj, gc, SKIN_PLAYPAUSE, 36, 0, 0, 0, 3, 9); + else + skin_draw_pixmap(bmp_active_skin, obj, gc, SKIN_PLAYPAUSE, 27, 0, 0, 0, 2, 9); + switch (playstatus->status) { + case STATUS_STOP: + skin_draw_pixmap(bmp_active_skin, obj, gc, SKIN_PLAYPAUSE, 18, 0, 2, 0, 9, 9); + break; + case STATUS_PAUSE: + skin_draw_pixmap(bmp_active_skin, obj, gc, SKIN_PLAYPAUSE, 9, 0, 2, 0, 9, 9); + break; + case STATUS_PLAY: + skin_draw_pixmap(bmp_active_skin, obj, gc, SKIN_PLAYPAUSE, 1, 0, 3, 0, 8, 9); + break; + } + + GdkPixmap *image = NULL; + + if (playstatus->double_size) { + image = create_dblsize_pixmap(obj); + } else { + image = gdk_pixmap_new(NULL, playstatus->width, playstatus->height, gdk_rgb_get_visual()->depth); + gdk_draw_drawable (image, gc, obj, 0, 0, 0, 0, playstatus->width, playstatus->height); + } + + g_object_unref(obj); + + gdk_draw_drawable (widget->window, gc, image, 0, 0, 0, 0, + playstatus->width*(1+playstatus->double_size), playstatus->height*(1+playstatus->double_size)); + g_object_unref(gc); + g_object_unref(image); + + return FALSE; +} + +static void ui_skinned_playstatus_toggle_doublesize(UiSkinnedPlaystatus *playstatus) { + GtkWidget *widget = GTK_WIDGET (playstatus); + + playstatus->double_size = !playstatus->double_size; + gtk_widget_set_size_request(widget, playstatus->width*(1+playstatus->double_size), playstatus->height*(1+playstatus->double_size)); + + gtk_widget_queue_draw(GTK_WIDGET(playstatus)); +} + +void ui_skinned_playstatus_set_status(GtkWidget *widget, PStatus status) { + g_return_if_fail (UI_SKINNED_IS_PLAYSTATUS (widget)); + UiSkinnedPlaystatus *playstatus = UI_SKINNED_PLAYSTATUS (widget); + + playstatus->status = status; + gtk_widget_queue_draw(widget); +} + +void ui_skinned_playstatus_set_buffering(GtkWidget *widget, gboolean status) { + g_return_if_fail (UI_SKINNED_IS_PLAYSTATUS (widget)); + UiSkinnedPlaystatus *playstatus = UI_SKINNED_PLAYSTATUS (widget); + + playstatus->buffering = status; + gtk_widget_queue_draw(widget); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audacious/ui_skinned_playstatus.h Tue Jul 17 18:33:49 2007 +0900 @@ -0,0 +1,71 @@ +/* + * Audacious - a cross-platform multimedia player + * Copyright (c) 2007 Audacious development team. + * + * Based on: + * BMP - Cross-platform multimedia player + * Copyright (C) 2003-2004 BMP development team. + * 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; under version 2 of the License. + * + * 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 UISKINNEDPLAYSTATUS_H +#define UISKINNEDPLAYSTATUS_H + +#include <gdk/gdk.h> +#include <gtk/gtkadjustment.h> +#include <gtk/gtkwidget.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define UI_SKINNED_PLAYSTATUS(obj) GTK_CHECK_CAST (obj, ui_skinned_playstatus_get_type (), UiSkinnedPlaystatus) +#define UI_SKINNED_PLAYSTATUS_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, ui_skinned_playstatus_get_type (), UiSkinnedPlaystatusClass) +#define UI_SKINNED_IS_PLAYSTATUS(obj) GTK_CHECK_TYPE (obj, ui_skinned_playstatus_get_type ()) + +typedef struct _UiSkinnedPlaystatus UiSkinnedPlaystatus; +typedef struct _UiSkinnedPlaystatusClass UiSkinnedPlaystatusClass; + +typedef enum { + STATUS_STOP, STATUS_PAUSE, STATUS_PLAY +} PStatus; + +struct _UiSkinnedPlaystatus { + GtkWidget widget; + + gint x, y, width, height; + GtkWidget *fixed; + gboolean double_size; + PStatus status; + gboolean buffering; +}; + +struct _UiSkinnedPlaystatusClass { + GtkWidgetClass parent_class; + void (* doubled) (UiSkinnedPlaystatus *menurow); +}; + +GtkWidget* ui_skinned_playstatus_new (GtkWidget *fixed, gint x, gint y); +GtkType ui_skinned_playstatus_get_type(void); +void ui_skinned_playstatus_set_status(GtkWidget *widget, PStatus status); +void ui_skinned_playstatus_set_buffering(GtkWidget *widget, gboolean status); + +#ifdef __cplusplus +} +#endif + +#endif
--- a/src/audacious/ui_skinned_textbox.c Tue Jul 17 18:28:54 2007 +0900 +++ b/src/audacious/ui_skinned_textbox.c Tue Jul 17 18:33:49 2007 +0900 @@ -334,21 +334,14 @@ } - GdkPixmap *image; - image = gdk_pixmap_new(NULL, textbox->width*(1+priv->double_size), - textbox->height*(1+priv->double_size), - gdk_rgb_get_visual()->depth); + GdkPixmap *image = NULL; - if (priv->double_size) { - GdkImage *img, *img2x; - img = gdk_drawable_get_image(obj, 0, 0, textbox->width, textbox->height); - img2x = create_dblsize_image(img); - gdk_draw_image (image, gc, img2x, 0, 0, 0, 0, textbox->width*2, textbox->height*2); - g_object_unref(img2x); - g_object_unref(img); - } else - gdk_draw_drawable (image, gc, obj, 0, 0, 0, 0, textbox->width, textbox->height); - + if (priv->double_size) { + image = create_dblsize_pixmap(obj); + } else { + image = gdk_pixmap_new(NULL, textbox->width, textbox->height, gdk_rgb_get_visual()->depth); + gdk_draw_drawable (image, gc, obj, 0, 0, 0, 0, textbox->width, textbox->height); + } g_object_unref(obj);
--- a/src/audacious/ui_skinned_window.c Tue Jul 17 18:28:54 2007 +0900 +++ b/src/audacious/ui_skinned_window.c Tue Jul 17 18:33:49 2007 +0900 @@ -78,10 +78,6 @@ window->x = event->x; window->y = event->y; -#if 0 - g_print("%p window->x = %d, window->y = %d\n", window, window->x, window->y); -#endif - return FALSE; } @@ -143,12 +139,12 @@ } GtkWidget * -ui_skinned_window_new(GtkWindowType type, const gchar *wmclass_name) +ui_skinned_window_new(const gchar *wmclass_name) { GtkWidget *widget = g_object_new(ui_skinned_window_get_type(), NULL); GtkWindow *window = GTK_WINDOW(widget); - window->type = type; + window->type = SKINNED_WINDOW_TYPE; if (wmclass_name) gtk_window_set_wmclass(GTK_WINDOW(widget), wmclass_name, "Audacious");
--- a/src/audacious/ui_skinned_window.h Tue Jul 17 18:28:54 2007 +0900 +++ b/src/audacious/ui_skinned_window.h Tue Jul 17 18:33:49 2007 +0900 @@ -25,6 +25,12 @@ #define SKINNED_CHECK_WINDOW(obj) GTK_CHECK_TYPE (obj, ui_skinned_window_get_type ()) #define SKINNED_TYPE_WINDOW (ui_skinned_window_get_type()) +#ifdef GDK_WINDOWING_QUARTZ +# define SKINNED_WINDOW_TYPE GTK_WINDOW_POPUP +#else +# define SKINNED_WINDOW_TYPE GTK_WINDOW_TOPLEVEL +#endif + typedef struct _SkinnedWindow SkinnedWindow; typedef struct _SkinnedWindowClass SkinnedWindowClass; @@ -46,7 +52,7 @@ }; extern GType ui_skinned_window_get_type(void); -extern GtkWidget *ui_skinned_window_new(GtkWindowType type, const gchar *wmclass_name); +extern GtkWidget *ui_skinned_window_new(const gchar *wmclass_name); extern void ui_skinned_window_widgetlist_associate(GtkWidget * widget, Widget * w); extern void ui_skinned_window_widgetlist_dissociate(GtkWidget * widget, Widget * w); extern gboolean ui_skinned_window_widgetlist_contained(GtkWidget * widget, gint x, gint y);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audacious/ui_svis.c Tue Jul 17 18:33:49 2007 +0900 @@ -0,0 +1,543 @@ +/* + * Audacious - a cross-platform multimedia player + * Copyright (c) 2007 Audacious development team. + * + * Based on: + * BMP - Cross-platform multimedia player + * Copyright (C) 2003-2004 BMP development team. + * 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; under version 2 of the License. + * + * 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 "widgets/widgetcore.h" +#include "ui_svis.h" +#include "ui_vis.h" +#include "main.h" +#include "util.h" +#include "strings.h" +#include "playback.h" +#include <string.h> +#include <ctype.h> +#include <gtk/gtkmain.h> +#include <gtk/gtkmarshal.h> +#include <gtk/gtkimage.h> + +#define UI_TYPE_SVIS (ui_svis_get_type()) + +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 + +enum { + DOUBLED, + LAST_SIGNAL +}; + +static void ui_svis_class_init (UiSVisClass *klass); +static void ui_svis_init (UiSVis *svis); +static void ui_svis_destroy (GtkObject *object); +static void ui_svis_realize (GtkWidget *widget); +static void ui_svis_unrealize (GtkWidget *widget); +static void ui_svis_map (GtkWidget *widget); +static void ui_svis_unmap (GtkWidget *widget); +static void ui_svis_size_request (GtkWidget *widget, GtkRequisition *requisition); +static void ui_svis_size_allocate (GtkWidget *widget, GtkAllocation *allocation); +static gboolean ui_svis_expose (GtkWidget *widget, GdkEventExpose *event); +static void ui_svis_toggle_doublesize (UiSVis *svis); + +static GtkWidgetClass *parent_class = NULL; +static guint vis_signals[LAST_SIGNAL] = { 0 }; + +GType ui_svis_get_type() { + static GType vis_type = 0; + if (!vis_type) { + static const GTypeInfo vis_info = { + sizeof (UiSVisClass), + NULL, + NULL, + (GClassInitFunc) ui_svis_class_init, + NULL, + NULL, + sizeof (UiSVis), + 0, + (GInstanceInitFunc) ui_svis_init, + }; + vis_type = g_type_register_static (GTK_TYPE_WIDGET, "UiSVis", &vis_info, 0); + } + + return vis_type; +} + +static void ui_svis_class_init(UiSVisClass *klass) { + GtkObjectClass *object_class; + GtkWidgetClass *widget_class; + + object_class = (GtkObjectClass*) klass; + widget_class = (GtkWidgetClass*) klass; + parent_class = gtk_type_class (gtk_widget_get_type ()); + + object_class->destroy = ui_svis_destroy; + + widget_class->realize = ui_svis_realize; + widget_class->unrealize = ui_svis_unrealize; + widget_class->map = ui_svis_map; + widget_class->unmap = ui_svis_unmap; + widget_class->expose_event = ui_svis_expose; + widget_class->size_request = ui_svis_size_request; + widget_class->size_allocate = ui_svis_size_allocate; + + klass->doubled = ui_svis_toggle_doublesize; + + vis_signals[DOUBLED] = + g_signal_new ("toggle-double-size", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET (UiSVisClass, doubled), NULL, NULL, + gtk_marshal_VOID__VOID, G_TYPE_NONE, 0); +} + +static void ui_svis_init(UiSVis *svis) { + +} + +GtkWidget* ui_svis_new(GtkWidget *fixed, gint x, gint y) { + UiSVis *svis = g_object_new (ui_svis_get_type (), NULL); + + svis->x = x; + svis->y = y; + + svis->width = SVIS_WIDTH; + svis->height = SVIS_HEIGHT; + + svis->fixed = fixed; + svis->double_size = FALSE; + + svis->visible_window = TRUE; + svis->event_window = NULL; + + gtk_fixed_put(GTK_FIXED(svis->fixed), GTK_WIDGET(svis), svis->x, svis->y); + + return GTK_WIDGET(svis); +} + +static void ui_svis_destroy(GtkObject *object) { + UiSVis *svis; + + g_return_if_fail (object != NULL); + g_return_if_fail (UI_IS_SVIS (object)); + + svis = UI_SVIS (object); + + if (GTK_OBJECT_CLASS (parent_class)->destroy) + (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); +} + +static void ui_svis_realize(GtkWidget *widget) { + UiSVis *svis; + GdkWindowAttr attributes; + gint attributes_mask; + + g_return_if_fail (widget != NULL); + g_return_if_fail (UI_IS_SVIS(widget)); + + GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED); + svis = UI_SVIS(widget); + + attributes.x = widget->allocation.x; + attributes.y = widget->allocation.y; + attributes.width = widget->allocation.width; + attributes.height = widget->allocation.height; + attributes.window_type = GDK_WINDOW_CHILD; + attributes.event_mask = gtk_widget_get_events(widget); + attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK; + + if (svis->visible_window) + { + attributes.visual = gtk_widget_get_visual(widget); + attributes.colormap = gtk_widget_get_colormap(widget); + attributes.wclass = GDK_INPUT_OUTPUT; + attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; + widget->window = gdk_window_new(widget->parent->window, &attributes, attributes_mask); + GTK_WIDGET_UNSET_FLAGS(widget, GTK_NO_WINDOW); + gdk_window_set_user_data(widget->window, widget); + } + else + { + widget->window = gtk_widget_get_parent_window (widget); + g_object_ref (widget->window); + + attributes.wclass = GDK_INPUT_ONLY; + attributes_mask = GDK_WA_X | GDK_WA_Y; + svis->event_window = gdk_window_new (widget->window, &attributes, attributes_mask); + GTK_WIDGET_SET_FLAGS (widget, GTK_NO_WINDOW); + gdk_window_set_user_data(svis->event_window, widget); + } + + widget->style = gtk_style_attach(widget->style, widget->window); +} + +static void ui_svis_unrealize(GtkWidget *widget) { + UiSVis *svis; + svis = UI_SVIS(widget); + + if ( svis->event_window != NULL ) + { + gdk_window_set_user_data( svis->event_window , NULL ); + gdk_window_destroy( svis->event_window ); + svis->event_window = NULL; + } + + if (GTK_WIDGET_CLASS (parent_class)->unrealize) + (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget); +} + +static void ui_svis_map(GtkWidget *widget) +{ + UiSVis *svis; + svis = UI_SVIS(widget); + + if (svis->event_window != NULL) + gdk_window_show (svis->event_window); + + if (GTK_WIDGET_CLASS (parent_class)->map) + (* GTK_WIDGET_CLASS (parent_class)->map) (widget); +} + +static void ui_svis_unmap (GtkWidget *widget) +{ + UiSVis *svis; + svis = UI_SVIS(widget); + + if (svis->event_window != NULL) + gdk_window_hide (svis->event_window); + + if (GTK_WIDGET_CLASS (parent_class)->unmap) + (* GTK_WIDGET_CLASS (parent_class)->unmap) (widget); +} + +static void ui_svis_size_request(GtkWidget *widget, GtkRequisition *requisition) { + UiSVis *svis = UI_SVIS(widget); + + requisition->width = svis->width*(1+svis->double_size); + requisition->height = svis->height*(1+svis->double_size); +} + +static void ui_svis_size_allocate(GtkWidget *widget, GtkAllocation *allocation) { + UiSVis *svis = UI_SVIS (widget); + + widget->allocation = *allocation; + widget->allocation.x *= (1+svis->double_size); + widget->allocation.y *= (1+svis->double_size); + if (GTK_WIDGET_REALIZED (widget)) + { + if (svis->event_window != NULL) + gdk_window_move_resize(svis->event_window, widget->allocation.x, widget->allocation.y, allocation->width, allocation->height); + else + gdk_window_move_resize(widget->window, widget->allocation.x, widget->allocation.y, allocation->width, allocation->height); + } + + svis->x = widget->allocation.x/(svis->double_size ? 2 : 1); + svis->y = widget->allocation.y/(svis->double_size ? 2 : 1); +} + +static gboolean ui_svis_expose(GtkWidget *widget, GdkEventExpose *event) { + g_return_val_if_fail (widget != NULL, FALSE); + g_return_val_if_fail (UI_IS_SVIS (widget), FALSE); + g_return_val_if_fail (event != NULL, FALSE); + + UiSVis *svis = UI_SVIS (widget); + + 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; + + if (!GTK_WIDGET_VISIBLE(widget)) + return FALSE; + + if (!svis->visible_window) + return FALSE; + + 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->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->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->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->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->data[x << 1] / 3; + ptr = rgb_data + ((4 - h) * 38) + x; + *ptr = svis_scope_colors[h]; + } + } + + } + 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->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->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->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->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->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]; + } + } + + + } + + GdkPixmap *obj = NULL; + GdkGC *gc; + obj = gdk_pixmap_new(NULL, svis->width*(1+svis->double_size), svis->height*(1+svis->double_size), gdk_rgb_get_visual()->depth); + gc = gdk_gc_new(obj); + + if (!svis->double_size) { + gdk_draw_indexed_image(obj, gc, 0, 0, svis->width, svis->height, + GDK_RGB_DITHER_NORMAL, (guchar *) rgb_data, + 38, cmap); + } else { + gdk_draw_indexed_image(obj, gc, + 0 << 1, 0 << 1, + svis->width << 1, svis->height << 1, + GDK_RGB_DITHER_NONE, (guchar *) rgb_data, + 76, cmap); + } + + gdk_rgb_cmap_free(cmap); + gdk_draw_drawable (widget->window, gc, obj, 0, 0, 0, 0, + svis->width*(1+svis->double_size), svis->height*(1+svis->double_size)); + g_object_unref(obj); + g_object_unref(gc); + + return FALSE; +} + +static void ui_svis_toggle_doublesize(UiSVis *svis) { + GtkWidget *widget = GTK_WIDGET (svis); + svis->double_size = !svis->double_size; + + gtk_widget_set_size_request(widget, svis->width*(1+svis->double_size), svis->height*(1+svis->double_size)); + + gtk_widget_queue_draw(widget); +} + +void ui_svis_set_visible(GtkWidget *widget, gboolean window_is_visible) +{ + UiSVis *svis; + gboolean widget_is_visible; + + g_return_if_fail(UI_IS_SVIS(widget)); + + svis = UI_SVIS (widget); + widget_is_visible = GTK_WIDGET_VISIBLE(widget); + + svis->visible_window = window_is_visible; + + if (GTK_WIDGET_REALIZED (widget)) + { + if ( widget_is_visible ) + gtk_widget_hide(widget); + + gtk_widget_unrealize(widget); + gtk_widget_realize(widget); + + if ( widget_is_visible ) + gtk_widget_show(widget); + } + + if (widget_is_visible) + gtk_widget_queue_resize(widget); +} + +void ui_svis_clear_data(GtkWidget *widget) { + gint i; + + UiSVis *svis = UI_SVIS (widget); + + for (i = 0; i < 75; i++) { + svis->data[i] = (cfg.vis_type == VIS_SCOPE) ? 6 : 0; + } +} + +void ui_svis_timeout_func(GtkWidget *widget, guchar * data) { + UiSVis *svis = UI_SVIS (widget); + 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->data[i]) + svis->data[i] = data[i]; + else if (falloff) { + if (svis->data[i] >= 2) + svis->data[i] -= 2; + else + svis->data[i] = 0; + } + } + + } + } + else if (data) { + for (i = 0; i < 75; i++) + svis->data[i] = data[i]; + } + + if (micros > 14000) { + if (!svis->refresh_delay) { + gtk_widget_queue_draw(widget); + svis->refresh_delay = svis_redraw_delays[cfg.vis_refresh]; + } + svis->refresh_delay--; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audacious/ui_svis.h Tue Jul 17 18:33:49 2007 +0900 @@ -0,0 +1,64 @@ +/* + * Audacious - a cross-platform multimedia player + * Copyright (c) 2007 Audacious 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; under version 2 of the License. + * + * 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 UISVIS_H +#define UISVIS_H + +#include <gdk/gdk.h> +#include <gtk/gtkadjustment.h> +#include <gtk/gtkwidget.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define UI_SVIS(obj) GTK_CHECK_CAST (obj, ui_svis_get_type (), UiSVis) +#define UI_SVIS_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, ui_svis_get_type (), UiSVisClass) +#define UI_IS_SVIS(obj) GTK_CHECK_TYPE (obj, ui_svis_get_type ()) + +typedef struct _UiSVis UiSVis; +typedef struct _UiSVisClass UiSVisClass; + +struct _UiSVis { + GtkWidget widget; + + gint x, y, width, height; + gint data[75]; + gint refresh_delay; + gboolean double_size; + GtkWidget *fixed; + gboolean visible_window; + GdkWindow *event_window; +}; + +struct _UiSVisClass { + GtkWidgetClass parent_class; + void (* doubled) (UiSVis *vis); +}; + +GtkWidget* ui_svis_new (GtkWidget *fixed, gint x, gint y); +GtkType ui_svis_get_type(void); +void ui_svis_clear_data(GtkWidget *widget); +void ui_svis_timeout_func(GtkWidget *widget, guchar * data); +void ui_svis_set_visible(GtkWidget *widget, gboolean window_is_visible); + +#ifdef __cplusplus +} +#endif + +#endif
--- a/src/audacious/ui_vis.c Tue Jul 17 18:28:54 2007 +0900 +++ b/src/audacious/ui_vis.c Tue Jul 17 18:33:49 2007 +0900 @@ -53,6 +53,8 @@ static void ui_vis_destroy (GtkObject *object); static void ui_vis_realize (GtkWidget *widget); static void ui_vis_unrealize (GtkWidget *widget); +static void ui_vis_map (GtkWidget *widget); +static void ui_vis_unmap (GtkWidget *widget); static void ui_vis_size_request (GtkWidget *widget, GtkRequisition *requisition); static void ui_vis_size_allocate (GtkWidget *widget, GtkAllocation *allocation); static gboolean ui_vis_expose (GtkWidget *widget, GdkEventExpose *event); @@ -93,6 +95,8 @@ widget_class->realize = ui_vis_realize; widget_class->unrealize = ui_vis_unrealize; + widget_class->map = ui_vis_map; + widget_class->unmap = ui_vis_unmap; widget_class->expose_event = ui_vis_expose; widget_class->size_request = ui_vis_size_request; widget_class->size_allocate = ui_vis_size_allocate; @@ -122,6 +126,7 @@ vis->double_size = FALSE; vis->visible_window = TRUE; + vis->event_window = NULL; gtk_fixed_put(GTK_FIXED(vis->fixed), GTK_WIDGET(vis), vis->x, vis->y); @@ -166,27 +171,63 @@ attributes.wclass = GDK_INPUT_OUTPUT; attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; widget->window = gdk_window_new(widget->parent->window, &attributes, attributes_mask); + GTK_WIDGET_UNSET_FLAGS(widget, GTK_NO_WINDOW); + gdk_window_set_user_data(widget->window, widget); } else { + widget->window = gtk_widget_get_parent_window (widget); + g_object_ref (widget->window); + attributes.wclass = GDK_INPUT_ONLY; attributes_mask = GDK_WA_X | GDK_WA_Y; - widget->window = gdk_window_new (widget->parent->window, &attributes, attributes_mask); + vis->event_window = gdk_window_new (widget->window, &attributes, attributes_mask); + GTK_WIDGET_SET_FLAGS (widget, GTK_NO_WINDOW); + gdk_window_set_user_data(vis->event_window, widget); } widget->style = gtk_style_attach(widget->style, widget->window); - - gdk_window_set_user_data(widget->window, widget); } static void ui_vis_unrealize(GtkWidget *widget) { UiVis *vis; vis = UI_VIS(widget); + if ( vis->event_window != NULL ) + { + gdk_window_set_user_data( vis->event_window , NULL ); + gdk_window_destroy( vis->event_window ); + vis->event_window = NULL; + } + if (GTK_WIDGET_CLASS (parent_class)->unrealize) (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget); } +static void ui_vis_map(GtkWidget *widget) +{ + UiVis *vis; + vis = UI_VIS(widget); + + if (vis->event_window != NULL) + gdk_window_show (vis->event_window); + + if (GTK_WIDGET_CLASS (parent_class)->map) + (* GTK_WIDGET_CLASS (parent_class)->map) (widget); +} + +static void ui_vis_unmap (GtkWidget *widget) +{ + UiVis *vis; + vis = UI_VIS(widget); + + if (vis->event_window != NULL) + gdk_window_hide (vis->event_window); + + if (GTK_WIDGET_CLASS (parent_class)->unmap) + (* GTK_WIDGET_CLASS (parent_class)->unmap) (widget); +} + static void ui_vis_size_request(GtkWidget *widget, GtkRequisition *requisition) { UiVis *vis = UI_VIS(widget); @@ -201,7 +242,12 @@ widget->allocation.x *= (1+vis->double_size); widget->allocation.y *= (1+vis->double_size); if (GTK_WIDGET_REALIZED (widget)) - gdk_window_move_resize(widget->window, widget->allocation.x, widget->allocation.y, allocation->width, allocation->height); + { + if (vis->event_window != NULL) + gdk_window_move_resize(vis->event_window, widget->allocation.x, widget->allocation.y, allocation->width, allocation->height); + else + gdk_window_move_resize(widget->window, widget->allocation.x, widget->allocation.y, allocation->width, allocation->height); + } vis->x = widget->allocation.x/(vis->double_size ? 2 : 1); vis->y = widget->allocation.y/(vis->double_size ? 2 : 1);
--- a/src/audacious/ui_vis.h Tue Jul 17 18:28:54 2007 +0900 +++ b/src/audacious/ui_vis.h Tue Jul 17 18:33:49 2007 +0900 @@ -76,6 +76,7 @@ gboolean double_size; GtkWidget *fixed; gboolean visible_window; + GdkWindow *event_window; }; struct _UiVisClass {
--- a/src/audacious/util.c Tue Jul 17 18:28:54 2007 +0900 +++ b/src/audacious/util.c Tue Jul 17 18:33:49 2007 +0900 @@ -859,6 +859,25 @@ return out; } +GdkPixmap *create_dblsize_pixmap(GdkPixmap *pix) { + int w, h; + gdk_drawable_get_size(pix, &w, &h); + GdkGC* gc = gdk_gc_new(pix); + GdkPixbuf *img, *img2x; + GdkColormap *colormap = gdk_colormap_get_system(); + img = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, w, h); + gdk_pixbuf_get_from_drawable(img, pix, colormap, 0, 0, 0, 0, w, h); + img2x = gdk_pixbuf_scale_simple(img, w*2, h*2, GDK_INTERP_NEAREST); + + GdkPixmap *image; + image = gdk_pixmap_new(NULL, w*2, h*2, gdk_rgb_get_visual()->depth); + gdk_draw_pixbuf(image, gc, img2x, 0, 0, 0, 0, w*2, h*2, GDK_RGB_DITHER_NONE, 0, 0); + g_object_unref(img); + g_object_unref(img2x); + g_object_unref(gc); + return image; +} + GdkImage *create_dblsize_image(GdkImage * img) { #ifdef GDK_WINDOWING_X11
--- a/src/audacious/util.h Tue Jul 17 18:28:54 2007 +0900 +++ b/src/audacious/util.h Tue Jul 17 18:33:49 2007 +0900 @@ -107,6 +107,7 @@ gboolean xmms_check_realtime_priority(void); void xmms_usleep(gint usec); +GdkPixmap *create_dblsize_pixmap(GdkPixmap *pix); GdkImage *create_dblsize_image(GdkImage * img); GdkPixbuf *audacious_create_colorized_pixbuf(GdkPixbuf *src, gint red, gint green, gint blue);
--- a/src/audacious/visualization.c Tue Jul 17 18:28:54 2007 +0900 +++ b/src/audacious/visualization.c Tue Jul 17 18:33:49 2007 +0900 @@ -284,7 +284,7 @@ if (!pcm_data || nch < 1) { if (cfg.vis_type != VIS_OFF) { if (cfg.player_shaded && cfg.player_visible) - svis_timeout_func(mainwin_svis, NULL); + ui_svis_timeout_func(mainwin_svis, NULL); else ui_vis_timeout_func(mainwin_vis, NULL); } @@ -464,7 +464,7 @@ } } if (cfg.player_shaded && cfg.player_visible) - svis_timeout_func(mainwin_svis, intern_vis_data); + ui_svis_timeout_func(mainwin_svis, intern_vis_data); else ui_vis_timeout_func(mainwin_vis, intern_vis_data); }
--- a/src/audacious/widgets/Makefile Tue Jul 17 18:28:54 2007 +0900 +++ b/src/audacious/widgets/Makefile Tue Jul 17 18:33:49 2007 +0900 @@ -20,11 +20,6 @@ SOURCES = \ widget.c \ - hslider.c \ - menurow.c \ - monostereo.c \ - svis.c \ - playstatus.c \ playlist_list.c \ playlist_slider.c \ eq_graph.c \
--- a/src/audacious/widgets/eq_graph.c Tue Jul 17 18:28:54 2007 +0900 +++ b/src/audacious/widgets/eq_graph.c Tue Jul 17 18:33:49 2007 +0900 @@ -6,8 +6,7 @@ * * 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. + * the Free Software Foundation; under version 2 of the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of
--- a/src/audacious/widgets/eq_graph.h Tue Jul 17 18:28:54 2007 +0900 +++ b/src/audacious/widgets/eq_graph.h Tue Jul 17 18:33:49 2007 +0900 @@ -6,8 +6,7 @@ * * 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. + * the Free Software Foundation; under version 2 of the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of
--- a/src/audacious/widgets/eq_slider.c Tue Jul 17 18:28:54 2007 +0900 +++ b/src/audacious/widgets/eq_slider.c Tue Jul 17 18:33:49 2007 +0900 @@ -6,8 +6,7 @@ * * 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. + * the Free Software Foundation; under version 2 of the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of
--- a/src/audacious/widgets/eq_slider.h Tue Jul 17 18:28:54 2007 +0900 +++ b/src/audacious/widgets/eq_slider.h Tue Jul 17 18:33:49 2007 +0900 @@ -6,8 +6,7 @@ * * 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. + * the Free Software Foundation; under version 2 of the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of
--- a/src/audacious/widgets/hslider.c Tue Jul 17 18:28:54 2007 +0900 +++ /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 Tue Jul 17 18:28:54 2007 +0900 +++ /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/menurow.c Tue Jul 17 18:28:54 2007 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,186 +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 "main.h" -#include "menurow.h" -#include "widget.h" - -void -menurow_draw(Widget * widget) -{ - MenuRow *mr = MENU_ROW(widget); - - GdkPixmap *obj = mr->mr_widget.parent; - - if (mr->mr_selected == MENUROW_NONE) { - if (cfg.always_show_cb || mr->mr_bpushed) - skin_draw_pixmap(bmp_active_skin, obj, - mr->mr_widget.gc, - mr->mr_skin_index, - mr->mr_nx, mr->mr_ny, - mr->mr_widget.x, mr->mr_widget.y, 8, 43); - else - skin_draw_pixmap(bmp_active_skin, obj, - mr->mr_widget.gc, - mr->mr_skin_index, - mr->mr_nx + 8, mr->mr_ny, - mr->mr_widget.x, mr->mr_widget.y, 8, 43); - } - else { - skin_draw_pixmap(bmp_active_skin, obj, - mr->mr_widget.gc, - mr->mr_skin_index, - mr->mr_sx + ((mr->mr_selected - 1) * 8), - mr->mr_sy, mr->mr_widget.x, mr->mr_widget.y, 8, 43); - } - if (cfg.always_show_cb || mr->mr_bpushed) { - if (mr->mr_always_selected) - skin_draw_pixmap(bmp_active_skin, obj, - mr->mr_widget.gc, - mr->mr_skin_index, - mr->mr_sx + 8, mr->mr_sy + 10, - mr->mr_widget.x, mr->mr_widget.y + 10, 8, 8); - if (mr->mr_doublesize_selected) - skin_draw_pixmap(bmp_active_skin, obj, - mr->mr_widget.gc, - mr->mr_skin_index, - mr->mr_sx + 24, mr->mr_sy + 26, - mr->mr_widget.x, mr->mr_widget.y + 26, 8, 8); - } - -} - -MenuRowItem -menurow_find_selected(MenuRow * mr, gint x, gint y) -{ - MenuRowItem ret = MENUROW_NONE; - - x -= mr->mr_widget.x; - y -= mr->mr_widget.y; - if (x > 0 && x < 8) { - if (y >= 0 && y <= 10) - ret = MENUROW_OPTIONS; - if (y >= 10 && y <= 17) - ret = MENUROW_ALWAYS; - if (y >= 18 && y <= 25) - ret = MENUROW_FILEINFOBOX; - if (y >= 26 && y <= 33) - ret = MENUROW_DOUBLESIZE; - if (y >= 34 && y <= 42) - ret = MENUROW_VISUALIZATION; - } - return ret; -} - -void -menurow_button_press(GtkWidget * widget, - GdkEventButton * event, - gpointer data) -{ - MenuRow *mr = MENU_ROW(data); - - if (event->button != 1) - return; - - if (widget_contains(&mr->mr_widget, event->x, event->y)) { - mr->mr_bpushed = TRUE; - mr->mr_selected = menurow_find_selected(mr, event->x, event->y); - - widget_draw(WIDGET(mr)); - - if (mr->mr_change_callback) - mr->mr_change_callback(mr->mr_selected); - } -} - -void -menurow_motion(GtkWidget * widget, - GdkEventMotion * event, - gpointer data) -{ - MenuRow *mr = MENU_ROW(data); - - if (mr->mr_bpushed) { - mr->mr_selected = menurow_find_selected(mr, event->x, event->y); - - widget_draw(WIDGET(mr)); - - if (mr->mr_change_callback) - mr->mr_change_callback(mr->mr_selected); - } -} - -void -menurow_button_release(GtkWidget * widget, - GdkEventButton * event, - gpointer data) -{ - MenuRow *mr = MENU_ROW(data); - - if (mr->mr_bpushed) { - mr->mr_bpushed = FALSE; - - if (mr->mr_selected == MENUROW_ALWAYS) - mr->mr_always_selected = !mr->mr_always_selected; - - if (mr->mr_selected == MENUROW_DOUBLESIZE) - mr->mr_doublesize_selected = !mr->mr_doublesize_selected; - - if ((int)(mr->mr_selected) != -1 && mr->mr_release_callback) - mr->mr_release_callback(mr->mr_selected); - - mr->mr_selected = MENUROW_NONE; - - widget_draw(WIDGET(mr)); - } -} - -MenuRow * -create_menurow(GList ** wlist, GdkPixmap * parent, GdkGC * gc, - gint x, gint y, gint nx, gint ny, gint sx, gint sy, - void (*ccb) (MenuRowItem), - void (*rcb) (MenuRowItem), SkinPixmapId si) -{ - MenuRow *mr; - - mr = g_new0(MenuRow, 1); - widget_init(&mr->mr_widget, parent, gc, x, y, 8, 43, 1); - mr->mr_widget.draw = menurow_draw; - mr->mr_widget.button_press_cb = menurow_button_press; - mr->mr_widget.motion_cb = menurow_motion; - mr->mr_widget.button_release_cb = menurow_button_release; - mr->mr_nx = nx; - mr->mr_ny = ny; - mr->mr_sx = sx; - mr->mr_sy = sy; - mr->mr_selected = MENUROW_NONE; - mr->mr_change_callback = ccb; - mr->mr_release_callback = rcb; - mr->mr_skin_index = si; - - widget_list_add(wlist, WIDGET(mr)); - return mr; -}
--- a/src/audacious/widgets/menurow.h Tue Jul 17 18:28:54 2007 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +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 MENUROW_H -#define MENUROW_H - -#include <glib.h> -#include <gdk/gdk.h> - -#include "skin.h" -#include "widget.h" - -typedef enum { - MENUROW_NONE, MENUROW_OPTIONS, MENUROW_ALWAYS, MENUROW_FILEINFOBOX, - MENUROW_DOUBLESIZE, MENUROW_VISUALIZATION -} MenuRowItem; - -#define MENU_ROW(x) ((MenuRow *)(x)) -struct _MenuRow { - Widget mr_widget; - gint mr_nx, mr_ny; - gint mr_sx, mr_sy; - MenuRowItem mr_selected; - gboolean mr_bpushed; - gboolean mr_always_selected; - gboolean mr_doublesize_selected; - void (*mr_change_callback) (MenuRowItem); - void (*mr_release_callback) (MenuRowItem); - SkinPixmapId mr_skin_index; -}; - -typedef struct _MenuRow MenuRow; - -MenuRow *create_menurow(GList ** wlist, GdkPixmap * parent, GdkGC * gc, - gint x, gint y, gint nx, gint ny, gint sx, gint sy, - void (*ccb) (MenuRowItem), - void (*rcb) (MenuRowItem), SkinPixmapId si); - -#endif
--- a/src/audacious/widgets/monostereo.c Tue Jul 17 18:28:54 2007 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +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 "skin.h" -#include "widget.h" - -void -monostereo_draw(Widget * widget) -{ - MonoStereo *ms = (MonoStereo *) widget; - GdkPixmap *obj; - - obj = ms->ms_widget.parent; - - switch (ms->ms_num_channels) { - case 0: - skin_draw_pixmap(bmp_active_skin, obj, ms->ms_widget.gc, - ms->ms_skin_index, 29, 12, - ms->ms_widget.x, ms->ms_widget.y, 27, 12); - skin_draw_pixmap(bmp_active_skin, obj, ms->ms_widget.gc, - ms->ms_skin_index, 0, 12, - ms->ms_widget.x + 27, ms->ms_widget.y, 29, 12); - break; - case 1: - skin_draw_pixmap(bmp_active_skin, obj, ms->ms_widget.gc, - ms->ms_skin_index, 29, 0, - ms->ms_widget.x, ms->ms_widget.y, 27, 12); - skin_draw_pixmap(bmp_active_skin, obj, ms->ms_widget.gc, - ms->ms_skin_index, 0, 12, - ms->ms_widget.x + 27, ms->ms_widget.y, 29, 12); - break; - case 2: - skin_draw_pixmap(bmp_active_skin, obj, ms->ms_widget.gc, - ms->ms_skin_index, 29, 12, - ms->ms_widget.x, ms->ms_widget.y, 27, 12); - skin_draw_pixmap(bmp_active_skin, obj, ms->ms_widget.gc, - ms->ms_skin_index, 0, 0, - ms->ms_widget.x + 27, ms->ms_widget.y, 29, 12); - break; - } -} - -void -monostereo_set_num_channels(MonoStereo * ms, - gint nch) -{ - if (!ms) - return; - - ms->ms_num_channels = nch; - widget_draw(WIDGET(ms)); -} - -MonoStereo * -create_monostereo(GList ** wlist, - GdkPixmap * parent, - GdkGC * gc, - gint x, gint y, - SkinPixmapId si) -{ - MonoStereo *ms; - - ms = g_new0(MonoStereo, 1); - widget_init(&ms->ms_widget, parent, gc, x, y, 56, 12, 1); - ms->ms_widget.draw = monostereo_draw; - ms->ms_skin_index = si; - - widget_list_add(wlist, WIDGET(ms)); - return ms; -}
--- a/src/audacious/widgets/monostereo.h Tue Jul 17 18:28:54 2007 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +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 MONOSTEREO_H -#define MONOSTEREO_H - -#include <glib.h> -#include <gdk/gdk.h> - -#include "skin.h" -#include "widget.h" - -#define MONO_STEREO(x) ((MonoStereo *)(x)) -struct _MonoStereo { - Widget ms_widget; - gint ms_num_channels; - SkinPixmapId ms_skin_index; -}; - -typedef struct _MonoStereo MonoStereo; - -MonoStereo *create_monostereo(GList ** wlist, GdkPixmap * parent, - GdkGC * gc, gint x, gint y, SkinPixmapId si); -void monostereo_set_num_channels(MonoStereo * ms, gint nch); - -#endif
--- a/src/audacious/widgets/playlist_list.c Tue Jul 17 18:28:54 2007 +0900 +++ b/src/audacious/widgets/playlist_list.c Tue Jul 17 18:33:49 2007 +0900 @@ -9,8 +9,7 @@ * * 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. + * the Free Software Foundation; under version 2 of the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -492,9 +491,10 @@ strings should be kept properly. */ if (!entry->title) { - gchar *basename = g_path_get_basename(entry->filename); + gchar *realfn = g_filename_from_uri(entry->filename, NULL, NULL); + gchar *basename = g_path_get_basename(realfn ? realfn : entry->filename); title = filename_to_utf8(basename); - g_free(basename); + g_free(basename); g_free(realfn); } else title = str_to_utf8(entry->title);
--- a/src/audacious/widgets/playlist_list.h Tue Jul 17 18:28:54 2007 +0900 +++ b/src/audacious/widgets/playlist_list.h Tue Jul 17 18:33:49 2007 +0900 @@ -6,8 +6,7 @@ * * 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. + * the Free Software Foundation; under version 2 of the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of
--- a/src/audacious/widgets/playlist_slider.c Tue Jul 17 18:28:54 2007 +0900 +++ b/src/audacious/widgets/playlist_slider.c Tue Jul 17 18:33:49 2007 +0900 @@ -6,8 +6,7 @@ * * 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. + * the Free Software Foundation; under version 2 of the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of
--- a/src/audacious/widgets/playlist_slider.h Tue Jul 17 18:28:54 2007 +0900 +++ b/src/audacious/widgets/playlist_slider.h Tue Jul 17 18:33:49 2007 +0900 @@ -6,8 +6,7 @@ * * 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. + * the Free Software Foundation; under version 2 of the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of
--- a/src/audacious/widgets/playstatus.c Tue Jul 17 18:28:54 2007 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +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 "skin.h" -#include "widget.h" - -void -playstatus_draw(Widget * w) -{ - PlayStatus *ps = PLAY_STATUS(w); - GdkPixmap *obj; - - if (!w) - return; - - obj = ps->ps_widget.parent; - if (ps->ps_status == STATUS_STOP && ps->ps_status_buffering == TRUE) - ps->ps_status_buffering = FALSE; - if (ps->ps_status == STATUS_PLAY && ps->ps_status_buffering == TRUE) - skin_draw_pixmap(bmp_active_skin, obj, ps->ps_widget.gc, - SKIN_PLAYPAUSE, 39, 0, ps->ps_widget.x, - ps->ps_widget.y, 3, 9); - else if (ps->ps_status == STATUS_PLAY) - skin_draw_pixmap(bmp_active_skin, obj, ps->ps_widget.gc, - SKIN_PLAYPAUSE, 36, 0, ps->ps_widget.x, - ps->ps_widget.y, 3, 9); - else - skin_draw_pixmap(bmp_active_skin, obj, ps->ps_widget.gc, - SKIN_PLAYPAUSE, 27, 0, ps->ps_widget.x, - ps->ps_widget.y, 2, 9); - switch (ps->ps_status) { - case STATUS_STOP: - skin_draw_pixmap(bmp_active_skin, obj, ps->ps_widget.gc, - SKIN_PLAYPAUSE, 18, 0, - ps->ps_widget.x + 2, ps->ps_widget.y, 9, 9); - break; - case STATUS_PAUSE: - skin_draw_pixmap(bmp_active_skin, obj, ps->ps_widget.gc, - SKIN_PLAYPAUSE, 9, 0, - ps->ps_widget.x + 2, ps->ps_widget.y, 9, 9); - break; - case STATUS_PLAY: - skin_draw_pixmap(bmp_active_skin, obj, ps->ps_widget.gc, - SKIN_PLAYPAUSE, 1, 0, - ps->ps_widget.x + 3, ps->ps_widget.y, 8, 9); - break; - } -} - -void -playstatus_set_status(PlayStatus * ps, PStatus status) -{ - if (!ps) - return; - - ps->ps_status = status; - widget_draw(WIDGET(ps)); -} - -void -playstatus_set_status_buffering(PlayStatus * ps, gboolean status) -{ - if (!ps) - return; - - ps->ps_status_buffering = status; - widget_draw(WIDGET(ps)); -} - -PlayStatus * -create_playstatus(GList ** wlist, GdkPixmap * parent, - GdkGC * gc, gint x, gint y) -{ - PlayStatus *ps; - - ps = g_new0(PlayStatus, 1); - widget_init(&ps->ps_widget, parent, gc, x, y, 11, 9, TRUE); - ps->ps_widget.draw = playstatus_draw; - - widget_list_add(wlist, WIDGET(ps)); - return ps; -}
--- a/src/audacious/widgets/playstatus.h Tue Jul 17 18:28:54 2007 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +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 PLAYSTATUS_H -#define PLAYSTATUS_H - -#include "widget.h" - -typedef enum { - STATUS_STOP, STATUS_PAUSE, STATUS_PLAY -} PStatus; - -#define PLAY_STATUS(x) ((PlayStatus *)(x)) -struct _PlayStatus { - Widget ps_widget; - PStatus ps_status; - gboolean ps_status_buffering; -}; - -typedef struct _PlayStatus PlayStatus; - -void playstatus_set_status(PlayStatus * ps, PStatus status); -void playstatus_set_status_buffering(PlayStatus * ps, gboolean status); -PlayStatus *create_playstatus(GList ** wlist, GdkPixmap * parent, - GdkGC * gc, gint x, gint y); - -#endif
--- a/src/audacious/widgets/skin.c Tue Jul 17 18:28:54 2007 +0900 +++ b/src/audacious/widgets/skin.c Tue Jul 17 18:33:49 2007 +0900 @@ -6,8 +6,7 @@ * * 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. + * the Free Software Foundation; under version 2 of the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -1621,7 +1620,18 @@ if (xsrc+width > pixmap->width || ysrc+height > pixmap->height) { if (pixmap_id == SKIN_NUMBERS) xsrc = 90; - else + else if (pixmap_id == SKIN_VOLUME) { + /* some winamp skins have too strait SKIN_VOLUME, so let's copy what's remain from SKIN_MAIN */ + gdk_draw_drawable(drawable, gc, skin_get_pixmap(bmp_active_skin, SKIN_MAIN)->pixmap, + skin->properties.mainwin_volume_x, skin->properties.mainwin_volume_y, + pixmap->width, ydest, width - pixmap->width, height); + width = pixmap->width; + } else if (pixmap_id == SKIN_MONOSTEREO) { + /* XMMS skins seems to have SKIN_MONOSTEREO with size 58x20 instead of 58x24 */ + gdk_draw_drawable(drawable, gc, skin_get_pixmap(bmp_active_skin, SKIN_MAIN)->pixmap, + 212 + xdest, 41, xdest, ydest, width, height); + height = pixmap->height/2; + } else return; }
--- a/src/audacious/widgets/skin.h Tue Jul 17 18:28:54 2007 +0900 +++ b/src/audacious/widgets/skin.h Tue Jul 17 18:33:49 2007 +0900 @@ -6,8 +6,7 @@ * * 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. + * the Free Software Foundation; under version 2 of the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of
--- a/src/audacious/widgets/svis.c Tue Jul 17 18:28:54 2007 +0900 +++ /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 Tue Jul 17 18:28:54 2007 +0900 +++ /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
--- a/src/audacious/widgets/widget.c Tue Jul 17 18:28:54 2007 +0900 +++ b/src/audacious/widgets/widget.c Tue Jul 17 18:33:49 2007 +0900 @@ -6,8 +6,7 @@ * * 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. + * the Free Software Foundation; under version 2 of the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of
--- a/src/audacious/widgets/widget.h Tue Jul 17 18:28:54 2007 +0900 +++ b/src/audacious/widgets/widget.h Tue Jul 17 18:33:49 2007 +0900 @@ -6,8 +6,7 @@ * * 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. + * the Free Software Foundation; under version 2 of the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of
--- a/src/audacious/widgets/widgetcore.h Tue Jul 17 18:28:54 2007 +0900 +++ b/src/audacious/widgets/widgetcore.h Tue Jul 17 18:33:49 2007 +0900 @@ -4,8 +4,7 @@ * * 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. + * the Free Software Foundation; under version 2 of the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -22,14 +21,9 @@ #include "eq_graph.h" #include "eq_slider.h" -#include "hslider.h" -#include "menurow.h" -#include "monostereo.h" #include "playlist_list.h" #include "playlist_slider.h" -#include "playstatus.h" #include "skin.h" -#include "svis.h" #include "widget.h" #endif