Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
pwmt
zathura
Commits
d9f58894
Commit
d9f58894
authored
Apr 07, 2012
by
Sebastian Ramacher
Browse files
Use the information from the file info.
parent
1e2ff055
Changes
1
Hide whitespace changes
Inline
Side-by-side
zathura.c
View file @
d9f58894
...
...
@@ -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
,
&
current_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 */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment