changeset 2507:e07c141dd326 trunk

[svn] - made new functions: widget_move_relative and widget_resize_relative - cleaned up playlist resizing code (removed lots of constants with help of the new widget functions)
author mf0102
date Mon, 12 Feb 2007 08:59:08 -0800
parents 630910fd140f
children ecdfed7b1861
files ChangeLog src/audacious/build_stamp.c src/audacious/ui_playlist.c src/audacious/widgets/widget.c src/audacious/widgets/widget.h
diffstat 5 files changed, 53 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Feb 12 08:13:53 2007 -0800
+++ b/ChangeLog	Mon Feb 12 08:59:08 2007 -0800
@@ -1,3 +1,15 @@
+2007-02-12 16:13:53 +0000  Michael Farber <01mf02@gmail.com>
+  revision [4022]
+  - changed plugin directory to ~/.local/share/audacious/Plugins (seems more logical to me)
+  - updated migrate_config.sh to reflect the change
+  - reindented a bit
+  
+  
+  trunk/migrate_config.sh    |   12 ++++++------
+  trunk/src/audacious/main.c |   20 ++++++++++----------
+  2 files changed, 16 insertions(+), 16 deletions(-)
+
+
 2007-02-12 15:18:47 +0000  Giacomo Lozito <james@develia.org>
   revision [4020]
   - added set volume hook
--- a/src/audacious/build_stamp.c	Mon Feb 12 08:13:53 2007 -0800
+++ b/src/audacious/build_stamp.c	Mon Feb 12 08:59:08 2007 -0800
@@ -1,2 +1,2 @@
 #include <glib.h>
-const gchar *svn_stamp = "20070212-4020";
+const gchar *svn_stamp = "20070212-4022";
--- a/src/audacious/ui_playlist.c	Mon Feb 12 08:13:53 2007 -0800
+++ b/src/audacious/ui_playlist.c	Mon Feb 12 08:59:08 2007 -0800
@@ -620,6 +620,7 @@
 playlistwin_resize(gint width, gint height)
 {
     gint tx, ty;
+    gint dx, dy;
     gboolean redraw;
 
     g_return_if_fail(width > 0 && height > 0);
@@ -642,33 +643,35 @@
     if (tx == cfg.playlist_width && ty == cfg.playlist_height)
         return;
 
+    /* difference between previous size and new size */
+    dx = tx - cfg.playlist_width;
+    dy = ty - cfg.playlist_height;
+
     cfg.playlist_width = width = tx;
     cfg.playlist_height = height = ty;
 
-    /* FIXME: why the fsck are we doing this manually? */
-    /* adjust widget positions and sizes */
 
-    widget_resize(WIDGET(playlistwin_list), width - 31, height - 58);
+    widget_resize_relative(WIDGET(playlistwin_list), dx, dy);
 
-    widget_move(WIDGET(playlistwin_slider), width - 15, 20);
-    widget_resize(WIDGET(playlistwin_slider), 8, height - 58);
+    widget_move_relative(WIDGET(playlistwin_slider), dx, 0);
+    widget_resize_relative(WIDGET(playlistwin_slider), 0, dy);
 
-    widget_resize(WIDGET(playlistwin_sinfo), width - 35, 14);
+    widget_resize_relative(WIDGET(playlistwin_sinfo), dx, 0);
     playlistwin_update_sinfo(playlist_get_active());
 
-    widget_move(WIDGET(playlistwin_shade), width - 21, 3);
-    widget_move(WIDGET(playlistwin_close), width - 11, 3);
-    widget_move(WIDGET(playlistwin_time_min), width - 82, height - 15);
-    widget_move(WIDGET(playlistwin_time_sec), width - 64, height - 15);
-    widget_move(WIDGET(playlistwin_info), width - 143, height - 28);
-    widget_move(WIDGET(playlistwin_srew), width - 144, height - 16);
-    widget_move(WIDGET(playlistwin_splay), width - 138, height - 16);
-    widget_move(WIDGET(playlistwin_spause), width - 128, height - 16);
-    widget_move(WIDGET(playlistwin_sstop), width - 118, height - 16);
-    widget_move(WIDGET(playlistwin_sfwd), width - 109, height - 16);
-    widget_move(WIDGET(playlistwin_seject), width - 100, height - 16);
-    widget_move(WIDGET(playlistwin_sscroll_up), width - 14, height - 35);
-    widget_move(WIDGET(playlistwin_sscroll_down), width - 14, height - 30);
+    widget_move_relative(WIDGET(playlistwin_shade), dx, 0);
+    widget_move_relative(WIDGET(playlistwin_close), dx, 0);
+    widget_move_relative(WIDGET(playlistwin_time_min), dx, dy);
+    widget_move_relative(WIDGET(playlistwin_time_sec), dx, dy);
+    widget_move_relative(WIDGET(playlistwin_info), dx, dy);
+    widget_move_relative(WIDGET(playlistwin_srew), dx, dy);
+    widget_move_relative(WIDGET(playlistwin_splay), dx, dy);
+    widget_move_relative(WIDGET(playlistwin_spause), dx, dy);
+    widget_move_relative(WIDGET(playlistwin_sstop), dx, dy);
+    widget_move_relative(WIDGET(playlistwin_sfwd), dx, dy);
+    widget_move_relative(WIDGET(playlistwin_seject), dx, dy);
+    widget_move_relative(WIDGET(playlistwin_sscroll_up), dx, dy);
+    widget_move_relative(WIDGET(playlistwin_sscroll_down), dx, dy);
 
     g_object_unref(playlistwin_bg);
     playlistwin_bg = gdk_pixmap_new(playlistwin->window, width, height, -1);
@@ -717,10 +720,10 @@
             event->y + playlistwin_resize_y != playlistwin_get_height())
         {
             playlistwin_resize(event->x + playlistwin_resize_x,
-  		 	       event->y + playlistwin_resize_y);
+                               event->y + playlistwin_resize_y);
         }
         gdk_window_resize(playlistwin->window,
-	    cfg.playlist_width, cfg.playlist_height);
+                          cfg.playlist_width, cfg.playlist_height);
     }
     else if (dock_is_moving(GTK_WINDOW(playlistwin)))
         dock_move_motion(GTK_WINDOW(playlistwin), event);
--- a/src/audacious/widgets/widget.c	Mon Feb 12 08:13:53 2007 -0800
+++ b/src/audacious/widgets/widget.c	Mon Feb 12 08:59:08 2007 -0800
@@ -107,6 +107,12 @@
 }
 
 void
+widget_resize_relative(Widget * widget, gint width, gint height)
+{
+    widget_resize(widget, widget->width + width, widget->height + height);
+}
+
+void
 widget_move(Widget * widget, gint x, gint y)
 {
     widget_lock(widget);
@@ -115,10 +121,15 @@
 }
 
 void
+widget_move_relative(Widget * widget, gint x, gint y)
+{
+    widget_move(widget, widget->x + x, widget->y + y);
+}
+
+void
 widget_draw(Widget * widget)
 {
-    if (widget->visible == FALSE)
-	return;
+    g_return_if_fail(widget->visible == TRUE);
 
     widget_lock(widget);
     WIDGET(widget)->redraw = TRUE;
@@ -131,7 +142,7 @@
     widget_lock(widget);
     if (WIDGET(widget)->draw != NULL)
     {
-	WIDGET(widget)->draw(widget);
+        WIDGET(widget)->draw(widget);
         gdk_flush();
     }
     widget_unlock(widget);
--- a/src/audacious/widgets/widget.h	Mon Feb 12 08:13:53 2007 -0800
+++ b/src/audacious/widgets/widget.h	Mon Feb 12 08:59:08 2007 -0800
@@ -82,7 +82,9 @@
 gboolean widget_is_visible(Widget * widget);
 
 void widget_resize(Widget * widget, gint width, gint height);
+void widget_resize_relative(Widget * widget, gint width, gint height);
 void widget_move(Widget * widget, gint x, gint y);
+void widget_move_relative(Widget * widget, gint x, gint y);
 void widget_draw(Widget * widget);
 void widget_draw_quick(Widget * widget);
 
@@ -102,6 +104,4 @@
 void widget_list_lock(GList * list);
 void widget_list_unlock(GList * list);
 
-
-
 #endif