From: John Ellis Date: Tue, 29 Mar 2005 01:28:17 +0000 (+0000) Subject: Mon Mar 28 20:23:34 2005 John Ellis X-Git-Tag: v1.0.0~1777 X-Git-Url: http://geeqie.org/cgi-bin/gitweb.cgi?p=geeqie.git;a=commitdiff_plain;h=4db5268dbd31a5800787eb958475c306d388da4d Mon Mar 28 20:23:34 2005 John Ellis * 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. ##### --- diff --git a/ChangeLog b/ChangeLog index 08eecd71..6f108e03 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Mon Mar 28 20:23:34 2005 John Ellis + + * 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 * image.c: Connect to 'zoom' signal of pixbuf-renderer and notify diff --git a/TODO b/TODO index 566a0351..dbd33442 100644 --- 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'. diff --git a/src/image.c b/src/image.c index ae29e100..7b6824b9 100644 --- a/src/image.c +++ b/src/image.c @@ -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; } diff --git a/src/image.h b/src/image.h index d5a1a04e..82224630 100644 --- a/src/image.h +++ b/src/image.h @@ -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 diff --git a/src/pixbuf-renderer.c b/src/pixbuf-renderer.c index 91edec4c..0d18659d 100644 --- a/src/pixbuf-renderer.c +++ b/src/pixbuf-renderer.c @@ -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) diff --git a/src/preferences.c b/src/preferences.c index 105bf96a..cd4a8aa3 100644 --- a/src/preferences.c +++ b/src/preferences.c @@ -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();