Commit 98c8ceab authored by Moritz Lipp's avatar Moritz Lipp

Merge branch 'release/0.3.0'

parents 386c949d 74d67de5
...@@ -25,3 +25,5 @@ Diego Joss <djego.joss@gmail.com> ...@@ -25,3 +25,5 @@ Diego Joss <djego.joss@gmail.com>
Ignas Anikevicius <anikevicius@gmail.com> Ignas Anikevicius <anikevicius@gmail.com>
Kamil Smardzewski <roderyk197@gmail.com> Kamil Smardzewski <roderyk197@gmail.com>
oblique oblique
Maxime Chéramy <maxime.cheramy@gmail.com>
Alexander Shabalin <shabalyn.a@gmail.com>
...@@ -4,7 +4,7 @@ include config.mk ...@@ -4,7 +4,7 @@ include config.mk
include colors.mk include colors.mk
include common.mk include common.mk
OSOURCE = $(filter-out css-definitions.c, $(filter-out dbus-interface-definitions.c, $(wildcard *.c))) $(wildcard synctex/*.c) OSOURCE = $(filter-out css-definitions.c, $(filter-out dbus-interface-definitions.c, $(wildcard *.c)))
HEADER = $(wildcard *.h) $(wildcard synctex/*.h) HEADER = $(wildcard *.h) $(wildcard synctex/*.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
...@@ -23,6 +23,22 @@ LIBS += $(MAGIC_LIB) ...@@ -23,6 +23,22 @@ LIBS += $(MAGIC_LIB)
CPPFLAGS += -DWITH_MAGIC CPPFLAGS += -DWITH_MAGIC
endif endif
ifneq ($(WITH_SYSTEM_SYNCTEX),0)
INCS += $(SYNCTEX_INC)
LIBS += $(SYNCTEX_LIB)
else
INCS += $(ZLIB_INC)
LIBS += $(ZLIB_LIB)
SOURCE += $(wildcard synctex/*.c)
ifeq (,$(findstring -Isynctex,${CPPFLAGS}))
CPPFLAGS += -Isynctex
endif
ifeq (,$(findstring -DSYNCTEX_VERBOSE=0,${CPPFLAGS}))
CPPFLAGS += -DSYNCTEX_VERBOSE=0
endif
endif
ifneq ($(wildcard ${VALGRIND_SUPPRESSION_FILE}),) ifneq ($(wildcard ${VALGRIND_SUPPRESSION_FILE}),)
VALGRIND_ARGUMENTS += --suppressions=${VALGRIND_SUPPRESSION_FILE} VALGRIND_ARGUMENTS += --suppressions=${VALGRIND_SUPPRESSION_FILE}
endif endif
...@@ -36,13 +52,6 @@ endif ...@@ -36,13 +52,6 @@ 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 css-definitions.o OBJECTS = $(patsubst %.c, %.o, $(SOURCE)) dbus-interface-definitions.o css-definitions.o
DOBJECTS = $(patsubst %.o, %.do, $(OBJECTS)) DOBJECTS = $(patsubst %.o, %.do, $(OBJECTS))
...@@ -95,7 +104,7 @@ css-definitions.c: data/zathura.css_t ...@@ -95,7 +104,7 @@ css-definitions.c: data/zathura.css_t
%.do: %.c %.do: %.c
$(call colorecho,CC,$<) $(call colorecho,CC,$<)
@mkdir -p .depend $(QUIET) mkdir -p $(shell dirname .depend/$@.dep)
$(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} ${DFLAGS} -o $@ $< -MMD -MF .depend/$@.dep $(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} ${DFLAGS} -o $@ $< -MMD -MF .depend/$@.dep
${OBJECTS} ${DOBJECTS}: config.mk version.h \ ${OBJECTS} ${DOBJECTS}: config.mk version.h \
...@@ -118,6 +127,8 @@ clean: ...@@ -118,6 +127,8 @@ clean:
version.h.tmp \ version.h.tmp \
dbus-interface-definitions.c \ dbus-interface-definitions.c \
dbus-interface-definitions.c.tmp \ dbus-interface-definitions.c.tmp \
css-definitions.c \
css-definitions.c.tmp \
*gcda *gcno $(PROJECT).info gcov *.tmp \ *gcda *gcno $(PROJECT).info gcov *.tmp \
.version-checks .version-checks
$(QUIET)$(MAKE) -C tests clean $(QUIET)$(MAKE) -C tests clean
...@@ -198,7 +209,12 @@ install-dbus: ...@@ -198,7 +209,12 @@ install-dbus:
$(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-appdata:
$(call colorecho,INSTALL,"AppData file")
$(QUIET)mkdir -m 755 -p $(DESTDIR)$(APPDATAPREFIX)
$(QUIET)install -m 644 data/$(PROJECT).appdata.xml $(DESTDIR)$(APPDATAPREFIX)
install: all install-headers install-manpages install-dbus install-appdata
$(call colorecho,INSTALL,"executeable 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
...@@ -224,6 +240,8 @@ uninstall: uninstall-headers ...@@ -224,6 +240,8 @@ uninstall: uninstall-headers
$(QUIET)rm -f ${DESTDIR}${DESKTOPPREFIX}/${PROJECT}.desktop $(QUIET)rm -f ${DESTDIR}${DESKTOPPREFIX}/${PROJECT}.desktop
$(call colorecho,UNINSTALL,"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
$(call colorecho,UNINSTALL,"AppData file")
$(QUIET)rm -f $(DESTDIR)$(APPDATAPREFIX)/$(PROJECT).appdata.xml
$(MAKE) -C po uninstall $(MAKE) -C po uninstall
-include $(wildcard .depend/*.dep) -include $(wildcard .depend/*.dep)
......
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
#include "page-widget.h" #include "page-widget.h"
#include "page.h" #include "page.h"
#include "adjustment.h" #include "adjustment.h"
#include "synctex.h"
#include "dbus-interface.h"
gboolean gboolean
cb_destroy(GtkWidget* UNUSED(widget), zathura_t* zathura) cb_destroy(GtkWidget* UNUSED(widget), zathura_t* zathura)
...@@ -49,7 +51,7 @@ cb_buffer_changed(girara_session_t* session) ...@@ -49,7 +51,7 @@ cb_buffer_changed(girara_session_t* session)
} }
} }
static void void
update_visible_pages(zathura_t* zathura) update_visible_pages(zathura_t* zathura)
{ {
const unsigned int number_of_pages = zathura_document_get_number_of_pages(zathura->document); const unsigned int number_of_pages = zathura_document_get_number_of_pages(zathura->document);
...@@ -508,6 +510,23 @@ cb_setting_recolor_keep_hue_change(girara_session_t* session, const char* name, ...@@ -508,6 +510,23 @@ cb_setting_recolor_keep_hue_change(girara_session_t* session, const char* name,
} }
} }
void
cb_setting_recolor_keep_reverse_video_change(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(session != NULL);
g_return_if_fail(session->global.data != NULL);
g_return_if_fail(name != NULL);
zathura_t* zathura = session->global.data;
const bool bool_value = *((bool*) value);
if (zathura->sync.render_thread != NULL && zathura_renderer_recolor_reverse_video_enabled(zathura->sync.render_thread) != bool_value) {
zathura_renderer_enable_recolor_reverse_video(zathura->sync.render_thread, bool_value);
render_all(zathura);
}
}
bool bool
cb_unknown_command(girara_session_t* session, const char* input) cb_unknown_command(girara_session_t* session, const char* input)
...@@ -556,13 +575,18 @@ cb_page_widget_text_selected(ZathuraPage* page, const char* text, void* data) ...@@ -556,13 +575,18 @@ cb_page_widget_text_selected(ZathuraPage* page, const char* text, void* data)
if (selection != NULL) { if (selection != NULL) {
gtk_clipboard_set_text(gtk_clipboard_get(*selection), text, -1); gtk_clipboard_set_text(gtk_clipboard_get(*selection), text, -1);
char* stripped_text = g_strdelimit(g_strdup(text), "\n\t\r\n", ' '); bool notification = true;
char* escaped_text = g_markup_printf_escaped( girara_setting_get(zathura->ui.session, "selection-notification", &notification);
_("Copied selected text to clipboard: %s"), stripped_text);
g_free(stripped_text); if (notification == true) {
char* stripped_text = g_strdelimit(g_strdup(text), "\n\t\r\n", ' ');
char* escaped_text = g_markup_printf_escaped(
_("Copied selected text to clipboard: %s"), stripped_text);
g_free(stripped_text);
girara_notify(zathura->ui.session, GIRARA_INFO, "%s", escaped_text); girara_notify(zathura->ui.session, GIRARA_INFO, "%s", escaped_text);
g_free(escaped_text); g_free(escaped_text);
}
} }
g_free(selection); g_free(selection);
...@@ -597,3 +621,38 @@ cb_page_widget_link(ZathuraPage* page, void* data) ...@@ -597,3 +621,38 @@ cb_page_widget_link(ZathuraPage* page, void* data)
gdk_window_set_cursor(window, cursor); gdk_window_set_cursor(window, cursor);
g_object_unref(cursor); g_object_unref(cursor);
} }
void
cb_page_widget_scaled_button_release(ZathuraPage* page_widget, GdkEventButton* event,
void* data)
{
if (event->button != 1 || !(event->state & GDK_CONTROL_MASK)) {
return;
}
zathura_t* zathura = data;
bool synctex = false;
girara_setting_get(zathura->ui.session, "synctex", &synctex);
if (synctex == false) {
return;
}
zathura_page_t* page = zathura_page_widget_get_page(page_widget);
if (zathura->dbus != NULL) {
zathura_dbus_edit(zathura->dbus, zathura_page_get_index(page), event->x, event->y);
}
char* editor = NULL;
girara_setting_get(zathura->ui.session, "synctex-editor-command", &editor);
if (editor == NULL || *editor == '\0') {
g_free(editor);
return;
}
synctex_edit(editor, page, event->x, event->y);
g_free(editor);
}
...@@ -176,6 +176,17 @@ void cb_setting_recolor_change(girara_session_t* session, const char* name, ...@@ -176,6 +176,17 @@ void cb_setting_recolor_change(girara_session_t* session, const char* name,
void cb_setting_recolor_keep_hue_change(girara_session_t* session, const char* name, void cb_setting_recolor_keep_hue_change(girara_session_t* session, const char* name,
girara_setting_type_t type, void* value, void* data); girara_setting_type_t type, void* value, void* data);
/**
* Emitted when the 'recolor-reverse-video' setting is changed
*
* @param session Girara session
* @param name Name of the setting ("recolor")
* @param type Type of the setting (BOOLEAN)
* @param value New value
* @param data Custom data
*/
void cb_setting_recolor_keep_reverse_video_change(girara_session_t* session,
const char* name, girara_setting_type_t type, void* value, void* data);
/** /**
* Unknown command handler which is used to handle the strict numeric goto * Unknown command handler which is used to handle the strict numeric goto
...@@ -200,8 +211,14 @@ void cb_page_widget_text_selected(ZathuraPage* page, const char* text, ...@@ -200,8 +211,14 @@ 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_scaled_button_release(ZathuraPage* page,
GdkEventButton* event, void* data);
void void
cb_page_widget_link(ZathuraPage* page, void* data); cb_page_widget_link(ZathuraPage* page, void* data);
void
update_visible_pages(zathura_t* zathura);
#endif // CALLBACKS_H #endif // CALLBACKS_H
...@@ -10,6 +10,7 @@ COLOR_NORMAL = `$(TPUT) sgr0` ...@@ -10,6 +10,7 @@ COLOR_NORMAL = `$(TPUT) sgr0`
COLOR_ACTION = `$(TPUT) bold``$(TPUT) setaf 3` COLOR_ACTION = `$(TPUT) bold``$(TPUT) setaf 3`
COLOR_COMMENT = `$(TPUT) bold``$(TPUT) setaf 2` COLOR_COMMENT = `$(TPUT) bold``$(TPUT) setaf 2`
COLOR_BRACKET = `$(TPUT) setaf 4` COLOR_BRACKET = `$(TPUT) setaf 4`
CC += -fdiagnostics-color=always
define colorecho define colorecho
@echo $(COLOR_BRACKET)" ["$(COLOR_ACTION)$1$(COLOR_BRACKET)"] "$(COLOR_COMMENT)$2$(COLOR_BRACKET) $(COLOR_NORMAL) @echo $(COLOR_BRACKET)" ["$(COLOR_ACTION)$1$(COLOR_BRACKET)"] "$(COLOR_COMMENT)$2$(COLOR_BRACKET) $(COLOR_NORMAL)
endef endef
......
...@@ -523,10 +523,16 @@ cmd_exec(girara_session_t* session, girara_list_t* argument_list) ...@@ -523,10 +523,16 @@ 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 = girara_replace_substring(value, "$FILE", path); char* r = girara_replace_substring(value, "$FILE", path);
if (r != NULL) {
girara_list_iterator_set(iter, r); if (r != NULL) {
} char* s = girara_replace_substring(r, "%", path);
g_free(r);
if (s != NULL) {
girara_list_iterator_set(iter, s);
}
}
GIRARA_LIST_FOREACH_END(argument_list, char*, iter, value); GIRARA_LIST_FOREACH_END(argument_list, char*, iter, value);
} }
......
...@@ -31,10 +31,12 @@ cb_jumplist_change(girara_session_t* session, const char* name, ...@@ -31,10 +31,12 @@ 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 (*(int *)value < 0) { const int* ivalue = value;
if (*ivalue < 0) {
zathura->jumplist.max_size = 0; zathura->jumplist.max_size = 0;
} else { } else {
zathura->jumplist.max_size = *(int *)value; zathura->jumplist.max_size = *ivalue;
} }
if (zathura->jumplist.list != NULL && zathura->jumplist.size != 0) { if (zathura->jumplist.list != NULL && zathura->jumplist.size != 0) {
...@@ -184,6 +186,8 @@ config_load_default(zathura_t* zathura) ...@@ -184,6 +186,8 @@ config_load_default(zathura_t* zathura)
bool_value = false; bool_value = false;
girara_setting_add(gsession, "recolor-keephue", &bool_value, BOOLEAN, false, _("When recoloring keep original hue and adjust lightness only"), cb_setting_recolor_keep_hue_change, NULL); girara_setting_add(gsession, "recolor-keephue", &bool_value, BOOLEAN, false, _("When recoloring keep original hue and adjust lightness only"), cb_setting_recolor_keep_hue_change, NULL);
bool_value = false; bool_value = false;
girara_setting_add(gsession, "recolor-reverse-video", &bool_value, BOOLEAN, false, _("When recoloring keep original image colors"), cb_setting_recolor_keep_reverse_video_change, NULL);
bool_value = false;
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);
...@@ -221,12 +225,16 @@ config_load_default(zathura_t* zathura) ...@@ -221,12 +225,16 @@ config_load_default(zathura_t* zathura)
girara_setting_add(gsession, "window-title-page", &bool_value, BOOLEAN, false, _("Display the page number in the window title"), NULL, NULL); girara_setting_add(gsession, "window-title-page", &bool_value, BOOLEAN, false, _("Display the page number in the window title"), NULL, NULL);
bool_value = false; bool_value = false;
girara_setting_add(gsession, "statusbar-basename", &bool_value, BOOLEAN, false, _("Use basename of the file in the statusbar"), NULL, NULL); girara_setting_add(gsession, "statusbar-basename", &bool_value, BOOLEAN, false, _("Use basename of the file in the statusbar"), NULL, NULL);
bool_value = false; bool_value = true;
girara_setting_add(gsession, "synctex", &bool_value, BOOLEAN, false, _("Enable synctex support"), NULL, NULL); girara_setting_add(gsession, "synctex", &bool_value, BOOLEAN, false, _("Enable synctex support"), NULL, NULL);
string_value = "";
girara_setting_add(gsession, "synctex-editor-command", string_value, STRING, false, _("Synctex editor command"), NULL, NULL);
bool_value = true; bool_value = true;
girara_setting_add(gsession, "dbus-service", &bool_value, BOOLEAN, false, _("Enable D-Bus service"), NULL, NULL); girara_setting_add(gsession, "dbus-service", &bool_value, BOOLEAN, false, _("Enable D-Bus service"), NULL, NULL);
string_value = "primary"; 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); girara_setting_add(gsession, "selection-clipboard", string_value, STRING, false, _("The clipboard into which mouse-selected data will be written"), NULL, NULL);
bool_value = true;
girara_setting_add(gsession, "selection-notification", &bool_value, BOOLEAN, false, _("Enable notification after selecting text"), NULL, NULL);
#define DEFAULT_SHORTCUTS(mode) \ #define DEFAULT_SHORTCUTS(mode) \
girara_shortcut_add(gsession, 0, GDK_KEY_a, NULL, sc_adjust_window, (mode), ZATHURA_ADJUST_BESTFIT, NULL); \ girara_shortcut_add(gsession, 0, GDK_KEY_a, NULL, sc_adjust_window, (mode), ZATHURA_ADJUST_BESTFIT, NULL); \
...@@ -315,16 +323,18 @@ config_load_default(zathura_t* zathura) ...@@ -315,16 +323,18 @@ config_load_default(zathura_t* zathura)
girara_shortcut_add(gsession, 0, 0, "zZ", sc_zoom, (mode), ZOOM_SPECIFIC, NULL); girara_shortcut_add(gsession, 0, 0, "zZ", sc_zoom, (mode), ZOOM_SPECIFIC, NULL);
#define DEFAULT_MOUSE_EVENTS(mode) \ #define DEFAULT_MOUSE_EVENTS(mode) \
girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, (mode), GIRARA_EVENT_SCROLL_UP, UP, NULL); \ girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, (mode), GIRARA_EVENT_SCROLL_UP, UP, NULL); \
girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, (mode), GIRARA_EVENT_SCROLL_DOWN, DOWN, NULL); \ girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, (mode), GIRARA_EVENT_SCROLL_DOWN, DOWN, NULL); \
girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, (mode), GIRARA_EVENT_SCROLL_LEFT, LEFT, NULL); \ girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, (mode), GIRARA_EVENT_SCROLL_LEFT, LEFT, NULL); \
girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, (mode), GIRARA_EVENT_SCROLL_RIGHT, RIGHT, NULL); \ girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, (mode), GIRARA_EVENT_SCROLL_RIGHT, RIGHT, NULL); \
girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, (mode), GIRARA_EVENT_SCROLL_BIDIRECTIONAL, BIDIRECTIONAL, NULL); \
\ \
girara_mouse_event_add(gsession, GDK_SHIFT_MASK, 0, sc_mouse_scroll, (mode), GIRARA_EVENT_SCROLL_UP, LEFT, NULL); \ girara_mouse_event_add(gsession, GDK_SHIFT_MASK, 0, sc_mouse_scroll, (mode), GIRARA_EVENT_SCROLL_UP, LEFT, NULL); \
girara_mouse_event_add(gsession, GDK_SHIFT_MASK, 0, sc_mouse_scroll, (mode), GIRARA_EVENT_SCROLL_DOWN, RIGHT, NULL); \ girara_mouse_event_add(gsession, GDK_SHIFT_MASK, 0, sc_mouse_scroll, (mode), GIRARA_EVENT_SCROLL_DOWN, RIGHT, NULL); \
\ \
girara_mouse_event_add(gsession, GDK_CONTROL_MASK, 0, sc_mouse_zoom, (mode), GIRARA_EVENT_SCROLL_UP, UP, NULL); \ girara_mouse_event_add(gsession, GDK_CONTROL_MASK, 0, sc_mouse_zoom, (mode), GIRARA_EVENT_SCROLL_UP, UP, NULL); \
girara_mouse_event_add(gsession, GDK_CONTROL_MASK, 0, sc_mouse_zoom, (mode), GIRARA_EVENT_SCROLL_DOWN, DOWN, NULL); \ girara_mouse_event_add(gsession, GDK_CONTROL_MASK, 0, sc_mouse_zoom, (mode), GIRARA_EVENT_SCROLL_DOWN, DOWN, NULL); \
girara_mouse_event_add(gsession, GDK_CONTROL_MASK, 0, sc_mouse_zoom, (mode), GIRARA_EVENT_SCROLL_BIDIRECTIONAL, BIDIRECTIONAL, NULL); \
girara_mouse_event_add(gsession, 0, GIRARA_MOUSE_BUTTON2, sc_mouse_scroll, (mode), GIRARA_EVENT_BUTTON_PRESS, 0, NULL); \ girara_mouse_event_add(gsession, 0, GIRARA_MOUSE_BUTTON2, sc_mouse_scroll, (mode), GIRARA_EVENT_BUTTON_PRESS, 0, NULL); \
girara_mouse_event_add(gsession, GDK_BUTTON2_MASK, GIRARA_MOUSE_BUTTON2, sc_mouse_scroll, (mode), GIRARA_EVENT_BUTTON_RELEASE, 0, NULL); \ girara_mouse_event_add(gsession, GDK_BUTTON2_MASK, GIRARA_MOUSE_BUTTON2, sc_mouse_scroll, (mode), GIRARA_EVENT_BUTTON_RELEASE, 0, NULL); \
girara_mouse_event_add(gsession, GDK_BUTTON2_MASK, 0, sc_mouse_scroll, (mode), GIRARA_EVENT_MOTION_NOTIFY, 0, NULL); \ girara_mouse_event_add(gsession, GDK_BUTTON2_MASK, 0, sc_mouse_scroll, (mode), GIRARA_EVENT_MOTION_NOTIFY, 0, NULL); \
...@@ -416,6 +426,7 @@ config_load_default(zathura_t* zathura) ...@@ -416,6 +426,7 @@ config_load_default(zathura_t* zathura)
girara_inputbar_command_add(gsession, "close", NULL, cmd_close, NULL, _("Close current file")); girara_inputbar_command_add(gsession, "close", NULL, cmd_close, NULL, _("Close current file"));
girara_inputbar_command_add(gsession, "info", NULL, cmd_info, NULL, _("Show file information")); girara_inputbar_command_add(gsession, "info", NULL, cmd_info, NULL, _("Show file information"));
girara_inputbar_command_add(gsession, "exec", NULL, cmd_exec, NULL, _("Execute a command")); girara_inputbar_command_add(gsession, "exec", NULL, cmd_exec, NULL, _("Execute a command"));
girara_inputbar_command_add(gsession, "!", NULL, cmd_exec, NULL, _("Execute a command")); /* like vim */
girara_inputbar_command_add(gsession, "help", NULL, cmd_help, NULL, _("Show help")); girara_inputbar_command_add(gsession, "help", NULL, cmd_help, NULL, _("Show help"));
girara_inputbar_command_add(gsession, "open", "o", cmd_open, cc_open, _("Open document")); girara_inputbar_command_add(gsession, "open", "o", cmd_open, cc_open, _("Open document"));
girara_inputbar_command_add(gsession, "quit", "q", cmd_quit, NULL, _("Close zathura")); girara_inputbar_command_add(gsession, "quit", "q", cmd_quit, NULL, _("Close zathura"));
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
PROJECT = zathura PROJECT = zathura
ZATHURA_VERSION_MAJOR = 0 ZATHURA_VERSION_MAJOR = 0
ZATHURA_VERSION_MINOR = 2 ZATHURA_VERSION_MINOR = 3
ZATHURA_VERSION_REV = 9 ZATHURA_VERSION_REV = 0
# 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,7 +18,7 @@ VERSION = ${ZATHURA_VERSION_MAJOR}.${ZATHURA_VERSION_MINOR}.${ZATHURA_VERSION_RE ...@@ -18,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.2.2 GIRARA_MIN_VERSION = 0.2.3
GIRARA_PKG_CONFIG_NAME = girara-gtk3 GIRARA_PKG_CONFIG_NAME = girara-gtk3
# glib # glib
GLIB_VERSION_CHECK ?= 1 GLIB_VERSION_CHECK ?= 1
...@@ -33,6 +33,10 @@ GTK_PKG_CONFIG_NAME = gtk+-3.0 ...@@ -33,6 +33,10 @@ GTK_PKG_CONFIG_NAME = gtk+-3.0
# To disable support for the sqlite backend set WITH_SQLITE to 0. # To disable support for the sqlite backend set WITH_SQLITE to 0.
WITH_SQLITE ?= $(shell (pkg-config --atleast-version=3.5.9 sqlite3 && echo 1) || echo 0) WITH_SQLITE ?= $(shell (pkg-config --atleast-version=3.5.9 sqlite3 && echo 1) || echo 0)
# synctex
# To use the embedded copy of the syntex parser set WITH_SYSTEM_SYNCTEX to 0.
WITH_SYSTEM_SYNCTEX ?= $(shell (pkg-config synctex && echo 1) || echo 0)
# mimetype detection # mimetype detection
# To disable support for mimetype detction with libmagic set WITH_MAGIC to 0. # To disable support for mimetype detction with libmagic set WITH_MAGIC to 0.
WITH_MAGIC ?= 1 WITH_MAGIC ?= 1
...@@ -41,6 +45,7 @@ WITH_MAGIC ?= 1 ...@@ -41,6 +45,7 @@ WITH_MAGIC ?= 1
PREFIX ?= /usr PREFIX ?= /usr
MANPREFIX ?= ${PREFIX}/share/man MANPREFIX ?= ${PREFIX}/share/man
DESKTOPPREFIX ?= ${PREFIX}/share/applications DESKTOPPREFIX ?= ${PREFIX}/share/applications
APPDATAPREFIX ?= ${PREFIX}/share/appdata
LIBDIR ?= ${PREFIX}/lib LIBDIR ?= ${PREFIX}/lib
INCLUDEDIR ?= ${PREFIX}/include INCLUDEDIR ?= ${PREFIX}/include
DBUSINTERFACEDIR ?= ${PREFIX}/share/dbus-1/interfaces DBUSINTERFACEDIR ?= ${PREFIX}/share/dbus-1/interfaces
...@@ -77,11 +82,16 @@ MAGIC_INC ?= ...@@ -77,11 +82,16 @@ MAGIC_INC ?=
MAGIC_LIB ?= -lmagic MAGIC_LIB ?= -lmagic
endif endif
ifneq ($(WITH_SYSTEM_SYNCTEX),0)
SYNCTEX_INC ?= $(shell pkg-config --cflags synctex)
SYNCTEX_LIB ?= $(shell pkg-config --libs synctex)
else
ZLIB_INC ?= $(shell pkg-config --cflags zlib) ZLIB_INC ?= $(shell pkg-config --cflags zlib)
ZLIB_LIB ?= $(shell pkg-config --libs zlib) ZLIB_LIB ?= $(shell pkg-config --libs zlib)
endif
INCS = ${GIRARA_INC} ${GTK_INC} ${GTHREAD_INC} ${GMODULE_INC} ${GLIB_INC} $(ZLIB_INC) INCS = ${GIRARA_INC} ${GTK_INC} ${GTHREAD_INC} ${GMODULE_INC} ${GLIB_INC}
LIBS = ${GIRARA_LIB} ${GTK_LIB} ${GTHREAD_LIB} ${GMODULE_LIB} ${GLIB_LIB} $(ZLIB_LIB) -lpthread -lm LIBS = ${GIRARA_LIB} ${GTK_LIB} ${GTHREAD_LIB} ${GMODULE_LIB} ${GLIB_LIB} -lpthread -lm
# flags # flags
CFLAGS += -std=c99 -pedantic -Wall -Wno-format-zero-length -Wextra $(INCS) CFLAGS += -std=c99 -pedantic -Wall -Wno-format-zero-length -Wextra $(INCS)
......
/* See LICENSE file for license and copyright information */ /* See LICENSE file for license and copyright information */
#define _BSD_SOURCE #define _DEFAULT_SOURCE
#define _XOPEN_SOURCE 700 #define _XOPEN_SOURCE 700
#include "content-type.h" #include "content-type.h"
......
...@@ -3,6 +3,13 @@ ...@@ -3,6 +3,13 @@
#ifndef ZATHURA_CONTENT_TYPE_H #ifndef ZATHURA_CONTENT_TYPE_H
#define ZATHURA_CONTENT_TYPE_H #define ZATHURA_CONTENT_TYPE_H
/**
* "Guess" the content type of a file. Various methods are tried depending on
* the available libraries.
*
* @param path file name
* @return content type of path
*/
const char* guess_content_type(const char* path); const char* guess_content_type(const char* path);
#endif #endif
...@@ -28,5 +28,11 @@ ...@@ -28,5 +28,11 @@
<property type='s' name='filename' access='read' /> <property type='s' name='filename' access='read' />
<property type='u' name='pagenumber' access='read' /> <property type='u' name='pagenumber' access='read' />
<property type='u' name='numberofpages' access='read' /> <property type='u' name='numberofpages' access='read' />
<!-- Open editor with given input file at line and column. -->
<signal name='Edit'>
<arg type='s' name='input' direction='out' />
<arg type='u' name='line' direction='out' />
<arg type='u' name='column' direction='out' />
</signal>
</interface> </interface>
</node> </node>
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2014 pwmt.org -->
<application>
<id type="desktop">zathura.desktop</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>Zlib</project_license>
<description>
<p>
zathura is a highly customizable and functional document viewer. It
provides a minimalistic and space saving interface as well as an easy
usage that mainly focuses on keyboard interaction. zathura makes it
possible to completely view and navigate through documents without using a
mouse.
</p>
<p>
Other features include:
<ul>
<li>SyncTeX forward and backward synchronization support.</li>
<li>Quickmarks and bookmarks.</li>
<li>Automatic document reloading.</li>
</ul>
</p>
</description>
<url type="homepage">http://pwmt.org/projects/zathura</url>
<screenshots>
<screenshot type="default">http://pwmt.org/projects/zathura/img/zathura-cover.png</screenshot>
<screenshot>http://pwmt.org/projects/zathura/img/zathura-completion.png</screenshot>
<screenshot>http://pwmt.org/projects/zathura/img/zathura-follow.png</screenshot>
<screenshot>http://pwmt.org/projects/zathura/img/zathura-bookmarks.png</screenshot>
</screenshots>
<updatecontact>zathura@lists.pwmt.org</updatecontact>
</application>
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <string.h> #include <string.h>
#include "database-sqlite.h" #include "database-sqlite.h"
#include "utils.h"
static void zathura_database_interface_init(ZathuraDatabaseInterface* iface); static void zathura_database_interface_init(ZathuraDatabaseInterface* iface);
static void io_interface_init(GiraraInputHistoryIOInterface* iface); static void io_interface_init(GiraraInputHistoryIOInterface* iface);
...@@ -126,6 +127,7 @@ sqlite_db_init(ZathuraSQLDatabase* db, const char* path) ...@@ -126,6 +127,7 @@ sqlite_db_init(ZathuraSQLDatabase* db, const char* path)
"vadj_ratio FLOAT," "vadj_ratio FLOAT,"
"PRIMARY KEY(file, id));"; "PRIMARY KEY(file, id));";
/* ceate jumplist table */
static const char SQL_JUMPLIST_INIT[] = static const char SQL_JUMPLIST_INIT[] =
"CREATE TABLE IF NOT EXISTS jumplist (" "CREATE TABLE IF NOT EXISTS jumplist ("
"id INTEGER PRIMARY KEY AUTOINCREMENT," "id INTEGER PRIMARY KEY AUTOINCREMENT,"
...@@ -156,6 +158,13 @@ sqlite_db_init(ZathuraSQLDatabase* db, const char* path) ...@@ -156,6 +158,13 @@ sqlite_db_init(ZathuraSQLDatabase* db, const char* path)
"line TEXT," "line TEXT,"
"PRIMARY KEY(line));"; "PRIMARY KEY(line));";
static const char* ALL_INIT[] = {
SQL_BOOKMARK_INIT,
SQL_JUMPLIST_INIT,
SQL_FILEINFO_INIT,
SQL_HISTORY_INIT
};
/* update fileinfo table (part 1) */ /* update fileinfo table (part 1) */
static const char SQL_FILEINFO_ALTER[] = static const char SQL_FILEINFO_ALTER[] =
"ALTER TABLE fileinfo ADD COLUMN pages_per_row INTEGER;" "ALTER TABLE fileinfo ADD COLUMN pages_per_row INTEGER;"
...@@ -178,28 +187,12 @@ sqlite_db_init(ZathuraSQLDatabase* db, const char* path) ...@@ -178,28 +187,12 @@ sqlite_db_init(ZathuraSQLDatabase* db, const char* path)
} }
/* create tables if they don't exist */ /* create tables if they don't exist */
if (sqlite3_exec(session, SQL_BOOKMARK_INIT, NULL, 0, NULL) != SQLITE_OK) { for (size_t s = 0; s < LENGTH(ALL_INIT); ++s) {
girara_error("Failed to initialize database: %s\n", path); if (sqlite3_exec(session, ALL_INIT[s], NULL, 0, NULL) != SQLITE_OK) {
sqlite3_close(session); girara_error("Failed to initialize database: %s\n", path);
return; sqlite3_close(session);
} return;
}
if (sqlite3_exec(session, SQL_JUMPLIST_INIT, NULL, 0, NULL) != SQLITE_OK) {
girara_error("Failed to initialize database: %s\n", path);
sqlite3_close(session);
return;
}
if (sqlite3_exec(session, SQL_FILEINFO_INIT, NULL, 0, NULL) != SQLITE_OK) {
girara_error("Failed to initialize database: %s\n", path);
sqlite3_close(session);
return;
}
if (sqlite3_exec(session, SQL_HISTORY_INIT, NULL, 0, NULL) != SQLITE_OK) {
girara_error("Failed to initialize database: %s\n", path);
sqlite3_close(session);
return;
} }
/* check existing tables for missing columns */ /* check existing tables for missing columns */
...@@ -388,7 +381,7 @@ sqlite_load_bookmarks(zathura_database_t* db, const char* file) ...@@ -388,7 +381,7 @@ sqlite_load_bookmarks(zathura_database_t* db, const char* file)
girara_list_t* result = girara_sorted_list_new2((girara_compare_function_t) zathura_bookmarks_compare, girara_list_t* result = girara_sorted_list_new2((girara_compare_function_t) zathura_bookmarks_compare,
(girara_free_function_t) zathura_bookmark_free); (girara_free_function_t) zathura_bookmark_free);
if (result != NULL) { if (result == NULL) {
sqlite3_finalize(stmt); sqlite3_finalize(stmt);
return NULL; return NULL;
} }
...@@ -403,11 +396,8 @@ sqlite_load_bookmarks(zathura_database_t* db, const char* file) ...@@ -403,11 +396,8 @@ sqlite_load_bookmarks(zathura_database_t* db, const char* file)
bookmark->page = sqlite3_column_int(stmt, 1); bookmark->page = sqlite3_column_int(stmt, 1);
bookmark->x = sqlite3_column_double(stmt, 2); bookmark->x = sqlite3_column_double(stmt, 2);
bookmark->y = sqlite3_column_double(stmt, 3); bookmark->y = sqlite3_column_double(stmt, 3);
bookmark->x = bookmark->x <= 0.0 ? DBL_MIN : bookmark->x;
if (bookmark->page > 1) { bookmark->y = bookmark->y <= 0.0 ? DBL_MIN : bookmark->y;
bookmark->x = bookmark->x == 0.0 ? DBL_MIN : bookmark->x;
bookmark->y = bookmark->y == 0.0 ? DBL_MIN : bookmark->y;
}
girara_list_append(result, bookmark); girara_list_append(result, bookmark);