From 2adb25223cc256e19a6c26e970a2b25e6743608d Mon Sep 17 00:00:00 2001 From: Moritz Lipp Date: Thu, 9 Feb 2012 18:30:36 +0100 Subject: [PATCH] Options for zoom_min/zoom_max --- config.c | 4 ++++ shortcuts.c | 16 ++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/config.c b/config.c index d46fca2..a5ebcad 100644 --- a/config.c +++ b/config.c @@ -48,6 +48,10 @@ config_load_default(zathura_t* zathura) girara_setting_add(gsession, "pages-per-row", &int_value, INT, false, "Number of pages per row", cb_pages_per_row_value_changed, zathura); float_value = 40; girara_setting_add(gsession, "scroll-step", &float_value, FLOAT, false, "Scroll step", NULL, NULL); + int_value = 10; + girara_setting_add(gsession, "zoom-min", &int_value, INT, false, "Zoom minimum", NULL, NULL); + int_value = 1000; + girara_setting_add(gsession, "zoom-max", &int_value, INT, false, "Zoom maximum", NULL, NULL); string_value = "#FFFFFF"; girara_setting_add(gsession, "recolor-darkcolor", string_value, STRING, false, "Recoloring (dark color)", NULL, NULL); diff --git a/shortcuts.c b/shortcuts.c index c5d8a0a..8ec1f4f 100644 --- a/shortcuts.c +++ b/shortcuts.c @@ -787,10 +787,18 @@ sc_zoom(girara_session_t* session, girara_argument_t* argument, girara_event_t* } /* zoom limitations */ - if (zathura->document->scale < 0.1f) { - zathura->document->scale = 0.1f; - } else if (zathura->document->scale > 10.0f) { - zathura->document->scale = 10.0f; + int zoom_min_int = 10; + int zoom_max_int = 1000; + girara_setting_get(session, "zoom-min", &zoom_min_int); + girara_setting_get(session, "zoom-max", &zoom_max_int); + + float zoom_min = zoom_min_int * 0.01f; + float zoom_max = zoom_max_int * 0.01f; + + if (zathura->document->scale < zoom_min) { + zathura->document->scale = zoom_min; + } else if (zathura->document->scale > zoom_max) { + zathura->document->scale = zoom_max; } /* keep position */