mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-29 13:16:00 +01:00
Merge branch 'release/0.2.6'
This commit is contained in:
commit
6d22f33fc6
6 changed files with 55 additions and 22 deletions
37
adjustment.c
37
adjustment.c
|
@ -6,8 +6,9 @@
|
||||||
|
|
||||||
|
|
||||||
double
|
double
|
||||||
page_calc_height_width(zathura_document_t* document, double height, double width,
|
page_calc_height_width(zathura_document_t* document, double height,
|
||||||
unsigned int* page_height, unsigned int* page_width, bool rotate)
|
double width, unsigned int* page_height,
|
||||||
|
unsigned int* page_width, bool rotate)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail(document != NULL && page_height != NULL && page_width != NULL, 0.0);
|
g_return_val_if_fail(document != NULL && page_height != NULL && page_width != NULL, 0.0);
|
||||||
|
|
||||||
|
@ -26,17 +27,16 @@ page_calc_height_width(zathura_document_t* document, double height, double width
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
page_calc_position(zathura_document_t* document, double x, double y,
|
page_calc_position(zathura_document_t* document, double x, double y, double* xn,
|
||||||
double *xn, double *yn) {
|
double* yn)
|
||||||
|
{
|
||||||
g_return_if_fail(document != NULL && xn != NULL && yn != NULL);
|
g_return_if_fail(document != NULL && xn != NULL && yn != NULL);
|
||||||
|
|
||||||
unsigned int rot = zathura_document_get_rotation(document);
|
const unsigned int rot = zathura_document_get_rotation(document);
|
||||||
|
|
||||||
if (rot == 90) {
|
if (rot == 90) {
|
||||||
*xn = 1 - y;
|
*xn = 1 - y;
|
||||||
*yn = x;
|
*yn = x;
|
||||||
}else if (rot == 180) {
|
} else if (rot == 180) {
|
||||||
*xn = 1 - x;
|
*xn = 1 - x;
|
||||||
*yn = 1 - y;
|
*yn = 1 - y;
|
||||||
} else if (rot == 270) {
|
} else if (rot == 270) {
|
||||||
|
@ -48,11 +48,10 @@ page_calc_position(zathura_document_t* document, double x, double y,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
unsigned int
|
unsigned int
|
||||||
position_to_page_number(zathura_document_t* document,
|
position_to_page_number(zathura_document_t* document, double pos_x,
|
||||||
double pos_x, double pos_y){
|
double pos_y)
|
||||||
|
{
|
||||||
g_return_val_if_fail(document != NULL, 0);
|
g_return_val_if_fail(document != NULL, 0);
|
||||||
|
|
||||||
unsigned int doc_width, doc_height;
|
unsigned int doc_width, doc_height;
|
||||||
|
@ -70,13 +69,20 @@ position_to_page_number(zathura_document_t* document,
|
||||||
unsigned int col = floor(pos_x * (double)doc_width / (double)(cell_width + pad));
|
unsigned int col = floor(pos_x * (double)doc_width / (double)(cell_width + pad));
|
||||||
unsigned int row = floor(pos_y * (double)doc_height / (double)(cell_height + pad));
|
unsigned int row = floor(pos_y * (double)doc_height / (double)(cell_height + pad));
|
||||||
|
|
||||||
return ncol * (row % nrow) + (col % ncol) - (c0 - 1);
|
unsigned int page = ncol * (row % nrow) + (col % ncol);
|
||||||
|
if (page < c0 - 1) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
return page - (c0 - 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
page_number_to_position(zathura_document_t* document, unsigned int page_number,
|
page_number_to_position(zathura_document_t* document, unsigned int page_number,
|
||||||
double xalign, double yalign, double *pos_x, double *pos_y) {
|
double xalign, double yalign, double* pos_x,
|
||||||
|
double* pos_y)
|
||||||
|
{
|
||||||
g_return_if_fail(document != NULL);
|
g_return_if_fail(document != NULL);
|
||||||
|
|
||||||
unsigned int c0 = zathura_document_get_first_page_column(document);
|
unsigned int c0 = zathura_document_get_first_page_column(document);
|
||||||
|
@ -115,7 +121,8 @@ page_number_to_position(zathura_document_t* document, unsigned int page_number,
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
page_is_visible(zathura_document_t *document, unsigned int page_number) {
|
page_is_visible(zathura_document_t *document, unsigned int page_number)
|
||||||
|
{
|
||||||
g_return_val_if_fail(document != NULL, false);
|
g_return_val_if_fail(document != NULL, false);
|
||||||
|
|
||||||
/* position at the center of the viewport */
|
/* position at the center of the viewport */
|
||||||
|
|
|
@ -226,6 +226,10 @@ cb_page_layout_value_changed(girara_session_t* session, const char* UNUSED(name)
|
||||||
g_return_if_fail(session->global.data != NULL);
|
g_return_if_fail(session->global.data != NULL);
|
||||||
zathura_t* zathura = session->global.data;
|
zathura_t* zathura = session->global.data;
|
||||||
|
|
||||||
|
if (zathura->document == NULL) {
|
||||||
|
/* no document has been openend yet */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int pages_per_row = 1;
|
unsigned int pages_per_row = 1;
|
||||||
girara_setting_get(session, "pages-per-row", &pages_per_row);
|
girara_setting_get(session, "pages-per-row", &pages_per_row);
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
ZATHURA_VERSION_MAJOR = 0
|
ZATHURA_VERSION_MAJOR = 0
|
||||||
ZATHURA_VERSION_MINOR = 2
|
ZATHURA_VERSION_MINOR = 2
|
||||||
ZATHURA_VERSION_REV = 5
|
ZATHURA_VERSION_REV = 6
|
||||||
# If the API changes, the API version and the ABI version have to be bumped.
|
# If the API changes, the API version and the ABI version have to be bumped.
|
||||||
ZATHURA_API_VERSION = 2
|
ZATHURA_API_VERSION = 2
|
||||||
# If the ABI breaks for any reason, this has to be bumped.
|
# If the ABI breaks for any reason, this has to be bumped.
|
||||||
|
|
18
document.c
18
document.c
|
@ -508,11 +508,11 @@ zathura_document_get_document_size(zathura_document_t* document,
|
||||||
{
|
{
|
||||||
g_return_if_fail(document != NULL && height != NULL && width != NULL);
|
g_return_if_fail(document != NULL && height != NULL && width != NULL);
|
||||||
|
|
||||||
unsigned int npag = zathura_document_get_number_of_pages(document);
|
const unsigned int npag = zathura_document_get_number_of_pages(document);
|
||||||
unsigned int ncol = zathura_document_get_pages_per_row(document);
|
const unsigned int ncol = zathura_document_get_pages_per_row(document);
|
||||||
unsigned int c0 = zathura_document_get_first_page_column(document);
|
const unsigned int c0 = zathura_document_get_first_page_column(document);
|
||||||
unsigned int nrow = (npag + c0 - 1 + ncol - 1) / ncol; /* number of rows */
|
const unsigned int nrow = (npag + c0 - 1 + ncol - 1) / ncol; /* number of rows */
|
||||||
unsigned int pad = zathura_document_get_page_padding(document);
|
const unsigned int pad = zathura_document_get_page_padding(document);
|
||||||
|
|
||||||
unsigned int cell_height = 0;
|
unsigned int cell_height = 0;
|
||||||
unsigned int cell_width = 0;
|
unsigned int cell_width = 0;
|
||||||
|
@ -527,8 +527,16 @@ zathura_document_set_page_layout(zathura_document_t* document, unsigned int page
|
||||||
unsigned int pages_per_row, unsigned int first_page_column)
|
unsigned int pages_per_row, unsigned int first_page_column)
|
||||||
{
|
{
|
||||||
g_return_if_fail(document != NULL);
|
g_return_if_fail(document != NULL);
|
||||||
|
|
||||||
document->page_padding = page_padding;
|
document->page_padding = page_padding;
|
||||||
document->pages_per_row = pages_per_row;
|
document->pages_per_row = pages_per_row;
|
||||||
|
|
||||||
|
if (first_page_column < 1) {
|
||||||
|
first_page_column = 1;
|
||||||
|
} else if (first_page_column > pages_per_row) {
|
||||||
|
first_page_column = ((first_page_column - 1) % pages_per_row) + 1;
|
||||||
|
}
|
||||||
|
|
||||||
document->first_page_column = first_page_column;
|
document->first_page_column = first_page_column;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
render.c
2
render.c
|
@ -412,7 +412,7 @@ zathura_render_request(ZathuraRenderRequest* request, gint64 last_view_time)
|
||||||
bool unfinished_jobs = false;
|
bool unfinished_jobs = false;
|
||||||
/* check if there are any active jobs left */
|
/* check if there are any active jobs left */
|
||||||
GIRARA_LIST_FOREACH(request_priv->active_jobs, render_job_t*, iter, job)
|
GIRARA_LIST_FOREACH(request_priv->active_jobs, render_job_t*, iter, job)
|
||||||
if (job->aborted != false) {
|
if (job->aborted == false) {
|
||||||
unfinished_jobs = true;
|
unfinished_jobs = true;
|
||||||
}
|
}
|
||||||
GIRARA_LIST_FOREACH_END(request_priv->active_jobs, render_job_t*, iter, job);
|
GIRARA_LIST_FOREACH_END(request_priv->active_jobs, render_job_t*, iter, job);
|
||||||
|
|
|
@ -502,6 +502,20 @@ Defines the foreground color of the statusbar
|
||||||
* Value type: String
|
* Value type: String
|
||||||
* Default value: #FFFFFF
|
* Default value: #FFFFFF
|
||||||
|
|
||||||
|
statusbar-h-padding
|
||||||
|
^^^^^^^^^^^^^^^^^^^
|
||||||
|
Defines the horizontal padding of the statusbar and notificationbar
|
||||||
|
|
||||||
|
* Value type: Integer
|
||||||
|
* Default value: 8
|
||||||
|
|
||||||
|
statusbar-v-padding
|
||||||
|
^^^^^^^^^^^^^^^^^^^
|
||||||
|
Defines the vertical padding of the statusbar and notificationbar
|
||||||
|
|
||||||
|
* Value type: Integer
|
||||||
|
* Default value: 2
|
||||||
|
|
||||||
window-height
|
window-height
|
||||||
^^^^^^^^^^^^^
|
^^^^^^^^^^^^^
|
||||||
Defines the window height on startup
|
Defines the window height on startup
|
||||||
|
|
Loading…
Reference in a new issue