Mercurial > geeqie.yaz
changeset 530:1d67ef911fa8
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
author | nadvornik |
---|---|
date | Tue, 29 Apr 2008 17:52:12 +0000 |
parents | 8815fea478ee |
children | 1149a7b0a3d7 |
files | src/image.c src/image.h src/layout_image.c src/layout_image.h |
diffstat | 4 files changed, 42 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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);
--- 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 */
--- 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;
--- 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);