changeset 26:acd9885ebd78

Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net> * image.[ch]: Add utility to sync image settings to user preferences. * pixbuf-renderer.c: Fix rounding errors. * preferences.c: Call image_options_sync() when applying changes. ##### 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 Tue, 29 Mar 2005 01:28:17 +0000
parents 0c3b353b666e
children 9c24765c2d3a
files ChangeLog TODO src/image.c src/image.h src/pixbuf-renderer.c src/preferences.c
diffstat 6 files changed, 66 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Mar 26 03:50:35 2005 +0000
+++ b/ChangeLog	Tue Mar 29 01:28:17 2005 +0000
@@ -1,3 +1,9 @@
+Mon Mar 28 20:23:34 2005  John Ellis  <johne@verizon.net>
+
+	* image.[ch]: Add utility to sync image settings to user preferences.
+	* pixbuf-renderer.c: Fix rounding errors.
+	* preferences.c: Call image_options_sync() when applying changes.
+
 Fri Mar 25 22:39:30 2005  John Ellis  <johne@verizon.net>
 
 	* image.c: Connect to 'zoom' signal of pixbuf-renderer and notify
--- a/TODO	Sat Mar 26 03:50:35 2005 +0000
+++ b/TODO	Tue Mar 29 01:28:17 2005 +0000
@@ -10,12 +10,12 @@
    > fix broken zoom out drawing when using source tiles.
 
  > image.c:
-   > need to keep a list of ImageWindows and provide function to sync options to each object.
+  d> need to keep a list of ImageWindows and provide function to sync options to each object.
   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.
+  d> fix region computation rounding when updating scaled image in 'area ready' signal.
 
 
  > work on pan view:
@@ -60,7 +60,7 @@
 
  -------------
 
- > update translations: ( ) ( ) ( )
+ > update translations: it( ) ( ) ( )
 
  > document recent additions/changes:
    > Added 'Fast jpeg thumbnailing'.
--- a/src/image.c	Sat Mar 26 03:50:35 2005 +0000
+++ b/src/image.c	Tue Mar 29 01:28:17 2005 +0000
@@ -39,6 +39,9 @@
 #define IMAGE_AUTO_REFRESH_TIME 3000
 
 
+static GList *image_list = NULL;
+
+
 /*
  *-------------------------------------------------------------------
  * 'signals'
@@ -1328,12 +1331,50 @@
 
 /*
  *-------------------------------------------------------------------
+ * prefs sync
+ *-------------------------------------------------------------------
+ */
+
+static void image_options_set(ImageWindow *imd)
+{
+	g_object_set(G_OBJECT(imd->pr), "zoom_quality", zoom_quality,
+					"zoom_2pass", two_pass_zoom,
+					"zoom_expand", zoom_to_fit_expands,
+					"dither_quality", dither_quality,
+					"scroll_reset", scroll_reset_method,
+					"cache_display", tile_cache_max,
+					"window_fit", fit_window,
+					"window_limit", limit_window_size,
+					"window_limit_value", max_window_size,
+					NULL);
+}
+
+void image_options_sync(void)
+{
+	GList *work;
+
+	work = image_list;
+	while (work)
+		{
+		ImageWindow *imd;
+
+		imd = work->data;
+		work = work->next;
+
+		image_options_set(imd);
+		}
+}
+
+/*
+ *-------------------------------------------------------------------
  * init / destroy
  *-------------------------------------------------------------------
  */
 
 static void image_free(ImageWindow *imd)
 {
+	image_list = g_list_remove(image_list, imd);
+
 	image_reset(imd);
 
 	image_read_ahead_cancel(imd);
@@ -1392,7 +1433,7 @@
 
 	imd->pr = GTK_WIDGET(pixbuf_renderer_new());
 
-	g_object_set(G_OBJECT(imd->pr), "zoom_2pass", TRUE, NULL);
+	image_options_set(imd);
 
 	if (imd->has_frame)
 		{
@@ -1431,6 +1472,8 @@
 	g_signal_connect(G_OBJECT(imd->pr), "render_complete",
 			 G_CALLBACK(image_render_complete_cb), imd);
 
+	image_list = g_list_append(image_list, imd);
+
 	return imd;
 }
 
--- a/src/image.h	Sat Mar 26 03:50:35 2005 +0000
+++ b/src/image.h	Tue Mar 29 01:28:17 2005 +0000
@@ -108,6 +108,9 @@
 			      gpointer data,
 			      gdouble zoom);
 
+/* reset default options */
+void image_options_sync(void);
+
 
 #endif
 
--- a/src/pixbuf-renderer.c	Sat Mar 26 03:50:35 2005 +0000
+++ b/src/pixbuf-renderer.c	Tue Mar 29 01:28:17 2005 +0000
@@ -3105,7 +3105,7 @@
 
 void pixbuf_renderer_area_changed(PixbufRenderer *pr, gint x, gint y, gint width, gint height)
 {
-	gint sx, sy, sw, sh;
+	gint x1, y1, x2, y2;
 
 	g_return_if_fail(IS_PIXBUF_RENDERER(pr));
 
@@ -3121,12 +3121,12 @@
 		height += 2;
 		}
 
-	sx = (gint)floor((double)x * pr->scale);
-	sy = (gint)floor((double)y * pr->scale);
-	sw = (gint)ceil((double)width * pr->scale);
-	sh = (gint)ceil((double)height * pr->scale);
-
-	pr_queue(pr, sx, sy, sw, sh, FALSE, TILE_RENDER_AREA, TRUE);
+	x1 = (gint)floor((double)x * pr->scale);
+	y1 = (gint)floor((double)y * pr->scale);
+	x2 = (gint)ceil((double)(x + width) * pr->scale);
+	y2 = (gint)ceil((double)(y + height) * pr->scale);
+
+	pr_queue(pr, x1, y1, x2 - x1, y2 - y1, FALSE, TILE_RENDER_AREA, TRUE);
 }
 
 void pixbuf_renderer_zoom_adjust(PixbufRenderer *pr, gdouble increment)
--- a/src/preferences.c	Sat Mar 26 03:50:35 2005 +0000
+++ b/src/preferences.c	Tue Mar 29 01:28:17 2005 +0000
@@ -17,6 +17,7 @@
 #include "editors.h"
 #include "filelist.h"
 #include "fullscreen.h"
+#include "image.h"
 #include "img-view.h"
 #include "layout_config.h"
 #include "layout_util.h"
@@ -310,6 +311,8 @@
 
 	g_free(l_conf);
 
+	image_options_sync();
+
 	if (refresh)
 		{
 		filter_rebuild();