Commit 70637056 authored by Moritz Lipp's avatar Moritz Lipp

Merge branch 'release/0.2.5'

parents e5f36e40 b2c14a37
......@@ -17,4 +17,4 @@ doc/
*.tmp
zathura.1
zathurarc.5
girara-version-check
.version-checks/
......@@ -42,11 +42,15 @@ DOBJECTS = $(patsubst %.c, %.do, $(SOURCE))
all: options ${PROJECT} po build-manpages
girara-version-check:
ifneq ($(GIRARA_VERSION_CHECK), 0)
$(error "The minimum required version of girara is ${GIRARA_MIN_VERSION}")
endif
$(QUIET)touch girara-version-check
# pkg-config based version checks
.version-checks/%:
$(QUIET)test $($(*)_VERSION_CHECK) -eq 0 || \
pkg-config --atleast-version $($(*)_MIN_VERSION) $($(*)_PKG_CONFIG_NAME) || ( \
echo "The minium required version of $(*) is $($(*)_MIN_VERSION)" && \
false \
)
@mkdir -p .version-checks
$(QUIET)touch $@
options:
@echo ${PROJECT} build options:
......@@ -56,11 +60,11 @@ options:
@echo "CC = ${CC}"
version.h: version.h.in config.mk
$(QUIET)sed 's/ZVMAJOR/${ZATHURA_VERSION_MAJOR}/' < version.h.in | \
sed 's/ZVMINOR/${ZATHURA_VERSION_MINOR}/' | \
sed 's/ZVREV/${ZATHURA_VERSION_REV}/' | \
sed 's/ZVAPI/${ZATHURA_API_VERSION}/' | \
sed 's/ZVABI/${ZATHURA_ABI_VERSION}/' > version.h
$(QUIET)sed -e 's/ZVMAJOR/${ZATHURA_VERSION_MAJOR}/' \
-e 's/ZVMINOR/${ZATHURA_VERSION_MINOR}/' \
-e 's/ZVREV/${ZATHURA_VERSION_REV}/' \
-e 's/ZVAPI/${ZATHURA_API_VERSION}/' \
-e 's/ZVABI/${ZATHURA_ABI_VERSION}/' version.h.in > version.h
%.o: %.c
$(ECHO) CC $<
......@@ -72,8 +76,8 @@ version.h: version.h.in config.mk
@mkdir -p .depend
$(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} ${DFLAGS} -o $@ $< -MMD -MF .depend/$@.dep
${OBJECTS}: config.mk version.h girara-version-check
${DOBJECTS}: config.mk version.h girara-version-check
${OBJECTS} ${DOBJECTS}: config.mk version.h \
.version-checks/GIRARA .version-checks/GLIB .version-checks/GTK
${PROJECT}: ${OBJECTS}
$(ECHO) CC -o $@
......@@ -83,7 +87,7 @@ clean:
$(QUIET)rm -rf ${PROJECT} ${OBJECTS} ${PROJECT}-${VERSION}.tar.gz \
${DOBJECTS} ${PROJECT}-debug .depend ${PROJECT}.pc doc version.h \
*gcda *gcno $(PROJECT).info gcov *.tmp \
girara-version-check
.version-checks
ifneq "$(wildcard ${RSTTOMAN})" ""
$(QUIET)rm -f zathura.1 zathurarc.5
endif
......
......@@ -5,7 +5,8 @@ girara user interface library and several document libraries.
Requirements
------------
gtk2 (>= 2.28)
gtk2 (>= 2.18) or gtk3
glib (>= 2.28)
girara
sqlite3 (optional, >= 3.5.9)
check (for tests)
......@@ -36,8 +37,13 @@ To build and install zathura:
make install
Uninstall:
----------
Uninstall
---------
To delete zathura from your system, just type:
make uninstall
Bugs
----
Please report bugs at http://bugs.pwmt.org or contact us on our mailing list at
zathura@lists.pwmt.org.
......@@ -2,6 +2,142 @@
#include "adjustment.h"
#include "utils.h"
#include <math.h>
double
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);
double scale = zathura_document_get_scale(document);
if (rotate && zathura_document_get_rotation(document) % 180) {
*page_width = round(height * scale);
*page_height = round(width * scale);
scale = MAX(*page_width / height, *page_height / width);
} else {
*page_width = round(width * scale);
*page_height = round(height * scale);
scale = MAX(*page_width / width, *page_height / height);
}
return scale;
}
void
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);
if (rot == 90) {
*xn = 1 - y;
*yn = x;
}else if (rot == 180) {
*xn = 1 - x;
*yn = 1 - y;
} else if (rot == 270) {
*xn = y;
*yn = 1 - x;
} else {
*xn = x;
*yn = y;
}
}
unsigned int
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;
zathura_document_get_document_size(document, &doc_height, &doc_width);
unsigned int cell_width, cell_height;
zathura_document_get_cell_size(document, &cell_height, &cell_width);
unsigned int c0 = zathura_document_get_first_page_column(document);
unsigned int npag = zathura_document_get_number_of_pages(document);
unsigned int ncol = zathura_document_get_pages_per_row(document);
unsigned int nrow = (npag + c0 - 1 + ncol - 1) / ncol; /* number of rows */
unsigned int pad = zathura_document_get_page_padding(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);
}
void
page_number_to_position(zathura_document_t* document, unsigned int page_number,
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);
unsigned int npag = zathura_document_get_number_of_pages(document);
unsigned int ncol = zathura_document_get_pages_per_row(document);
unsigned int nrow = (npag + c0 - 1 + ncol - 1) / ncol; /* number of rows */
/* row and column for page_number indexed from 0 */
unsigned int row = (page_number + c0 - 1) / ncol;
unsigned int col = (page_number + c0 - 1) % ncol;
/* sizes of page cell, viewport and document */
unsigned int cell_height = 0, cell_width = 0;
zathura_document_get_cell_size(document, &cell_height, &cell_width);
unsigned int view_height = 0, view_width = 0;
zathura_document_get_viewport_size(document, &view_height, &view_width);
unsigned int doc_height = 0, doc_width = 0;
zathura_document_get_document_size(document, &doc_height, &doc_width);
/* compute the shift to align to the viewport. If the page fits to viewport, just center it. */
double shift_x = 0.5, shift_y = 0.5;
if (cell_width > view_width) {
shift_x = 0.5 + (xalign - 0.5) * ((double)cell_width - (double)view_width) / (double)cell_width;
}
if (cell_height > view_height) {
shift_y = 0.5 + (yalign - 0.5) * ((double)cell_height - (double)view_height) / (double)cell_height;
}
/* compute the position */
*pos_x = ((double)col + shift_x) / (double)ncol;
*pos_y = ((double)row + shift_y) / (double)nrow;
}
bool
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 */
double pos_x = zathura_document_get_position_x(document);
double pos_y = zathura_document_get_position_y(document);
/* get the center of page page_number */
double page_x, page_y;
page_number_to_position(document, page_number, 0.5, 0.5, &page_x, &page_y);
unsigned int cell_width, cell_height;
zathura_document_get_cell_size(document, &cell_height, &cell_width);
unsigned int doc_width, doc_height;
zathura_document_get_document_size(document, &doc_height, &doc_width);
unsigned int view_width, view_height;
zathura_document_get_viewport_size(document, &view_height, &view_width);
return ( fabs(pos_x - page_x) < 0.5 * (double)(view_width + cell_width) / (double)doc_width &&
fabs(pos_y - page_y) < 0.5 * (double)(view_height + cell_height) / (double)doc_height);
}
GtkAdjustment*
zathura_adjustment_clone(GtkAdjustment* adjustment)
......
......@@ -4,8 +4,73 @@
#define ZATHURA_ADJUSTMENT_H
#include <gtk/gtk.h>
#include <stdbool.h>
#include "document.h"
/* Clone a GtkAdjustment
/**
* Calculate the page size according to the corrent scaling and rotation if
* desired.
*
* @param document the document
* @param height width the original height and width
* @return page_height page_width the scaled and rotated height and width
* @param rotate honor page's rotation
* @return real scale after rounding
*/
double page_calc_height_width(zathura_document_t* document, double height, double width,
unsigned int* page_height, unsigned int* page_width, bool rotate);
/**
* Calculate a page relative position after a rotation. The positions x y are
* relative to a page, i.e. 0=top of page, 1=bottom of page. They are NOT
* relative to the entire document.
*
* @param document the document
* @param x y the x y coordinates on the unrotated page
* @param xn yn the x y coordinates after rotation
*/
void page_calc_position(zathura_document_t* document, double x, double y,
double *xn, double *yn);
/**
* Converts a relative position within the document to a page number.
*
* @param document The document
* @param pos_x pos_y the position relative to the document
* @return page sitting in that position
*/
unsigned int position_to_page_number(zathura_document_t* document,
double pos_x, double pos_y);
/**
* Converts a page number to a position in units relative to the document
*
* We can specify where to aliwn the viewport and the page. For instance, xalign
* = 0 means align them on the left margin, xalign = 0.5 means centered, and
* xalign = 1.0 align them on the right margin.
*
* The return value is the position in in units relative to the document (0=top
* 1=bottom) of the point thet will lie at the center of the viewport.
*
* @param document The document
* @param page_number the given page number
* @param xalign yalign where to align the viewport and the page
* @return pos_x pos_y position that will lie at the center of the viewport.
*/
void page_number_to_position(zathura_document_t* document, unsigned int page_number,
double xalign, double yalign, double *pos_x, double *pos_y);
/**
* Checks whether a given page falls within the viewport
*
* @param document The document
* @param page_number the page number
* @return true if the page intersects the viewport
*/
bool page_is_visible(zathura_document_t *document, unsigned int page_number);
/**
* Clone a GtkAdjustment
*
* Creates a new adjustment with the same value, lower and upper bounds, step
* and page increments and page_size as the original adjustment.
......
......@@ -25,14 +25,14 @@ zathura_bookmark_add(zathura_t* zathura, const gchar* id, unsigned int page)
g_return_val_if_fail(zathura && zathura->document && zathura->bookmarks.bookmarks, NULL);
g_return_val_if_fail(id, NULL);
double x = zathura_adjustment_get_ratio(gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(zathura->ui.session->gtk.view)));
double y = zathura_adjustment_get_ratio(gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(zathura->ui.session->gtk.view)));
double position_x = zathura_document_get_position_x(zathura->document);
double position_y = zathura_document_get_position_y(zathura->document);
zathura_bookmark_t* old = zathura_bookmark_get(zathura, id);
if (old != NULL) {
old->page = page;
old->x = x;
old->y = y;
old->x = position_x;
old->y = position_y;
if (zathura->database != NULL) {
const char* path = zathura_document_get_path(zathura->document);
......@@ -52,8 +52,8 @@ zathura_bookmark_add(zathura_t* zathura, const gchar* id, unsigned int page)
bookmark->id = g_strdup(id);
bookmark->page = page;
bookmark->x = x;
bookmark->y = y;
bookmark->x = position_x;
bookmark->y = position_y;
girara_list_append(zathura->bookmarks.bookmarks, bookmark);
if (zathura->database != NULL) {
......
This diff is collapsed.
......@@ -27,6 +27,15 @@ gboolean cb_destroy(GtkWidget* widget, zathura_t* zathura);
*/
void cb_buffer_changed(girara_session_t* session);
/**
* This function gets called when the value of the horizontal scrollbars
* changes (e.g.: by scrolling, moving to another page)
*
* @param adjustment The hadjustment of the page view
* @param data NULL
*/
void cb_view_hadjustment_value_changed(GtkAdjustment *adjustment, gpointer data);
/**
* This function gets called when the value of the vertical scrollbars
* changes (e.g.: by scrolling, moving to another page)
......@@ -40,9 +49,7 @@ void cb_view_vadjustment_value_changed(GtkAdjustment *adjustment, gpointer data)
* This function gets called when the bounds or the page_size of the horizontal
* scrollbar change (e.g. when the zoom level is changed).
*
* It adjusts the value of the horizontal scrollbar, possibly based on its
* previous adjustment, stored in the tracking adjustment
* zathura->ui.hadjustment.
* It adjusts the value of the horizontal scrollbar
*
* @param adjustment The horizontal adjustment of a gtkScrolledWindow
* @param data The zathura instance
......@@ -61,26 +68,16 @@ void cb_view_hadjustment_changed(GtkAdjustment *adjustment, gpointer data);
*/
void cb_view_vadjustment_changed(GtkAdjustment *adjustment, gpointer data);
/* This function gets called when the value of the adjustment changes.
*
* It updates the value of the tracking adjustment, only if the bounds of the
* adjustment have not changed (if they did change,
* cb_adjustment_track_bounds() will take care of updating everything).
*
* @param adjustment The adjustment instance
* @param data The tracking adjustment instance
*/
void cb_adjustment_track_value(GtkAdjustment* adjustment, gpointer data);
/* This function gets called when the bounds or the page_size of the adjustment
* change.
/**
* This function gets called when the program need to refresh the document view.
*
* It updates the value, bounds and page_size of the tracking adjustment.
* It adjusts the value of the scrollbars, triggering a redraw in the new
* position.
*
* @param adjustment The adjustment instance
* @param data The tracking adjustment instance
* @param view The view GtkWidget
* @param data The zathura instance
*/
void cb_adjustment_track_bounds(GtkAdjustment* adjustment, gpointer data);
void cb_refresh_view(GtkWidget* view, gpointer data);
/**
* This function gets called when the value of the "pages-per-row"
......@@ -92,19 +89,7 @@ void cb_adjustment_track_bounds(GtkAdjustment* adjustment, gpointer data);
* @param value The value
* @param data Custom data
*/
void cb_pages_per_row_value_changed(girara_session_t* session, const char* name,
girara_setting_type_t type, void* value, void* data);
/**
* This function gets called when the value of the "first-page-column"
* variable changes
*
* @param session The current girara session
* @param name The name of the row
* @param type The settings type
* @param value The value
* @param data Custom data
*/
void cb_first_page_column_value_changed(girara_session_t* session, const char* name,
void cb_page_layout_value_changed(girara_session_t* session, const char* name,
girara_setting_type_t type, void* value, void* data);
/**
......@@ -202,4 +187,17 @@ void cb_setting_recolor_keep_hue_change(girara_session_t* session, const char* n
*/
bool cb_unknown_command(girara_session_t* session, const char* input);
/**
* Emitted when text has been selected in the page widget
*
* @param widget page view widget
* @param text selected text
* @param data user data
*/
void cb_page_widget_text_selected(ZathuraPage* page, const char* text,
void* data);
void cb_page_widget_image_selected(ZathuraPage* page, GdkPixbuf* pixbuf,
void* data);
#endif // CALLBACKS_H
......@@ -118,15 +118,9 @@ cmd_bookmark_open(girara_session_t* session, girara_list_t* argument_list)
}
zathura_jumplist_add(zathura);
page_set(zathura, bookmark->page - 1);
if (bookmark->x != DBL_MIN && bookmark->y != DBL_MIN) {
GtkAdjustment* hadjustment = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(zathura->ui.session->gtk.view));
GtkAdjustment* vadjustment = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(zathura->ui.session->gtk.view));
zathura_adjustment_set_value_from_ratio(hadjustment, bookmark->x);
zathura_adjustment_set_value_from_ratio(vadjustment, bookmark->y);
zathura_document_set_current_page_number(zathura->document, bookmark->page - 1);
statusbar_page_number_update(zathura);
} else {
page_set(zathura, bookmark->page - 1);
position_set(zathura, bookmark->x, bookmark->y);
}
zathura_jumplist_add(zathura);
......@@ -164,15 +158,15 @@ cmd_info(girara_session_t* session, girara_list_t* UNUSED(argument_list))
zathura_document_information_type_t field;
};
struct meta_field meta_fields[] = {
{ "Title", ZATHURA_DOCUMENT_INFORMATION_TITLE },
{ "Author", ZATHURA_DOCUMENT_INFORMATION_AUTHOR },
{ "Subject", ZATHURA_DOCUMENT_INFORMATION_SUBJECT },
{ "Keywords", ZATHURA_DOCUMENT_INFORMATION_KEYWORDS },
{ "Creator", ZATHURA_DOCUMENT_INFORMATION_CREATOR },
{ "Producer", ZATHURA_DOCUMENT_INFORMATION_PRODUCER },
{ "Creation date", ZATHURA_DOCUMENT_INFORMATION_CREATION_DATE },
{ "Modiciation date", ZATHURA_DOCUMENT_INFORMATION_MODIFICATION_DATE }
const struct meta_field meta_fields[] = {
{ _("Title"), ZATHURA_DOCUMENT_INFORMATION_TITLE },
{ _("Author"), ZATHURA_DOCUMENT_INFORMATION_AUTHOR },
{ _("Subject"), ZATHURA_DOCUMENT_INFORMATION_SUBJECT },
{ _("Keywords"), ZATHURA_DOCUMENT_INFORMATION_KEYWORDS },
{ _("Creator"), ZATHURA_DOCUMENT_INFORMATION_CREATOR },
{ _("Producer"), ZATHURA_DOCUMENT_INFORMATION_PRODUCER },
{ _("Creation date"), ZATHURA_DOCUMENT_INFORMATION_CREATION_DATE },
{ _("Modification date"), ZATHURA_DOCUMENT_INFORMATION_MODIFICATION_DATE }
};
girara_list_t* information = zathura_document_get_information(zathura->document, NULL);
......@@ -381,9 +375,9 @@ cmd_search(girara_session_t* session, const char* input, girara_argument_t* argu
GtkWidget* page_widget = zathura_page_get_widget(zathura, page);
g_object_set(page_widget, "draw-links", FALSE, NULL);
render_lock(zathura->sync.render_thread);
zathura_renderer_lock(zathura->sync.render_thread);
girara_list_t* result = zathura_page_search_text(page, input, &error);
render_unlock(zathura->sync.render_thread);
zathura_renderer_unlock(zathura->sync.render_thread);
if (result == NULL || girara_list_size(result) == 0) {
girara_list_free(result);
......
......@@ -57,9 +57,13 @@ cb_color_change(girara_session_t* session, const char* name,
} else if (g_strcmp0(name, "highlight-active-color") == 0) {
gdk_color_parse(string_value, &(zathura->ui.colors.highlight_color_active));
} else if (g_strcmp0(name, "recolor-darkcolor") == 0) {
gdk_color_parse(string_value, &(zathura->ui.colors.recolor_dark_color));
if (zathura->sync.render_thread != NULL) {
zathura_renderer_set_recolor_colors_str(zathura->sync.render_thread, NULL, string_value);
}
} else if (g_strcmp0(name, "recolor-lightcolor") == 0) {
gdk_color_parse(string_value, &(zathura->ui.colors.recolor_light_color));
if (zathura->sync.render_thread != NULL) {
zathura_renderer_set_recolor_colors_str(zathura->sync.render_thread, string_value, NULL);
}
} else if (g_strcmp0(name, "render-loading-bg") == 0) {
gdk_color_parse(string_value, &(zathura->ui.colors.render_loading_bg));
} else if (g_strcmp0(name, "render-loading-fg") == 0) {
......@@ -69,27 +73,6 @@ cb_color_change(girara_session_t* session, const char* name,
render_all(zathura);
}
static void
cb_page_padding_changed(girara_session_t* session, const char* UNUSED(name),
girara_setting_type_t UNUSED(type), void* value, void* UNUSED(data))
{
g_return_if_fail(value != NULL);
g_return_if_fail(session != NULL);
g_return_if_fail(session->global.data != NULL);
zathura_t* zathura = session->global.data;
int val = *(int*) value;
if (GTK_IS_TABLE(zathura->ui.page_widget) == TRUE) {
#if (GTK_MAJOR_VERSION == 3)
gtk_grid_set_row_spacing(GTK_GRID(zathura->ui.page_widget), val);
gtk_grid_set_column_spacing(GTK_GRID(zathura->ui.page_widget), val);
#else
gtk_table_set_row_spacings(GTK_TABLE(zathura->ui.page_widget), val);
gtk_table_set_col_spacings(GTK_TABLE(zathura->ui.page_widget), val);
#endif
}
}
static void
cb_nohlsearch_changed(girara_session_t* session, const char* UNUSED(name),
girara_setting_type_t UNUSED(type), void* value, void* UNUSED(data))
......@@ -128,6 +111,7 @@ config_load_default(zathura_t* zathura)
float float_value = 0;
bool bool_value = false;
bool inc_search = true;
char* string_value = NULL;
girara_session_t* gsession = zathura->ui.session;
/* mode settings */
......@@ -144,21 +128,21 @@ config_load_default(zathura_t* zathura)
girara_mode_set(gsession, zathura->modes.normal);
/* zathura settings */
girara_setting_add(gsession, "database", "plain", STRING, true, _("Database backend"), NULL, NULL);
girara_setting_add(gsession, "database", "plain", STRING, true, _("Database backend"), NULL, NULL);
int_value = 10;
girara_setting_add(gsession, "zoom-step", &int_value, INT, false, _("Zoom step"), NULL, NULL);
girara_setting_add(gsession, "zoom-step", &int_value, INT, false, _("Zoom step"), NULL, NULL);
int_value = 1;
girara_setting_add(gsession, "page-padding", &int_value, INT, false, _("Padding between pages"), cb_page_padding_changed, NULL);
girara_setting_add(gsession, "page-padding", &int_value, INT, false, _("Padding between pages"), cb_page_layout_value_changed, NULL);
int_value = 1;
girara_setting_add(gsession, "pages-per-row", &int_value, INT, false, _("Number of pages per row"), cb_pages_per_row_value_changed, NULL);
girara_setting_add(gsession, "pages-per-row", &int_value, INT, false, _("Number of pages per row"), cb_page_layout_value_changed, NULL);
int_value = 1;
girara_setting_add(gsession, "first-page-column", &int_value, INT, false, _("Column of the first page"),cb_first_page_column_value_changed, NULL);
girara_setting_add(gsession, "first-page-column", &int_value, INT, false, _("Column of the first page"), cb_page_layout_value_changed, NULL);
float_value = 40;
girara_setting_add(gsession, "scroll-step", &float_value, FLOAT, false, _("Scroll step"), NULL, NULL);
girara_setting_add(gsession, "scroll-step", &float_value, FLOAT, false, _("Scroll step"), NULL, NULL);
float_value = 40;
girara_setting_add(gsession, "scroll-hstep", &float_value, FLOAT, false, _("Horizontal scroll step"), NULL, NULL);
girara_setting_add(gsession, "scroll-hstep", &float_value, FLOAT, false, _("Horizontal scroll step"), NULL, NULL);
float_value = 0.0;
girara_setting_add(gsession, "scroll-full-overlap", &float_value, FLOAT, false, _("Full page scroll overlap"), NULL, NULL);
girara_setting_add(gsession, "scroll-full-overlap", &float_value, FLOAT, false, _("Full page scroll overlap"), NULL, NULL);
int_value = 10;
girara_setting_add(gsession, "zoom-min", &int_value, INT, false, _("Zoom minimum"), NULL, NULL);
int_value = 1000;
......@@ -168,17 +152,15 @@ config_load_default(zathura_t* zathura)
int_value = 2000;
girara_setting_add(gsession, "jumplist-size", &int_value, INT, false, _("Number of positions to remember in the jumplist"), cb_jumplist_change, NULL);
girara_setting_add(gsession, "recolor-darkcolor", NULL, STRING, false, _("Recoloring (dark color)"), cb_color_change, NULL);
girara_setting_set(gsession, "recolor-darkcolor", "#FFFFFF");
girara_setting_add(gsession, "recolor-lightcolor", NULL, STRING, false, _("Recoloring (light color)"), cb_color_change, NULL);
girara_setting_set(gsession, "recolor-lightcolor", "#000000");
girara_setting_add(gsession, "highlight-color", NULL, STRING, false, _("Color for highlighting"), cb_color_change, NULL);
girara_setting_add(gsession, "recolor-darkcolor", "#FFFFFF", STRING, false, _("Recoloring (dark color)"), cb_color_change, NULL);
girara_setting_add(gsession, "recolor-lightcolor", "#000000", STRING, false, _("Recoloring (light color)"), cb_color_change, NULL);
girara_setting_add(gsession, "highlight-color", NULL, STRING, false, _("Color for highlighting"), cb_color_change, NULL);
girara_setting_set(gsession, "highlight-color", "#9FBC00");
girara_setting_add(gsession, "highlight-active-color", NULL, STRING, false, _("Color for highlighting (active)"), cb_color_change, NULL);
girara_setting_add(gsession, "highlight-active-color", NULL, STRING, false, _("Color for highlighting (active)"), cb_color_change, NULL);
girara_setting_set(gsession, "highlight-active-color", "#00BC00");
girara_setting_add(gsession, "render-loading-bg", NULL, STRING, false, _("'Loading ...' background color"), cb_color_change, NULL);
girara_setting_add(gsession, "render-loading-bg", NULL, STRING, false, _("'Loading ...' background color"), cb_color_change, NULL);
girara_setting_set(gsession, "render-loading-bg", "#FFFFFF");
girara_setting_add(gsession, "render-loading-fg", NULL, STRING, false, _("'Loading ...' foreground color"), cb_color_change, NULL);
girara_setting_add(gsession, "render-loading-fg", NULL, STRING, false, _("'Loading ...' foreground color"), cb_color_change, NULL);
girara_setting_set(gsession, "render-loading-fg", "#000000");
bool_value = false;
......@@ -196,6 +178,8 @@ config_load_default(zathura_t* zathura)
bool_value = true;
girara_setting_add(gsession, "link-hadjust", &bool_value, BOOLEAN, false, _("Align link target to the left"), NULL, NULL);
bool_value = true;
girara_setting_add(gsession, "link-zoom", &bool_value, BOOLEAN, false, _("Let zoom be changed when following links"), NULL, NULL);
bool_value = true;
girara_setting_add(gsession, "search-hadjust", &bool_value, BOOLEAN, false, _("Center result horizontally"), NULL, NULL);
float_value = 0.5;
girara_setting_add(gsession, "highlight-transparency", &float_value, FLOAT, false, _("Transparency for highlighting"), NULL, NULL);
......@@ -222,6 +206,8 @@ config_load_default(zathura_t* zathura)
girara_setting_add(gsession, "statusbar-basename", &bool_value, BOOLEAN, false, _("Use basename of the file in the statusbar"), NULL, NULL);
bool_value = false;
girara_setting_add(gsession, "synctex", &bool_value, BOOLEAN, false, _("Enable synctex support"), NULL, NULL);
string_value = "primary";
girara_setting_add(gsession, "selection-clipboard", string_value, STRING, false, _("The clipboard into which mouse-selected data will be written"), NULL, NULL);
/* define default shortcuts */
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_c, NULL, sc_abort, 0, 0, NULL);
......
......@@ -3,7 +3,7 @@
ZATHURA_VERSION_MAJOR = 0
ZATHURA_VERSION_MINOR = 2
ZATHURA_VERSION_REV = 4
ZATHURA_VERSION_REV = 5
# 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.
......@@ -11,13 +11,23 @@ ZATHURA_ABI_VERSION = 2
VERSION = ${ZATHURA_VERSION_MAJOR}.${ZATHURA_VERSION_MINOR}.${ZATHURA_VERSION_REV}
# the GTK+ version to use
# note: zathura with GTK+ 3 is broken!
ZATHURA_GTK_VERSION ?= 2
# minimum required zathura version
# If you want to disable the check, set GIRARA_VERSION_CHECK to 0.
GIRARA_MIN_VERSION = 0.1.6
GIRARA_VERSION_CHECK ?= $(shell pkg-config --atleast-version=$(GIRARA_MIN_VERSION) girara-gtk${ZATHURA_GTK_VERSION}; echo $$?)
ZATHURA_GTK_VERSION ?= 3
# version checks
# If you want to disable any of the checks, set *_VERSION_CHECK to 0.
# girara
GIRARA_VERSION_CHECK ?= 1
GIRARA_MIN_VERSION = 0.1.8
GIRARA_PKG_CONFIG_NAME = girara-gtk$(ZATHURA_GTK_VERSION)
# glib
GLIB_VERSION_CHECK ?= 1
GLIB_MIN_VERSION = 2.28
GLIB_PKG_CONFIG_NAME = glib-2.0
# GTK
GTK_VERSION_CHECK ?= 1
GTK_MIN_VERSION = 2.18
GTK_PKG_CONFIG_NAME = gtk+-$(ZATHURA_GTK_VERSION).0
# database
# To disable support for the sqlite backend set WITH_SQLITE to 0.
......@@ -52,6 +62,9 @@ GTHREAD_LIB ?= $(shell pkg-config --libs gthread-2.0)
GMODULE_INC ?= $(shell pkg-config --cflags gmodule-no-export-2.0)
GMODULE_LIB ?= $(shell pkg-config --libs gmodule-no-export-2.0)
GLIB_INC ?= $(shell pkg-config --cflags glib-2.0)
GLIB_LIB ?= $(shell pkg-config --libs glib-2.0)
GIRARA_INC ?= $(shell pkg-config --cflags girara-gtk${ZATHURA_GTK_VERSION})
GIRARA_LIB ?= $(shell pkg-config --libs girara-gtk${ZATHURA_GTK_VERSION})
......@@ -65,8 +78,8 @@ MAGIC_INC ?=
MAGIC_LIB ?= -lmagic
endif
INCS = ${GIRARA_INC} ${GTK_INC} ${GTHREAD_INC} ${GMODULE_INC}
LIBS = ${GIRARA_LIB} ${GTK_LIB} ${GTHREAD_LIB} ${GMODULE_LIB} -lpthread -lm
INCS = ${GIRARA_INC} ${GTK_INC} ${GTHREAD_INC} ${GMODULE_INC} ${GLIB_INC}
LIBS = ${GIRARA_LIB} ${GTK_LIB} ${GTHREAD_LIB} ${GMODULE_LIB} ${GLIB_LIB} -lpthread -lm
# flags
CFLAGS += -std=c99 -pedantic -Wall -Wno-format-zero-length -Wextra $(INCS)
......
......@@ -394,14 +394,13 @@ plain_load_bookmarks(zathura_database_t* db, const char* file)
return NULL;
}
char **val_list = NULL;
gsize num_vals = 0;
for (gsize i = 0; i < num_keys; i++) {
zathura_bookmark_t* bookmark = g_malloc0(sizeof(zathura_bookmark_t));
bookmark->id = g_strdup(keys[i]);
val_list = g_key_file_get_string_list(priv->bookmarks, name, keys[i], &num_vals, NULL);
bookmark->id = g_strdup(keys[i]);
char **val_list = g_key_file_get_string_list(priv->bookmarks, name, keys[i], &num_vals, NULL);
bookmark->page = atoi(val_list[0]);
......
......@@ -22,6 +22,7 @@
#include <girara/session.h>
#include <girara/settings.h>
#include "adjustment.h"
#include "document.h"
#include "utils.h"
#include "zathura.h"
......@@ -50,6 +51,15 @@ struct zathura_document_s {
void* data; /**< Custom data */
zathura_adjust_mode_t adjust_mode; /**< Adjust mode (best-fit, width) */
int page_offset; /**< Page offset */
double cell_width; /**< width of a page cell in the document (not ransformed by scale and rotation) */
double cell_height; /**< height of a page cell in the document (not ransformed by scale and rotation) */
unsigned int view_width; /**< width of current viewport */
unsigned int view_height; /**< height of current viewport */
unsigned int pages_per_row; /**< number of pages in a row */
unsigned int first_page_column; /**< column of the first page */
unsigned int page_padding; /**< padding between pages */
double position_x; /**< X adjustment */
double position_y; /**< Y adjustment */