Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
authorJohn Ellis <johne@verizon.net>
Tue, 29 Mar 2005 01:28:17 +0000 (01:28 +0000)
committerJohn Ellis <johne@verizon.net>
Tue, 29 Mar 2005 01:28:17 +0000 (01:28 +0000)
        * 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. #####

ChangeLog
TODO
src/image.c
src/image.h
src/pixbuf-renderer.c
src/preferences.c

index 08eecd7..6f108e0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/TODO b/TODO
index 566a035..dbd3344 100644 (file)
--- a/TODO
+++ b/TODO
@@ -10,12 +10,12 @@ Major:
    > 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 @@ Major:
 
  -------------
 
- > update translations: ( ) ( ) ( )
+ > update translations: it( ) ( ) ( )
 
  > document recent additions/changes:
    > Added 'Fast jpeg thumbnailing'.
index ae29e10..7b6824b 100644 (file)
@@ -39,6 +39,9 @@
 #define IMAGE_AUTO_REFRESH_TIME 3000
 
 
+static GList *image_list = NULL;
+
+
 /*
  *-------------------------------------------------------------------
  * 'signals'
@@ -1326,6 +1329,42 @@ void image_to_root_window(ImageWindow *imd, gint scaled)
        gdk_flush();
 }
 
+/*
+ *-------------------------------------------------------------------
+ * 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
@@ -1334,6 +1373,8 @@ void image_to_root_window(ImageWindow *imd, gint scaled)
 
 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 @@ ImageWindow *image_new(gint frame)
 
        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 @@ ImageWindow *image_new(gint frame)
        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;
 }
 
index d5a1a04..8222463 100644 (file)
@@ -108,6 +108,9 @@ void image_set_image_as_tiles(ImageWindow *imd, gint width, gint height,
                              gpointer data,
                              gdouble zoom);
 
+/* reset default options */
+void image_options_sync(void);
+
 
 #endif
 
index 91edec4..0d18659 100644 (file)
@@ -3105,7 +3105,7 @@ void pixbuf_renderer_move(PixbufRenderer *pr, PixbufRenderer *source)
 
 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 @@ void pixbuf_renderer_area_changed(PixbufRenderer *pr, gint x, gint y, gint width
                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);
+       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, sx, sy, sw, sh, FALSE, TILE_RENDER_AREA, TRUE);
+       pr_queue(pr, x1, y1, x2 - x1, y2 - y1, FALSE, TILE_RENDER_AREA, TRUE);
 }
 
 void pixbuf_renderer_zoom_adjust(PixbufRenderer *pr, gdouble increment)
index 105bf96..cd4a8aa 100644 (file)
@@ -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 @@ static void config_window_apply(void)
 
        g_free(l_conf);
 
+       image_options_sync();
+
        if (refresh)
                {
                filter_rebuild();