Update of /cvsroot/gtkpod/gtkpod/src
In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv31912/src
Modified Files:
Tag: coverart_display_development_branch
display_coverart.c display_sorttabs.c fileselection.c
display_playlists.c misc_confirm.c display.h
display_coverart.h
Log Message:
cdshine.png added to pixmaps for highlighting pixbuf
draw_shadow functions replaced with add_highlight / add_shadow_to_cover
functions
clear_cdimages changed to coverart_clear_images and made public to allow for
updating coverart when a playlist is removed
addition of highlight file initialised in init_default_file
coverart_sort_images now called as part of coverart_set_images so no need to
call independantly
adding a directory / track reinitialises coverart display
deletion of tracks reinitialises coverart display
deletion of playlist clear coverart display
Index: display_coverart.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/Attic/display_coverart.c,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -d -r1.1.2.4 -r1.1.2.5
--- display_coverart.c 25 Jan 2007 00:10:06 -0000 1.1.2.4
+++ display_coverart.c 8 Feb 2007 00:25:41 -0000 1.1.2.5
@@ -31,24 +31,20 @@
# include <config.h>
#endif
+#include "display_private.h"
+#include "display.h"
+#include "itdb.h"
+#include "prefs.h"
#include "display_coverart.h"
/* Declarations */
static void debug_albums ();
static GdkPixbuf *draw_blank_cdimage ();
-static GdkPixbuf *draw_shadow_top (gdouble width, gdouble height);
-static GdkPixbuf *draw_shadow_bottom (gdouble width, gdouble height);
-static GdkPixbuf *draw_shadow_left (gdouble width, gdouble height);
-static GdkPixbuf *draw_shadow_right (gdouble width, gdouble height);
+static void add_highlight (Cover_Item *cover);
static void draw_background (GnomeCanvas *canvas);
-static void get_shadow_buffers (Cover_Shadow *shadow);
-static void add_shadow_to_cover (Cover_Item *cover, Cover_Shadow *shadow);
-static void free_shadow (Cover_Shadow *shadow);
-static void clear_cdimages ();
static void raise_cdimages (GPtrArray *cdcovers);
static GdkPixbuf *get_thumb (Itdb_Track *track);
static void scroll_covers (gint direction);
-static gint sort_tracks (Itdb_Track *a, Itdb_Track *b);
static gint search_tracks_by_album (Itdb_Track *a, gchar *b);
static void on_cover_display_button_clicked (GtkWidget *widget, gpointer data);
static void on_main_cover_image_clicked (GnomeCanvas *canvas, GdkEvent *event,
gpointer data);
@@ -69,6 +65,8 @@
static gdouble BIG_IMG_HEIGHT;
/* Path of the png file used for albums without cd covers */
static gchar *DEFAULT_FILE;
+/* Path of the png file used for the highlighting of cd covers */
+static gchar *HIGHLIGHT_FILE;
static void debug_albums ()
{
@@ -142,229 +140,33 @@
}
/**
- * draw_shadow_ top/bottom/left/right:
- *
- * Using provided widths and heights, constructs shadow buffers
- * conforming to the required dimensions.
- *
- * @width: width of desired shadow buffer
- * @height: height of required shadow buffer
- *
- * Returns:
- * pixbuf of calculated shadow buffer
- */
-static GdkPixbuf *draw_shadow_top(gdouble width, gdouble height)
-{
- gint pixel_offset, rowstride, x, y;
- guchar *drawbuf;
-
- drawbuf = g_malloc ((gint) (width * 16) * (gint) height);
-
- /* drawing buffer length multiplied by 4
- * due to 1 width per R, G, B & ALPHA
- */
- rowstride = width * 4;
-
- for(y = 0; y < height; ++y)
- {
- for(x = 0; x < width; ++x)
- {
- pixel_offset = (y * rowstride) + (x * 4);
- drawbuf[pixel_offset] = 0;
- drawbuf[pixel_offset + 1] = 0;
- drawbuf[pixel_offset + 2] = 0;
- drawbuf[pixel_offset + 3] = 255 - (y * (255 / height));
- /* drawbuf[pixel_offset + 3] = 255; */
- }
- }
- return gdk_pixbuf_new_from_data(drawbuf,
-
GDK_COLORSPACE_RGB,
- TRUE,
- 8,
- width,
- height,
-
rowstride,
-
(GdkPixbufDestroyNotify) g_free, NULL);
-}
-
-static GdkPixbuf *draw_shadow_bottom(gdouble width, gdouble height)
-{
- gint pixel_offset, rowstride, x, y;
- guchar *drawbuf;
-
- drawbuf = g_malloc((gint) (width * 16) * (gint) height);
-
- /* drawing buffer length multiplied by 4
- * due to 1 width per R, G, B & ALPHA
- */
- rowstride = width * 4;
- for(y = 0; y < height; ++y)
- {
- for(x = 0; x < width; ++x)
- {
- pixel_offset = (y * rowstride) + (x * 4);
- drawbuf[pixel_offset] = 0;
- drawbuf[pixel_offset + 1] = 0;
- drawbuf[pixel_offset + 2] = 0;
- drawbuf[pixel_offset + 3] = y * (255 / height);
- }
- }
- return gdk_pixbuf_new_from_data(drawbuf,
-
GDK_COLORSPACE_RGB,
- TRUE,
- 8,
- width,
- height,
-
rowstride,
-
(GdkPixbufDestroyNotify) g_free, NULL);
-}
-
-static GdkPixbuf *draw_shadow_left(gdouble width, gdouble height)
-{
- gint pixel_offset, rowstride, x, y;
- guchar *drawbuf;
-
- drawbuf = g_malloc((gint) (width * 16) * (gint) height);
-
- /* drawing buffer length multiplied by 4
- * due to 1 width per R, G, B & ALPHA
- */
- rowstride = width * 4;
- for(y = 0; y < height; ++y)
- {
- for(x = 0; x < width; ++x)
- {
- /* 255 is opaque while 0 is transparent */
- pixel_offset = (y * rowstride) + (x * 4);
- drawbuf[pixel_offset] = 0;
- drawbuf[pixel_offset + 1] = 0;
- drawbuf[pixel_offset + 2] = 0;
- drawbuf[pixel_offset + 3] = 255 - (x * (255 / width));
- }
- }
- return gdk_pixbuf_new_from_data(drawbuf,
-
GDK_COLORSPACE_RGB,
- TRUE,
- 8,
- width,
- height,
-
rowstride,
-
(GdkPixbufDestroyNotify) g_free, NULL);
-}
-
-static GdkPixbuf *draw_shadow_right(gdouble width, gdouble height)
-{
- gint pixel_offset, rowstride, x, y;
- guchar *drawbuf;
-
- drawbuf = g_malloc((gint) (width * 16) * (gint) height);
-
- /* drawing buffer length multiplied by 4
- * due to 1 width per R, G, B & ALPHA
- */
- rowstride = width * 4;
- for(y = 0; y < height; ++y)
- {
- for(x = 0; x < width; ++x)
- {
- /* 255 is opaque while 0 is transparent */
- pixel_offset = (y * rowstride) + (x * 4);
- drawbuf[pixel_offset] = 0;
- drawbuf[pixel_offset + 1] = 0;
- drawbuf[pixel_offset + 2] = 0;
- drawbuf[pixel_offset + 3] = x * (255 / width);
- }
- }
- return gdk_pixbuf_new_from_data(drawbuf,
-
GDK_COLORSPACE_RGB,
- TRUE,
- 8,
- width,
- height,
-
rowstride,
-
(GdkPixbufDestroyNotify) g_free, NULL);
-}
-
-/**
- * get_shadow_buffers:
- *
- * Adds created shadow buffers to an already created Cover Shadow
- * object.
- *
- * @shadow: shadow object requring shadow.
- *
- */
-static void get_shadow_buffers (Cover_Shadow *shadow) {
- gdouble shwidth, shheight;
-
- shwidth = shadow->img_width;
- shheight = shadow->img_height / 5;
-
- shadow->topbuf = draw_shadow_top(shwidth, shheight);
- shadow->bottombuf = draw_shadow_bottom(shwidth, shheight);
-
- /* LEFT AND RIGHT SHADOW SECTIONS */
- shwidth = shwidth / 5;
- shheight = shadow->img_height;
-
- shadow->leftbuf = draw_shadow_left(shwidth, shheight);
- shadow->rightbuf = draw_shadow_right(shwidth, shheight);
-}
-
-/**
- * add_shadow_to_cover:
+ * add_highlight:
*
- * Add the shadow to a cover item.
+ * Add the highlighted image to the cover to give shine and a reflection
*
- * @cover: cover item requiring shadow
- * @shadow: shadow object
- *
+ * @cover: A Cover_Item object which the higlighted is added to.
+ *
*/
-static void add_shadow_to_cover (Cover_Item *cover, Cover_Shadow *shadow)
+static void add_highlight (Cover_Item *cover)
{
- gdouble x, y;
+ GdkPixbuf *image;
+ GError *error = NULL;
- cover->shadow_top = gnome_canvas_item_new((GnomeCanvasGroup *)
cover->cdcvrgrp,
-
GNOME_TYPE_CANVAS_PIXBUF,
-
"pixbuf", shadow->topbuf,
-
NULL);
+ image = gdk_pixbuf_new_from_file(HIGHLIGHT_FILE, &error);
+ if(error != NULL)
+ {
+ printf("Error occurred loading file - \nCode: %d\nMessage:
%s\n", error->code, error->message);
+ g_return_if_fail (image);
+ }
- y = cover->img_height - gdk_pixbuf_get_height(shadow->bottombuf);
- cover->shadow_bottom = gnome_canvas_item_new((GnomeCanvasGroup *)
cover->cdcvrgrp,
-
GNOME_TYPE_CANVAS_PIXBUF,
-
"pixbuf", shadow->bottombuf,
-
"y", (double) y,
-
NULL);
-
- cover->shadow_left = gnome_canvas_item_new((GnomeCanvasGroup *)
cover->cdcvrgrp,
-
GNOME_TYPE_CANVAS_PIXBUF,
-
"pixbuf", shadow->leftbuf,
-
NULL);
-
- x = cover->img_width - gdk_pixbuf_get_width(shadow->rightbuf);
- cover->shadow_right = gnome_canvas_item_new((GnomeCanvasGroup *)
cover->cdcvrgrp,
+ 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", shadow->rightbuf,
-
"x", (double) x,
-
NULL);
-}
-
-/**
- * free_shadow:
- *
- * Frees a shadow object when no longer required.
- *
- * @shadow: shadow object containing references to all the types
- * of shadow used by a Cover Item.
- *
- */
-static void free_shadow(Cover_Shadow *shadow)
-{
- g_object_unref(shadow->topbuf);
- g_object_unref(shadow->bottombuf);
- g_object_unref(shadow->leftbuf);
- g_object_unref(shadow->rightbuf);
- g_free(shadow);
+ "pixbuf", image,
+
NULL);
+
+ gnome_canvas_item_hide (cover->highlight);
}
/**
@@ -384,8 +186,8 @@
gnome_canvas_rect_get_type(),
"x1",(double) 0,
"y1",(double) 0,
- "x2",(double) WIDTH,
- "y2",(double) HEIGHT,
+ "x2",(double) WIDTH + 50,
+ "y2",(double) HEIGHT + 50,
"fill_color", "black",
NULL);
@@ -433,7 +235,7 @@
*/
static void set_covers ()
{
- GdkPixbuf *imgbuf;
+ GdkPixbuf *imgbuf, *reflection;
gint i, dataindex;
Itdb_Track *track;
Cover_Item *cover;
@@ -445,25 +247,35 @@
track = g_list_nth_data (cdwidget->displaytracks, dataindex);
if (track == NULL)
+ {
imgbuf = draw_blank_cdimage ();
+ gnome_canvas_item_hide (cover->highlight);
+ }
else
+ {
imgbuf = get_thumb (track);
+ gnome_canvas_item_show (cover->highlight);
+ }
if (imgbuf != NULL)
{
/* Set the pixbuf into the cd image */
- cover = g_ptr_array_index(cdwidget->cdcovers, i);
cover->track = track;
imgbuf = gdk_pixbuf_scale_simple(imgbuf,
cover->img_width, cover->img_height, GDK_INTERP_NEAREST);
- gnome_canvas_item_set(cover->cdimage, "pixbuf", imgbuf);
+ gnome_canvas_item_set (cover->cdimage, "pixbuf",
imgbuf);
+
+ /* flip image vertically to create reflection */
+ reflection = gdk_pixbuf_flip (imgbuf, FALSE);
+ gnome_canvas_item_set (cover->cdreflection, "pixbuf",
reflection);
}
if (i == IMG_MAIN)
{
/* Set the text to display details of the main image */
gnome_canvas_item_set ( GNOME_CANVAS_ITEM
(cdwidget->cvrtext),
-
"text", g_strconcat (track->artist, " - ",
track->album, NULL),
+
"text", g_strconcat (track->artist, "\n", track->album,
NULL),
"fill_color", "white",
+
"justification", GTK_JUSTIFY_CENTER,
NULL);
}
}
@@ -483,7 +295,6 @@
gint displaytotal;
displaytotal = g_list_length(cdwidget->displaytracks);
- printf("Display Total: %d\n", displaytotal);
if (displaytotal <= 0)
return;
@@ -618,32 +429,18 @@
gint i;
gdouble x = 0, y = 0, img_width = 0, img_height = 0;
Cover_Item *cover;
- Cover_Shadow *imgshadow, *bigimgshadow;
/* 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_usize(GTK_WIDGET(cdwidget->canvas), WIDTH, HEIGHT);
- gnome_canvas_set_scroll_region(cdwidget->canvas, 0.0, 0.0, WIDTH,
HEIGHT);
+ 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);
- /* Prepare the shadow on the cover images */
- imgshadow = g_new0(Cover_Shadow, 1);
- bigimgshadow = g_new0(Cover_Shadow, 1);
-
- /* init shadow pixbufs for the 8 scaled cover images */
- imgshadow->img_width = SMALL_IMG_WIDTH;
- imgshadow->img_height = SMALL_IMG_HEIGHT;
- get_shadow_buffers (imgshadow);
-
- /* init shadow pixbufs for the main scaled cover image */
- bigimgshadow->img_width = BIG_IMG_WIDTH;
- bigimgshadow->img_height = BIG_IMG_HEIGHT;
- get_shadow_buffers (bigimgshadow);
-
cdwidget->cdcovers = g_ptr_array_sized_new (IMG_TOTAL);
for(i = 0; i < IMG_TOTAL; ++i)
{
@@ -703,7 +500,7 @@
break;
case IMG_MAIN:
/* The Main Image CD Cover Image */
- y = HEIGHT - (BIG_IMG_HEIGHT + BORDER + (BORDER
/ 2));
+ y = HEIGHT - (BIG_IMG_HEIGHT + (BORDER * 4));
img_height = BIG_IMG_HEIGHT;
}
@@ -718,51 +515,55 @@
"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)
{
- add_shadow_to_cover (cover, bigimgshadow);
/* 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);
- }
- else
- add_shadow_to_cover (cover, imgshadow);
- g_ptr_array_add(cdwidget->cdcovers, cover);
- cover = NULL;
- }
-
- cdwidget->cvrtext =
GNOME_CANVAS_TEXT(gnome_canvas_item_new(gnome_canvas_root(cdwidget->canvas),
+ 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) HEIGHT - (BORDER + (BORDER / 2)),
-
"justification", GTK_JUSTIFY_LEFT,
+
"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);
-
- free_shadow(imgshadow);
- free_shadow(bigimgshadow);
}
/**
- * clear_cdimages:
+ * coverart_clear_images:
*
* reset the cd cover images to default blank pixbufs and
* nullify the covers' pointers to any tracks.
*
*/
-static void clear_cdimages ()
+void coverart_clear_images ()
{
gint i;
Cover_Item *cover = NULL;
@@ -777,7 +578,9 @@
cover = g_ptr_array_index(cdwidget->cdcovers, i);
buf2 = gdk_pixbuf_scale_simple(buf, cover->img_width,
cover->img_height, GDK_INTERP_NEAREST);
gnome_canvas_item_set(cover->cdimage, "pixbuf", buf2, NULL);
-
+ gnome_canvas_item_set(cover->cdreflection, "pixbuf", buf2,
NULL);
+ gnome_canvas_item_hide (cover->highlight);
+
g_object_unref (buf2);
/* Reset track list too */
@@ -914,9 +717,9 @@
gchar *prog_absolute;
if (g_str_has_prefix (progname, "." G_DIR_SEPARATOR_S))
- prog_absolute = g_build_filename (cur_dir,progname+2,NULL);
+ prog_absolute = g_build_filename (cur_dir, progname+2, NULL);
else
- prog_absolute = g_build_filename (cur_dir,progname,NULL);
+ prog_absolute = g_build_filename (cur_dir, progname, NULL);
g_free (progname);
g_free (cur_dir);
@@ -931,6 +734,7 @@
{
*suffix = 0;
DEFAULT_FILE = g_build_filename (progname, "pixmaps",
"default-cover.png", NULL);
+ HIGHLIGHT_FILE = g_build_filename (progname, "pixmaps",
"cdshine.png", NULL);
}
}
@@ -940,10 +744,20 @@
g_free (DEFAULT_FILE);
DEFAULT_FILE = NULL;
}
+
+ if (!g_file_test (HIGHLIGHT_FILE, G_FILE_TEST_EXISTS))
+ {
+ g_free (HIGHLIGHT_FILE);
+ HIGHLIGHT_FILE = NULL;
+ }
+
}
if (!DEFAULT_FILE)
DEFAULT_FILE = g_build_filename (PACKAGE_DATA_DIR, PACKAGE, "pixmaps",
"default-cover.png", NULL);
+
+ if (!HIGHLIGHT_FILE)
+ HIGHLIGHT_FILE = g_build_filename (PACKAGE_DATA_DIR, PACKAGE, "pixmaps",
"cdshine.png", NULL);
}
/**
@@ -981,7 +795,7 @@
"default_height", &HEIGHT,
NULL);
- HEIGHT = HEIGHT / 3;
+ HEIGHT = HEIGHT / 2.75;
WIDTH = gtk_paned_get_position((GTK_PANED(podpane)));
ratio = (double) WIDTH / (double) HEIGHT;
@@ -996,9 +810,9 @@
BIG_IMG_HEIGHT = HEIGHT / 2;
prepare_canvas ();
+ gtk_widget_set_size_request (GTK_WIDGET(canvasbox), WIDTH, HEIGHT);
gtk_box_pack_start_defaults (GTK_BOX(canvasbox),
GTK_WIDGET(cdwidget->canvas));
-
g_signal_connect (G_OBJECT(cdwidget->leftbutton), "clicked",
G_CALLBACK(on_cover_display_button_clicked), NULL);
@@ -1027,7 +841,7 @@
* integer indicating order of tracks
*
*/
-static gint sort_tracks (Itdb_Track *a, Itdb_Track *b)
+gint sort_tracks (Itdb_Track *a, Itdb_Track *b)
{
gint artistval;
@@ -1052,34 +866,34 @@
* @track: chosen album
*
*/
- void coverart_select_cover (gchar *album)
- {
- GList *selectedtrk;
- gint displaytotal, index;
+void coverart_select_cover (gchar *album)
+{
+ GList *selectedtrk;
+ gint displaytotal, index;
- /* Only select covers if fire display change is enabled */
- if (! cdwidget->fire_display_change)
- return;
+ /* Only select covers if fire display change is enabled */
+ if (! cdwidget->fire_display_change)
+ return;
- displaytotal = g_list_length(cdwidget->displaytracks);
- if (displaytotal <= 0)
- return;
+ displaytotal = g_list_length(cdwidget->displaytracks);
+ if (displaytotal <= 0)
+ return;
- /* Find the track that matches the given album */
- selectedtrk = g_list_find_custom (cdwidget->displaytracks,
album, (GCompareFunc) search_tracks_by_album);
- g_return_if_fail (selectedtrk);
+ /* Find the track that matches the given album */
+ selectedtrk = g_list_find_custom (cdwidget->displaytracks, album,
(GCompareFunc) search_tracks_by_album);
+ g_return_if_fail (selectedtrk);
- /* Determine the index of the found track */
- index = g_list_position (cdwidget->displaytracks, selectedtrk);
+ /* Determine the index of the found track */
+ index = g_list_position (cdwidget->displaytracks, selectedtrk);
- /* Use the index value for the main image index */
- cdwidget->first_imgindex = index - IMG_MAIN;
- if (cdwidget->first_imgindex < 0)
- cdwidget->first_imgindex = 0;
- else if((cdwidget->first_imgindex + IMG_TOTAL) >= displaytotal)
- cdwidget->first_imgindex = displaytotal - IMG_TOTAL;
+ /* Use the index value for the main image index */
+ cdwidget->first_imgindex = index - IMG_MAIN;
+ if (cdwidget->first_imgindex < 0)
+ cdwidget->first_imgindex = 0;
+ else if((cdwidget->first_imgindex + IMG_TOTAL) >= displaytotal)
+ cdwidget->first_imgindex = displaytotal - IMG_TOTAL;
- set_covers ();
+ set_covers ();
}
@@ -1087,37 +901,44 @@
* coverart_sort_images:
*
* When the alphabetize function is initiated this will
- * sort the covers in the same way
+ * sort the covers in the same way. Used at any point to
+ * sort the covers BUT must be called after an initial coverart_set_images
+ * as the latter initialises the cdwidget->displaytracks list
*
* @order: order type
*
*/
- void coverart_sort_images (GtkSortType order)
- {
+void coverart_sort_images (GtkSortType order)
+{
Playlist* pl;
GList *newlist = NULL;
+ /*if (order == SORT_NONE)
+ {
+ //pl = pm_get_selected_playlist ();
+ //newlist = pl->members;
+ return;
+ }
+ else
+ {*/
if (order == SORT_NONE)
{
- pl = pm_get_selected_playlist ();
- newlist = pl->members;
+ /* Due to list being prepended together and remaining unsorted
need to reverse */
+ cdwidget->displaytracks = g_list_reverse
(cdwidget->displaytracks);
}
else
{
- newlist = g_list_copy(cdwidget->displaytracks);
-
/* Remove all the null tracks before sorting */
- newlist = g_list_remove_all (newlist, NULL);
-
- newlist = g_list_sort (newlist, (GCompareFunc) sort_tracks);
+ cdwidget->displaytracks = g_list_remove_all
(cdwidget->displaytracks, NULL);
+ cdwidget->displaytracks = g_list_sort (cdwidget->displaytracks,
(GCompareFunc) sort_tracks);
}
if (order == GTK_SORT_DESCENDING)
{
- newlist = g_list_reverse (newlist);
+ cdwidget->displaytracks = g_list_reverse
(cdwidget->displaytracks);
}
- coverart_set_images (newlist);
+ //coverart_set_images (newlist);
}
/**
@@ -1142,23 +963,19 @@
*/
if (! cdwidget->fire_display_change)
return;
-
+
cover_window = gtkpod_xml_get_widget (main_window_xml,
"cover_display_window");
//gtk_widget_set (cover_window, "visible", TRUE, NULL);
- clear_cdimages ();
- cdwidget->displaytracks = NULL;
+ coverart_clear_images ();
cdwidget->first_imgindex = 0;
+ cdwidget->displaytracks = NULL;
gtk_range_set_value (GTK_RANGE (cdwidget->cdslider), 0);
if (tracks == NULL)
return;
-
- /* Add 4 null tracks to the start of the track list for padding */
- for (i = 0; i < IMG_MAIN; ++i)
- cdwidget->displaytracks = g_list_prepend
(cdwidget->displaytracks, NULL);
-
+
while (tracks)
{
track = tracks->data;
@@ -1169,17 +986,22 @@
tracks = tracks->next;
}
+ /* Sort the tracks to the order set in the preference */
+ coverart_sort_images (prefs_get_int("st_sort"));
+
/* Add 4 null tracks to the end of the track list for padding */
for (i = 0; i < IMG_MAIN; ++i)
- cdwidget->displaytracks = g_list_prepend
(cdwidget->displaytracks, NULL);
+ cdwidget->displaytracks = g_list_append
(cdwidget->displaytracks, NULL);
- cdwidget->displaytracks = g_list_reverse (cdwidget->displaytracks);
+ /* Add 4 null tracks to the start of the track list for padding */
+ for (i = 0; i < IMG_MAIN; ++i)
+ cdwidget->displaytracks = g_list_prepend
(cdwidget->displaytracks, NULL);
set_covers ();
/* Set the scale range */
gtk_range_set_range (GTK_RANGE (cdwidget->cdslider), 0, g_list_length
(cdwidget->displaytracks) - 1);
-
+
/*printf("######### ORIGINAL LINE UP ########\n");
debug_albums ();
printf("######### END OF ORIGINAL LINE UP #######\n");*/
Index: display_sorttabs.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/display_sorttabs.c,v
retrieving revision 1.85.2.3
retrieving revision 1.85.2.4
diff -u -d -r1.85.2.3 -r1.85.2.4
--- display_sorttabs.c 25 Jan 2007 00:10:06 -0000 1.85.2.3
+++ display_sorttabs.c 8 Feb 2007 00:25:42 -0000 1.85.2.4
@@ -2029,7 +2029,8 @@
for (i=0; i < prefs_get_int("sort_tab_num"); ++i)
st_sort_inst (i, order);
- coverart_sort_images (order);
+ Playlist *plitem = pm_get_selected_playlist ();
+ coverart_set_images (plitem->members);
}
@@ -2209,7 +2210,6 @@
/* Select the cover in the coverart_display */
GList *gl = g_list_first(new_entry->members);
Track *track = gl->data;
- printf("track artist: %s Track Album: %s\n", track->artist,
track->album);
coverart_select_cover (track->album);
}
Index: fileselection.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/fileselection.c,v
retrieving revision 1.13
retrieving revision 1.13.2.1
diff -u -d -r1.13 -r1.13.2.1
--- fileselection.c 23 Jun 2006 16:03:06 -0000 1.13
+++ fileselection.c 8 Feb 2007 00:25:42 -0000 1.13.2.1
@@ -53,6 +53,7 @@
#include "misc.h"
#include "misc_track.h"
#include "fileselection.h"
+#include "display_coverart.h"
/*
* Data global to this module only
@@ -128,9 +129,14 @@
else
gtkpod_statusbar_message (_("Some files were not added successfully"));
+ /* Reinitialise coverart display for selected playlist */
+ coverart_set_images (playlist->members);
+
/* Clean up the names list */
delete_file_list(names);
release_widgets ();
+
+
}
/*
@@ -680,6 +686,8 @@
NULL, NULL);
prefs_set_string ("last_dir_browsed", dir);
gtkpod_tracks_statusbar_update();
+ /* Reinitialise coverart display for selected playlist */
+ coverart_set_images (plitem->members);
}
else
{
Index: display_playlists.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/display_playlists.c,v
retrieving revision 1.94.2.1
retrieving revision 1.94.2.2
diff -u -d -r1.94.2.1 -r1.94.2.2
--- display_playlists.c 8 Jan 2007 21:08:44 -0000 1.94.2.1
+++ display_playlists.c 8 Feb 2007 00:25:42 -0000 1.94.2.2
@@ -1328,6 +1328,7 @@
GtkTreeModel *model;
GtkTreeIter iter;
Playlist *new_playlist = NULL;
+ GList *newlist = NULL;
#if DEBUG_TIMING
GTimeVal time;
@@ -1362,9 +1363,10 @@
st_init (-1, 0);
current_playlist = new_playlist;
-
- coverart_set_images (new_playlist->members);
-
+
+ /* Set the coverart display based on the selected playlist */
+ coverart_set_images (new_playlist->members);
+
if (new_playlist->is_spl && new_playlist->splpref.liveupdate)
itdb_spl_update (new_playlist);
if (new_playlist->members)
Index: misc_confirm.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/misc_confirm.c,v
retrieving revision 1.44
retrieving revision 1.44.2.1
diff -u -d -r1.44 -r1.44.2.1
--- misc_confirm.c 24 Sep 2006 12:16:26 -0000 1.44
+++ misc_confirm.c 8 Feb 2007 00:25:42 -0000 1.44.2.1
@@ -39,6 +39,7 @@
#include "misc.h"
#include "prefs.h"
#include "info.h"
+#include "display_coverart.h"
#ifdef HAVE_STATVFS
#include <sys/types.h>
@@ -308,6 +309,8 @@
gp_playlist_remove_track (dd->pl, l->data, dd->deleteaction);
}
+ /* Update the coverart display and ensure it is sorted
correctly */
+ coverart_set_images (dd->pl->members);
g_list_free (dd->tracks);
g_free (dd);
@@ -648,6 +651,8 @@
delete_playlist_cleanup (dd);
gtkpod_tracks_statusbar_update ();
+
+ coverart_clear_images ();
}
Index: display.h
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/display.h,v
retrieving revision 1.117.2.1
retrieving revision 1.117.2.2
diff -u -d -r1.117.2.1 -r1.117.2.2
--- display.h 8 Jan 2007 21:08:44 -0000 1.117.2.1
+++ display.h 8 Feb 2007 00:25:42 -0000 1.117.2.2
@@ -38,6 +38,7 @@
#include <glade/glade.h>
#include "itdb.h"
#include "display_itdb.h"
+#include "display_coverart.h"
/* Main XML glade file */
GladeXML *main_window_xml;
Index: display_coverart.h
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/Attic/display_coverart.h,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -d -r1.1.2.4 -r1.1.2.5
--- display_coverart.h 25 Jan 2007 00:10:06 -0000 1.1.2.4
+++ display_coverart.h 8 Feb 2007 00:25:42 -0000 1.1.2.5
@@ -3,10 +3,6 @@
#include <gtk/gtk.h>
#include <libgnomecanvas/libgnomecanvas.h>
-#include "display_private.h"
-#include "display.h"
-#include "itdb.h"
-#include "prefs.h"
#define IMG_MAIN 4
#define IMG_NEXT 1
@@ -15,15 +11,6 @@
#define BORDER 10
typedef struct {
- gdouble img_width;
- gdouble img_height;
- GdkPixbuf *topbuf;
- GdkPixbuf *bottombuf;
- GdkPixbuf *leftbuf;
- GdkPixbuf *rightbuf;
-} Cover_Shadow;
-
-typedef struct {
Itdb_Track *track;
gdouble img_x;
gdouble img_y;
@@ -31,10 +18,8 @@
gdouble img_height;
GnomeCanvasItem *cdcvrgrp;
GnomeCanvasItem *cdimage;
- GnomeCanvasItem *shadow_top;
- GnomeCanvasItem *shadow_bottom;
- GnomeCanvasItem *shadow_left;
- GnomeCanvasItem *shadow_right;
+ GnomeCanvasItem *cdreflection;
+ GnomeCanvasItem *highlight;
} Cover_Item;
typedef struct {
@@ -54,5 +39,7 @@
void coverart_sort_images (GtkSortType order);
void coverart_select_cover (gchar *album);
void coverart_set_images (GList *tracks);
+void coverart_clear_images ();
+gint sort_tracks (Itdb_Track *a, Itdb_Track *b);
#endif
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2