Re: Zoom prblems in print preview



Le vendredi 07 octobre 2005 à 07:30 +0200, Jean Bréfort a écrit :
Le jeudi 06 octobre 2005 à 17:48 -0400, Jody Goldberg a écrit :
On Thu, Oct 06, 2005 at 03:05:18PM -0600, Andreas J. Guelzow wrote:
xev to see what events ctrl-+ and ctrl-- are sending.

You only mention that it happens with + and -. Do you have the same
effect with ctrl-+ and ctrl--?

The code would be the same.  I'm seeing some asymetry on zooming in
an out with CVS head.  Out then In does not restore the same zoom.
It looks like the display resolution may impact things.

It is not a keyboard problem. If I click on the zoom in and zoom out
buttons, I get the same effect, it always zoom in, although not with the
same speed, zoom in is more efficient ;).
This occurs only on my amd64, not on my x86 laptop.
I should be able to find some time to fix that during next week.

In the end, I found very easily what's wrong:
Index: libgnomeprintui/gnome-print-job-preview.c
===================================================================
RCS
file: /cvs/gnome/libgnomeprintui/libgnomeprintui/gnome-print-job-preview.c,v
retrieving revision 1.91
diff -u -5 -r1.91 gnome-print-job-preview.c
--- libgnomeprintui/gnome-print-job-preview.c   22 Sep 2005 14:49:30
-0000      1.91
+++ libgnomeprintui/gnome-print-job-preview.c   7 Oct 2005 08:03:52
-0000
@@ -887,11 +887,11 @@
                gdouble zoomx = width  / ((jp->paw + PAGE_PAD * 2) *
jp->nx + PAGE_PAD * 2);
                gdouble zoomy = height / ((jp->pah + PAGE_PAD * 2) *
jp->ny + PAGE_PAD * 2.);

                zoom = MIN (zoomx, zoomy);
        } else
-               zoom = jp->zoom_factor * factor * (xdpi + ydpi) / (72. *
2.);
+               zoom = jp->zoom_factor * factor;
        jp->zoom_factor = CLAMP (zoom, GPMP_ZOOM_MIN, GPMP_ZOOM_MAX);
        gnome_canvas_set_pixels_per_unit (jp->canvas, jp->zoom_factor);

        g_object_set (G_OBJECT (jp->zoom.z1), "sensitive", (!
CLOSE_ENOUGH (jp->zoom_factor, 1.0)), NULL);
        g_object_set (G_OBJECT (jp->zoom.zi), "sensitive", (!
CLOSE_ENOUGH (jp->zoom_factor, GPMP_ZOOM_MAX)), NULL);

if xdpi + ydpi is not 144., the zoom factor is multiplied each time by a
constant. If this constant is larger than sqrt(2), <control>-- will zoom
in instead of zooming out. Things work quite well when I remove this
factor. Also this explains the asymetry.

Cheers,
Jean




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]