changeset 77:44f2223541d1

Sun Oct 15 10:45:14 2006 John Ellis <johne@verizon.net> * pan-view.c: Recalc the size of the layout when popping up new images in the calendar so that all new images can be scrolled into view. * pixbuf-renderer.[ch] (pixbuf_renderer_set_tiles_size): Add ability to resize a tile canvas without the need for a complete reset/render.
author gqview
date Sun, 15 Oct 2006 14:49:25 +0000
parents 07773a3c5b29
children b192a0efe080
files ChangeLog TODO src/pan-view.c src/pixbuf-renderer.c src/pixbuf-renderer.h
diffstat 5 files changed, 69 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Oct 15 08:06:14 2006 +0000
+++ b/ChangeLog	Sun Oct 15 14:49:25 2006 +0000
@@ -1,3 +1,10 @@
+Sun Oct 15 10:45:14 2006  John Ellis  <johne@verizon.net>
+
+	* pan-view.c: Recalc the size of the layout when popping up new images
+	in the calendar so that all new images can be scrolled into view.
+	* pixbuf-renderer.[ch] (pixbuf_renderer_set_tiles_size): Add ability
+	to resize a tile canvas without the need for a complete reset/render.
+
 Sun Oct 15 04:03:41 2006  John Ellis  <johne@verizon.net>
 
 	* main.c: Fix command line parser to work with any combination of files
--- a/TODO	Sun Oct 15 08:06:14 2006 +0000
+++ b/TODO	Sun Oct 15 14:49:25 2006 +0000
@@ -90,6 +90,8 @@
    > xvpics is now hidden option.
    > Holding down shift will now scroll more when panning with mouse.
 
+   > add blurb about moving images between collections with shift+drag
+
 
 Minor (non blockers):
 ----------------------------------------------
--- a/src/pan-view.c	Sun Oct 15 08:06:14 2006 +0000
+++ b/src/pan-view.c	Sun Oct 15 14:49:25 2006 +0000
@@ -288,6 +288,8 @@
 
 static GList *pan_layout_intersect(PanWindow *pw, gint x, gint y, gint width, gint height);
 
+static void pan_layout_resize(PanWindow *pw, gint border);
+
 static void pan_window_layout_update_idle(PanWindow *pw);
 
 static GtkWidget *pan_popup_menu(PanWindow *pw);
@@ -1997,6 +1999,8 @@
 
 	pan_item_box_shadow(pbox, PAN_SHADOW_OFFSET * 2, PAN_SHADOW_FADE * 2);
 	pan_item_added(pw, pbox);
+
+	pan_layout_resize(pw, 100);
 }
 
 static void pan_window_layout_compute_calendar(PanWindow *pw, const gchar *path, gint *width, gint *height)
@@ -2528,6 +2532,46 @@
 	return list;
 }
 
+static void pan_layout_resize(PanWindow *pw, gint border)
+{
+	gint width = 0;
+	gint height = 0;
+	GList *work;
+	PixbufRenderer *pr;
+
+	work = pw->list;
+	while (work)
+		{
+		PanItem *pi;
+
+		pi = work->data;
+		work = work->next;
+
+		if (width < pi->x + pi->width) width = pi->x + pi->width;
+		if (height < pi->y + pi->height) height = pi->y + pi->height;
+		}
+	work = pw->list_static;
+	while (work)
+		{
+		PanItem *pi;
+
+		pi = work->data;
+		work = work->next;
+
+		if (width < pi->x + pi->width) width = pi->x + pi->width;
+		if (height < pi->y + pi->height) height = pi->y + pi->height;
+		}
+
+	width += border;
+	height += border;
+
+	pr = PIXBUF_RENDERER(pw->imd->pr);
+	if (width < pr->window_width) width = pr->window_width;
+	if (height < pr->window_width) height = pr->window_height;
+
+	pixbuf_renderer_set_tiles_size(PIXBUF_RENDERER(pw->imd->pr), width, height);
+}
+
 /*
  *-----------------------------------------------------------------------------
  * tile generation
--- a/src/pixbuf-renderer.c	Sun Oct 15 08:06:14 2006 +0000
+++ b/src/pixbuf-renderer.c	Sun Oct 15 14:49:25 2006 +0000
@@ -1577,6 +1577,21 @@
 	pr_redraw(pr, TRUE);
 }
 
+void pixbuf_renderer_set_tiles_size(PixbufRenderer *pr, gint width, gint height)
+{
+	g_return_if_fail(IS_PIXBUF_RENDERER(pr));
+	g_return_if_fail(width >= 32 && height > 32);
+
+	if (!pr->source_tiles_enabled) return;
+	if (pr->image_width == width && pr->image_height == height) return;
+
+	pr->image_width = width;
+	pr->image_height = height;
+
+	pr_zoom_sync(pr, pr->zoom, TRUE, FALSE, TRUE, FALSE, 0, 0);
+	pr_redraw(pr, TRUE);
+}
+
 gint pixbuf_renderer_get_tiles(PixbufRenderer *pr)
 {
 	g_return_val_if_fail(IS_PIXBUF_RENDERER(pr), FALSE);
--- a/src/pixbuf-renderer.h	Sun Oct 15 08:06:14 2006 +0000
+++ b/src/pixbuf-renderer.h	Sun Oct 15 14:49:25 2006 +0000
@@ -163,6 +163,7 @@
 			       PixbufRendererTileDisposeFunc func_dispose,
 			       gpointer user_data,
 			       gdouble zoom);
+void pixbuf_renderer_set_tiles_size(PixbufRenderer *pr, gint width, gint height);
 gint pixbuf_renderer_get_tiles(PixbufRenderer *pr);
 
 /* move image data from source to pr, source is then set to NULL image */