changeset 25:0c3b353b666e

Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net> * image.c: Connect to 'zoom' signal of pixbuf-renderer and notify listener to update. Fix delay flip by listening for 'render_complete'. * pixbuf-renderer.[ch]: Add complete property and and emit a 'render-complete' signal when changing complete back to TRUE. * view_dir_tree.c (vdtree_row_expanded): Populate a folder node whenever it is expanded. ##### Note: GQview CVS on sourceforge is not always up to date, please use ##### ##### an offical release when making enhancements and translation updates. #####
author gqview
date Sat, 26 Mar 2005 03:50:35 +0000
parents 104e34f9ab1f
children acd9885ebd78
files ChangeLog TODO src/image.c src/pixbuf-renderer.c src/pixbuf-renderer.h src/view_dir_tree.c
diffstat 6 files changed, 82 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Mar 23 05:29:45 2005 +0000
+++ b/ChangeLog	Sat Mar 26 03:50:35 2005 +0000
@@ -1,3 +1,12 @@
+Fri Mar 25 22:39:30 2005  John Ellis  <johne@verizon.net>
+
+	* image.c: Connect to 'zoom' signal of pixbuf-renderer and notify
+	listener to update. Fix delay flip by listening for 'render_complete'.
+	* pixbuf-renderer.[ch]: Add complete property and and emit a
+	'render-complete' signal when changing complete back to TRUE.
+	* view_dir_tree.c (vdtree_row_expanded): Populate a folder node
+	whenever it is expanded.
+
 Wed Mar 23 00:22:28 2005  John Ellis  <johne@verizon.net>
 
 	* image.c (image_change_from_image): Fix and use pixbuf_renderer_move.
--- a/TODO	Wed Mar 23 05:29:45 2005 +0000
+++ b/TODO	Sat Mar 26 03:50:35 2005 +0000
@@ -11,8 +11,11 @@
 
  > image.c:
    > need to keep a list of ImageWindows and provide function to sync options to each object.
-   > test and probably fix delay_flip.
+  d> test and probably fix delay_flip.
+      > UPDATE: works as before (pre pixbuf-renderer), but should be fixed to provide a single redraw
+        by pre-rendering any scaled tiles that are visible before signaling 'render_complete'.
    > make this a g_object with signals for completed, changed, etc.
+   > fix region computation rounding when updating scaled image in 'area ready' signal.
 
 
  > work on pan view:
@@ -38,6 +41,7 @@
     w> fix search. (UPDATE: still can not find day containing name/path/partial)
      > supports thumbnail size images only, should grey out actual size items in size menu or something...
      > allow use of file date or EXIF (embedded) date.
+     > fix scrolling when 'day' popup appears outsize of canvas.
 
    > grid view:
      > allow sorting by name, date, size, dimensions, etc.
@@ -51,6 +55,9 @@
  > the info dialog is not set as a transient of the calling window, this causes it to be behind
    a full screen window when 'stay above other windows' is enabled.
 
+ > folder tree view shortcuts for expanding/collapsing leak through to the main
+   window (+,-,*,/, etc.), figure what behavior is desired and fix this.
+
  -------------
 
  > update translations: ( ) ( ) ( )
--- a/src/image.c	Wed Mar 23 05:29:45 2005 +0000
+++ b/src/image.c	Sat Mar 26 03:50:35 2005 +0000
@@ -76,6 +76,13 @@
 	if (imd->func_update) imd->func_update(imd, imd->data_update);
 }
 
+static void image_zoom_cb(PixbufRenderer *pr, gdouble zoom, gpointer data)
+{
+	ImageWindow *imd = data;
+
+	image_update_util(imd);
+}
+
 static void image_complete_util(ImageWindow *imd, gint preload)
 {
 	if (imd->il && image_get_pixbuf(imd) != image_loader_get_pixbuf(imd->il)) return;
@@ -88,6 +95,13 @@
 	if (imd->func_complete) imd->func_complete(imd, preload, imd->data_complete);
 }
 
+static void image_render_complete_cb(PixbufRenderer *pr, gpointer data)
+{
+	ImageWindow *imd = data;
+
+	image_complete_util(imd, FALSE);
+}
+
 static void image_new_util(ImageWindow *imd)
 {
 	if (imd->func_new) imd->func_new(imd, imd->data_new);
@@ -539,6 +553,7 @@
 	if (imd->il) return FALSE;
 
 	imd->completed = FALSE;
+	g_object_set(G_OBJECT(imd->pr), "complete", FALSE, NULL);
 
 	if (image_post_buffer_get(imd))
 		{
@@ -1411,6 +1426,11 @@
 	g_signal_connect(G_OBJECT(imd->pr), "destroy",
 			 G_CALLBACK(image_destroy_cb), imd);
 
+	g_signal_connect(G_OBJECT(imd->pr), "zoom",
+			 G_CALLBACK(image_zoom_cb), imd);
+	g_signal_connect(G_OBJECT(imd->pr), "render_complete",
+			 G_CALLBACK(image_render_complete_cb), imd);
+
 	return imd;
 }
 
--- a/src/pixbuf-renderer.c	Wed Mar 23 05:29:45 2005 +0000
+++ b/src/pixbuf-renderer.c	Sat Mar 26 03:50:35 2005 +0000
@@ -135,6 +135,7 @@
 	SIGNAL_ZOOM = 0,
 	SIGNAL_CLICKED,
 	SIGNAL_SCROLL_NOTIFY,
+	SIGNAL_RENDER_COMPLETE,
 	SIGNAL_COUNT
 };
 
@@ -149,6 +150,7 @@
 	PROP_SCROLL_RESET,
 	PROP_DELAY_FLIP,
 	PROP_LOADING,
+	PROP_COMPLETE,
 	PROP_CACHE_SIZE_DISPLAY,
 	PROP_CACHE_SIZE_TILES,
 	PROP_WINDOW_FIT,
@@ -172,6 +174,7 @@
 					 GValue *value, GParamSpec *pspec);
 static gint pixbuf_renderer_expose(GtkWidget *widget, GdkEventExpose *event);
 
+static void pr_render_complete_signal(PixbufRenderer *pr);
 
 static void pr_overlay_list_clear(PixbufRenderer *pr);
 static void pr_scroller_timer_set(PixbufRenderer *pr, gint start);
@@ -327,6 +330,14 @@
 							     G_PARAM_READABLE | G_PARAM_WRITABLE));
 
 	g_object_class_install_property(gobject_class,
+					PROP_COMPLETE,
+					g_param_spec_boolean("complete",
+							     "Image rendering complete",
+							     NULL,
+							     FALSE,
+							     G_PARAM_READABLE | G_PARAM_WRITABLE));
+
+	g_object_class_install_property(gobject_class,
 					PROP_CACHE_SIZE_DISPLAY,
 					g_param_spec_uint("cache_display",
 							  "Display cache size MB",
@@ -400,6 +411,15 @@
 			     NULL, NULL,
 			     g_cclosure_marshal_VOID__VOID,
 			     G_TYPE_NONE, 0);
+
+	signals[SIGNAL_RENDER_COMPLETE] = 
+		g_signal_new("render-complete",
+			     G_OBJECT_CLASS_TYPE(gobject_class),
+			     G_SIGNAL_RUN_LAST,
+			     G_STRUCT_OFFSET(PixbufRendererClass, render_complete),
+			     NULL, NULL,
+			     g_cclosure_marshal_VOID__VOID,
+			     G_TYPE_NONE, 0);
 }
 
 static void pixbuf_renderer_init(PixbufRenderer *pr)
@@ -501,6 +521,9 @@
 		case PROP_LOADING:
 			pr->loading = g_value_get_boolean(value);
 			break;
+		case PROP_COMPLETE:
+			pr->complete = g_value_get_boolean(value);
+			break;
 		case PROP_CACHE_SIZE_DISPLAY:
 			pr->tile_cache_max = g_value_get_uint(value);
 			break;
@@ -558,6 +581,9 @@
 		case PROP_LOADING:
 			g_value_set_boolean(value, pr->loading);
 			break;
+		case PROP_COMPLETE:
+			g_value_set_boolean(value, pr->complete);
+			break;
 		case PROP_CACHE_SIZE_DISPLAY:
 			g_value_set_uint(value, pr->tile_cache_max);
 			break;
@@ -2010,9 +2036,7 @@
 	    (!pr->draw_queue && !pr->draw_queue_2pass) ||
 	    pr->draw_idle_id == -1)
 		{
-#if 0
-		if (!pr->completed) image_complete_util(pr, FALSE);
-#endif
+		pr_render_complete_signal(pr);
 
 		pr->draw_idle_id = -1;
 		return FALSE;
@@ -2087,9 +2111,7 @@
 
 	if (!pr->draw_queue && !pr->draw_queue_2pass)
 		{
-#if 0
-		if (!pr->completed) image_complete_util(pr, FALSE);
-#endif
+		pr_render_complete_signal(pr);
 
 		pr->draw_idle_id = -1;
 		return FALSE;
@@ -2311,14 +2333,23 @@
 	g_signal_emit(pr, signals[SIGNAL_ZOOM], 0, pr->zoom);
 }
 
+static void pr_clicked_signal(PixbufRenderer *pr, GdkEventButton *bevent)
+{
+	g_signal_emit(pr, signals[SIGNAL_CLICKED], 0, bevent);
+}
+
 static void pr_scroll_notify_signal(PixbufRenderer *pr)
 {
 	g_signal_emit(pr, signals[SIGNAL_SCROLL_NOTIFY], 0);
 }
 
-static void pr_button_signal(PixbufRenderer *pr, GdkEventButton *bevent)
+static void pr_render_complete_signal(PixbufRenderer *pr)
 {
-	g_signal_emit(pr, signals[SIGNAL_CLICKED], 0, bevent);
+	if (!pr->complete)
+		{
+		g_signal_emit(pr, signals[SIGNAL_RENDER_COMPLETE], 0);
+		g_object_set(G_OBJECT(pr), "complete", TRUE, NULL);
+		}
 }
 
 /*
@@ -2859,7 +2890,7 @@
 			pr->drag_moved = 0;
 			break;
 		case 3:
-			pr_button_signal(pr, bevent);
+			pr_clicked_signal(pr, bevent);
 			break;
 		default:
 			break;
@@ -2901,7 +2932,7 @@
 			}
 		else if (bevent->button == 1 || bevent->button == 2)
 			{
-			pr_button_signal(pr, bevent);
+			pr_clicked_signal(pr, bevent);
 			}
 		}
 
--- a/src/pixbuf-renderer.h	Wed Mar 23 05:29:45 2005 +0000
+++ b/src/pixbuf-renderer.h	Sat Mar 26 03:50:35 2005 +0000
@@ -117,6 +117,7 @@
 
 	gboolean delay_flip;
 	gboolean loading;
+	gboolean complete;
 
 	gint scroller_id;
 	gint scroller_overlay;
@@ -137,6 +138,8 @@
 	void (* zoom)		(PixbufRenderer *pr, gdouble zoom);
 	void (* clicked)	(PixbufRenderer *pr, GdkEventButton *event);
 	void (* scroll_notify)	(PixbufRenderer *pr);
+
+	void (* render_complete)(PixbufRenderer *pr);
 };
 
 
--- a/src/view_dir_tree.c	Wed Mar 23 05:29:45 2005 +0000
+++ b/src/view_dir_tree.c	Sat Mar 26 03:50:35 2005 +0000
@@ -1524,6 +1524,7 @@
 {
 	ViewDirTree *vdt = data;
 
+	vdtree_populate_path_by_iter(vdt, iter, FALSE, NULL);
 	vdtree_icon_set_by_iter(vdt, iter, vdt->pf->open);
 }