changeset 2947:13591e28d89e trunk

cleanup
author Tomasz Mon <desowin@gmail.com>
date Sun, 01 Jul 2007 12:52:58 +0200
parents ee9e9eb6276c
children 830fdbec31be
files src/audacious/ui_main.c src/audacious/ui_main.h src/audacious/ui_skinned_textbox.c src/audacious/ui_skinned_textbox.h src/audacious/visualization.c
diffstat 5 files changed, 32 insertions(+), 53 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/ui_main.c	Sun Jul 01 05:06:59 2007 -0500
+++ b/src/audacious/ui_main.c	Sun Jul 01 12:52:58 2007 +0200
@@ -98,11 +98,6 @@
     MAINWIN_SEEK_FWD
 };
 
-enum {
-    MAINWIN_VIS_ACTIVE_MAINWIN, MAINWIN_VIS_ACTIVE_PLAYLISTWIN
-};
-
-
 typedef struct _PlaybackInfo PlaybackInfo;
 
 struct _PlaybackInfo {
@@ -150,7 +145,6 @@
 
 static gboolean setting_volume = FALSE;
 
-Vis *active_vis;
 Vis *mainwin_vis;
 SVis *mainwin_svis;
 
@@ -323,12 +317,6 @@
 }
 
 static void
-mainwin_vis_set_active_vis(gint new_vis)
-{
-    active_vis = mainwin_vis;
-}
-
-static void
 mainwin_vis_set_refresh(RefreshRate rate)
 {
     cfg.vis_refresh = rate;
@@ -396,10 +384,10 @@
         if (cfg.player_shaded && cfg.player_visible)
             svis_clear(mainwin_svis);
         else
-            vis_clear(active_vis);
+            vis_clear(mainwin_vis);
     }
     if (mode == VIS_ANALYZER || mode == VIS_SCOPE || mode == VIS_VOICEPRINT) {
-        vis_clear_data(active_vis);
+        vis_clear_data(mainwin_vis);
         svis_clear_data(mainwin_svis);
     }
 }
@@ -980,7 +968,7 @@
     playlistwin_hide_timer();
     draw_main_window(TRUE);
 
-    vis_clear(active_vis);
+    vis_clear(mainwin_vis);
 }
 
 void
@@ -1180,10 +1168,7 @@
         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))// ||
-        //widget_contains(WIDGET(mainwin_stime_min), event->x, event->y) ||
-        //widget_contains(WIDGET(mainwin_stime_sec), event->x, event->y))
-    {
+        widget_contains(WIDGET(mainwin_sec_num), event->x, event->y)) {
         change_timer_mode();
         }
     }
@@ -1959,9 +1944,8 @@
     check_set( toggleaction_group_others , "show player" , TRUE );
 
     if (cfg.player_shaded)
-        vis_clear_data(active_vis);
-
-    mainwin_vis_set_active_vis(MAINWIN_VIS_ACTIVE_MAINWIN);
+        vis_clear_data(mainwin_vis);
+
     mainwin_set_shape_mask();
 
     if (cfg.show_wm_decorations) {
@@ -2017,7 +2001,6 @@
 
     gtk_widget_hide(mainwin);
 
-    mainwin_vis_set_active_vis(MAINWIN_VIS_ACTIVE_PLAYLISTWIN);
     cfg.player_visible = FALSE;
 }
 
@@ -2915,7 +2898,6 @@
         create_vis(&mainwin_wlist, mainwin_bg, mainwin->window, SKINNED_WINDOW(mainwin)->gc,
                    24, 43, 76, cfg.doublesize);
     mainwin_svis = create_svis(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 79, 5);
-    active_vis = mainwin_vis;
 
     mainwin_position =
         create_hslider(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 16, 72, 248,
--- a/src/audacious/ui_main.h	Sun Jul 01 05:06:59 2007 -0500
+++ b/src/audacious/ui_main.h	Sun Jul 01 12:52:58 2007 +0200
@@ -103,7 +103,6 @@
 
 extern GtkWidget *mainwin_stime_min, *mainwin_stime_sec;
 
-extern Vis *active_vis;
 extern Vis *mainwin_vis;
 extern SVis *mainwin_svis;
 
--- a/src/audacious/ui_skinned_textbox.c	Sun Jul 01 05:06:59 2007 -0500
+++ b/src/audacious/ui_skinned_textbox.c	Sun Jul 01 12:52:58 2007 +0200
@@ -48,7 +48,6 @@
 struct _UiSkinnedTextboxPrivate {
     GtkWidget        *image;
     GdkGC            *gc;
-    gint             w;
     SkinPixmapId     skin_index;
     GtkWidget        *fixed;
     gboolean         double_size;
@@ -269,7 +268,7 @@
     textbox->x = x;
     textbox->y = y;
     priv->gc = gc;
-    priv->w = w;
+    textbox->width = w;
     priv->scroll_allowed = allow_scroll;
     priv->scroll_enabled = TRUE;
     priv->skin_index = si;
@@ -280,7 +279,7 @@
     priv->fixed = fixed;
     priv->double_size = FALSE;
 
-    gtk_widget_set_size_request(widget, priv->w, textbox->height);
+    gtk_widget_set_size_request(widget, textbox->width, textbox->height);
     gtk_fixed_put(GTK_FIXED(priv->fixed), widget, textbox->x, textbox->y);
 }
 
@@ -306,8 +305,8 @@
     textbox->x = widget->allocation.x/(priv->double_size ? 2 : 1);
     textbox->y = widget->allocation.y/(priv->double_size ? 2 : 1);
 
-    if (priv->w !=  widget->allocation.width) {
-        priv->w = widget->allocation.width;
+    if (textbox->width !=  widget->allocation.width) {
+        textbox->width = widget->allocation.width;
         if (priv->pixmap_text) g_free(priv->pixmap_text);
         priv->pixmap_text = NULL;
         priv->offset = 0;
@@ -324,7 +323,7 @@
 
         if (event->button == 1) {
             if (priv->scroll_allowed) {
-                if ((priv->pixmap_width > priv->w) && priv->is_scrollable) {
+                if ((priv->pixmap_width > textbox->width) && priv->is_scrollable) {
                     priv->is_dragging = TRUE;
                     textbox->redraw = TRUE;
                     priv->drag_off = priv->offset;
@@ -361,14 +360,14 @@
 
     if (priv->is_dragging) {
         if (priv->scroll_allowed &&
-            priv->pixmap_width > priv->w) {
+            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 - priv->w))
-                priv->offset = (priv->pixmap_width - priv->w);
+            while (priv->offset > (priv->pixmap_width - textbox->width))
+                priv->offset = (priv->pixmap_width - textbox->width);
 
             ui_skinned_textbox_redraw(textbox);
         }
@@ -386,7 +385,7 @@
     UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE (textbox);
     priv->double_size = !priv->double_size;
 
-    gtk_widget_set_size_request(widget, priv->w*(1+priv->double_size), textbox->height*(1+priv->double_size));
+    gtk_widget_set_size_request(widget, textbox->width*(1+priv->double_size), textbox->height*(1+priv->double_size));
     gtk_widget_set_uposition(widget, textbox->x*(1+priv->double_size), textbox->y*(1+priv->double_size));
 
     textbox->redraw = TRUE;
@@ -410,21 +409,21 @@
                 priv->skin_id = skin_get_id();
                 textbox_generate_pixmap(textbox);
             }
-            obj = gdk_pixmap_new(NULL, priv->w, textbox->height, gdk_rgb_get_visual()->depth);
+            obj = gdk_pixmap_new(NULL, textbox->width, textbox->height, gdk_rgb_get_visual()->depth);
             src = priv->pixmap;
 
             cw = priv->pixmap_width - priv->offset;
-            if (cw > priv->w)
-                cw = priv->w;
+            if (cw > textbox->width)
+                cw = textbox->width;
             gdk_draw_drawable(obj, priv->gc, src, priv->offset, 0, 0, 0, cw, textbox->height);
-            if (cw < priv->w)
+            if (cw < textbox->width)
                 gdk_draw_drawable(obj, priv->gc, src, 0, 0,
                                   textbox->x + cw, textbox->y,
-                                  priv->w - cw, textbox->height);
+                                  textbox->width - cw, textbox->height);
 
             if (priv->double_size) {
                 GdkImage *img, *img2x;
-                img = gdk_drawable_get_image(obj, 0, 0, priv->w, textbox->height);
+                img = gdk_drawable_get_image(obj, 0, 0, textbox->width, textbox->height);
                 img2x = create_dblsize_image(img);
                 gtk_image_set(GTK_IMAGE(priv->image), img2x, NULL);
                 g_object_unref(img2x);
@@ -452,13 +451,13 @@
         gint width;
         text_get_extents(priv->fontname, textbox->text, &width, NULL, NULL, NULL);
 
-        if (width <= priv->w)
+        if (width <= textbox->width)
             return FALSE;
         else
             return TRUE;
     }
 
-    if (g_utf8_strlen(textbox->text, -1) * bmp_active_skin->properties.textbox_bitmap_font_width > priv->w)
+    if (g_utf8_strlen(textbox->text, -1) * bmp_active_skin->properties.textbox_bitmap_font_width > textbox->width)
         return TRUE;
 
     return FALSE;
@@ -540,7 +539,7 @@
 
     text_get_extents(priv->fontname, pixmaptext, &width, NULL, NULL, NULL);
 
-    priv->pixmap_width = MAX(width, priv->w);
+    priv->pixmap_width = MAX(width, textbox->width);
     priv->pixmap = gdk_pixmap_new(mainwin->window, priv->pixmap_width,
                                    textbox->height,
                                    gdk_rgb_get_visual()->depth);
@@ -588,7 +587,7 @@
         if (priv->scroll_back) priv->offset -= 1;
         else priv->offset += 1;
 
-        if (priv->offset >= (priv->pixmap_width - priv->w)) {
+        if (priv->offset >= (priv->pixmap_width - textbox->width)) {
             priv->scroll_back = TRUE;
             /* There are 1 million microseconds per second */
             //g_usleep(1000000);
@@ -632,8 +631,8 @@
      * wl is the number of (partial) letters visible. Only makes
      * sense when using skinned font.
      */
-    wl = priv->w / 5;
-    if (wl * 5 != priv->w)
+    wl = textbox->width / 5;
+    if (wl * 5 != textbox->width)
         wl++;
 
     length = g_utf8_strlen(textbox->text, -1);
@@ -847,7 +846,6 @@
 }
 
 void ui_skinned_textbox_resize_relative(GtkWidget *widget, gint w, gint h) {
-        UiSkinnedTextbox *t = UI_SKINNED_TEXTBOX(widget);
-        UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE (widget);
-        gtk_widget_set_size_request(widget, priv->w+w, t->height+h);
+        UiSkinnedTextbox *textbox = UI_SKINNED_TEXTBOX(widget);
+        gtk_widget_set_size_request(widget, textbox->width+w, textbox->height+h);
 }
--- a/src/audacious/ui_skinned_textbox.h	Sun Jul 01 05:06:59 2007 -0500
+++ b/src/audacious/ui_skinned_textbox.h	Sun Jul 01 12:52:58 2007 +0200
@@ -40,7 +40,7 @@
 struct _UiSkinnedTextbox {
     GtkBin bin;
     GdkWindow *event_window;
-    gint x, y, height;
+    gint x, y, width, height;
     gboolean redraw;
     gchar *text;
 };
--- a/src/audacious/visualization.c	Sun Jul 01 05:06:59 2007 -0500
+++ b/src/audacious/visualization.c	Sun Jul 01 12:52:58 2007 +0200
@@ -286,7 +286,7 @@
             if (cfg.player_shaded && cfg.player_visible)
                 svis_timeout_func(mainwin_svis, NULL);
             else
-                vis_timeout_func(active_vis, NULL);
+                vis_timeout_func(mainwin_vis, NULL);
         }
         return;
     }
@@ -466,5 +466,5 @@
     if (cfg.player_shaded && cfg.player_visible)
         svis_timeout_func(mainwin_svis, intern_vis_data);
     else
-        vis_timeout_func(active_vis, intern_vis_data);
+        vis_timeout_func(mainwin_vis, intern_vis_data);
 }