From 3d75491d3b671215cbbc25af1c991706e740fb59 Mon Sep 17 00:00:00 2001 From: malc Date: Sun, 10 Mar 2013 00:00:45 +0400 Subject: [PATCH] Further ctrl-1/2 tweaks --- link.c | 10 ++++------ main.ml | 8 ++++---- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/link.c b/link.c index 9aa49bf..9972c90 100644 --- a/link.c +++ b/link.c @@ -3240,15 +3240,15 @@ CAMLprim value ml_zoom_for_height (value winw_v, value winh_v, double winh = Int_val (winh_v); double dw = Int_val (dw_v); double cols = Int_val (cols_v); - double pw = 1.0, ph = 1.0, aspect; + double pw = 1.0, ph = 1.0; if (trylock ("ml_zoom_for_height")) { goto done; } for (i = 0, p = state.pagedims; i < state.pagedimcount; ++i, ++p) { - int w = p->bounds.x1 / cols; - int h = p->bounds.y1; + double w = p->pagebox.x1 / cols; + double h = p->pagebox.y1; if (h > maxh) { maxh = h; ph = h; @@ -3256,9 +3256,7 @@ CAMLprim value ml_zoom_for_height (value winw_v, value winh_v, if (w > pw) pw = w; } - aspect = pw / ph; - zoom = (winh * aspect + dw) / winw; - + zoom = (((winh / ph) * pw) + dw) / winw; unlock ("ml_zoom_for_height"); done: ret_v = caml_copy_double (zoom); diff --git a/main.ml b/main.ml index 076486c..e038324 100644 --- a/main.ml +++ b/main.ml @@ -2721,13 +2721,13 @@ let settrim trimmargins trimfuzz = let setzoom zoom = match state.throttle with | None -> - let zoom = max 0.01 zoom in + let zoom = max 0.0001 zoom in if zoom <> conf.zoom then ( state.prevzoom <- conf.zoom; conf.zoom <- zoom; reshape state.winw state.winh; - state.text <- Printf.sprintf "zoom is now %-5.1f" (zoom *. 100.0); + state.text <- Printf.sprintf "zoom is now %-5.2f" (zoom *. 100.0); ) | Some (layout, y, started) -> @@ -5013,7 +5013,7 @@ let viewkeyboard key mask = ) else setzoom 1.0 - | 49 when ctrl -> (* ctrl-1 *) + | 49 | 50 when ctrl -> (* ctrl-1/2 *) let cols = match conf.columns with | Csingle _ | Cmulti _ -> 1 @@ -5023,7 +5023,7 @@ let viewkeyboard key mask = conf.interpagespace lsl (if conf.presentation then 1 else 0) in let zoom = zoomforh state.winw h state.scrollw cols in - if zoom > 0.0 + if zoom > 0.0 && (key = 50 || zoom < 1.0) then setzoom zoom | 0xffc6 -> (* f9 *) -- 2.11.4.GIT