Update of /cvsroot/gtkpod/gtkpod/src
In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv21227/src

Modified Files:
      Tag: coverart_display_development_branch
        display_coverart.c display_tracks.c display_coverart.h 
Log Message:
gtkpod.glade
- added button_release_event signal handler to paned0
- added buttons to vbox2 which controls the visibility of the coverart display
- cover_display_canvasbox does not expand or fill.
- left hand child of paned0 denied shrink and resize. Stops the resizing of the 
paned0 position bar when the app is resized.

display_tracks.c
- fixed error in call to coverart_select_cover which now uses a track reference 
rather than just an album string

display_coverart.h
- added canvasbox, controlbox and bground to the cdwidget structure. Saves 
calling the xml everytime one of these is required.
- addition of cover_up_button_clicked, cover_down_button_clicked and 
gtkpod_window_callback

display_coverart.c
- add_highlight renamed set_highlight
- draw_background removed and commands relocated to prepare_canvas
- cover dimensions commands broken out into their own function
- display dimensions for cdwidget broken out into their own function
- set_highlight only applies the highlight pixbuf while prepare_canvas actually 
declares it.
- DEFAULT_WIDTH and DEFAULT_HEIGHT added as global vars. They record the values 
of the canvasbox when the app is opened. Ensures that the coverart_display can 
be returned to its default size and being expanded using the paned0 bar.

Index: display_coverart.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/Attic/display_coverart.c,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -u -d -r1.1.2.7 -r1.1.2.8
--- display_coverart.c  14 Feb 2007 21:31:40 -0000      1.1.2.7
+++ display_coverart.c  17 Feb 2007 23:31:13 -0000      1.1.2.8
@@ -39,15 +39,16 @@
 
 /* Declarations */
 static void debug_albums ();
+static void set_display_dimensions ();
 static GdkPixbuf *draw_blank_cdimage ();
-static void add_highlight (Cover_Item *cover);
-static void draw_background (GnomeCanvas *canvas);
+static void set_highlight (Cover_Item *cover);
 static void raise_cdimages (GPtrArray *cdcovers);
 static GdkPixbuf *get_thumb (Itdb_Track *track);
 static void scroll_covers (gint direction);
 static void on_cover_display_button_clicked (GtkWidget *widget, gpointer data);
 static void on_main_cover_image_clicked (GnomeCanvas *canvas, GdkEvent *event, 
gpointer data);
 static void on_cover_display_slider_value_changed (GtkRange *range, gpointer 
user_data);
+static void set_cover_dimensions (Cover_Item *cover, int cover_index);
 static void prepare_canvas ();
 static void set_covers ();
 
@@ -56,6 +57,8 @@
 /* Dimensions used for the canvas */
 static gint WIDTH;
 static gint HEIGHT;
+static gint DEFAULT_WIDTH;
+static gint DEFAULT_HEIGHT;
 /* Dimensions used for the smaller 8 cd cover images */
 static gdouble SMALL_IMG_WIDTH;
 static gdouble SMALL_IMG_HEIGHT;
@@ -139,14 +142,15 @@
 }
 
 /**
- * add_highlight:
+ * set_highlight:
  *
- * Add the highlighted image to the cover to give shine and a reflection
+ * Sets the highlighted image to the cover to give shine 
+ * and a reflection.
  * 
  * @cover: A Cover_Item object which the higlighted is added to.
  *  
  */
-static void add_highlight (Cover_Item *cover)
+static void set_highlight (Cover_Item *cover)
 {
        GdkPixbuf *image;
   GError *error = NULL;
@@ -160,40 +164,14 @@
        
        image = gdk_pixbuf_scale_simple(image, cover->img_width, 
((cover->img_height * 2) + 6), GDK_INTERP_NEAREST);
                
-  cover->highlight = gnome_canvas_item_new((GnomeCanvasGroup *) 
cover->cdcvrgrp,
-                                                                               
        GNOME_TYPE_CANVAS_PIXBUF,
-                                                               "pixbuf", image,
-                                                                               
        NULL);          
-       
+  gnome_canvas_item_set (cover->highlight,
+                                                                               
                                                                                
        "pixbuf", image,
+                                                                               
                                                                                
        NULL);
+                                                                               
                                                                                
        
        gnome_canvas_item_hide (cover->highlight);                              
 }
 
 /**
- * draw_background:
- *
- * Fill the background canvas with desired colour. Currently, set
- * to black but could be optional colour if required.
- * 
- * @canvas: main display canvas of the artwork display.
- *  
- */
-static void draw_background(GnomeCanvas *canvas) {
-       /* set bg color */
-       GnomeCanvasItem *bg;
-       
-       bg = gnome_canvas_item_new(gnome_canvas_root(canvas),
-                           gnome_canvas_rect_get_type(),
-                           "x1",(double) 0, 
-                           "y1",(double) 0,
-                           "x2",(double) WIDTH + 50,
-                           "y2",(double) HEIGHT + 50,
-                           "fill_color", "black",
-                           NULL);
-                           
-       gnome_canvas_item_lower_to_bottom(bg);
-}
-
-/**
  * raise_cdimages:
  *
  * Ensures that once all the canvas items have been created on the
@@ -378,10 +356,8 @@
   label = gtk_button_get_label(button);
     
   if(g_str_equal(label, (gchar *) ">"))
-       //scroll_covers (IMG_NEXT);
        cdwidget->first_imgindex++;
   else
-       //scroll_covers (IMG_PREV);
        cdwidget->first_imgindex--;
        
        /* Change the value of the slider to do the work of scrolling the 
covers */
@@ -426,144 +402,6 @@
 }
 
 /**
- * prepare_canvas:
- *
- * Initialise the canvas and prepare the 9 cover items, along
- * with shadow and correct positions/dimensions.
- */
-static void prepare_canvas ()
-{
-       gint i;
-       gdouble x = 0, y = 0, img_width = 0, img_height = 0;
-       Cover_Item *cover;
-       
-       /* create a new canvas */
-       cdwidget->canvas = GNOME_CANVAS(gnome_canvas_new_aa());
-       g_return_if_fail (cdwidget->canvas);
-       
-       /* set the size and scroll region of the canvas */
-       gtk_widget_set_size_request(GTK_WIDGET(cdwidget->canvas), WIDTH, 
HEIGHT);
-       gnome_canvas_set_center_scroll_region (cdwidget->canvas, FALSE);
-       //gnome_canvas_set_scroll_region(cdwidget->canvas, 0.0, 0.0, WIDTH, 
HEIGHT);
-       
-       draw_background (cdwidget->canvas);
-       
-       cdwidget->cdcovers = g_ptr_array_sized_new (IMG_TOTAL);
-       for(i = 0; i < IMG_TOTAL; ++i)
-       {
-               img_width = SMALL_IMG_WIDTH;
-               img_height = SMALL_IMG_HEIGHT;
-               
-               /* Set the x location of the cover image */
-               switch(i) {
-                       case 0:
-                               x = BORDER;
-                               break;
-                       case 1:
-                               x = BORDER * 1.6;
-                               break;
-                       case 2:
-                               x = BORDER * 2.2;
-                               break;
-                       case 3:
-                               x = BORDER * 2.8;
-                               break;
-                       case IMG_MAIN:
-                               /* The Main Image CD Cover Image */
-                               x = (WIDTH - BIG_IMG_WIDTH) / 2;
-                               img_width = BIG_IMG_WIDTH;
-                               break;
-                       case 5:
-                               x = WIDTH - (SMALL_IMG_WIDTH + (BORDER * 2.8));
-                               break;
-                       case 6:
-                               x = WIDTH - (SMALL_IMG_WIDTH + (BORDER * 2.2));
-                               break;
-                       case 7:
-                               x = WIDTH - (SMALL_IMG_WIDTH + (BORDER * 1.6));
-                               break;
-                       case 8:
-                               x =     WIDTH - (SMALL_IMG_WIDTH + BORDER);
-                               break;
-               }
-               
-               /* Set the y location of the cover image */             
-               switch(i) {
-                       case 0:
-                       case 8:
-                               y = BORDER;
-                               break;
-                       case 1:
-                       case 7:
-                               y = BORDER * 3;
-                               break;
-                       case 2:
-                       case 6:
-                               y = BORDER * 5;
-                               break;
-                       case 3:
-                       case 5:
-                               y = BORDER * 7;
-                               break;
-                       case IMG_MAIN:
-                               /* The Main Image CD Cover Image */
-                               y = HEIGHT - (BIG_IMG_HEIGHT + (BORDER * 4));
-                               img_height = BIG_IMG_HEIGHT;    
-               }
-               
-               cover = g_new0(Cover_Item, 1);
-               cover->img_x = x;
-               cover->img_y = y;
-               cover->img_height = img_height;
-               cover->img_width = img_width;
-               
-               cover->cdcvrgrp = 
gnome_canvas_item_new(gnome_canvas_root(cdwidget->canvas),
-                                                                               
                gnome_canvas_group_get_type(),
-                                                                               
                "x", (gdouble) cover->img_x,
-                                                                               
                "y", (gdouble) cover->img_y,
-                                                                               
                NULL);
-                                                                               
                
-               cover->cdimage = gnome_canvas_item_new((GnomeCanvasGroup *) 
cover->cdcvrgrp,
-                                                                               
GNOME_TYPE_CANVAS_PIXBUF,
-                                                                               
NULL);
-               
-               cover->cdreflection = gnome_canvas_item_new((GnomeCanvasGroup 
*) cover->cdcvrgrp,
-                                                                               
GNOME_TYPE_CANVAS_PIXBUF,
-                                                                               
"y", (gdouble) (cover->img_height + 4),
-                                                                               
NULL);
-       
-               add_highlight (cover);
-               
-               
-               if(i == IMG_MAIN)
-               {
-                       /* set up some callback events on the main scaled image 
*/
-                       g_signal_connect(GTK_OBJECT(cover->cdimage), "event", 
GTK_SIGNAL_FUNC(on_main_cover_image_clicked), NULL);
-               
-                       cdwidget->cvrtext = 
GNOME_CANVAS_TEXT(gnome_canvas_item_new(gnome_canvas_root(cdwidget->canvas),
-                                                                               
GNOME_TYPE_CANVAS_TEXT,
-                                                                               
"text", "No Artist",
-                                                                               
"x", (gdouble) WIDTH / 2,
-                                                                               
"y", (gdouble) cover->img_y + cover ->img_height + 10,
-                                                                               
"justification", GTK_JUSTIFY_CENTER,
-                                                                       
"anchor", GTK_ANCHOR_NORTH,
-                                                                       
"fill_color", "black",
-                                                                       "font", 
"-*-clean-medium-r-normal-*-12-*-*-*-*-*-*",
-                                                                               
NULL));
-               }
-               
-               g_ptr_array_add(cdwidget->cdcovers, cover);
-               cover = NULL;
-       }
-       
-       
-                                                                               
-       
-       
-       raise_cdimages (cdwidget->cdcovers);
-}
-
-/**
  * coverart_clear_images:
  *
  * reset the cd cover images to default blank pixbufs and
@@ -743,58 +581,346 @@
 }
 
 /**
- * coverart_init_display:
+ * on_cover_up_button_clicked:
  *
- * Initialise the boxes and canvases of the coverart_display.
+ * callback for the cover_up_button. Shows all the cover_art widgets
+ * when clicked.
+ *
+ * @widget, data unused standard parameters
  *  
  */
-static void coverart_init_display ()
+void on_cover_up_button_clicked (GtkWidget *widget, gpointer data)
+{
+       gtk_widget_show_all (cdwidget->contentpanel);
+}
+
+/**
+ * on_cover_down_button_clicked:
+ *
+ * callback for the cover_down_button. Hides all the cover_art widgets
+ * when clicked.
+ *
+ * @widget, data unused standard parameters
+ *  
+ */
+void on_cover_down_button_clicked (GtkWidget *widget, gpointer data)
+{
+       gtk_widget_hide_all (cdwidget->contentpanel);
+}
+
+/**
+ * on_paned0_button_release_event:
+ *
+ * Callback fired when a button release event occurs on
+ * paned0. Only worthwhile things are carried out when
+ * the position of paned0 has changed, ie. the bar was moved.
+ * Moving the bar will scale the cover images appropriately.
+ * 
+ * @widget: gtkpod app window
+ * @event: gdk event button
+ * @data: any user data passed to the function
+ * 
+ * Returns:
+ * boolean indicating whether other handlers should be run.
+ */
+gboolean on_paned0_button_release_event (GtkWidget *widget, GdkEventButton 
*event, gpointer data)
+{
+       gint width, i;
+       Cover_Item *cover;
+       GdkPixbuf *pixbuf;
+       
+       width = gtk_paned_get_position (GTK_PANED(widget));
+       if (width >= DEFAULT_WIDTH)
+       {
+               WIDTH = width;
+               gnome_canvas_item_set (GNOME_CANVAS_ITEM(cdwidget->cvrtext), 
+                                                                               
                                                                                
                                        "x", (gdouble) WIDTH / 2,
+                                                                               
                                                                                
                                        NULL);
+               
+               for(i = 0; i < IMG_TOTAL; ++i)
+       {
+               cover = g_ptr_array_index(cdwidget->cdcovers, i);
+               set_cover_dimensions (cover, i);
+               
+               
+               gtk_object_get (GTK_OBJECT(cover->highlight),
+                                                                               
                                "pixbuf", &pixbuf,
+                                                                               
                                NULL);
+               
+               g_object_unref(pixbuf);
+               set_highlight (cover);  
+       }
+               
+               set_covers ();
+               
+       }
+               
+       return FALSE;
+}
+
+/**
+ * gtkpod_window_configure_callback:
+ *
+ * Callback for the gtkpod app window. When the window
+ * is resized the background of the cdwidget is given a size
+ * of the same size. Ensure the background is always black
+ * and no overlapping internal components occur.
+ * 
+ * @widget: gtkpod app window
+ * @event: gdk configure event
+ * @data: any user data passed to the function
+ * 
+ * Returns:
+ * boolean indicating whether other handlers should be run.
+ */
+static gboolean gtkpod_window_configure_callback (GtkWidget *widget, 
GdkEventConfigure *event, gpointer data)
+{                              
+       gnome_canvas_item_set (cdwidget->bground, 
+                                                                               
                                                                                
                                "x1",(double) 0, 
+                                                                               
                                                                                
                "y1",(double) 0,
+                                                                               
                                                                                
                "x2",(double) event->width,
+                                                                               
                                                                                
                "y2",(double) event->height,
+                                                                               
                                                                                
                                NULL);
+       gnome_canvas_item_request_update (cdwidget->bground);
+                               
+       return FALSE;
+}
+
+/**
+ * set_display_dimensions:
+ *
+ * Initialises the display component width and height.
+ * Sets the podpane's paned position value too.
+ */
+static void set_display_dimensions ()
 {
        GtkWidget *gtkpod_window;
        GtkWidget *podpane;
-       GtkWidget *canvasbox;
-       gdouble ratio;
+
+       gtkpod_window = gtkpod_xml_get_widget (main_window_xml, "gtkpod");
+       g_return_if_fail (gtkpod_window);
+                               
+       g_object_get (gtkpod_window,
+                                                               
"default_height", &HEIGHT,
+                                                               NULL);
+               
+       HEIGHT = HEIGHT / 2.5;
+       DEFAULT_HEIGHT = HEIGHT;
+       
+       podpane = gtkpod_xml_get_widget (main_window_xml, "paned0");    
+       g_return_if_fail (podpane);
+
+       WIDTH = HEIGHT / 1.2;   
+       gtk_paned_set_position (GTK_PANED(podpane), WIDTH);
+       DEFAULT_WIDTH = WIDTH;
+               
+       printf("SET DIMENSION WIDTH = %d, HEIGHT = %d\n", WIDTH, HEIGHT);
+}
+
+/**
+ * set_cover_dimensions::
+ *
+ * Utility function for set all the x, y, width and height
+ * dimensions applicable to a single cover widget
+ * 
+ * @cover: cover widget for which dimensions are to be set
+ * @cover_index: index of the widget. Used to determine whether
+ *                                                                             
                cover is the main cover or not
+ */
+static void set_cover_dimensions (Cover_Item *cover, int cover_index)
+{
+       gdouble x = 0, y = 0, img_width = 0, img_height = 0;
+       
+       SMALL_IMG_WIDTH = WIDTH / 3;
+       SMALL_IMG_HEIGHT = HEIGHT / 3;
+       BIG_IMG_WIDTH = WIDTH / 2;
+       BIG_IMG_HEIGHT = HEIGHT / 2;
+       
+       img_width = SMALL_IMG_WIDTH;
+       img_height = SMALL_IMG_HEIGHT;
+               
+               /* Set the x location of the cover image */
+               switch(cover_index) {
+                       case 0:
+                               x = BORDER;
+                               break;
+                       case 1:
+                               x = BORDER * 1.6;
+                               break;
+                       case 2:
+                               x = BORDER * 2.2;
+                               break;
+                       case 3:
+                               x = BORDER * 2.8;
+                               break;
+                       case IMG_MAIN:
+                               /* The Main Image CD Cover Image */
+                               x = (WIDTH - BIG_IMG_WIDTH) / 2;
+                               img_width = BIG_IMG_WIDTH;
+                               break;
+                       case 5:
+                               x = WIDTH - (SMALL_IMG_WIDTH + (BORDER * 2.8));
+                               break;
+                       case 6:
+                               x = WIDTH - (SMALL_IMG_WIDTH + (BORDER * 2.2));
+                               break;
+                       case 7:
+                               x = WIDTH - (SMALL_IMG_WIDTH + (BORDER * 1.6));
+                               break;
+                       case 8:
+                               x =     WIDTH - (SMALL_IMG_WIDTH + BORDER);
+                               break;
+               }
+               
+               /* Set the y location of the cover image */             
+               switch(cover_index) {
+                       case 0:
+                       case 8:
+                               y = BORDER;
+                               break;
+                       case 1:
+                       case 7:
+                               y = BORDER * 3;
+                               break;
+                       case 2:
+                       case 6:
+                               y = BORDER * 5;
+                               break;
+                       case 3:
+                       case 5:
+                               y = BORDER * 7;
+                               break;
+                       case IMG_MAIN:
+                               /* The Main Image CD Cover Image */
+                               y = HEIGHT - (BIG_IMG_HEIGHT + (BORDER * 4));
+                               img_height = BIG_IMG_HEIGHT;    
+               }
+               
+               cover->img_x = x;
+               cover->img_y = y;
+               cover->img_height = img_height;
+               cover->img_width = img_width;
+               
+               gnome_canvas_item_set (cover->cdcvrgrp,
+                                                                               
                                                                                
                        "x", (gdouble) cover->img_x,
+                                                                               
                                                                                
                        "y", (gdouble) cover->img_y,
+                                                                               
                                                                                
                        NULL);
+               
+               gnome_canvas_item_set (cover->cdreflection,
+                                                                               
                                                                                
                        "y", (gdouble) (cover->img_height + 4),
+                                                                               
                                                                                
                        NULL);
+}
+
+/**
+ * prepare_canvas:
+ *
+ * Initialise the canvas and prepare the 9 cover items, along
+ * with shadow and correct positions/dimensions.
+ */
+static void prepare_canvas ()
+{
+       gint i;
+       Cover_Item *cover;
+       
+       gtk_widget_set_size_request(GTK_WIDGET(cdwidget->canvasbox), WIDTH, 
HEIGHT);
+       /* create a new canvas */
+       cdwidget->canvas = GNOME_CANVAS(gnome_canvas_new_aa());
+       g_return_if_fail (cdwidget->canvas);
+       
+       /* set the size and scroll region of the canvas */
+       gtk_widget_set_size_request(GTK_WIDGET(cdwidget->canvas), WIDTH, 
HEIGHT);
+       gnome_canvas_set_center_scroll_region (cdwidget->canvas, FALSE);
+       
+       cdwidget->bground = 
gnome_canvas_item_new(gnome_canvas_root(cdwidget->canvas),
+                           gnome_canvas_rect_get_type(),
+                           "x1",(double) 0, 
+                           "y1",(double) 0,
+                           "x2",(double) WIDTH,
+                           "y2",(double) HEIGHT,
+                           "fill_color", "black",
+                           NULL);
+                           
+       gnome_canvas_item_lower_to_bottom(cdwidget->bground);
        
+       cdwidget->cdcovers = g_ptr_array_sized_new (IMG_TOTAL);
+       for(i = 0; i < IMG_TOTAL; ++i)
+       {
+               cover = g_new0(Cover_Item, 1);
+               
+               cover->cdcvrgrp = 
gnome_canvas_item_new(gnome_canvas_root(cdwidget->canvas),
+                                                                               
                gnome_canvas_group_get_type(),
+                                                                               
                NULL);
+                                                                               
                
+               cover->cdimage = gnome_canvas_item_new((GnomeCanvasGroup *) 
cover->cdcvrgrp,
+                                                                               
GNOME_TYPE_CANVAS_PIXBUF,
+                                                                               
NULL);
+               
+               cover->cdreflection = gnome_canvas_item_new((GnomeCanvasGroup 
*) cover->cdcvrgrp,
+                                                                               
GNOME_TYPE_CANVAS_PIXBUF,
+                                                                               
NULL);
+       
+               set_cover_dimensions (cover, i);
+               
+               cover->highlight = gnome_canvas_item_new((GnomeCanvasGroup *) 
cover->cdcvrgrp,
+                                                                               
                                                                                
                GNOME_TYPE_CANVAS_PIXBUF,
+                                                                               
                                                                        NULL);  
        
+
+               set_highlight (cover);
+               
+               if(i == IMG_MAIN)
+               {
+                       /* set up some callback events on the main scaled image 
*/
+                       g_signal_connect(GTK_OBJECT(cover->cdimage), "event", 
GTK_SIGNAL_FUNC(on_main_cover_image_clicked), NULL);
+               
+                       cdwidget->cvrtext = 
GNOME_CANVAS_TEXT(gnome_canvas_item_new(gnome_canvas_root(cdwidget->canvas),
+                                                                               
GNOME_TYPE_CANVAS_TEXT,
+                                                                               
"text", "No Artist",
+                                                                               
"x", (gdouble) WIDTH / 2,
+                                                                               
"y", (gdouble) cover->img_y + cover ->img_height,
+                                                                               
"justification", GTK_JUSTIFY_CENTER,
+                                                                       
"anchor", GTK_ANCHOR_NORTH,
+                                                                       
"fill_color", "black",
+                                                                       "font", 
"-*-clean-medium-r-normal-*-12-*-*-*-*-*-*",
+                                                                               
NULL));
+               }
+               
+               g_ptr_array_add(cdwidget->cdcovers, cover);
+               cover = NULL;
+       }
+       
+       raise_cdimages (cdwidget->cdcovers);
+}
+
+/**
+ * coverart_init_display:
+ *
+ * Initialise the boxes and canvases of the coverart_display.
+ *  
+ */
+static void coverart_init_display ()
+{              
        cdwidget = g_new0(CD_Widget, 1);
        
-       gtkpod_window = gtkpod_xml_get_widget (main_window_xml, "gtkpod");
-       podpane = gtkpod_xml_get_widget (main_window_xml, "paned0");
-  canvasbox = gtkpod_xml_get_widget (main_window_xml, 
"cover_display_canvasbox"); 
+  cdwidget->canvasbox = gtkpod_xml_get_widget (main_window_xml, 
"cover_display_canvasbox"); 
        cdwidget->contentpanel = gtkpod_xml_get_widget (main_window_xml, 
"cover_display_window");
+  cdwidget->controlbox = gtkpod_xml_get_widget (main_window_xml, 
"cover_display_controlbox");
   cdwidget->leftbutton = GTK_BUTTON (gtkpod_xml_get_widget (main_window_xml, 
"cover_display_leftbutton"));
   cdwidget->rightbutton = GTK_BUTTON (gtkpod_xml_get_widget (main_window_xml, 
"cover_display_rightbutton"));
   cdwidget->cdslider = GTK_HSCALE (gtkpod_xml_get_widget (main_window_xml, 
"cover_display_scaler"));
   
-  g_return_if_fail (gtkpod_window);
        g_return_if_fail (cdwidget->contentpanel);
-       g_return_if_fail (canvasbox);
-       g_return_if_fail (podpane);
+       g_return_if_fail (cdwidget->canvasbox);
+       g_return_if_fail (cdwidget->controlbox);
        g_return_if_fail (cdwidget->leftbutton);
   g_return_if_fail (cdwidget->rightbutton);
   g_return_if_fail (cdwidget->cdslider);
   
-       g_object_get (gtkpod_window,
-                                                               
"default_height", &HEIGHT,
-                                                               NULL);
-                                                               
-       HEIGHT = HEIGHT / 2.75;
-       WIDTH = gtk_paned_get_position((GTK_PANED(podpane)));
-       ratio = (double) WIDTH / (double) HEIGHT;
-       
-       if ((WIDTH < 150) || (ratio > 1.3) || (ratio < 1.0)) {
-               WIDTH = HEIGHT;
-               gtk_paned_set_position (GTK_PANED(podpane), WIDTH);
-       }
-       
-       SMALL_IMG_WIDTH = WIDTH / 3;
-       SMALL_IMG_HEIGHT = HEIGHT / 3;
-       BIG_IMG_WIDTH = WIDTH / 2;
-       BIG_IMG_HEIGHT = HEIGHT / 2;
+       set_display_dimensions ();
        
        prepare_canvas ();
-       gtk_widget_set_size_request (GTK_WIDGET(canvasbox), WIDTH, HEIGHT);
        
-       gtk_box_pack_start_defaults (GTK_BOX(canvasbox), 
GTK_WIDGET(cdwidget->canvas));
+       gtk_box_pack_start_defaults (GTK_BOX(cdwidget->canvasbox), 
GTK_WIDGET(cdwidget->canvas));
+                       
        g_signal_connect (G_OBJECT(cdwidget->leftbutton), "clicked",
                      G_CALLBACK(on_cover_display_button_clicked), NULL);
                      
@@ -804,6 +930,9 @@
        g_signal_connect (G_OBJECT(cdwidget->cdslider), "value-changed",
                      G_CALLBACK(on_cover_display_slider_value_changed), NULL);
        
+       g_signal_connect (gtkpod_window, "configure_event", 
+               G_CALLBACK (gtkpod_window_configure_callback), NULL);
+               
        coverart_block_change (FALSE);
        
        gtk_widget_show_all (cdwidget->contentpanel);
@@ -887,19 +1016,22 @@
  * sort the covers BUT must be called after an initial coverart_set_images
  * as the latter initialises the cdwidget->displaytracks list 
  * 
- * @order: order type 
+ * @order: order type
  * 
  */
 void coverart_sort_images (GtkSortType order)
 { 
-       /*if (order == SORT_NONE)
+       /*
+       if (order == SORT_NONE)
        {
-               //pl = pm_get_selected_playlist ();
-               //newlist = pl->members;
+               pl = pm_get_selected_playlist ();
+               newlist = pl->members;
                return;
        }
        else
-       {*/
+       {
+       */
+       
        if (order == SORT_NONE)
        {
                /* Due to list being prepended together and remaining unsorted 
need to reverse */
@@ -916,8 +1048,6 @@
        {
                cdwidget->displaytracks = g_list_reverse 
(cdwidget->displaytracks);             
        }
-               
-       //coverart_set_images (newlist);
  }
 
 /**
@@ -931,7 +1061,6 @@
 void coverart_set_images (GList *tracks)
 {
        gint i;
-       GtkWidget *cover_window;
        Itdb_Track *track;
 
        /* initialize display if not already done */
@@ -942,11 +1071,7 @@
         */
        if (cdwidget->block_display_change)
                return;
-                       
-       cover_window = gtkpod_xml_get_widget (main_window_xml, 
"cover_display_window");
        
-       //gtk_widget_set (cover_window, "visible", TRUE, NULL);
-               
        coverart_clear_images ();
        cdwidget->first_imgindex = 0;
        cdwidget->displaytracks = NULL;
@@ -987,6 +1112,15 @@
        printf("######### END OF ORIGINAL LINE UP #######\n");*/
 }
 
+/**
+ * coverart_block_change:
+ *
+ * Select covers events can be switched off when automatic
+ * slections of tracks are taking place.
+ *
+ * @val: indicating whether to block or unblock select cover events
+ *  
+ */
 void coverart_block_change (gboolean val)
 {
        cdwidget->block_display_change = val;

Index: display_tracks.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/display_tracks.c,v
retrieving revision 1.114.2.1
retrieving revision 1.114.2.2
diff -u -d -r1.114.2.1 -r1.114.2.2
--- display_tracks.c    22 Jan 2007 00:05:08 -0000      1.114.2.1
+++ display_tracks.c    17 Feb 2007 23:31:14 -0000      1.114.2.2
@@ -2084,7 +2084,7 @@
     {
        Track *track = selected->data;
        if(track != NULL)
-               coverart_select_cover (track->album);
+               coverart_select_cover (track);
     }
 }
 

Index: display_coverart.h
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/Attic/display_coverart.h,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -u -d -r1.1.2.7 -r1.1.2.8
--- display_coverart.h  14 Feb 2007 21:31:40 -0000      1.1.2.7
+++ display_coverart.h  17 Feb 2007 23:31:14 -0000      1.1.2.8
@@ -24,7 +24,10 @@
 
 typedef struct {
        GtkWidget *contentpanel;
+       GtkWidget *canvasbox;
+       GtkWidget *controlbox;
        GnomeCanvas *canvas;
+       GnomeCanvasItem *bground;
        GnomeCanvasText *cvrtext;
        GtkButton *leftbutton;
        GtkHScale *cdslider;
@@ -42,5 +45,8 @@
 void coverart_clear_images ();
 void coverart_block_change ();
 gint sort_tracks (Itdb_Track *a, Itdb_Track *b);
+void on_cover_up_button_clicked (GtkWidget *widget, gpointer data);
+void on_cover_down_button_clicked (GtkWidget *widget, gpointer data);
+void on_paned0_check_resize (GtkContainer *container, gpointer data);
 
 #endif


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2

Reply via email to