Update of /cvsroot/ufraw/ufraw
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv10728

Modified Files:
        ufraw_preview.c 
Log Message:
Keep the viewport center during zooming. Patch by Frank van Maarseveen.


Index: ufraw_preview.c
===================================================================
RCS file: /cvsroot/ufraw/ufraw/ufraw_preview.c,v
retrieving revision 1.302
retrieving revision 1.303
diff -u -d -r1.302 -r1.303
--- ufraw_preview.c     10 Nov 2009 03:33:55 -0000      1.302
+++ ufraw_preview.c     10 Nov 2009 03:44:25 -0000      1.303
@@ -785,6 +785,13 @@
     int height = gdk_pixbuf_get_height(data->PreviewPixbuf);
     ufraw_image_data *image = ufraw_final_image(data->UF, FALSE);
     if (width!=image->width || height!=image->height) {
+    
+       /* Calculate current viewport center */
+       GdkRectangle vp;
+       gtk_image_view_get_viewport(GTK_IMAGE_VIEW(data->PreviewWidget), &vp);
+       double xc = (vp.x + vp.width / 2.0) / width * image->width;
+       double yc = (vp.y + vp.height / 2.0) / height * image->height;
+ 
        data->PreviewPixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8,
                                            image->width, image->height);
        /* Clear the pixbuffer to avoid displaying garbage */
@@ -792,6 +799,11 @@
        gtk_image_view_set_pixbuf(GTK_IMAGE_VIEW(data->PreviewWidget),
                data->PreviewPixbuf, FALSE);
        g_object_unref(data->PreviewPixbuf);
+
+       /* restore the viewport center */
+       gtk_image_view_set_offset(GTK_IMAGE_VIEW(data->PreviewWidget),
+               xc - vp.width / 2, yc - vp.height / 2, FALSE);
+
     }
     render_status_text(data);
 }


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
ufraw-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ufraw-cvs

Reply via email to