changeset 3001:6d4b7b739232 trunk

fully implement UiSkinnedNumber, number.c no longer needed
author Tomasz Mon <desowin@gmail.com>
date Sun, 08 Jul 2007 12:21:09 +0200
parents bbca1e0e054a
children 26c68f59663d
files src/audacious/Makefile src/audacious/genevent.c src/audacious/playback.c src/audacious/ui_main.c src/audacious/ui_main.h src/audacious/ui_skinned_number.c src/audacious/ui_skinned_number.h src/audacious/widgets/Makefile src/audacious/widgets/skin.c src/audacious/widgets/widgetcore.h
diffstat 10 files changed, 407 insertions(+), 72 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/Makefile	Sun Jul 08 10:23:16 2007 +0200
+++ b/src/audacious/Makefile	Sun Jul 08 12:21:09 2007 +0200
@@ -106,6 +106,7 @@
 	ui_skinned_window.c \
 	ui_skinned_button.c \
 	ui_skinned_textbox.c \
+	ui_skinned_number.c \
 	ui_skinselector.c \
 	ui_urlopener.c \
 	util.c \
--- a/src/audacious/genevent.c	Sun Jul 08 10:23:16 2007 +0200
+++ b/src/audacious/genevent.c	Sun Jul 08 12:21:09 2007 +0200
@@ -56,6 +56,7 @@
 #include "ui_main.h"
 #include "ui_playlist.h"
 #include "ui_skinned_textbox.h"
+#include "ui_skinned_number.h"
 #include "util.h"
 #include "visualization.h"
 #include "vfs.h"
@@ -82,10 +83,10 @@
             (gint) g_timer_elapsed(pause_timer, NULL);
 
         if (mainwin_10min_num != NULL) {
-            number_set_number(mainwin_10min_num, timeleft / 600);
-            number_set_number(mainwin_min_num, (timeleft / 60) % 10);
-            number_set_number(mainwin_10sec_num, (timeleft / 10) % 6);
-            number_set_number(mainwin_sec_num, timeleft % 10);
+            ui_skinned_number_set_number(mainwin_10min_num, timeleft / 600);
+            ui_skinned_number_set_number(mainwin_min_num, (timeleft / 60) % 10);
+            ui_skinned_number_set_number(mainwin_10sec_num, (timeleft / 10) % 6);
+            ui_skinned_number_set_number(mainwin_sec_num, timeleft % 10);
         }
 
         if (mainwin_sposition != NULL && !mainwin_sposition->hs_pressed) {
@@ -93,9 +94,11 @@
 
             time_str = g_strdup_printf("%2.2d", timeleft / 60);
             ui_skinned_textbox_set_text(mainwin_stime_min, time_str);
+            g_free(time_str);
 
             time_str = g_strdup_printf("%2.2d", timeleft % 60);
             ui_skinned_textbox_set_text(mainwin_stime_sec, time_str);
+            g_free(time_str);
         }
 
         playlistwin_set_time(timeleft * 1000, 0, TIMER_ELAPSED);
--- a/src/audacious/playback.c	Sun Jul 08 10:23:16 2007 +0200
+++ b/src/audacious/playback.c	Sun Jul 08 12:21:09 2007 +0200
@@ -104,6 +104,12 @@
     if (cfg.player_shaded) {
         gtk_widget_show(mainwin_stime_min);
         gtk_widget_show(mainwin_stime_sec);
+    } else {
+        gtk_widget_show(mainwin_minus_num);
+        gtk_widget_show(mainwin_10min_num);
+        gtk_widget_show(mainwin_min_num);
+        gtk_widget_show(mainwin_10sec_num);
+        gtk_widget_show(mainwin_sec_num);
     }
 
     hook_call("playback begin", entry);
--- a/src/audacious/ui_main.c	Sun Jul 08 10:23:16 2007 +0200
+++ b/src/audacious/ui_main.c	Sun Jul 08 12:21:09 2007 +0200
@@ -82,6 +82,7 @@
 #include "ui_skinned_window.h"
 #include "ui_skinned_button.h"
 #include "ui_skinned_textbox.h"
+#include "ui_skinned_number.h"
 #include "ui_jumptotrack.h"
 
 static GTimeVal cb_time; /* click delay for tristate is defined by TRISTATE_THRESHOLD */
@@ -139,8 +140,8 @@
 
 PlayStatus *mainwin_playstatus;
 
-Number *mainwin_minus_num, *mainwin_10min_num, *mainwin_min_num;
-Number *mainwin_10sec_num, *mainwin_sec_num;
+GtkWidget *mainwin_minus_num, *mainwin_10min_num, *mainwin_min_num;
+GtkWidget *mainwin_10sec_num, *mainwin_sec_num;
 
 static gboolean setting_volume = FALSE;
 
@@ -684,23 +685,23 @@
         bmp_active_skin->properties.mainwin_infobar_y);
 
     if (bmp_active_skin->properties.mainwin_number_0_x && bmp_active_skin->properties.mainwin_number_0_y)
-    widget_move(WIDGET(mainwin_minus_num), bmp_active_skin->properties.mainwin_number_0_x,
+    gtk_fixed_move(GTK_FIXED(SKINNED_WINDOW(mainwin)->fixed), GTK_WIDGET(mainwin_minus_num), bmp_active_skin->properties.mainwin_number_0_x,
         bmp_active_skin->properties.mainwin_number_0_y);
 
     if (bmp_active_skin->properties.mainwin_number_1_x && bmp_active_skin->properties.mainwin_number_1_y)
-    widget_move(WIDGET(mainwin_10min_num), bmp_active_skin->properties.mainwin_number_1_x,
+    gtk_fixed_move(GTK_FIXED(SKINNED_WINDOW(mainwin)->fixed), GTK_WIDGET(mainwin_10min_num), bmp_active_skin->properties.mainwin_number_1_x,
         bmp_active_skin->properties.mainwin_number_1_y);
 
     if (bmp_active_skin->properties.mainwin_number_2_x && bmp_active_skin->properties.mainwin_number_2_y)
-    widget_move(WIDGET(mainwin_min_num), bmp_active_skin->properties.mainwin_number_2_x,
+    gtk_fixed_move(GTK_FIXED(SKINNED_WINDOW(mainwin)->fixed), GTK_WIDGET(mainwin_min_num), bmp_active_skin->properties.mainwin_number_2_x,
         bmp_active_skin->properties.mainwin_number_2_y);
 
     if (bmp_active_skin->properties.mainwin_number_3_x && bmp_active_skin->properties.mainwin_number_3_y)
-    widget_move(WIDGET(mainwin_10sec_num), bmp_active_skin->properties.mainwin_number_3_x,
+    gtk_fixed_move(GTK_FIXED(SKINNED_WINDOW(mainwin)->fixed), GTK_WIDGET(mainwin_10sec_num), bmp_active_skin->properties.mainwin_number_3_x,
         bmp_active_skin->properties.mainwin_number_3_y);
 
     if (bmp_active_skin->properties.mainwin_number_4_x && bmp_active_skin->properties.mainwin_number_4_y)
-    widget_move(WIDGET(mainwin_sec_num), bmp_active_skin->properties.mainwin_number_4_x,
+    gtk_fixed_move(GTK_FIXED(SKINNED_WINDOW(mainwin)->fixed), GTK_WIDGET(mainwin_sec_num), bmp_active_skin->properties.mainwin_number_4_x,
         bmp_active_skin->properties.mainwin_number_4_y);
 
     if (bmp_active_skin->properties.mainwin_playstatus_x && bmp_active_skin->properties.mainwin_playstatus_y)
@@ -866,12 +867,6 @@
 
     monostereo_set_num_channels(mainwin_monostereo, n_channels);
 
-    widget_show(WIDGET(mainwin_minus_num));
-    widget_show(WIDGET(mainwin_10min_num));
-    widget_show(WIDGET(mainwin_min_num));
-    widget_show(WIDGET(mainwin_10sec_num));
-    widget_show(WIDGET(mainwin_sec_num));
-
     if (!playback_get_paused() && mainwin_playstatus != NULL)
         playstatus_set_status(mainwin_playstatus, STATUS_PLAY);
 
@@ -941,11 +936,11 @@
         playstatus_set_status(mainwin_playstatus, STATUS_STOP);
 
     /* hide playback time */
-    widget_hide(WIDGET(mainwin_minus_num));
-    widget_hide(WIDGET(mainwin_10min_num));
-    widget_hide(WIDGET(mainwin_min_num));
-    widget_hide(WIDGET(mainwin_10sec_num));
-    widget_hide(WIDGET(mainwin_sec_num));
+    gtk_widget_hide(mainwin_minus_num);
+    gtk_widget_hide(mainwin_10min_num);
+    gtk_widget_hide(mainwin_min_num);
+    gtk_widget_hide(mainwin_10sec_num);
+    gtk_widget_hide(mainwin_sec_num);
 
     gtk_widget_hide(mainwin_stime_min);
     gtk_widget_hide(mainwin_stime_sec);
@@ -1152,17 +1147,6 @@
         }
     }
 
-    if (event->button == 1)
-    {
-        if (widget_contains(WIDGET(mainwin_minus_num), event->x, event->y) ||
-        widget_contains(WIDGET(mainwin_10min_num), event->x, event->y) ||
-        widget_contains(WIDGET(mainwin_min_num), event->x, event->y) ||
-        widget_contains(WIDGET(mainwin_10sec_num), event->x, event->y) ||
-        widget_contains(WIDGET(mainwin_sec_num), event->x, event->y)) {
-        change_timer_mode();
-        }
-    }
-
     if (grab)
         gdk_pointer_grab(mainwin->window, FALSE,
                          GDK_BUTTON_MOTION_MASK |
@@ -1949,8 +1933,6 @@
         return;
     }
 
-    gtk_widget_show_all(mainwin);
-
     if (nullmask)
     {
       g_object_unref(nullmask);
@@ -2854,29 +2836,25 @@
     mainwin_playstatus =
         create_playstatus(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 24, 28);
 
-    mainwin_minus_num =
-        create_number(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 36, 26,
+    mainwin_minus_num = ui_skinned_number_new(SKINNED_WINDOW(mainwin)->fixed, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 36, 26,
                       SKIN_NUMBERS);
-    widget_hide(WIDGET(mainwin_minus_num));
-    mainwin_10min_num =
-        create_number(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 48, 26,
+    g_signal_connect(mainwin_minus_num, "clicked", change_timer_mode, NULL);
+
+    mainwin_10min_num = ui_skinned_number_new(SKINNED_WINDOW(mainwin)->fixed, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 48, 26,
                       SKIN_NUMBERS);
-    widget_hide(WIDGET(mainwin_10min_num));
-
-    mainwin_min_num =
-        create_number(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 60, 26,
+    g_signal_connect(mainwin_10min_num, "clicked", change_timer_mode, NULL);
+
+    mainwin_min_num = ui_skinned_number_new(SKINNED_WINDOW(mainwin)->fixed, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 60, 26,
                       SKIN_NUMBERS);
-    widget_hide(WIDGET(mainwin_min_num));
-
-    mainwin_10sec_num =
-        create_number(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 78, 26,
+    g_signal_connect(mainwin_min_num, "clicked", change_timer_mode, NULL);
+
+    mainwin_10sec_num = ui_skinned_number_new(SKINNED_WINDOW(mainwin)->fixed, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 78, 26,
                       SKIN_NUMBERS);
-    widget_hide(WIDGET(mainwin_10sec_num));
-
-    mainwin_sec_num =
-        create_number(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 90, 26,
+    g_signal_connect(mainwin_10sec_num, "clicked", change_timer_mode, NULL);
+
+    mainwin_sec_num = ui_skinned_number_new(SKINNED_WINDOW(mainwin)->fixed, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 90, 26,
                       SKIN_NUMBERS);
-    widget_hide(WIDGET(mainwin_sec_num));
+    g_signal_connect(mainwin_sec_num, "clicked", change_timer_mode, NULL);
 
     mainwin_about = ui_skinned_button_new();
     ui_skinned_small_button_setup(mainwin_about, SKINNED_WINDOW(mainwin)->fixed, mainwin_bg,
@@ -2930,12 +2908,6 @@
     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_minus_num));
-    ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_10min_num));
-    ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_min_num));
-    ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_10sec_num));
-    ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_sec_num));
-
     ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_vis));
     ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_svis));
 
@@ -3005,6 +2977,18 @@
                 bmp_active_skin->properties.mainwin_height * 2, -1);
     mainwin_set_back_pixmap();
     mainwin_create_widgets();
+    gtk_widget_show_all(mainwin);
+
+    if (cfg.player_shaded) {
+        gtk_widget_show(mainwin_stime_min);
+        gtk_widget_show(mainwin_stime_sec);
+    }
+    gtk_widget_hide(mainwin_minus_num);
+    gtk_widget_hide(mainwin_10min_num);
+    gtk_widget_hide(mainwin_min_num);
+    gtk_widget_hide(mainwin_10sec_num);
+    gtk_widget_hide(mainwin_sec_num);
+    gtk_widget_hide(mainwin_othertext);
 
     vis_set_window(mainwin_vis, mainwin->window);
 }
@@ -3034,18 +3018,18 @@
 
     if (cfg.timer_mode == TIMER_REMAINING) {
         if (length != -1) {
-            number_set_number(mainwin_minus_num, 11);
+            ui_skinned_number_set_number(mainwin_minus_num, 11);
             t = length - time;
             stime_prefix = '-';
         }
         else {
-            number_set_number(mainwin_minus_num, 10);
+            ui_skinned_number_set_number(mainwin_minus_num, 10);
             t = time;
             stime_prefix = ' ';
         }
     }
     else {
-        number_set_number(mainwin_minus_num, 10);
+        ui_skinned_number_set_number(mainwin_minus_num, 10);
         t = time;
         stime_prefix = ' ';
     }
@@ -3055,10 +3039,10 @@
      * minutes. */
     if (t >= 100 * 60)
         t /= 60;
-    number_set_number(mainwin_10min_num, t / 600);
-    number_set_number(mainwin_min_num, (t / 60) % 10);
-    number_set_number(mainwin_10sec_num, (t / 10) % 6);
-    number_set_number(mainwin_sec_num, t % 10);
+    ui_skinned_number_set_number(mainwin_10min_num, t / 600);
+    ui_skinned_number_set_number(mainwin_min_num, (t / 60) % 10);
+    ui_skinned_number_set_number(mainwin_10sec_num, (t / 10) % 6);
+    ui_skinned_number_set_number(mainwin_sec_num, t % 10);
 
     if (!mainwin_sposition->hs_pressed) {
         gchar *time_str;
--- a/src/audacious/ui_main.h	Sun Jul 08 10:23:16 2007 +0200
+++ b/src/audacious/ui_main.h	Sun Jul 08 12:21:09 2007 +0200
@@ -108,8 +108,8 @@
 
 extern PlayStatus *mainwin_playstatus;
 
-extern Number *mainwin_minus_num, *mainwin_10min_num, *mainwin_min_num;
-extern Number *mainwin_10sec_num, *mainwin_sec_num;
+extern GtkWidget *mainwin_minus_num, *mainwin_10min_num, *mainwin_min_num;
+extern GtkWidget *mainwin_10sec_num, *mainwin_sec_num;
 
 extern HSlider *mainwin_sposition;
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/audacious/ui_skinned_number.c	Sun Jul 08 12:21:09 2007 +0200
@@ -0,0 +1,275 @@
+/*
+ * 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_number.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_NUMBER           (ui_skinned_number_get_type())
+
+enum {
+    CLICKED,
+    DOUBLED,
+    REDRAW,
+    LAST_SIGNAL
+};
+
+static void ui_skinned_number_class_init         (UiSkinnedNumberClass *klass);
+static void ui_skinned_number_init               (UiSkinnedNumber *number);
+static void ui_skinned_number_destroy            (GtkObject *object);
+static void ui_skinned_number_realize            (GtkWidget *widget);
+static void ui_skinned_number_size_request       (GtkWidget *widget, GtkRequisition *requisition);
+static void ui_skinned_number_size_allocate      (GtkWidget *widget, GtkAllocation *allocation);
+static gboolean ui_skinned_number_expose         (GtkWidget *widget, GdkEventExpose *event);
+static gboolean ui_skinned_number_button_press   (GtkWidget *widget, GdkEventButton *event);
+static void ui_skinned_number_toggle_doublesize  (UiSkinnedNumber *number);
+static void ui_skinned_number_redraw             (UiSkinnedNumber *number);
+
+static GtkWidgetClass *parent_class = NULL;
+static guint number_signals[LAST_SIGNAL] = { 0 };
+
+GType ui_skinned_number_get_type() {
+    static GType number_type = 0;
+    if (!number_type) {
+        static const GTypeInfo number_info = {
+            sizeof (UiSkinnedNumberClass),
+            NULL,
+            NULL,
+            (GClassInitFunc) ui_skinned_number_class_init,
+            NULL,
+            NULL,
+            sizeof (UiSkinnedNumber),
+            0,
+            (GInstanceInitFunc) ui_skinned_number_init,
+        };
+        number_type = g_type_register_static (GTK_TYPE_WIDGET, "UiSkinnedNumber", &number_info, 0);
+    }
+
+    return number_type;
+}
+
+static void ui_skinned_number_class_init(UiSkinnedNumberClass *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_skinned_number_destroy;
+
+    widget_class->realize = ui_skinned_number_realize;
+    widget_class->expose_event = ui_skinned_number_expose;
+    widget_class->size_request = ui_skinned_number_size_request;
+    widget_class->size_allocate = ui_skinned_number_size_allocate;
+    widget_class->button_press_event = ui_skinned_number_button_press;
+
+    klass->clicked = NULL;
+    klass->doubled = ui_skinned_number_toggle_doublesize;
+    klass->redraw = ui_skinned_number_redraw;
+
+    number_signals[CLICKED] = 
+        g_signal_new ("clicked", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+                      G_STRUCT_OFFSET (UiSkinnedNumberClass, clicked), NULL, NULL,
+                      gtk_marshal_VOID__VOID, G_TYPE_NONE, 0);
+
+    number_signals[DOUBLED] = 
+        g_signal_new ("toggle-double-size", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+                      G_STRUCT_OFFSET (UiSkinnedNumberClass, doubled), NULL, NULL,
+                      gtk_marshal_VOID__VOID, G_TYPE_NONE, 0);
+
+    number_signals[REDRAW] = 
+        g_signal_new ("redraw", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+                      G_STRUCT_OFFSET (UiSkinnedNumberClass, redraw), NULL, NULL,
+                      gtk_marshal_VOID__VOID, G_TYPE_NONE, 0);
+}
+
+static void ui_skinned_number_init(UiSkinnedNumber *number) {
+    number->width = 9;
+    number->height = 13;
+    number->img = NULL;
+}
+
+GtkWidget* ui_skinned_number_new(GtkWidget *fixed, GdkPixmap * parent, GdkGC * gc, gint x, gint y, SkinPixmapId si) {
+    UiSkinnedNumber *number = g_object_new (ui_skinned_number_get_type (), NULL);
+
+    number->x = x;
+    number->y = y;
+    number->num = 0;
+    number->gc = gc;
+    number->skin_index = si;
+
+    number->fixed = fixed;
+    number->double_size = FALSE;
+
+    gtk_fixed_put(GTK_FIXED(number->fixed), GTK_WIDGET(number), number->x, number->y);
+
+    return GTK_WIDGET(number);
+}
+
+static void ui_skinned_number_destroy(GtkObject *object) {
+    UiSkinnedNumber *number;
+
+    g_return_if_fail (object != NULL);
+    g_return_if_fail (UI_SKINNED_IS_NUMBER (object));
+
+    number = UI_SKINNED_NUMBER (object);
+
+    if (GTK_OBJECT_CLASS (parent_class)->destroy)
+        (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
+}
+
+static void ui_skinned_number_realize(GtkWidget *widget) {
+    UiSkinnedNumber *number;
+    GdkWindowAttr attributes;
+    gint attributes_mask;
+
+    g_return_if_fail (widget != NULL);
+    g_return_if_fail (UI_SKINNED_IS_NUMBER(widget));
+
+    GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED);
+    number = UI_SKINNED_NUMBER(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;
+    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_number_size_request(GtkWidget *widget, GtkRequisition *requisition) {
+    UiSkinnedNumber *number = UI_SKINNED_NUMBER(widget);
+
+    requisition->width = number->width*(1+number->double_size);
+    requisition->height = number->height*(1+number->double_size);
+}
+
+static void ui_skinned_number_size_allocate(GtkWidget *widget, GtkAllocation *allocation) {
+    UiSkinnedNumber *number = UI_SKINNED_NUMBER (widget);
+
+    widget->allocation = *allocation;
+    if (GTK_WIDGET_REALIZED (widget))
+        gdk_window_move_resize(widget->window, allocation->x, allocation->y, allocation->width, allocation->height);
+
+    number->x = widget->allocation.x/(number->double_size ? 2 : 1);
+    number->y = widget->allocation.y/(number->double_size ? 2 : 1);
+}
+
+static gboolean ui_skinned_number_expose(GtkWidget *widget, GdkEventExpose *event) {
+    g_return_val_if_fail (widget != NULL, FALSE);
+    g_return_val_if_fail (UI_SKINNED_IS_NUMBER (widget), FALSE);
+    g_return_val_if_fail (event != NULL, FALSE);
+
+    UiSkinnedNumber *number = UI_SKINNED_NUMBER (widget);
+
+    GdkPixmap *obj = NULL;
+    obj = gdk_pixmap_new(NULL, number->width, number->height, gdk_rgb_get_visual()->depth);
+
+    if (number->num > 11)
+        number->num = 10;
+
+    skin_draw_pixmap(bmp_active_skin, obj, number->gc,
+                     number->skin_index, number->num * 9, 0,
+                     0, 0, number->width, number->height);
+
+    if (number->img)
+        g_object_unref(number->img);
+    number->img = gdk_pixmap_new(NULL, number->width*(1+number->double_size),
+                                       number->height*(1+number->double_size),
+                                       gdk_rgb_get_visual()->depth);
+
+    if (number->double_size) {
+        GdkImage *img, *img2x;
+        img = gdk_drawable_get_image(obj, 0, 0, number->width, number->height);
+        img2x = create_dblsize_image(img);
+        gdk_draw_image (number->img, number->gc, img2x, 0, 0, 0, 0, number->width*2, number->height*2);
+        g_object_unref(img2x);
+        g_object_unref(img);
+    } else
+        gdk_draw_drawable (number->img, number->gc, obj, 0, 0, 0, 0, number->width, number->height);
+
+    g_object_unref(obj);
+
+    gdk_draw_drawable (widget->window, number->gc, number->img, 0, 0, 0, 0,
+                       number->width*(1+number->double_size), number->height*(1+number->double_size));
+    return FALSE;
+}
+
+static gboolean ui_skinned_number_button_press(GtkWidget *widget, GdkEventButton *event) {
+    g_return_val_if_fail (widget != NULL, FALSE);
+    g_return_val_if_fail (UI_SKINNED_IS_NUMBER (widget), FALSE);
+    g_return_val_if_fail (event != NULL, FALSE);
+
+    if (event->type == GDK_BUTTON_PRESS) {
+        if (event->button == 1) {
+                g_signal_emit(widget, number_signals[CLICKED], 0);
+        } else if (event->button == 3)
+                   return FALSE;
+    }
+
+    return TRUE;
+}
+
+static void ui_skinned_number_toggle_doublesize(UiSkinnedNumber *number) {
+    GtkWidget *widget = GTK_WIDGET (number);
+    number->double_size = !number->double_size;
+
+    gtk_widget_set_size_request(widget, number->width*(1+number->double_size), number->height*(1+number->double_size));
+    gtk_widget_set_uposition(widget, number->x*(1+number->double_size), number->y*(1+number->double_size));
+
+    gtk_widget_queue_draw(GTK_WIDGET(number));
+}
+
+static void ui_skinned_number_redraw(UiSkinnedNumber *number) {
+    gtk_widget_queue_draw(GTK_WIDGET(number));
+}
+
+void ui_skinned_number_set_number(GtkWidget *widget, gint num) {
+    UiSkinnedNumber *number = UI_SKINNED_NUMBER (widget);
+
+    if (number->num == num)
+         return;
+
+    number->num = num;
+    gtk_widget_queue_draw(GTK_WIDGET(number));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/audacious/ui_skinned_number.h	Sun Jul 08 12:21:09 2007 +0200
@@ -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 UISKINNEDNUMBER_H
+#define UISKINNEDNUMBER_H
+
+#include <gdk/gdk.h>
+#include <gtk/gtkadjustment.h>
+#include <gtk/gtkwidget.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define UI_SKINNED_NUMBER(obj)          GTK_CHECK_CAST (obj, ui_skinned_number_get_type (), UiSkinnedNumber)
+#define UI_SKINNED_NUMBER_CLASS(klass)  GTK_CHECK_CLASS_CAST (klass, ui_skinned_number_get_type (), UiSkinnedNumberClass)
+#define UI_SKINNED_IS_NUMBER(obj)       GTK_CHECK_TYPE (obj, ui_skinned_number_get_type ())
+
+typedef struct _UiSkinnedNumber        UiSkinnedNumber;
+typedef struct _UiSkinnedNumberClass   UiSkinnedNumberClass;
+
+struct _UiSkinnedNumber {
+    GtkWidget        widget;
+
+    gint             x, y, width, height;
+    gint             num;
+    gboolean         double_size;
+    GdkPixmap        *img;
+    GdkGC            *gc;
+    SkinPixmapId     skin_index;
+    GtkWidget        *fixed;
+};
+
+struct _UiSkinnedNumberClass {
+    GtkWidgetClass          parent_class;
+    void (* clicked)        (UiSkinnedNumber *textbox);
+    void (* doubled)        (UiSkinnedNumber *textbox);
+    void (* redraw)         (UiSkinnedNumber *textbox);
+};
+
+GtkWidget* ui_skinned_number_new (GtkWidget *fixed, GdkPixmap * parent, GdkGC * gc, gint x, gint y, SkinPixmapId si);
+GtkType ui_skinned_number_get_type(void);
+void ui_skinned_number_set_number(GtkWidget *widget, gint num);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- a/src/audacious/widgets/Makefile	Sun Jul 08 10:23:16 2007 +0200
+++ b/src/audacious/widgets/Makefile	Sun Jul 08 12:21:09 2007 +0200
@@ -25,7 +25,6 @@
 	monostereo.c \
 	vis.c \
 	svis.c \
-	number.c \
 	playstatus.c \
 	playlist_list.c \
 	playlist_slider.c \
--- a/src/audacious/widgets/skin.c	Sun Jul 08 10:23:16 2007 +0200
+++ b/src/audacious/widgets/skin.c	Sun Jul 08 12:21:09 2007 +0200
@@ -1619,8 +1619,12 @@
     g_return_if_fail(pixmap != NULL);
     g_return_if_fail(pixmap->pixmap != NULL);
 
-    if (xsrc > pixmap->width || ysrc > pixmap->height)
-        return;
+    if (xsrc+width > pixmap->width || ysrc+height > pixmap->height) {
+        if (pixmap_id == SKIN_NUMBERS)
+            xsrc = 90;
+        else
+            return;
+    }
 
     width = MIN(width, pixmap->width - xsrc);
     height = MIN(height, pixmap->height - ysrc);
--- a/src/audacious/widgets/widgetcore.h	Sun Jul 08 10:23:16 2007 +0200
+++ b/src/audacious/widgets/widgetcore.h	Sun Jul 08 12:21:09 2007 +0200
@@ -25,7 +25,6 @@
 #include "hslider.h"
 #include "menurow.h"
 #include "monostereo.h"
-#include "number.h"
 #include "playlist_list.h"
 #include "playlist_slider.h"
 #include "playstatus.h"