Mercurial > audlegacy
changeset 3072:84de3244aeaa
replace Playstatus with UiSkinnedPlaystatus
author | Tomasz Mon <desowin@gmail.com> |
---|---|
date | Fri, 13 Jul 2007 22:28:20 +0200 |
parents | 5ae86bc2233d |
children | da99b90d63d3 |
files | src/audacious/Makefile src/audacious/input.c src/audacious/playback.c src/audacious/ui_main.c src/audacious/ui_main.h src/audacious/ui_skinned_playstatus.c src/audacious/ui_skinned_playstatus.h src/audacious/widgets/Makefile src/audacious/widgets/playstatus.c src/audacious/widgets/playstatus.h src/audacious/widgets/widgetcore.h |
diffstat | 11 files changed, 347 insertions(+), 162 deletions(-) [+] |
line wrap: on
line diff
--- a/src/audacious/Makefile Fri Jul 13 21:49:14 2007 +0200 +++ b/src/audacious/Makefile Fri Jul 13 22:28:20 2007 +0200 @@ -115,6 +115,7 @@ ui_vis.c \ ui_svis.c \ ui_skinned_menurow.c \ + ui_skinned_playstatus.c \ ui_skinselector.c \ ui_urlopener.c \ util.c \
--- a/src/audacious/input.c Fri Jul 13 21:49:14 2007 +0200 +++ b/src/audacious/input.c Fri Jul 13 22:28:20 2007 +0200 @@ -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" @@ -747,10 +748,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/playback.c Fri Jul 13 21:49:14 2007 +0200 +++ b/src/audacious/playback.c Fri Jul 13 22:28:20 2007 +0200 @@ -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 "playback.h" @@ -146,9 +147,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 @@ -187,7 +188,7 @@ g_source_remove(song_info_timeout_source); 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/ui_main.c Fri Jul 13 21:49:14 2007 +0200 +++ b/src/audacious/ui_main.c Fri Jul 13 22:28:20 2007 +0200 @@ -86,6 +86,7 @@ #include "ui_skinned_number.h" #include "ui_skinned_horizontal_slider.h" #include "ui_skinned_menurow.h" +#include "ui_skinned_playstatus.h" #include "ui_jumptotrack.h" static GTimeVal cb_time; /* click delay for tristate is defined by TRISTATE_THRESHOLD */ @@ -141,7 +142,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; @@ -780,7 +781,7 @@ 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) @@ -922,7 +923,7 @@ 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) @@ -976,7 +977,7 @@ 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); @@ -2834,8 +2835,7 @@ 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_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); @@ -2892,7 +2892,6 @@ /* XXX: eventually update widgetcore API to not need this */ ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_monostereo)); - ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_playstatus)); } static void
--- a/src/audacious/ui_main.h Fri Jul 13 21:49:14 2007 +0200 +++ b/src/audacious/ui_main.h Fri Jul 13 22:28:20 2007 +0200 @@ -109,7 +109,7 @@ extern GtkWidget *mainwin_vis; 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;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audacious/ui_skinned_playstatus.c Fri Jul 13 22:28:20 2007 +0200 @@ -0,0 +1,260 @@ +/* + * 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; + image = gdk_pixmap_new(NULL, playstatus->width*(1+playstatus->double_size), + playstatus->height*(1+playstatus->double_size), + gdk_rgb_get_visual()->depth); + + if (playstatus->double_size) { + GdkImage *img, *img2x; + img = gdk_drawable_get_image(obj, 0, 0, playstatus->width, playstatus->height); + img2x = create_dblsize_image(img); + gdk_draw_image (image, gc, img2x, 0, 0, 0, 0, playstatus->width*2, playstatus->height*2); + g_object_unref(img2x); + g_object_unref(img); + } else + 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 Fri Jul 13 22:28:20 2007 +0200 @@ -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/widgets/Makefile Fri Jul 13 21:49:14 2007 +0200 +++ b/src/audacious/widgets/Makefile Fri Jul 13 22:28:20 2007 +0200 @@ -21,7 +21,6 @@ SOURCES = \ widget.c \ monostereo.c \ - playstatus.c \ playlist_list.c \ playlist_slider.c \ eq_graph.c \
--- a/src/audacious/widgets/playstatus.c Fri Jul 13 21:49:14 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,101 +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; 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 "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 Fri Jul 13 21:49:14 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +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; 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 _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/widgetcore.h Fri Jul 13 21:49:14 2007 +0200 +++ b/src/audacious/widgets/widgetcore.h Fri Jul 13 22:28:20 2007 +0200 @@ -24,7 +24,6 @@ #include "monostereo.h" #include "playlist_list.h" #include "playlist_slider.h" -#include "playstatus.h" #include "skin.h" #include "widget.h"