Commit 6d22f33f authored by Moritz Lipp's avatar Moritz Lipp

Merge branch 'release/0.2.6'

parents 70637056 a4de3eef
......@@ -6,8 +6,9 @@
double
page_calc_height_width(zathura_document_t* document, double height, double width,
unsigned int* page_height, unsigned int* page_width, bool rotate)
page_calc_height_width(zathura_document_t* document, double height,
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);
......@@ -26,17 +27,16 @@ page_calc_height_width(zathura_document_t* document, double height, double width
}
void
page_calc_position(zathura_document_t* document, double x, double y,
double *xn, double *yn) {
page_calc_position(zathura_document_t* document, double x, double y, double* xn,
double* yn)
{
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) {
*xn = 1 - y;
*yn = x;
}else if (rot == 180) {
} else if (rot == 180) {
*xn = 1 - x;
*yn = 1 - y;
} else if (rot == 270) {
......@@ -48,11 +48,10 @@ page_calc_position(zathura_document_t* document, double x, double y,
}
}
unsigned int
position_to_page_number(zathura_document_t* document,
double pos_x, double pos_y){
position_to_page_number(zathura_document_t* document, double pos_x,
double pos_y)
{
g_return_val_if_fail(document != NULL, 0);
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 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
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);
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
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);
/* 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);
zathura_t* zathura = session->global.data;
if (zathura->document == NULL) {
/* no document has been openend yet */
return;
}
unsigned int pages_per_row = 1;
girara_setting_get(session, "pages-per-row", &pages_per_row);
......
......@@ -3,7 +3,7 @@
ZATHURA_VERSION_MAJOR = 0
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.
ZATHURA_API_VERSION = 2
# If the ABI breaks for any reason, this has to be bumped.
......
......@@ -508,11 +508,11 @@ zathura_document_get_document_size(zathura_document_t* document,
{
g_return_if_fail(document != NULL && height != NULL && width != NULL);
unsigned int npag = zathura_document_get_number_of_pages(document);
unsigned int ncol = zathura_document_get_pages_per_row(document);
unsigned int c0 = zathura_document_get_first_page_column(document);
unsigned int nrow = (npag + c0 - 1 + ncol - 1) / ncol; /* number of rows */
unsigned int pad = zathura_document_get_page_padding(document);
const unsigned int npag = zathura_document_get_number_of_pages(document);
const unsigned int ncol = zathura_document_get_pages_per_row(document);
const unsigned int c0 = zathura_document_get_first_page_column(document);
const unsigned int nrow = (npag + c0 - 1 + ncol - 1) / ncol; /* number of rows */
const unsigned int pad = zathura_document_get_page_padding(document);
unsigned int cell_height = 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)
{
g_return_if_fail(document != NULL);
document->page_padding = page_padding;
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;
}
......
......@@ -412,7 +412,7 @@ zathura_render_request(ZathuraRenderRequest* request, gint64 last_view_time)
bool unfinished_jobs = false;
/* check if there are any active jobs left */
GIRARA_LIST_FOREACH(request_priv->active_jobs, render_job_t*, iter, job)
if (job->aborted != false) {
if (job->aborted == false) {
unfinished_jobs = true;
}
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
* 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
^^^^^^^^^^^^^
Defines the window height on startup
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment