Update of /cvsroot/gtkpod/gtkpod/src
In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv21590/src
Modified Files:
Tag: coverart_display_development_branch
display_sorttabs.c main.c prefs_window.c display_private.h
Makefile.am display_playlists.c display.h prefs.c
Added Files:
Tag: coverart_display_development_branch
display_coverart.h display_coverart.c
Log Message:
08/01/2007
- Commit of 2nd prototype version of display_coverart
- Addition of a default image file if tracks do not contain cover art
- Modifications to existing api to allow integration with new code
- New src files added that contain functionality for cover art display
--- NEW FILE: display_coverart.h ---
#ifndef __DISPLAY_COVERART_H__
#define __DISPLAY_COVERART_H__
#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
#define IMG_PREV 2
#define IMG_TOTAL 9
#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;
gdouble img_width;
gdouble img_height;
GnomeCanvasItem *cdcvrgrp;
GnomeCanvasItem *cdimage;
GnomeCanvasItem *shadow_top;
GnomeCanvasItem *shadow_bottom;
GnomeCanvasItem *shadow_left;
GnomeCanvasItem *shadow_right;
} Cover_Item;
typedef struct {
GtkWidget *contentpanel;
GnomeCanvas *canvas;
GtkButton *leftbutton;
GtkHScale *cdslider;
GtkButton *rightbutton;
GPtrArray *cdcovers;
GList *displaytracks;
gint first_imgindex;
} CD_Widget;
void init_default_file (gchar *progpath);
void coverart_init_display ();
void coverart_set_images (GList *tracks);
#endif
--- NEW FILE: display_coverart.c ---
/* Time-stamp: <2006-12-18 20:48:28 jcs>
|
| Copyright (C) 2002-2005 Jorg Schuler <jcsjcs at users sourceforge net>
| Part of the gtkpod project.
|
| URL: http://www.gtkpod.org/
| URL: http://gtkpod.sourceforge.net/
|
| This program is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2 of the License, or
| (at your option) any later version.
|
| This program is distributed in the hope that it will be useful,
| but WITHOUT ANY WARRANTY; without even the implied warranty of
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
| GNU General Public License for more details.
|
| You should have received a copy of the GNU General Public License
[...996 lines suppressed...]
else
pixbuf = get_thumb (track);
if (pixbuf != NULL)
{
/* Set the pixbuf into the cd image */
cover = g_ptr_array_index(cdwidget->cdcovers, i);
cover->track = track;
pixbuf = gdk_pixbuf_scale_simple(pixbuf,
cover->img_width, cover->img_height, GDK_INTERP_NEAREST);
gnome_canvas_item_set(cover->cdimage, "pixbuf", pixbuf);
}
}
/* 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
retrieving revision 1.85.2.1
diff -u -d -r1.85 -r1.85.2.1
--- display_sorttabs.c 20 Jun 2006 23:13:35 -0000 1.85
+++ display_sorttabs.c 8 Jan 2007 21:08:44 -0000 1.85.2.1
@@ -2030,6 +2030,79 @@
st_sort_inst (i, order);
}
+gboolean st_set_selection (Itdb_Track *track)
+{
+ GtkTreeSelection *selection;
+ GtkTreeView *treeview;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ TabEntry *entry = NULL;
+ gboolean status;
+
+ gtk_notebook_set_current_page (sorttab[0]->notebook, ST_CAT_ARTIST);
+ st_page_selected (sorttab[0]->notebook, ST_CAT_ARTIST);
+
+ while (gtk_events_pending ()) gtk_main_iteration ();
+
+ /* ######## Select the artist from the first sorttab ######## */
+ treeview = sorttab[0]->treeview[ST_CAT_ARTIST];
+ model = gtk_tree_view_get_model (treeview);
+ selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
+
+ status = gtk_tree_model_get_iter_first (model, &iter);
+ g_return_val_if_fail (status, FALSE);
+
+ do
+ {
+ gtk_tree_model_get (model, &iter, ST_COLUMN_ENTRY, &entry , -1);
+ g_return_val_if_fail (entry, FALSE);
+
+ if (g_ascii_strcasecmp (entry->name, track->artist) == 0)
+ {
+ /* break out the loop once the correct iter has been
found */
+ break;
+ }
+ }
+ while (gtk_tree_model_iter_next (model, &iter));
+
+ while (gtk_events_pending ()) gtk_main_iteration ();
+
+ gtk_tree_selection_select_iter (selection, &iter);
+
+ while (gtk_events_pending ()) gtk_main_iteration ();
+
+ /* ######## Select the album from the second sorttab ######## */
+ gtk_notebook_set_current_page (sorttab[1]->notebook, ST_CAT_ALBUM);
+ st_page_selected (sorttab[1]->notebook, ST_CAT_ALBUM);
+
+ while (gtk_events_pending ()) gtk_main_iteration ();
+
+ treeview = sorttab[1]->treeview[ST_CAT_ALBUM];
+ model = gtk_tree_view_get_model (treeview);
+ selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
+
+ status = gtk_tree_model_get_iter_first (model, &iter);
+ g_return_val_if_fail (status, FALSE);
+
+ do
+ {
+ gtk_tree_model_get (model, &iter, ST_COLUMN_ENTRY, &entry , -1);
+ g_return_val_if_fail (entry, FALSE);
+
+ if (g_ascii_strcasecmp (entry->name, track->album) == 0)
+ {
+ /* break out the loop once the correct iter has been found */
+ break;
+ }
+ }
+ while (gtk_tree_model_iter_next (model, &iter));
+
+ while (gtk_events_pending ()) gtk_main_iteration ();
+
+ gtk_tree_selection_select_iter (selection, &iter);
+
+ return TRUE;
+}
static void st_selection_changed_cb (gpointer user_data1, gpointer user_data2)
{
Index: main.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/main.c,v
retrieving revision 1.58
retrieving revision 1.58.2.1
diff -u -d -r1.58 -r1.58.2.1
--- main.c 24 Sep 2006 12:16:26 -0000 1.58
+++ main.c 8 Jan 2007 21:08:44 -0000 1.58.2.1
@@ -36,6 +36,7 @@
#include "display.h"
#include "clientserver.h"
+#include "display_coverart.h"
#include "prefs.h"
#include "misc.h"
#include "file.h"
@@ -122,9 +123,14 @@
gtkpod_window = gtkpod_xml_get_widget (main_window_xml, "gtkpod");
init_prefs(argc, argv);
-
- display_create ();
-
+
+ display_create ();
+
+ init_default_file (argv[0]);
+
+ if (prefs_get_int("display_artcovers"))
+ coverart_init_display ();
+
gtk_widget_show (gtkpod_window);
init_data (gtkpod_window); /* setup base data */
Index: prefs_window.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/prefs_window.c,v
retrieving revision 1.188
retrieving revision 1.188.2.1
diff -u -d -r1.188 -r1.188.2.1
--- prefs_window.c 22 Nov 2006 15:54:38 -0000 1.188
+++ prefs_window.c 8 Jan 2007 21:08:44 -0000 1.188.2.1
@@ -411,7 +411,11 @@
w = gtkpod_xml_get_widget (prefs_window_xml, "cfg_display_tooltips_prefs");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),
prefs_get_int("display_tooltips_prefs"));
-
+
+ w = gtkpod_xml_get_widget (prefs_window_xml,
"cfg_display_artcovers");
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),
+ prefs_get_int("display_artcovers"));
+
w = gtkpod_xml_get_widget (prefs_window_xml, "cfg_multi_edit");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),
prefs_get_int("multi_edit"));
@@ -1247,6 +1251,13 @@
gtk_toggle_button_get_active (togglebutton));
}
+void
+on_cfg_coverart_display_toggled
(GtkToggleButton *togglebutton,
+ gpointer
user_data)
+{
+ temp_prefs_set_int(temp_prefs, "display_artcovers",
+ gtk_toggle_button_get_active (togglebutton));
+}
void
on_cfg_display_toolbar_toggled (GtkToggleButton *togglebutton,
Index: display_private.h
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/display_private.h,v
retrieving revision 1.23
retrieving revision 1.23.2.1
diff -u -d -r1.23 -r1.23.2.1
--- display_private.h 19 Nov 2005 07:29:46 -0000 1.23
+++ display_private.h 8 Jan 2007 21:08:44 -0000 1.23.2.1
@@ -36,6 +36,7 @@
#include "display.h"
#include "misc.h"
+#include "display_coverart.h"
/* tree sort cannot be unsorted by choosing the default sort
* column. Set to 1 if it's broken, 0 if it's not broken */
Index: Makefile.am
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/Makefile.am,v
retrieving revision 1.59
retrieving revision 1.59.2.1
diff -u -d -r1.59 -r1.59.2.1
--- Makefile.am 22 Nov 2006 15:54:37 -0000 1.59
+++ Makefile.am 8 Jan 2007 21:08:44 -0000 1.59.2.1
@@ -33,6 +33,7 @@
context_menus.c context_menus.h \
date_parser.l date_parser2.l date_parser.h \
details.c details.h \
+ display_coverart.c display_coverart.h \
display.c display_playlists.c display_sorttabs.c \
display.h display_private.h \
display_itdb.c display_itdb.h \
Index: display_playlists.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/display_playlists.c,v
retrieving revision 1.94
retrieving revision 1.94.2.1
diff -u -d -r1.94 -r1.94.2.1
--- display_playlists.c 26 Nov 2006 08:40:31 -0000 1.94
+++ display_playlists.c 8 Jan 2007 21:08:44 -0000 1.94.2.1
@@ -1362,6 +1362,9 @@
st_init (-1, 0);
current_playlist = new_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: display.h
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/display.h,v
retrieving revision 1.117
retrieving revision 1.117.2.1
diff -u -d -r1.117 -r1.117.2.1
--- display.h 21 Oct 2006 10:21:53 -0000 1.117
+++ display.h 8 Jan 2007 21:08:44 -0000 1.117.2.1
@@ -300,6 +300,7 @@
void st_stop_editing (gint inst, gboolean cancel);
void st_page_selected (GtkNotebook *notebook, guint page);
+gboolean st_set_selection (Itdb_Track *track);
void st_redisplay (guint32 inst);
void st_sort (GtkSortType order);
void st_remove_entry (TabEntry *entry, guint32 inst);
Index: prefs.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/prefs.c,v
retrieving revision 1.272
retrieving revision 1.272.2.1
diff -u -d -r1.272 -r1.272.2.1
--- prefs.c 24 Nov 2006 06:48:25 -0000 1.272
+++ prefs.c 8 Jan 2007 21:08:44 -0000 1.272.2.1
@@ -237,6 +237,7 @@
prefs_set_int("info_window", FALSE);
prefs_set_int("last_prefs_page", 0);
prefs_set_int("tmp_disable_sort", TRUE);
+ prefs_set_int("display_artcovers", FALSE);
prefs_set_int("multi_edit_title", TRUE);
prefs_set_int("multi_edit", FALSE);
prefs_set_int("not_played_track", TRUE);
-------------------------------------------------------------------------
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