Commit 635b9700 authored by Moritz Lipp's avatar Moritz Lipp

Merge branch 'release/0.2.8'

parents a7b3d73f 7d5bdbe6
...@@ -13,9 +13,14 @@ zathura.pc ...@@ -13,9 +13,14 @@ zathura.pc
gcov/ gcov/
*.swp *.swp
version.h version.h
doc/ ./doc/_build
*.tmp *.tmp
zathura.1 zathura.1
zathurarc.5 zathurarc.5
.version-checks/ .version-checks/
dbus-interface-definitions.c dbus-interface-definitions.c
css-definitions.c
.ycm_extra_conf.py
.ropeproject
compile_commands.json
zathura-*.tar.gz
...@@ -23,4 +23,5 @@ Rob Cornish <jrmcornish@gmail.com> ...@@ -23,4 +23,5 @@ Rob Cornish <jrmcornish@gmail.com>
Marwan Tanager <marwan.tngr@gmail.com> Marwan Tanager <marwan.tngr@gmail.com>
Diego Joss <djego.joss@gmail.com> Diego Joss <djego.joss@gmail.com>
Ignas Anikevicius <anikevicius@gmail.com> Ignas Anikevicius <anikevicius@gmail.com>
Kamil Smardzewski <roderyk197@gmail.com>
oblique oblique
# See LICENSE file for license and copyright information # See LICENSE file for license and copyright information
include config.mk include config.mk
include colors.mk
include common.mk include common.mk
PROJECT = zathura OSOURCE = $(filter-out css-definitions.c, $(filter-out dbus-interface-definitions.c, $(wildcard *.c))) $(wildcard synctex/*.c)
OSOURCE = $(filter-out dbus-interface-definitions.c, $(wildcard *.c)) HEADER = $(wildcard *.h) $(wildcard synctex/*.h)
HEADER = $(wildcard *.h)
HEADERINST = version.h document.h macros.h page.h types.h plugin-api.h links.h HEADERINST = version.h document.h macros.h page.h types.h plugin-api.h links.h
ifneq (${WITH_SQLITE},0) ifneq (${WITH_SQLITE},0)
...@@ -36,8 +36,15 @@ endif ...@@ -36,8 +36,15 @@ endif
ifeq (,$(findstring -DLOCALEDIR,${CPPFLAGS})) ifeq (,$(findstring -DLOCALEDIR,${CPPFLAGS}))
CPPFLAGS += -DLOCALEDIR=\"${LOCALEDIR}\" CPPFLAGS += -DLOCALEDIR=\"${LOCALEDIR}\"
endif endif
ifeq (,$(findstring -Isynctex,${CPPFLAGS}))
CPPFLAGS += -Isynctex
endif
ifeq (,$(findstring -DSYNCTEX_VERBOSE=0,${CPPFLAGS}))
CPPFLAGS += -DSYNCTEX_VERBOSE=0
endif
OBJECTS = $(patsubst %.c, %.o, $(SOURCE)) dbus-interface-definitions.o OBJECTS = $(patsubst %.c, %.o, $(SOURCE)) dbus-interface-definitions.o css-definitions.o
DOBJECTS = $(patsubst %.o, %.do, $(OBJECTS)) DOBJECTS = $(patsubst %.o, %.do, $(OBJECTS))
all: options ${PROJECT} po build-manpages all: options ${PROJECT} po build-manpages
...@@ -68,19 +75,26 @@ version.h: version.h.in config.mk ...@@ -68,19 +75,26 @@ version.h: version.h.in config.mk
$(QUIET)mv version.h.tmp version.h $(QUIET)mv version.h.tmp version.h
dbus-interface-definitions.c: data/org.pwmt.zathura.xml dbus-interface-definitions.c: data/org.pwmt.zathura.xml
$(QUIET)echo '#include "dbus-interface-definitions.h"' > dbus-interface-definitions.c.tmp $(QUIET)echo '#include "dbus-interface-definitions.h"' > $@.tmp
$(QUIET)echo 'const char* DBUS_INTERFACE_XML =' >> dbus-interface-definitions.c.tmp $(QUIET)echo 'const char* DBUS_INTERFACE_XML =' >> $@.tmp
$(QUIET)sed 's/^\(.*\)$$/"\1\\n"/' data/org.pwmt.zathura.xml >> dbus-interface-definitions.c.tmp $(QUIET)sed 's/^\(.*\)$$/"\1\\n"/' data/org.pwmt.zathura.xml >> $@.tmp
$(QUIET)echo ';' >> dbus-interface-definitions.c.tmp $(QUIET)echo ';' >> $@.tmp
$(QUIET)mv dbus-interface-definitions.c.tmp dbus-interface-definitions.c $(QUIET)mv $@.tmp $@
css-definitions.c: data/zathura.css_t
$(QUIET)echo '#include "css-definitions.h"' > $@.tmp
$(QUIET)echo 'const char* CSS_TEMPLATE_INDEX =' >> $@.tmp
$(QUIET)sed 's/^\(.*\)$$/"\1\\n"/' $< >> $@.tmp
$(QUIET)echo ';' >> $@.tmp
$(QUIET)mv $@.tmp $@
%.o: %.c %.o: %.c
$(ECHO) CC $< $(call colorecho,CC,$<)
@mkdir -p .depend $(QUIET) mkdir -p $(shell dirname .depend/$@.dep)
$(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} -o $@ $< -MMD -MF .depend/$@.dep $(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} -o $@ $< -MMD -MF .depend/$@.dep
%.do: %.c %.do: %.c
$(ECHO) CC $< $(call colorecho,CC,$<)
@mkdir -p .depend @mkdir -p .depend
$(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} ${DFLAGS} -o $@ $< -MMD -MF .depend/$@.dep $(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} ${DFLAGS} -o $@ $< -MMD -MF .depend/$@.dep
...@@ -88,32 +102,30 @@ ${OBJECTS} ${DOBJECTS}: config.mk version.h \ ...@@ -88,32 +102,30 @@ ${OBJECTS} ${DOBJECTS}: config.mk version.h \
.version-checks/GIRARA .version-checks/GLIB .version-checks/GTK .version-checks/GIRARA .version-checks/GLIB .version-checks/GTK
${PROJECT}: ${OBJECTS} ${PROJECT}: ${OBJECTS}
$(ECHO) CC -o $@ $(call colorecho,CC,$@)
$(QUIET)${CC} ${SFLAGS} ${LDFLAGS} -o $@ ${OBJECTS} ${LIBS} $(QUIET)${CC} ${SFLAGS} ${LDFLAGS} -o $@ ${OBJECTS} ${LIBS}
clean: clean:
$(QUIET)rm -rf ${PROJECT} \ $(QUIET)rm -rf ${PROJECT} \
${OBJECTS} \ ${OBJECTS} \
${PROJECT}-${VERSION}.tar.gz \ ${TARFILE} \
${TARDIR} \
${DOBJECTS} \ ${DOBJECTS} \
${PROJECT}-debug \ ${PROJECT}-debug \
.depend \ .depend \
${PROJECT}.pc \ ${PROJECT}.pc \
doc \
version.h \ version.h \
version.h.tmp \ version.h.tmp \
dbus-interface-definitions.c \ dbus-interface-definitions.c \
dbus-interface-definitions.c.tmp \ dbus-interface-definitions.c.tmp \
*gcda *gcno $(PROJECT).info gcov *.tmp \ *gcda *gcno $(PROJECT).info gcov *.tmp \
.version-checks .version-checks
ifneq "$(wildcard ${RSTTOMAN})" ""
$(QUIET)rm -f zathura.1 zathurarc.5
endif
$(QUIET)$(MAKE) -C tests clean $(QUIET)$(MAKE) -C tests clean
$(QUIET)$(MAKE) -C po clean $(QUIET)$(MAKE) -C po clean
$(QUIET)$(MAKE) -C doc clean
${PROJECT}-debug: ${DOBJECTS} ${PROJECT}-debug: ${DOBJECTS}
$(ECHO) CC -o $@ $(call colorecho,CC,$@)
$(QUIET)${CC} ${LDFLAGS} -o $@ ${DOBJECTS} ${LIBS} $(QUIET)${CC} ${LDFLAGS} -o $@ ${DOBJECTS} ${LIBS}
debug: ${PROJECT}-debug debug: ${PROJECT}-debug
...@@ -139,24 +151,13 @@ test: ${OBJECTS} ...@@ -139,24 +151,13 @@ test: ${OBJECTS}
$(QUIET)make -C tests run $(QUIET)make -C tests run
dist: clean build-manpages dist: clean build-manpages
$(QUIET)mkdir -p ${PROJECT}-${VERSION} $(QUIET)tar -czf $(TARFILE) --exclude=.gitignore \
$(QUIET)mkdir -p ${PROJECT}-${VERSION}/tests --transform 's,^,zathura-$(VERSION)/,' \
$(QUIET)mkdir -p ${PROJECT}-${VERSION}/po `git ls-files` \
$(QUIET)cp LICENSE Makefile config.mk common.mk README AUTHORS Doxyfile \ doc/_build/$(PROJECT).1 doc/_build/$(PROJECT)rc.5
${PROJECT}.1.rst ${PROJECT}rc.5.rst ${OSOURCE} ${HEADER} ${PROJECT}.pc.in \
${PROJECT}.desktop version.h.in \
${PROJECT}.1 ${PROJECT}rc.5 \
${PROJECT}-${VERSION}
$(QUIET)cp -r data ${PROJECT}-${VERSION}
$(QUIET)cp tests/Makefile tests/config.mk tests/*.c \
${PROJECT}-${VERSION}/tests
$(QUIET)cp po/Makefile po/*.po ${PROJECT}-${VERSION}/po
$(QUIET)tar -cf ${PROJECT}-${VERSION}.tar ${PROJECT}-${VERSION}
$(QUIET)gzip ${PROJECT}-${VERSION}.tar
$(QUIET)rm -rf ${PROJECT}-${VERSION}
doc: doc:
$(QUIET)doxygen Doxyfile $(QUIET)make -C doc
gcov: clean gcov: clean
$(QUIET)CFLAGS="${CFLAGS} -fprofile-arcs -ftest-coverage" LDFLAGS="${LDFLAGS} -fprofile-arcs" ${MAKE} $(PROJECT) $(QUIET)CFLAGS="${CFLAGS} -fprofile-arcs -ftest-coverage" LDFLAGS="${LDFLAGS} -fprofile-arcs" ${MAKE} $(PROJECT)
...@@ -170,68 +171,58 @@ po: ...@@ -170,68 +171,58 @@ po:
update-po: update-po:
$(QUIET)${MAKE} -C po update-po $(QUIET)${MAKE} -C po update-po
ifneq "$(wildcard ${RSTTOMAN})" ""
%.1 %.5: config.mk
$(QUIET)sed "s/VERSION/${VERSION}/g" < $@.rst > $@.tmp
$(QUIET)${RSTTOMAN} $@.tmp > $@.out.tmp
$(QUIET)mv $@.out.tmp $@
$(QUIET)rm $@.tmp
${PROJECT}.1: ${PROJECT}.1.rst
${PROJECT}rc.5: ${PROJECT}rc.5.rst
build-manpages: ${PROJECT}.1 ${PROJECT}rc.5
else
build-manpages: build-manpages:
endif $(QUIET)${MAKE} -C doc man
install-manpages: build-manpages install-manpages: build-manpages
$(ECHO) installing manual pages $(call colorecho,INSTALL,"man pages")
$(QUIET)mkdir -m 755 -p ${DESTDIR}${MANPREFIX}/man1 ${DESTDIR}${MANPREFIX}/man5 $(QUIET)mkdir -m 755 -p ${DESTDIR}${MANPREFIX}/man1 ${DESTDIR}${MANPREFIX}/man5
ifneq "$(wildcard ${PROJECT}.1)" "" ifneq "$(wildcard doc/_build/${PROJECT}.1)" ""
$(QUIET)install -m 644 ${PROJECT}.1 ${DESTDIR}${MANPREFIX}/man1 $(QUIET)install -m 644 doc/_build/${PROJECT}.1 ${DESTDIR}${MANPREFIX}/man1
endif endif
ifneq "$(wildcard ${PROJECT}rc.5)" "" ifneq "$(wildcard doc/_build/${PROJECT}rc.5)" ""
$(QUIET)install -m 644 ${PROJECT}rc.5 ${DESTDIR}${MANPREFIX}/man5 $(QUIET)install -m 644 doc/_build/${PROJECT}rc.5 ${DESTDIR}${MANPREFIX}/man5
endif endif
install-headers: ${PROJECT}.pc install-headers: ${PROJECT}.pc
$(ECHO) installing header files $(call colorecho,INSTALL,"header files")
$(QUIET)mkdir -m 755 -p ${DESTDIR}${INCLUDEDIR}/${PROJECT} $(QUIET)mkdir -m 755 -p ${DESTDIR}${INCLUDEDIR}/${PROJECT}
$(QUIET)install -m 644 ${HEADERINST} ${DESTDIR}${INCLUDEDIR}/${PROJECT} $(QUIET)install -m 644 ${HEADERINST} ${DESTDIR}${INCLUDEDIR}/${PROJECT}
$(ECHO) installing pkgconfig file
$(call colorecho,INSTALL,"pkgconfig file")
$(QUIET)mkdir -m 755 -p ${DESTDIR}${LIBDIR}/pkgconfig $(QUIET)mkdir -m 755 -p ${DESTDIR}${LIBDIR}/pkgconfig
$(QUIET)install -m 644 ${PROJECT}.pc ${DESTDIR}${LIBDIR}/pkgconfig $(QUIET)install -m 644 ${PROJECT}.pc ${DESTDIR}${LIBDIR}/pkgconfig
install-dbus: install-dbus:
$(ECHO) installing D-Bus interface definitions $(call colorecho,INSTALL,"D-Bus interface definitions")
$(QUIET)mkdir -m 755 -p $(DESTDIR)$(DBUSINTERFACEDIR) $(QUIET)mkdir -m 755 -p $(DESTDIR)$(DBUSINTERFACEDIR)
$(QUIET)install -m 644 data/org.pwmt.zathura.xml $(DESTDIR)$(DBUSINTERFACEDIR) $(QUIET)install -m 644 data/org.pwmt.zathura.xml $(DESTDIR)$(DBUSINTERFACEDIR)
install: all install-headers install-manpages install-dbus install: all install-headers install-manpages install-dbus
$(ECHO) installing executable file $(call colorecho,INSTALL,"executeable file")
$(QUIET)mkdir -m 755 -p ${DESTDIR}${PREFIX}/bin $(QUIET)mkdir -m 755 -p ${DESTDIR}${PREFIX}/bin
$(QUIET)install -m 755 ${PROJECT} ${DESTDIR}${PREFIX}/bin $(QUIET)install -m 755 ${PROJECT} ${DESTDIR}${PREFIX}/bin
$(QUIET)mkdir -m 755 -p ${DESTDIR}${DESKTOPPREFIX} $(QUIET)mkdir -m 755 -p ${DESTDIR}${DESKTOPPREFIX}
$(ECHO) installing desktop file $(call colorecho,INSTALL,"desktop file")
$(QUIET)install -m 644 ${PROJECT}.desktop ${DESTDIR}${DESKTOPPREFIX} $(QUIET)install -m 644 ${PROJECT}.desktop ${DESTDIR}${DESKTOPPREFIX}
$(MAKE) -C po install $(MAKE) -C po install
uninstall-headers: uninstall-headers:
$(ECHO) removing header files $(call colorecho,UNINSTALL,"header files")
$(QUIET)rm -rf ${DESTDIR}${INCLUDEDIR}/${PROJECT} $(QUIET)rm -rf ${DESTDIR}${INCLUDEDIR}/${PROJECT}
$(ECHO) removing pkgconfig file $(call colorecho,UNINSTALL,"pkgconfig file")
$(QUIET)rm -f ${DESTDIR}${LIBDIR}/pkgconfig/${PROJECT}.pc $(QUIET)rm -f ${DESTDIR}${LIBDIR}/pkgconfig/${PROJECT}.pc
uninstall: uninstall-headers uninstall: uninstall-headers
$(ECHO) removing executable file $(ECHO) removing executable file
$(call colorecho,UNINSTALL,"executeable")
$(QUIET)rm -f ${DESTDIR}${PREFIX}/bin/${PROJECT} $(QUIET)rm -f ${DESTDIR}${PREFIX}/bin/${PROJECT}
$(ECHO) removing manual pages $(call colorecho,UNINSTALL,"man pages")
$(QUIET)rm -f ${DESTDIR}${MANPREFIX}/man1/${PROJECT}.1 $(QUIET)rm -f ${DESTDIR}${MANPREFIX}/man1/${PROJECT}.1
$(QUIET)rm -f ${DESTDIR}${MANPREFIX}/man5/${PROJECT}rc.5 $(QUIET)rm -f ${DESTDIR}${MANPREFIX}/man5/${PROJECT}rc.5
$(ECHO) removing desktop file $(call colorecho,UNINSTALL,"desktop file")
$(QUIET)rm -f ${DESTDIR}${DESKTOPPREFIX}/${PROJECT}.desktop $(QUIET)rm -f ${DESTDIR}${DESKTOPPREFIX}/${PROJECT}.desktop
$(ECHO) removing D-Bus interface definitions $(call colorecho,UNINSTALL,"D-Bus interface definitions")
$(QUIET)rm -f $(DESTDIR)$(DBUSINTERFACEDIR)/org.pwmt.zathura.xml $(QUIET)rm -f $(DESTDIR)$(DBUSINTERFACEDIR)/org.pwmt.zathura.xml
$(MAKE) -C po uninstall $(MAKE) -C po uninstall
......
...@@ -7,20 +7,24 @@ Requirements ...@@ -7,20 +7,24 @@ Requirements
------------ ------------
gtk3 gtk3
glib (>= 2.28) glib (>= 2.28)
girara (>= 0.1.8) girara (>= 0.2.0)
sqlite3 (optional, >= 3.5.9) sqlite3 (optional, >= 3.5.9)
check (for tests) check (for tests)
intltool intltool
python-docutils (optional, for man pages)
libmagic from file(1) (optional, for mime-type detection) libmagic from file(1) (optional, for mime-type detection)
Sphinx (optional, for manpages and HTML documentation)
doxygen (optional, for HTML documentation)
breathe (optional, for HTML documentation)
sphinx_rtd_theme (optional, for HTML documentation)
Please note that you need to have a working pkg-config installation and that the Please note that you need to have a working pkg-config installation and that the
Makefile is only compatible with GNU make. If you don't have a working Makefile is only compatible with GNU make. If you don't have a working
pkg-config installation please set the GTK_INC, GTK_LIB, GIRARA_INC, GIRARA_LIB, pkg-config installation please set the GTK_INC, GTK_LIB, GIRARA_INC, GIRARA_LIB,
SQLITE_INC and SQLITE_LIB variables accordingly. SQLITE_INC and SQLITE_LIB variables accordingly.
And also note that rst2man from python-docutils is needed to build the man pages. Also note that Sphinx is needed to build the manpages. If it is not
If it is not installed, the man pages won't be built. installed, the man pages won't be built. For the HTML documentation, doxygen,
breathe and sphinx_rtd_theme are needed in additioan to Sphinx.
If you don't want to build with support for sqlite databases, you can set If you don't want to build with support for sqlite databases, you can set
WITH_SQLITE=0 and sqlite support won't be available. WITH_SQLITE=0 and sqlite support won't be available.
...@@ -31,6 +35,9 @@ WITH_MAGIC=0. ...@@ -31,6 +35,9 @@ WITH_MAGIC=0.
If you pass these flags as a command line argument to make, you have to ensure If you pass these flags as a command line argument to make, you have to ensure
to pass the same flags when executing the install target. to pass the same flags when executing the install target.
If you want to build zathuras documentation, please install all python
dependencies from the ./doc/requirements.txt file.
Installation Installation
------------ ------------
To build and install zathura: To build and install zathura:
......
...@@ -63,9 +63,17 @@ position_to_page_number(zathura_document_t* document, double pos_x, ...@@ -63,9 +63,17 @@ position_to_page_number(zathura_document_t* document, double pos_x,
unsigned int c0 = zathura_document_get_first_page_column(document); unsigned int c0 = zathura_document_get_first_page_column(document);
unsigned int npag = zathura_document_get_number_of_pages(document); unsigned int npag = zathura_document_get_number_of_pages(document);
unsigned int ncol = zathura_document_get_pages_per_row(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 nrow = 0;
unsigned int pad = zathura_document_get_page_padding(document); unsigned int pad = zathura_document_get_page_padding(document);
if (c0 == 1) {
/* There is no offset, so this is easy. */
nrow = (npag + ncol - 1) / ncol;
} else {
/* If there is a offset, we handle the first row extra. */
nrow = 1 + (npag - (ncol - c0 - 1) + (ncol - 1)) / ncol;
}
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));
...@@ -73,7 +81,7 @@ position_to_page_number(zathura_document_t* document, double pos_x, ...@@ -73,7 +81,7 @@ position_to_page_number(zathura_document_t* document, double pos_x,
if (page < c0 - 1) { if (page < c0 - 1) {
return 0; return 0;
} else { } else {
return page - (c0 - 1); return MIN(page - (c0 - 1), npag - 1);
} }
} }
......
...@@ -137,60 +137,54 @@ cb_view_vadjustment_value_changed(GtkAdjustment* adjustment, gpointer data) ...@@ -137,60 +137,54 @@ cb_view_vadjustment_value_changed(GtkAdjustment* adjustment, gpointer data)
statusbar_page_number_update(zathura); statusbar_page_number_update(zathura);
} }
void static void
cb_view_hadjustment_changed(GtkAdjustment* adjustment, gpointer data) cb_view_adjustment_changed(GtkAdjustment* adjustment, zathura_t* zathura,
bool width)
{ {
zathura_t* zathura = data;
g_return_if_fail(zathura != NULL);
zathura_adjust_mode_t adjust_mode =
zathura_document_get_adjust_mode(zathura->document);
/* Do nothing in index mode */ /* Do nothing in index mode */
if (girara_mode_get(zathura->ui.session) == zathura->modes.index) { if (girara_mode_get(zathura->ui.session) == zathura->modes.index) {
return; return;
} }
/* Don't scroll we're focusing the inputbar. */ const zathura_adjust_mode_t adjust_mode =
zathura_document_get_adjust_mode(zathura->document);
/* Don't scroll, we're focusing the inputbar. */
if (adjust_mode == ZATHURA_ADJUST_INPUTBAR) { if (adjust_mode == ZATHURA_ADJUST_INPUTBAR) {
return; return;
} }
/* save the viewport size */ /* Save the viewport size */
unsigned int view_width = (unsigned int)floor(gtk_adjustment_get_page_size(adjustment)); unsigned int size = (unsigned int)floor(gtk_adjustment_get_page_size(adjustment));
zathura_document_set_viewport_width(zathura->document, view_width); if (width == true) {
zathura_document_set_viewport_width(zathura->document, size);
} else {
zathura_document_set_viewport_height(zathura->document, size);
}
/* reset the adjustment, in case bounds have changed */ /* reset the adjustment, in case bounds have changed */
double ratio = zathura_document_get_position_x(zathura->document); const double ratio = width == true ?
zathura_document_get_position_x(zathura->document) :
zathura_document_get_position_y(zathura->document);
zathura_adjustment_set_value_from_ratio(adjustment, ratio); zathura_adjustment_set_value_from_ratio(adjustment, ratio);
} }
void void
cb_view_vadjustment_changed(GtkAdjustment* adjustment, gpointer data) cb_view_hadjustment_changed(GtkAdjustment* adjustment, gpointer data)
{ {
zathura_t* zathura = data; zathura_t* zathura = data;
g_return_if_fail(zathura != NULL); g_return_if_fail(zathura != NULL);
zathura_adjust_mode_t adjust_mode = cb_view_adjustment_changed(adjustment, zathura, true);
zathura_document_get_adjust_mode(zathura->document); }
/* Do nothing in index mode */
if (girara_mode_get(zathura->ui.session) == zathura->modes.index) {
return;
}
/* Don't scroll we're focusing the inputbar. */
if (adjust_mode == ZATHURA_ADJUST_INPUTBAR) {
return;
}
/* save the viewport size */ void
unsigned int view_height = (unsigned int)floor(gtk_adjustment_get_page_size(adjustment)); cb_view_vadjustment_changed(GtkAdjustment* adjustment, gpointer data)
zathura_document_set_viewport_height(zathura->document, view_height); {
zathura_t* zathura = data;
g_return_if_fail(zathura != NULL);
/* reset the adjustment, in case bounds have changed */ cb_view_adjustment_changed(adjustment, zathura, false);
double ratio = zathura_document_get_position_y(zathura->document);
zathura_adjustment_set_value_from_ratio(adjustment, ratio);
} }
void void
...@@ -220,13 +214,24 @@ cb_refresh_view(GtkWidget* GIRARA_UNUSED(view), gpointer data) ...@@ -220,13 +214,24 @@ cb_refresh_view(GtkWidget* GIRARA_UNUSED(view), gpointer data)
} }
void void
cb_page_layout_value_changed(girara_session_t* session, const char* UNUSED(name), girara_setting_type_t UNUSED(type), void* value, void* UNUSED(data)) cb_page_layout_value_changed(girara_session_t* session, const char* name, girara_setting_type_t UNUSED(type), void* value, void* UNUSED(data))
{ {
g_return_if_fail(value != NULL); g_return_if_fail(value != NULL);
g_return_if_fail(session != NULL); g_return_if_fail(session != NULL);
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;
/* pages-per-row must not be 0 */
if (g_strcmp0(name, "pages-per-row") == 0) {
unsigned int pages_per_row = *((unsigned int*) value);
if (pages_per_row == 0) {
pages_per_row = 1;
girara_setting_set(session, name, &pages_per_row);
girara_notify(session, GIRARA_WARNING, _("'%s' must not be 0. Set to 1."), name);
return;
}
}
if (zathura->document == NULL) { if (zathura->document == NULL) {
/* no document has been openend yet */ /* no document has been openend yet */
return; return;
...@@ -579,3 +584,16 @@ cb_page_widget_image_selected(ZathuraPage* page, GdkPixbuf* pixbuf, void* data) ...@@ -579,3 +584,16 @@ cb_page_widget_image_selected(ZathuraPage* page, GdkPixbuf* pixbuf, void* data)
g_free(selection); g_free(selection);
} }
void
cb_page_widget_link(ZathuraPage* page, void* data)
{
g_return_if_fail(page != NULL);
bool enter = (bool) data;
GdkWindow* window = gtk_widget_get_parent_window(GTK_WIDGET(page));
GdkCursor* cursor = gdk_cursor_new(enter == true ? GDK_HAND1 : GDK_LEFT_PTR);
gdk_window_set_cursor(window, cursor);
g_object_unref(cursor);
}
...@@ -200,4 +200,8 @@ void cb_page_widget_text_selected(ZathuraPage* page, const char* text, ...@@ -200,4 +200,8 @@ void cb_page_widget_text_selected(ZathuraPage* page, const char* text,
void cb_page_widget_image_selected(ZathuraPage* page, GdkPixbuf* pixbuf, void cb_page_widget_image_selected(ZathuraPage* page, GdkPixbuf* pixbuf,
void* data); void* data);
void
cb_page_widget_link(ZathuraPage* page, void* data);
#endif // CALLBACKS_H #endif // CALLBACKS_H
# See LICENSE file for license and copyright information
#
TPUT ?= /usr/bin/tput
TPUT_AVAILABLE ?= $(shell ${TPUT} -V 2>/dev/null)
ifdef TPUT_AVAILABLE
ifeq ($(COLOR),1)
COLOR_NORMAL = `$(TPUT) sgr0`
COLOR_ACTION = `$(TPUT) bold``$(TPUT) setaf 3`
COLOR_COMMENT = `$(TPUT) bold``$(TPUT) setaf 2`
COLOR_BRACKET = `$(TPUT) setaf 4`
define colorecho
@echo $(COLOR_BRACKET)" ["$(COLOR_ACTION)$1$(COLOR_BRACKET)"] "$(COLOR_COMMENT)$2$(COLOR_BRACKET) $(COLOR_NORMAL)
endef
else
define colorecho
@echo " [$1]" $2
endef
endif
else
define colorecho
@echo " [$1]" $2
endef
endif
...@@ -523,8 +523,8 @@ cmd_exec(girara_session_t* session, girara_list_t* argument_list) ...@@ -523,8 +523,8 @@ cmd_exec(girara_session_t* session, girara_list_t* argument_list)
const char* path = zathura_document_get_path(zathura->document); const char* path = zathura_document_get_path(zathura->document);
GIRARA_LIST_FOREACH(argument_list, char*, iter, value) GIRARA_LIST_FOREACH(argument_list, char*, iter, value)
char* r = NULL; char* r = girara_replace_substring(value, "$FILE", path);
if ((r = replace_substring(value, "$FILE", path)) != NULL) { if (r != NULL) {
girara_list_iterator_set(iter, r); girara_list_iterator_set(iter, r);
} }
GIRARA_LIST_FOREACH_END(argument_list, char*, iter, value); GIRARA_LIST_FOREACH_END(argument_list, char*, iter, value);
......
...@@ -31,17 +31,15 @@ cb_jumplist_change(girara_session_t* session, const char* name, ...@@ -31,17 +31,15 @@ cb_jumplist_change(girara_session_t* session, const char* name,
g_return_if_fail(name != NULL); g_return_if_fail(name != NULL);
zathura_t* zathura = session->global.data; zathura_t* zathura = session->global.data;
if (g_strcmp0(name, "jumplist-size") != 0) {
return;
}
if (*(int *)value < 0) { if (*(int *)value < 0) {
zathura->jumplist.max_size = 0; zathura->jumplist.max_size = 0;
} else { } else {
zathura->jumplist.max_size = *(int *)value; zathura->jumplist.max_size = *(int *)value;
} }
zathura_jumplist_trim(zathura); if (zathura->jumplist.list != NULL && zathura->jumplist.size != 0) {
zathura_jumplist_trim(zathura);
}
} }
static void static void
...@@ -176,6 +174,11 @@ config_load_default(zathura_t* zathura) ...@@ -176,6 +174,11 @@ config_load_default(zathura_t* zathura)
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"); girara_setting_set(gsession, "render-loading-fg", "#000000");
girara_setting_add(gsession, "index-fg", "#DDDDDD", STRING, true, _("Index mode foreground color"), NULL, NULL);
girara_setting_add(gsession, "index-bg", "#232323", STRING, true, _("Index mode background color"), NULL, NULL);
girara_setting_add(gsession, "index-active-fg", "#232323", STRING, true, _("Index mode foreground color (active element)"), NULL, NULL);
girara_setting_add(gsession, "index-active-bg", "#9FBC00", STRING, true, _("Index mode background color (active element)"), NULL, NULL);
bool_value = false; bool_value = false;
girara_setting_add(gsession, "recolor", &bool_value, BOOLEAN, false, _("Recolor pages"), cb_setting_recolor_change, NULL); girara_setting_add(gsession, "recolor", &bool_value, BOOLEAN, false, _("Recolor pages"), cb_setting_recolor_change, NULL);
bool_value = false; bool_value = false;
...@@ -184,7 +187,7 @@ config_load_default(zathura_t* zathura) ...@@ -184,7 +187,7 @@ config_load_default(zathura_t* zathura)
girara_setting_add(gsession, "scroll-wrap", &bool_value, BOOLEAN, false, _("Wrap scrolling"), NULL, NULL); girara_setting_add(gsession, "scroll-wrap", &bool_value, BOOLEAN, false, _("Wrap scrolling"), NULL, NULL);
bool_value = false; bool_value = false;
girara_setting_add(gsession, "scroll-page-aware", &bool_value, BOOLEAN, false, _("Page aware scrolling"), NULL, NULL); girara_setting_add(gsession, "scroll-page-aware", &bool_value, BOOLEAN, false, _("Page aware scrolling"), NULL, NULL);
bool_value = false; bool_value = true;
girara_setting_add(gsession, "advance-pages-per-row", &bool_value, BOOLEAN, false, _("Advance number of pages per row"), NULL, NULL); girara_setting_add(gsession, "advance-pages-per-row", &bool_value, BOOLEAN, false, _("Advance number of pages per row"), NULL, NULL);
bool_value = false; bool_value = false;
girara_setting_add(gsession, "zoom-center", &bool_value, BOOLEAN, false, _("Horizontally centered zoom"), NULL, NULL); girara_setting_add(gsession, "zoom-center", &bool_value, BOOLEAN, false, _("Horizontally centered zoom"), NULL, NULL);
......
# See LICENSE file for license and copyright information # See LICENSE file for license and copyright information
# zathura make config # zathura make config
# project
PROJECT = zathura
ZATHURA_VERSION_MAJOR = 0 ZATHURA_VERSION_MAJOR = 0
ZATHURA_VERSION_MINOR = 2 ZATHURA_VERSION_MINOR = 2
ZATHURA_VERSION_REV = 7 ZATHURA_VERSION_REV = 8
# 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.
...@@ -15,7 +18,7 @@ VERSION = ${ZATHURA_VERSION_MAJOR}.${ZATHURA_VERSION_MINOR}.${ZATHURA_VERSION_RE ...@@ -15,7 +18,7 @@ VERSION = ${ZATHURA_VERSION_MAJOR}.${ZATHURA_VERSION_MINOR}.${ZATHURA_VERSION_RE
# girara # girara
GIRARA_VERSION_CHECK ?= 1 GIRARA_VERSION_CHECK ?= 1
GIRARA_MIN_VERSION = 0.1.8 GIRARA_MIN_VERSION = 0.2.0
GIRARA_PKG_CONFIG_NAME = girara-gtk3 GIRARA_PKG_CONFIG_NAME = girara-gtk3
# glib # glib