mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-29 13:16:00 +01:00
add vertical centering option
This commit is contained in:
parent
0ca4789d66
commit
9f3f5b34e2
3 changed files with 19 additions and 2 deletions
|
@ -943,6 +943,13 @@ En/Disables horizontally centered zooming.
|
||||||
* Value type: Boolean
|
* Value type: Boolean
|
||||||
* Default value: false
|
* Default value: false
|
||||||
|
|
||||||
|
vertical-center
|
||||||
|
^^^^^^^^^^^
|
||||||
|
Center the screen at the vertical midpoint of the page by default.
|
||||||
|
|
||||||
|
* Value type: Boolean
|
||||||
|
* Default value: false
|
||||||
|
|
||||||
zoom-max
|
zoom-max
|
||||||
^^^^^^^^
|
^^^^^^^^
|
||||||
Defines the maximum percentage that the zoom level can be.
|
Defines the maximum percentage that the zoom level can be.
|
||||||
|
|
|
@ -198,6 +198,8 @@ config_load_default(zathura_t* zathura)
|
||||||
girara_setting_add(gsession, "advance-pages-per-row", &bool_value, BOOLEAN, false, _("Advance number of pages per row"), NULL, NULL);
|
girara_setting_add(gsession, "advance-pages-per-row", &bool_value, BOOLEAN, false, _("Advance number of pages per row"), NULL, NULL);
|
||||||
bool_value = false;
|
bool_value = false;
|
||||||
girara_setting_add(gsession, "zoom-center", &bool_value, BOOLEAN, false, _("Horizontally centered zoom"), NULL, NULL);
|
girara_setting_add(gsession, "zoom-center", &bool_value, BOOLEAN, false, _("Horizontally centered zoom"), NULL, NULL);
|
||||||
|
bool_value = false;
|
||||||
|
girara_setting_add(gsession, "vertical-center", &bool_value, BOOLEAN, false, _("Vertically center pages"), NULL, NULL);
|
||||||
bool_value = true;
|
bool_value = true;
|
||||||
girara_setting_add(gsession, "link-hadjust", &bool_value, BOOLEAN, false, _("Align link target to the left"), NULL, NULL);
|
girara_setting_add(gsession, "link-hadjust", &bool_value, BOOLEAN, false, _("Align link target to the left"), NULL, NULL);
|
||||||
bool_value = true;
|
bool_value = true;
|
||||||
|
|
|
@ -1382,9 +1382,17 @@ position_set(zathura_t* zathura, double position_x, double position_y)
|
||||||
double comppos_x, comppos_y;
|
double comppos_x, comppos_y;
|
||||||
unsigned int page_id = zathura_document_get_current_page_number(zathura->document);
|
unsigned int page_id = zathura_document_get_current_page_number(zathura->document);
|
||||||
|
|
||||||
|
bool vertical_center = false;
|
||||||
|
girara_setting_get(zathura->ui.session, "vertical-center", &vertical_center);
|
||||||
|
|
||||||
/* xalign = 0.5: center horizontally (with the page, not the document) */
|
/* xalign = 0.5: center horizontally (with the page, not the document) */
|
||||||
|
if (vertical_center) {
|
||||||
/* yalign = 0.0: align page an viewport edges at the top */
|
/* yalign = 0.0: align page an viewport edges at the top */
|
||||||
page_number_to_position(zathura->document, page_id, 0.5, 0.0, &comppos_x, &comppos_y);
|
page_number_to_position(zathura->document, page_id, 0.5, 0.0, &comppos_x, &comppos_y);
|
||||||
|
} else {
|
||||||
|
/* yalign = 0.5: center vertically */
|
||||||
|
page_number_to_position(zathura->document, page_id, 0.5, 0.5, &comppos_x, &comppos_y);
|
||||||
|
}
|
||||||
|
|
||||||
/* automatic horizontal adjustment */
|
/* automatic horizontal adjustment */
|
||||||
zathura_adjust_mode_t adjust_mode = zathura_document_get_adjust_mode(zathura->document);
|
zathura_adjust_mode_t adjust_mode = zathura_document_get_adjust_mode(zathura->document);
|
||||||
|
|
Loading…
Reference in a new issue