mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-28 07:06:02 +01:00
Use the information from the file info.
This commit is contained in:
parent
1e2ff0557e
commit
d9f5889415
1 changed files with 15 additions and 1 deletions
16
zathura.c
16
zathura.c
|
@ -465,7 +465,7 @@ document_open(zathura_t* zathura, const char* path, const char* password)
|
|||
const char* file_path = zathura_document_get_path(document);
|
||||
unsigned int number_of_pages = zathura_document_get_number_of_pages(document);
|
||||
unsigned int current_page_number = 0;
|
||||
double scale = 0;
|
||||
double scale = 1;
|
||||
unsigned int page_offset = 0;
|
||||
unsigned int rotate = 0;
|
||||
|
||||
|
@ -473,16 +473,30 @@ document_open(zathura_t* zathura, const char* path, const char* password)
|
|||
zathura_db_get_fileinfo(zathura->database, file_path, ¤t_page_number,
|
||||
&page_offset, &scale, &rotate);
|
||||
|
||||
zathura_document_set_page_offset(document, page_offset);
|
||||
|
||||
/* check for valid scale value */
|
||||
if (scale <= FLT_EPSILON) {
|
||||
girara_warning("document info: '%s' has non positive scale", file_path);
|
||||
zathura_document_set_scale(document, 1);
|
||||
} else {
|
||||
zathura_document_set_scale(document, scale);
|
||||
}
|
||||
|
||||
/* check current page number */
|
||||
if (current_page_number > number_of_pages) {
|
||||
girara_warning("document info: '%s' has an invalid page number", file_path);
|
||||
zathura_document_set_current_page_number(document, 0);
|
||||
} else {
|
||||
zathura_document_set_current_page_number(document, current_page_number);
|
||||
}
|
||||
|
||||
/* check for valid rotation */
|
||||
if (rotate % 90 != 0) {
|
||||
girara_warning("document info: '%s' has an invalid rotation", file_path);
|
||||
zathura_document_set_rotation(document, 0);
|
||||
} else {
|
||||
zathura_document_set_rotation(document, rotate % 360);
|
||||
}
|
||||
|
||||
/* jump to first page if setting enabled */
|
||||
|
|
Loading…
Reference in a new issue