Options for zoom_min/zoom_max

This commit is contained in:
Moritz Lipp 2012-02-09 18:30:36 +01:00
parent 043513558c
commit 2adb25223c
2 changed files with 16 additions and 4 deletions

View file

@ -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);

View file

@ -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 */