# HG changeset patch # User nadvornik # Date 1209491532 0 # Node ID 1d67ef911fa88553967ff0517eeca2be7859f701 # Parent 8815fea478eed3776cb6982bea694b27b0ed117c fixed connected zoom and scroll that didn't work in some cases http://sourceforge.net/tracker/index.php?func=detail&aid=1952429&group_id=222125&atid=1054680 diff -r 8815fea478ee -r 1d67ef911fa8 src/image.c --- a/src/image.c Sun Apr 27 23:31:20 2008 +0000 +++ b/src/image.c Tue Apr 29 17:52:12 2008 +0000 @@ -1294,6 +1294,11 @@ image_change_real(imd, fd, NULL, NULL, zoom); } +gint image_get_image_size(ImageWindow *imd, gint *width, gint *height) +{ + return pixbuf_renderer_get_image_size(PIXBUF_RENDERER(imd->pr), width, height); +} + GdkPixbuf *image_get_pixbuf(ImageWindow *imd) { return pixbuf_renderer_get_pixbuf((PixbufRenderer *)imd->pr); diff -r 8815fea478ee -r 1d67ef911fa8 src/image.h --- a/src/image.h Sun Apr 27 23:31:20 2008 +0000 +++ b/src/image.h Tue Apr 29 17:52:12 2008 +0000 @@ -61,6 +61,7 @@ CollectionData *image_get_collection(ImageWindow *imd, CollectInfo **info); void image_change_from_image(ImageWindow *imd, ImageWindow *source); +gint image_get_image_size(ImageWindow *imd, gint *width, gint *height); GdkPixbuf *image_get_pixbuf(ImageWindow *imd); /* manipulation */ diff -r 8815fea478ee -r 1d67ef911fa8 src/layout_image.c --- a/src/layout_image.c Sun Apr 27 23:31:20 2008 +0000 +++ b/src/layout_image.c Tue Apr 29 17:52:12 2008 +0000 @@ -1046,9 +1046,28 @@ void layout_image_scroll(LayoutWindow *lw, gint x, gint y) { + gdouble dx, dy; + gint width, height, i; if (!layout_valid(&lw)) return; image_scroll(lw->image, x, y); + + image_get_image_size(lw->image, &width, &height); + dx = (gdouble) x / width; + dy = (gdouble) y / height; + + for (i = 0; i < MAX_SPLIT_IMAGES; i++) + { + if (lw->split_images[i] && lw->split_images[i] != lw->image && lw->connect_scroll) + { + gdouble sx, sy; + image_get_scroll_center(lw->split_images[i], &sx, &sy); + sx += dx; + sy += dy; + image_set_scroll_center(lw->split_images[i], sx, sy); + } + } + } void layout_image_zoom_adjust(LayoutWindow *lw, gdouble increment) @@ -1065,6 +1084,20 @@ } } +void layout_image_zoom_adjust_at_point(LayoutWindow *lw, gdouble increment, gint x, gint y) +{ + gint i; + if (!layout_valid(&lw)) return; + + image_zoom_adjust_at_point(lw->image, increment, x, y); + + for (i = 0; i < MAX_SPLIT_IMAGES; i++) + { + if (lw->split_images[i] && lw->split_images[i] != lw->image && lw->connect_zoom) + image_zoom_adjust_at_point(lw->split_images[i], increment, x, y); + } +} + void layout_image_zoom_set(LayoutWindow *lw, gdouble zoom) { gint i; @@ -1582,10 +1615,10 @@ switch (direction) { case GDK_SCROLL_UP: - image_zoom_adjust_at_point(imd, get_zoom_increment(), x, y); + layout_image_zoom_adjust_at_point(lw, get_zoom_increment(), x, y); break; case GDK_SCROLL_DOWN: - image_zoom_adjust_at_point(imd, -get_zoom_increment(), x, y); + layout_image_zoom_adjust_at_point(lw, -get_zoom_increment(), x, y); break; default: break; diff -r 8815fea478ee -r 1d67ef911fa8 src/layout_image.h --- a/src/layout_image.h Sun Apr 27 23:31:20 2008 +0000 +++ b/src/layout_image.h Tue Apr 29 17:52:12 2008 +0000 @@ -48,6 +48,7 @@ void layout_image_scroll(LayoutWindow *lw, gint x, gint y); void layout_image_zoom_adjust(LayoutWindow *lw, gdouble increment); +void layout_image_zoom_adjust_at_point(LayoutWindow *lw, gdouble increment, gint x, gint y); void layout_image_zoom_set(LayoutWindow *lw, gdouble zoom); void layout_image_zoom_set_fill_geometry(LayoutWindow *lw, gint vertical); void layout_image_alter(LayoutWindow *lw, AlterType type);