changeset 3045:464ae313343c

mainwin_volume and mainwin_balance are UiSkinnedHorizontalSliders now; add workaround for skins with too strait SKIN_VOLUME
author Tomasz Mon <desowin@gmail.com>
date Thu, 12 Jul 2007 13:41:06 +0200
parents 01ae56759d15
children 3be0cfac03cd
files src/audacious/ui_main.c src/audacious/widgets/skin.c
diffstat 2 files changed, 27 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/ui_main.c	Thu Jul 12 12:50:52 2007 +0200
+++ b/src/audacious/ui_main.c	Thu Jul 12 13:41:06 2007 +0200
@@ -153,7 +153,7 @@
 GtkWidget *mainwin_sposition = NULL;
 
 static MenuRow *mainwin_menurow;
-static HSlider *mainwin_volume, *mainwin_balance;
+static GtkWidget *mainwin_volume, *mainwin_balance;
 GtkWidget *mainwin_position;
 
 static MonoStereo *mainwin_monostereo;
@@ -758,11 +758,11 @@
         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)
@@ -1835,18 +1835,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);
@@ -1854,7 +1853,7 @@
 }
 
 void
-mainwin_volume_release_cb(gint pos)
+mainwin_volume_release_cb(GtkWidget *widget, gint pos)
 {
     mainwin_adjust_volume_release();
 }
@@ -1866,7 +1865,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);
@@ -1874,7 +1873,7 @@
 }
 
 void
-mainwin_balance_release_cb(gint pos)
+mainwin_balance_release_cb(GtkWidget *widget, gint pos)
 {
     mainwin_adjust_volume_release();
 }
@@ -2810,16 +2809,17 @@
     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_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 =
         create_monostereo(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 212, 41,
@@ -2883,9 +2883,6 @@
 
     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));
 
--- a/src/audacious/widgets/skin.c	Thu Jul 12 12:50:52 2007 +0200
+++ b/src/audacious/widgets/skin.c	Thu Jul 12 13:41:06 2007 +0200
@@ -1621,7 +1621,13 @@
     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
             return;
     }