mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-28 06:26:01 +01:00
Merge branch 'develop' into feature/presentation-mode
Conflicts: config.c
This commit is contained in:
commit
5bdbebab7d
47 changed files with 957 additions and 681 deletions
2
LICENSE
2
LICENSE
|
@ -1,4 +1,4 @@
|
|||
Copyright (c) 2009-2013 pwmt.org
|
||||
Copyright (c) 2009-2014 pwmt.org
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
15
Makefile
15
Makefile
|
@ -43,7 +43,7 @@ DOBJECTS = $(patsubst %.c, %.do, $(SOURCE))
|
|||
all: options ${PROJECT} po build-manpages
|
||||
|
||||
# pkg-config based version checks
|
||||
.version-checks/%:
|
||||
.version-checks/%: config.mk
|
||||
$(QUIET)test $($(*)_VERSION_CHECK) -eq 0 || \
|
||||
pkg-config --atleast-version $($(*)_MIN_VERSION) $($(*)_PKG_CONFIG_NAME) || ( \
|
||||
echo "The minium required version of $(*) is $($(*)_MIN_VERSION)" && \
|
||||
|
@ -129,6 +129,7 @@ dist: clean build-manpages
|
|||
${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
|
||||
|
@ -184,7 +185,17 @@ install-headers: ${PROJECT}.pc
|
|||
$(QUIET)mkdir -m 755 -p ${DESTDIR}${LIBDIR}/pkgconfig
|
||||
$(QUIET)install -m 644 ${PROJECT}.pc ${DESTDIR}${LIBDIR}/pkgconfig
|
||||
|
||||
install: all install-headers install-manpages
|
||||
install-dbus:
|
||||
$(ECHO) installing D-Bus interface definitions
|
||||
$(QUIET)mkdir -m 755 -p $(DESTDIR)$(DBUSINTERFACEDIR)
|
||||
$(QUIET)install -m 644 data/org.pwmt.zathura.synctex.xml $(DESTDIR)$(DBUSINTERFACEDIR)
|
||||
|
||||
install-vimftplugin:
|
||||
$(ECHO) installing Vim filetype plugin
|
||||
$(QUIET)mkdir -m 755 -p $(DESTDIR)$(VIMFTPLUGINDIR)
|
||||
$(QUIET)install -m 644 data/tex_zathurasynctex.vim $(DESTDIR)$(VIMFTPLUGINDIR)
|
||||
|
||||
install: all install-headers install-manpages install-dbus
|
||||
$(ECHO) installing executable file
|
||||
$(QUIET)mkdir -m 755 -p ${DESTDIR}${PREFIX}/bin
|
||||
$(QUIET)install -m 755 ${PROJECT} ${DESTDIR}${PREFIX}/bin
|
||||
|
|
4
README
4
README
|
@ -5,9 +5,9 @@ girara user interface library and several document libraries.
|
|||
|
||||
Requirements
|
||||
------------
|
||||
gtk2 (>= 2.18) or gtk3
|
||||
gtk3
|
||||
glib (>= 2.28)
|
||||
girara
|
||||
girara (>= 0.1.8)
|
||||
sqlite3 (optional, >= 3.5.9)
|
||||
check (for tests)
|
||||
intltool
|
||||
|
|
53
config.c
53
config.c
|
@ -15,9 +15,12 @@
|
|||
#include <girara/shortcuts.h>
|
||||
#include <girara/config.h>
|
||||
#include <girara/commands.h>
|
||||
#include <girara/gtk2-compat.h>
|
||||
#include <girara/utils.h>
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
#define GLOBAL_RC "/etc/zathurarc"
|
||||
#define ZATHURA_RC "zathurarc"
|
||||
|
||||
static void
|
||||
cb_jumplist_change(girara_session_t* session, const char* name,
|
||||
girara_setting_type_t UNUSED(type), void* value, void* UNUSED(data))
|
||||
|
@ -51,11 +54,11 @@ cb_color_change(girara_session_t* session, const char* name,
|
|||
g_return_if_fail(name != NULL);
|
||||
zathura_t* zathura = session->global.data;
|
||||
|
||||
char* string_value = (char*) value;
|
||||
const char* string_value = (const char*) value;
|
||||
if (g_strcmp0(name, "highlight-color") == 0) {
|
||||
gdk_color_parse(string_value, &(zathura->ui.colors.highlight_color));
|
||||
gdk_rgba_parse(&(zathura->ui.colors.highlight_color), string_value);
|
||||
} else if (g_strcmp0(name, "highlight-active-color") == 0) {
|
||||
gdk_color_parse(string_value, &(zathura->ui.colors.highlight_color_active));
|
||||
gdk_rgba_parse(&(zathura->ui.colors.highlight_color_active), string_value);
|
||||
} else if (g_strcmp0(name, "recolor-darkcolor") == 0) {
|
||||
if (zathura->sync.render_thread != NULL) {
|
||||
zathura_renderer_set_recolor_colors_str(zathura->sync.render_thread, NULL, string_value);
|
||||
|
@ -65,9 +68,9 @@ cb_color_change(girara_session_t* session, const char* name,
|
|||
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));
|
||||
gdk_rgba_parse(&(zathura->ui.colors.render_loading_bg), string_value);
|
||||
} else if (g_strcmp0(name, "render-loading-fg") == 0) {
|
||||
gdk_color_parse(string_value, &(zathura->ui.colors.render_loading_fg));
|
||||
gdk_rgba_parse(&(zathura->ui.colors.render_loading_fg), string_value);
|
||||
}
|
||||
|
||||
render_all(zathura);
|
||||
|
@ -110,7 +113,6 @@ config_load_default(zathura_t* zathura)
|
|||
int int_value = 0;
|
||||
float float_value = 0;
|
||||
bool bool_value = false;
|
||||
bool inc_search = true;
|
||||
char* string_value = NULL;
|
||||
girara_session_t* gsession = zathura->ui.session;
|
||||
|
||||
|
@ -197,8 +199,9 @@ config_load_default(zathura_t* zathura)
|
|||
girara_setting_add(gsession, "open-first-page", &bool_value, BOOLEAN, false, _("Always open on first page"), NULL, NULL);
|
||||
bool_value = false;
|
||||
girara_setting_add(gsession, "nohlsearch", &bool_value, BOOLEAN, false, _("Highlight search results"), cb_nohlsearch_changed, NULL);
|
||||
inc_search = false;
|
||||
girara_setting_add(gsession, "incremental-search", &inc_search, BOOLEAN, false, _("Enable incremental search"), cb_incsearch_changed, NULL);
|
||||
#define INCREMENTAL_SEARCH false
|
||||
bool_value = INCREMENTAL_SEARCH;
|
||||
girara_setting_add(gsession, "incremental-search", &bool_value, BOOLEAN, false, _("Enable incremental search"), cb_incsearch_changed, NULL);
|
||||
bool_value = true;
|
||||
girara_setting_add(gsession, "abort-clear-search", &bool_value, BOOLEAN, false, _("Clear search results on abort"), NULL, NULL);
|
||||
bool_value = false;
|
||||
|
@ -209,6 +212,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);
|
||||
bool_value = true;
|
||||
girara_setting_add(gsession, "synctex-dbus-service", &bool_value, BOOLEAN, false, _("Enable D-Bus service for synctex forward synchronization 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);
|
||||
|
||||
|
@ -255,6 +260,8 @@ config_load_default(zathura_t* zathura)
|
|||
girara_shortcut_add(gsession, 0, GDK_KEY_Left, NULL, sc_scroll, (mode), LEFT, NULL); \
|
||||
girara_shortcut_add(gsession, 0, GDK_KEY_Up, NULL, sc_scroll, (mode), UP, NULL); \
|
||||
girara_shortcut_add(gsession, 0, GDK_KEY_Down, NULL, sc_scroll, (mode), DOWN, NULL); \
|
||||
girara_shortcut_add(gsession, 0, GDK_KEY_H, NULL, sc_scroll, (mode), PAGE_TOP, NULL); \
|
||||
girara_shortcut_add(gsession, 0, GDK_KEY_L, NULL, sc_scroll, (mode), PAGE_BOTTOM, NULL); \
|
||||
girara_shortcut_add(gsession, 0, GDK_KEY_Right, NULL, sc_scroll, (mode), RIGHT, NULL); \
|
||||
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_t, NULL, sc_scroll, (mode), HALF_LEFT, NULL); \
|
||||
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_d, NULL, sc_scroll, (mode), HALF_DOWN, NULL); \
|
||||
|
@ -392,8 +399,8 @@ config_load_default(zathura_t* zathura)
|
|||
girara_inputbar_command_add(gsession, "hlsearch", NULL, cmd_hlsearch, NULL, _("Highlight current search results"));
|
||||
girara_inputbar_command_add(gsession, "version", NULL, cmd_version, NULL, _("Show version information"));
|
||||
|
||||
girara_special_command_add(gsession, '/', cmd_search, inc_search, FORWARD, NULL);
|
||||
girara_special_command_add(gsession, '?', cmd_search, inc_search, BACKWARD, NULL);
|
||||
girara_special_command_add(gsession, '/', cmd_search, INCREMENTAL_SEARCH, FORWARD, NULL);
|
||||
girara_special_command_add(gsession, '?', cmd_search, INCREMENTAL_SEARCH, BACKWARD, NULL);
|
||||
|
||||
/* add shortcut mappings */
|
||||
girara_shortcut_mapping_add(gsession, "abort", sc_abort);
|
||||
|
@ -444,6 +451,8 @@ config_load_default(zathura_t* zathura)
|
|||
girara_argument_mapping_add(gsession, "left", LEFT);
|
||||
girara_argument_mapping_add(gsession, "next", NEXT);
|
||||
girara_argument_mapping_add(gsession, "out", ZOOM_OUT);
|
||||
girara_argument_mapping_add(gsession, "page-top", PAGE_TOP);
|
||||
girara_argument_mapping_add(gsession, "page-bottom", PAGE_BOTTOM);
|
||||
girara_argument_mapping_add(gsession, "previous", PREVIOUS);
|
||||
girara_argument_mapping_add(gsession, "right", RIGHT);
|
||||
girara_argument_mapping_add(gsession, "specific", ZOOM_SPECIFIC);
|
||||
|
@ -456,11 +465,25 @@ config_load_default(zathura_t* zathura)
|
|||
}
|
||||
|
||||
void
|
||||
config_load_file(zathura_t* zathura, char* path)
|
||||
config_load_files(zathura_t* zathura)
|
||||
{
|
||||
if (zathura == NULL || path == NULL) {
|
||||
return;
|
||||
/* load global configuration files */
|
||||
char* config_path = girara_get_xdg_path(XDG_CONFIG_DIRS);
|
||||
girara_list_t* config_dirs = girara_split_path_array(config_path);
|
||||
ssize_t size = girara_list_size(config_dirs) - 1;
|
||||
for (; size >= 0; --size) {
|
||||
const char* dir = girara_list_nth(config_dirs, size);
|
||||
char* file = g_build_filename(dir, ZATHURA_RC, NULL);
|
||||
girara_config_parse(zathura->ui.session, file);
|
||||
g_free(file);
|
||||
}
|
||||
girara_list_free(config_dirs);
|
||||
g_free(config_path);
|
||||
|
||||
girara_config_parse(zathura->ui.session, path);
|
||||
girara_config_parse(zathura->ui.session, GLOBAL_RC);
|
||||
|
||||
/* load local configuration files */
|
||||
char* configuration_file = g_build_filename(zathura->config.config_dir, ZATHURA_RC, NULL);
|
||||
girara_config_parse(zathura->ui.session, configuration_file);
|
||||
g_free(configuration_file);
|
||||
}
|
||||
|
|
5
config.h
5
config.h
|
@ -3,9 +3,6 @@
|
|||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
#define GLOBAL_RC "/etc/zathurarc"
|
||||
#define ZATHURA_RC "zathurarc"
|
||||
|
||||
#include "zathura.h"
|
||||
|
||||
/**
|
||||
|
@ -21,6 +18,6 @@ void config_load_default(zathura_t* zathura);
|
|||
* @param zathura The zathura session
|
||||
* @param path Path to the configuration file
|
||||
*/
|
||||
void config_load_file(zathura_t* zathura, char* path);
|
||||
void config_load_files(zathura_t* zathura);
|
||||
|
||||
#endif // CONFIG_H
|
||||
|
|
|
@ -43,6 +43,8 @@ MANPREFIX ?= ${PREFIX}/share/man
|
|||
DESKTOPPREFIX ?= ${PREFIX}/share/applications
|
||||
LIBDIR ?= ${PREFIX}/lib
|
||||
INCLUDEDIR ?= ${PREFIX}/include
|
||||
DBUSINTERFACEDIR ?= ${PREFIX}/share/dbus-1/interfaces
|
||||
VIMFTPLUGINDIR ?= ${PREFIX}/share/vim/addons/ftplugin
|
||||
|
||||
# plugin directory
|
||||
PLUGINDIR ?= ${LIBDIR}/zathura
|
||||
|
|
10
data/org.pwmt.zathura.synctex.xml
Normal file
10
data/org.pwmt.zathura.synctex.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
||||
<node>
|
||||
<interface name='org.pwmt.zathura.synctex'>
|
||||
<method name='View'>
|
||||
<arg type='s' name='position' direction='in' />
|
||||
<arg type='b' name='return' direction='out' />
|
||||
</method>
|
||||
<property type='s' name='filename' access='read' />
|
||||
</interface>
|
||||
</node>
|
52
data/tex_zathurasynctex.vim
Normal file
52
data/tex_zathurasynctex.vim
Normal file
|
@ -0,0 +1,52 @@
|
|||
" See LICENSE file for license and copyright information
|
||||
|
||||
" avoid re-execution
|
||||
if exists("b:did_zathura_synctex_plugin")
|
||||
finish
|
||||
endif
|
||||
let b:did_zathura_synctex_plugin = 1
|
||||
|
||||
" set up global variables
|
||||
if !exists("g:zathura_synctex_latex_suite")
|
||||
let g:zathura_synctex_latex_suite = 1
|
||||
endif
|
||||
|
||||
function! Zathura_SyncTexForward()
|
||||
let source = expand("%:p")
|
||||
let input = shellescape(line(".").":".col(".").":".source)
|
||||
let output = "<none>"
|
||||
if exists("*Tex_GetMainFileName") && g:zathura_synctex_latex_suite == 1
|
||||
" use Tex_GetMainFileName from latex-suite if it is available
|
||||
let output = Tex_GetMainFileName(":p:r").".pdf"
|
||||
else
|
||||
" try to find synctex files and use them to determine the output file
|
||||
let synctex_files = split(glob("%:p:h/*.synctex.gz"), "\n")
|
||||
if len(synctex_files) == 0
|
||||
echo "No synctex file found"
|
||||
return
|
||||
endif
|
||||
|
||||
let found = 0
|
||||
for synctex in synctex_files
|
||||
let pdffile = substitute(synctex, "synctex.gz", "pdf", "")
|
||||
let out = system("synctex view -i ".input." -o ".shellescape(pdffile))
|
||||
if match(out, "No tag for ".source) >= 0
|
||||
continue
|
||||
endif
|
||||
|
||||
let found = 1
|
||||
let output = pdffile
|
||||
break
|
||||
endfor
|
||||
|
||||
if found == 0
|
||||
echo "No synctex file containing reference to source file found"
|
||||
return
|
||||
endif
|
||||
endif
|
||||
|
||||
let execstr = "zathura --synctex-forward=".input." ".shellescape(output)
|
||||
silent call system(execstr)
|
||||
endfunction
|
||||
|
||||
nmap <buffer> <Leader>f :call Zathura_SyncTexForward()<Enter>
|
107
document.c
107
document.c
|
@ -35,7 +35,7 @@
|
|||
/** Read a most GT_MAX_READ bytes before falling back to file. */
|
||||
static const size_t GT_MAX_READ = 1 << 16;
|
||||
|
||||
static const gchar* guess_type(const char* path);
|
||||
static const char* guess_type(const char* path);
|
||||
|
||||
/**
|
||||
* Document
|
||||
|
@ -86,7 +86,7 @@ zathura_document_open(zathura_plugin_manager_t* plugin_manager, const char*
|
|||
return NULL;
|
||||
}
|
||||
|
||||
const gchar* content_type = guess_type(path);
|
||||
const char* content_type = guess_type(path);
|
||||
if (content_type == NULL) {
|
||||
girara_error("Could not determine file type.");
|
||||
return NULL;
|
||||
|
@ -665,11 +665,9 @@ zathura_document_get_information(zathura_document_t* document, zathura_error_t*
|
|||
return result;
|
||||
}
|
||||
|
||||
static const gchar*
|
||||
guess_type(const char* path)
|
||||
{
|
||||
const gchar* content_type = NULL;
|
||||
#ifdef WITH_MAGIC
|
||||
static const char*
|
||||
guess_type_magic(const char* path) {
|
||||
const char* mime_type = NULL;
|
||||
|
||||
/* creat magic cookie */
|
||||
|
@ -698,22 +696,66 @@ guess_type(const char* path)
|
|||
girara_debug("failed guessing filetype: %s", magic_error(magic));
|
||||
goto cleanup;
|
||||
}
|
||||
/* dup so we own the memory */
|
||||
mime_type = g_strdup(mime_type);
|
||||
|
||||
girara_debug("magic detected filetype: %s", mime_type);
|
||||
content_type = g_strdup(mime_type);
|
||||
|
||||
cleanup:
|
||||
if (magic != NULL) {
|
||||
magic_close(magic);
|
||||
}
|
||||
|
||||
if (content_type != NULL) {
|
||||
return content_type;
|
||||
return mime_type;
|
||||
}
|
||||
|
||||
static const char*
|
||||
guess_type_file(const char* UNUSED(path))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
#else
|
||||
static const char*
|
||||
guess_type_magic(const char* UNUSED(path)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char*
|
||||
guess_type_file(const char* path)
|
||||
{
|
||||
GString* command = g_string_new("file -b --mime-type ");
|
||||
char* tmp = g_shell_quote(path);
|
||||
|
||||
g_string_append(command, tmp);
|
||||
g_free(tmp);
|
||||
|
||||
GError* error = NULL;
|
||||
char* out = NULL;
|
||||
int ret = 0;
|
||||
g_spawn_command_line_sync(command->str, &out, NULL, &ret, &error);
|
||||
g_string_free(command, TRUE);
|
||||
if (error != NULL) {
|
||||
girara_warning("failed to execute command: %s", error->message);
|
||||
g_error_free(error);
|
||||
g_free(out);
|
||||
return NULL;
|
||||
}
|
||||
/* else fallback to g_content_type_guess method */
|
||||
#endif /*WITH_MAGIC*/
|
||||
if (WEXITSTATUS(ret) != 0) {
|
||||
girara_warning("file failed with error code: %d", WEXITSTATUS(ret));
|
||||
g_free(out);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
g_strdelimit(out, "\n\r", '\0');
|
||||
return out;
|
||||
}
|
||||
#endif
|
||||
|
||||
static const char*
|
||||
guess_type_glib(const char* path)
|
||||
{
|
||||
gboolean uncertain = FALSE;
|
||||
content_type = g_content_type_guess(path, NULL, 0, &uncertain);
|
||||
const char* content_type = g_content_type_guess(path, NULL, 0, &uncertain);
|
||||
if (content_type == NULL) {
|
||||
girara_debug("g_content_type failed\n");
|
||||
} else {
|
||||
|
@ -755,35 +797,24 @@ cleanup:
|
|||
}
|
||||
|
||||
g_free((void*)content_type);
|
||||
content_type = NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
girara_debug("falling back to file");
|
||||
|
||||
GString* command = g_string_new("file -b --mime-type ");
|
||||
char* tmp = g_shell_quote(path);
|
||||
|
||||
g_string_append(command, tmp);
|
||||
g_free(tmp);
|
||||
|
||||
GError* error = NULL;
|
||||
char* out = NULL;
|
||||
int ret = 0;
|
||||
g_spawn_command_line_sync(command->str, &out, NULL, &ret, &error);
|
||||
g_string_free(command, TRUE);
|
||||
if (error != NULL) {
|
||||
girara_warning("failed to execute command: %s", error->message);
|
||||
g_error_free(error);
|
||||
g_free(out);
|
||||
return NULL;
|
||||
static const char*
|
||||
guess_type(const char* path)
|
||||
{
|
||||
/* try libmagic first */
|
||||
const char* content_type = guess_type_magic(path);
|
||||
if (content_type != NULL) {
|
||||
return content_type;
|
||||
}
|
||||
if (WEXITSTATUS(ret) != 0) {
|
||||
girara_warning("file failed with error code: %d", WEXITSTATUS(ret));
|
||||
g_free(out);
|
||||
return NULL;
|
||||
/* else fallback to g_content_type_guess method */
|
||||
content_type = guess_type_glib(path);
|
||||
if (content_type != NULL) {
|
||||
return content_type;
|
||||
}
|
||||
|
||||
g_strdelimit(out, "\n\r", '\0');
|
||||
return out;
|
||||
/* and if libmagic is not available, try file as last resort */
|
||||
return guess_type_file(path);
|
||||
}
|
||||
|
||||
zathura_plugin_t*
|
||||
|
|
|
@ -5,29 +5,20 @@
|
|||
|
||||
#include <glib.h>
|
||||
|
||||
/* GStaticMutex is deprecated starting with glib 2.32 */
|
||||
#if !GLIB_CHECK_VERSION(2, 31, 0)
|
||||
#define mutex GStaticMutex
|
||||
#define mutex_init(m) g_static_mutex_init((m))
|
||||
#define mutex_lock(m) g_static_mutex_lock((m))
|
||||
#define mutex_unlock(m) g_static_mutex_unlock((m))
|
||||
#define mutex_free(m) g_static_mutex_free((m))
|
||||
#else
|
||||
/* GStaticMutex is deprecated starting with glib 2.32 and got replaced with
|
||||
* GMutex */
|
||||
#if GLIB_CHECK_VERSION(2, 32, 0)
|
||||
#define mutex GMutex
|
||||
#define mutex_init(m) g_mutex_init((m))
|
||||
#define mutex_lock(m) g_mutex_lock((m))
|
||||
#define mutex_unlock(m) g_mutex_unlock((m))
|
||||
#define mutex_free(m) g_mutex_clear((m))
|
||||
#endif
|
||||
|
||||
/* g_get_real_time appeared in 2.28 */
|
||||
#if !GLIB_CHECK_VERSION(2, 27, 0)
|
||||
inline static gint64 g_get_real_time(void)
|
||||
{
|
||||
GTimeVal tv;
|
||||
g_get_current_time(&tv);
|
||||
return (((gint64) tv.tv_sec) * 1000000) + tv.tv_usec;
|
||||
}
|
||||
#else
|
||||
#define mutex GStaticMutex
|
||||
#define mutex_init(m) g_static_mutex_init((m))
|
||||
#define mutex_lock(m) g_static_mutex_lock((m))
|
||||
#define mutex_unlock(m) g_static_mutex_unlock((m))
|
||||
#define mutex_free(m) g_static_mutex_free((m))
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
93
main.c
93
main.c
|
@ -1,15 +1,22 @@
|
|||
/* See LICENSE file for license and copyright information */
|
||||
|
||||
#define _BSD_SOURCE
|
||||
#define _XOPEN_SOURCE 700
|
||||
|
||||
#include <errno.h>
|
||||
#include <girara/utils.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <glib/gstdio.h>
|
||||
#include <limits.h>
|
||||
#include <locale.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <glib/gstdio.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <girara/utils.h>
|
||||
#include <locale.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "zathura.h"
|
||||
#include "utils.h"
|
||||
#include "synctex-dbus.h"
|
||||
|
||||
/* main function */
|
||||
int
|
||||
|
@ -43,29 +50,26 @@ main(int argc, char* argv[])
|
|||
gchar* loglevel = NULL;
|
||||
gchar* password = NULL;
|
||||
gchar* synctex_editor = NULL;
|
||||
gchar* synctex_fwd = NULL;
|
||||
bool forkback = false;
|
||||
bool print_version = false;
|
||||
bool synctex = false;
|
||||
int page_number = ZATHURA_PAGE_NUMBER_UNSPECIFIED;
|
||||
|
||||
#if GTK_CHECK_VERSION(3, 0, 0)
|
||||
Window embed = 0;
|
||||
#else
|
||||
GdkNativeWindow embed = 0;
|
||||
#endif
|
||||
Window embed = 0;
|
||||
|
||||
GOptionEntry entries[] = {
|
||||
{ "reparent", 'e', 0, G_OPTION_ARG_INT, &embed, _("Reparents to window specified by xid"), "xid" },
|
||||
{ "config-dir", 'c', 0, G_OPTION_ARG_FILENAME, &config_dir, _("Path to the config directory"), "path" },
|
||||
{ "data-dir", 'd', 0, G_OPTION_ARG_FILENAME, &data_dir, _("Path to the data directory"), "path" },
|
||||
{ "plugins-dir", 'p', 0, G_OPTION_ARG_STRING, &plugin_path, _("Path to the directories containing plugins"), "path" },
|
||||
{ "fork", '\0',0, G_OPTION_ARG_NONE, &forkback, _("Fork into the background"), NULL },
|
||||
{ "password", 'w', 0, G_OPTION_ARG_STRING, &password, _("Document password"), "password" },
|
||||
{ "page", 'P', 0, G_OPTION_ARG_INT, &page_number, _("Page number to go to"), "number" },
|
||||
{ "debug", 'l', 0, G_OPTION_ARG_STRING, &loglevel, _("Log level (debug, info, warning, error)"), "level" },
|
||||
{ "version", 'v', 0, G_OPTION_ARG_NONE, &print_version, _("Print version information"), NULL },
|
||||
{ "synctex", 's', 0, G_OPTION_ARG_NONE, &synctex, _("Enable synctex support"), NULL },
|
||||
{ "synctex-editor-command", 'x', 0, G_OPTION_ARG_STRING, &synctex_editor, _("Synctex editor (forwarded to the synctex command)"), "cmd" },
|
||||
{ "reparent", 'e', 0, G_OPTION_ARG_INT, &embed, _("Reparents to window specified by xid"), "xid" },
|
||||
{ "config-dir", 'c', 0, G_OPTION_ARG_FILENAME, &config_dir, _("Path to the config directory"), "path" },
|
||||
{ "data-dir", 'd', 0, G_OPTION_ARG_FILENAME, &data_dir, _("Path to the data directory"), "path" },
|
||||
{ "plugins-dir", 'p', 0, G_OPTION_ARG_STRING, &plugin_path, _("Path to the directories containing plugins"), "path" },
|
||||
{ "fork", '\0', 0, G_OPTION_ARG_NONE, &forkback, _("Fork into the background"), NULL },
|
||||
{ "password", 'w', 0, G_OPTION_ARG_STRING, &password, _("Document password"), "password" },
|
||||
{ "page", 'P', 0, G_OPTION_ARG_INT, &page_number, _("Page number to go to"), "number" },
|
||||
{ "debug", 'l', 0, G_OPTION_ARG_STRING, &loglevel, _("Log level (debug, info, warning, error)"), "level" },
|
||||
{ "version", 'v', 0, G_OPTION_ARG_NONE, &print_version, _("Print version information"), NULL },
|
||||
{ "synctex", 's', 0, G_OPTION_ARG_NONE, &synctex, _("Enable synctex support"), NULL },
|
||||
{ "synctex-editor-command", 'x', 0, G_OPTION_ARG_STRING, &synctex_editor, _("Synctex editor (forwarded to the synctex command)"), "cmd" },
|
||||
{ "synctex-forward", '\0', 0, G_OPTION_ARG_STRING, &synctex_fwd, _("Move to given synctex position"), "position" },
|
||||
{ NULL, '\0', 0, 0, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
|
@ -82,18 +86,6 @@ main(int argc, char* argv[])
|
|||
}
|
||||
g_option_context_free(context);
|
||||
|
||||
/* Fork into the background if the user really wants to ... */
|
||||
if (forkback == true) {
|
||||
int pid = fork();
|
||||
if (pid > 0) { /* parent */
|
||||
exit(0);
|
||||
} else if (pid < 0) { /* error */
|
||||
girara_error("Couldn't fork.");
|
||||
}
|
||||
|
||||
setsid();
|
||||
}
|
||||
|
||||
/* Set log level. */
|
||||
if (loglevel == NULL || g_strcmp0(loglevel, "info") == 0) {
|
||||
girara_set_debug_level(GIRARA_INFO);
|
||||
|
@ -103,6 +95,41 @@ main(int argc, char* argv[])
|
|||
girara_set_debug_level(GIRARA_ERROR);
|
||||
}
|
||||
|
||||
if (synctex_fwd != NULL) {
|
||||
if (argc != 2) {
|
||||
girara_error("Too many arguments or missing filename while running with --synctex-forward");
|
||||
return -1;
|
||||
}
|
||||
|
||||
char* real_path = realpath(argv[1], NULL);
|
||||
if (real_path == NULL) {
|
||||
girara_error("Failed to determine real path: %s", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (synctex_forward_position(real_path, synctex_fwd) == true) {
|
||||
free(real_path);
|
||||
return 0;
|
||||
} else {
|
||||
girara_error("Could not find open instance for '%s'", real_path);
|
||||
free(real_path);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Fork into the background if the user really wants to ... */
|
||||
if (forkback == true) {
|
||||
const int pid = fork();
|
||||
if (pid > 0) { /* parent */
|
||||
return 0;
|
||||
} else if (pid < 0) { /* error */
|
||||
girara_error("Couldn't fork.");
|
||||
}
|
||||
|
||||
setsid();
|
||||
}
|
||||
|
||||
zathura_set_xid(zathura, embed);
|
||||
zathura_set_config_dir(zathura, config_dir);
|
||||
zathura_set_data_dir(zathura, data_dir);
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include <string.h>
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
#include "glib-compat.h"
|
||||
#include "links.h"
|
||||
#include "page-widget.h"
|
||||
#include "page.h"
|
||||
|
@ -24,7 +23,6 @@ typedef struct zathura_page_widget_private_s {
|
|||
zathura_t* zathura; /**< Zathura object */
|
||||
cairo_surface_t* surface; /**< Cairo surface */
|
||||
ZathuraRenderRequest* render_request; /* Request object */
|
||||
mutex lock; /**< Lock */
|
||||
bool cached; /**< Cached state */
|
||||
|
||||
struct {
|
||||
|
@ -61,9 +59,6 @@ typedef struct zathura_page_widget_private_s {
|
|||
zathura_page_widget_private_t))
|
||||
|
||||
static gboolean zathura_page_widget_draw(GtkWidget* widget, cairo_t* cairo);
|
||||
#if GTK_MAJOR_VERSION == 2
|
||||
static gboolean zathura_page_widget_expose(GtkWidget* widget, GdkEventExpose* event);
|
||||
#endif
|
||||
static void zathura_page_widget_finalize(GObject* object);
|
||||
static void zathura_page_widget_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec);
|
||||
static void zathura_page_widget_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec);
|
||||
|
@ -111,11 +106,7 @@ zathura_page_widget_class_init(ZathuraPageClass* class)
|
|||
|
||||
/* overwrite methods */
|
||||
GtkWidgetClass* widget_class = GTK_WIDGET_CLASS(class);
|
||||
#if GTK_MAJOR_VERSION == 2
|
||||
widget_class->expose_event = zathura_page_widget_expose;
|
||||
#else
|
||||
widget_class->draw = zathura_page_widget_draw;
|
||||
#endif
|
||||
widget_class->size_allocate = zathura_page_widget_size_allocate;
|
||||
widget_class->button_press_event = cb_zathura_page_widget_button_press_event;
|
||||
widget_class->button_release_event = cb_zathura_page_widget_button_release_event;
|
||||
|
@ -199,8 +190,6 @@ zathura_page_widget_init(ZathuraPage* widget)
|
|||
priv->mouse.selection_basepoint.x = -1;
|
||||
priv->mouse.selection_basepoint.y = -1;
|
||||
|
||||
mutex_init(&(priv->lock));
|
||||
|
||||
/* we want mouse events */
|
||||
gtk_widget_add_events(GTK_WIDGET(widget),
|
||||
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK);
|
||||
|
@ -251,8 +240,6 @@ zathura_page_widget_finalize(GObject* object)
|
|||
girara_list_free(priv->links.list);
|
||||
}
|
||||
|
||||
mutex_free(&(priv->lock));
|
||||
|
||||
G_OBJECT_CLASS(zathura_page_widget_parent_class)->finalize(object);
|
||||
}
|
||||
|
||||
|
@ -368,43 +355,14 @@ zathura_page_widget_get_property(GObject* object, guint prop_id, GValue* value,
|
|||
}
|
||||
}
|
||||
|
||||
#if GTK_MAJOR_VERSION == 2
|
||||
static gboolean
|
||||
zathura_page_widget_expose(GtkWidget* widget, GdkEventExpose* event)
|
||||
{
|
||||
cairo_t* cairo = gdk_cairo_create(gtk_widget_get_window(widget));
|
||||
if (cairo == NULL) {
|
||||
girara_error("Could not retrieve cairo object");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* set clip region */
|
||||
cairo_rectangle(cairo, event->area.x, event->area.y, event->area.width, event->area.height);
|
||||
cairo_clip(cairo);
|
||||
|
||||
const gboolean ret = zathura_page_widget_draw(widget, cairo);
|
||||
cairo_destroy(cairo);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
static gboolean
|
||||
zathura_page_widget_draw(GtkWidget* widget, cairo_t* cairo)
|
||||
{
|
||||
zathura_page_widget_private_t* priv = ZATHURA_PAGE_GET_PRIVATE(widget);
|
||||
mutex_lock(&(priv->lock));
|
||||
|
||||
zathura_document_t* document = zathura_page_get_document(priv->page);
|
||||
|
||||
#if GTK_MAJOR_VERSION == 2
|
||||
GtkAllocation allocation;
|
||||
gtk_widget_get_allocation(widget, &allocation);
|
||||
const unsigned int page_height = allocation.height;
|
||||
const unsigned int page_width = allocation.width;
|
||||
#else
|
||||
zathura_document_t* document = zathura_page_get_document(priv->page);
|
||||
const unsigned int page_height = gtk_widget_get_allocated_height(widget);
|
||||
const unsigned int page_width = gtk_widget_get_allocated_width(widget);
|
||||
#endif
|
||||
|
||||
if (priv->surface != NULL) {
|
||||
cairo_save(cairo);
|
||||
|
@ -451,8 +409,8 @@ zathura_page_widget_draw(GtkWidget* widget, cairo_t* cairo)
|
|||
zathura_rectangle_t rectangle = recalc_rectangle(priv->page, zathura_link_get_position(link));
|
||||
|
||||
/* draw position */
|
||||
GdkColor color = priv->zathura->ui.colors.highlight_color;
|
||||
cairo_set_source_rgba(cairo, color.red/65535.0, color.green/65535.0, color.blue/65535.0, transparency);
|
||||
const GdkRGBA color = priv->zathura->ui.colors.highlight_color;
|
||||
cairo_set_source_rgba(cairo, color.red, color.green, color.blue, transparency);
|
||||
cairo_rectangle(cairo, rectangle.x1, rectangle.y1,
|
||||
(rectangle.x2 - rectangle.x1), (rectangle.y2 - rectangle.y1));
|
||||
cairo_fill(cairo);
|
||||
|
@ -476,11 +434,11 @@ zathura_page_widget_draw(GtkWidget* widget, cairo_t* cairo)
|
|||
|
||||
/* draw position */
|
||||
if (idx == priv->search.current) {
|
||||
GdkColor color = priv->zathura->ui.colors.highlight_color_active;
|
||||
cairo_set_source_rgba(cairo, color.red/65535.0, color.green/65535.0, color.blue/65535.0, transparency);
|
||||
const GdkRGBA color = priv->zathura->ui.colors.highlight_color_active;
|
||||
cairo_set_source_rgba(cairo, color.red, color.green, color.blue, transparency);
|
||||
} else {
|
||||
GdkColor color = priv->zathura->ui.colors.highlight_color;
|
||||
cairo_set_source_rgba(cairo, color.red/65535.0, color.green/65535.0, color.blue/65535.0, transparency);
|
||||
const GdkRGBA color = priv->zathura->ui.colors.highlight_color;
|
||||
cairo_set_source_rgba(cairo, color.red, color.green, color.blue, transparency);
|
||||
}
|
||||
cairo_rectangle(cairo, rectangle.x1, rectangle.y1,
|
||||
(rectangle.x2 - rectangle.x1), (rectangle.y2 - rectangle.y1));
|
||||
|
@ -490,8 +448,8 @@ zathura_page_widget_draw(GtkWidget* widget, cairo_t* cairo)
|
|||
}
|
||||
/* draw selection */
|
||||
if (priv->mouse.selection.y2 != -1 && priv->mouse.selection.x2 != -1) {
|
||||
GdkColor color = priv->zathura->ui.colors.highlight_color;
|
||||
cairo_set_source_rgba(cairo, color.red/65535.0, color.green/65535.0, color.blue/65535.0, transparency);
|
||||
const GdkRGBA color = priv->zathura->ui.colors.highlight_color;
|
||||
cairo_set_source_rgba(cairo, color.red, color.green, color.blue, transparency);
|
||||
cairo_rectangle(cairo, priv->mouse.selection.x1, priv->mouse.selection.y1,
|
||||
(priv->mouse.selection.x2 - priv->mouse.selection.x1), (priv->mouse.selection.y2 - priv->mouse.selection.y1));
|
||||
cairo_fill(cairo);
|
||||
|
@ -499,12 +457,12 @@ zathura_page_widget_draw(GtkWidget* widget, cairo_t* cairo)
|
|||
} else {
|
||||
/* set background color */
|
||||
if (zathura_renderer_recolor_enabled(priv->zathura->sync.render_thread) == true) {
|
||||
GdkColor color;
|
||||
GdkRGBA color;
|
||||
zathura_renderer_get_recolor_colors(priv->zathura->sync.render_thread, &color, NULL);
|
||||
cairo_set_source_rgb(cairo, color.red/65535.0, color.green/65535.0, color.blue/65535.0);
|
||||
cairo_set_source_rgb(cairo, color.red, color.green, color.blue);
|
||||
} else {
|
||||
GdkColor color = priv->zathura->ui.colors.render_loading_bg;
|
||||
cairo_set_source_rgb(cairo, color.red/65535.0, color.green/65535.0, color.blue/65535.0);
|
||||
const GdkRGBA color = priv->zathura->ui.colors.render_loading_bg;
|
||||
cairo_set_source_rgb(cairo, color.red, color.green, color.blue);
|
||||
}
|
||||
cairo_rectangle(cairo, 0, 0, page_width, page_height);
|
||||
cairo_fill(cairo);
|
||||
|
@ -515,11 +473,11 @@ zathura_page_widget_draw(GtkWidget* widget, cairo_t* cairo)
|
|||
/* write text */
|
||||
if (render_loading == true) {
|
||||
if (zathura_renderer_recolor_enabled(priv->zathura->sync.render_thread) == true) {
|
||||
GdkColor color;
|
||||
GdkRGBA color;
|
||||
zathura_renderer_get_recolor_colors(priv->zathura->sync.render_thread, NULL, &color);
|
||||
cairo_set_source_rgb(cairo, color.red/65535.0, color.green/65535.0, color.blue/65535.0);
|
||||
cairo_set_source_rgb(cairo, color.red, color.green, color.blue);
|
||||
} else {
|
||||
GdkColor color = priv->zathura->ui.colors.render_loading_fg;
|
||||
const GdkRGBA color = priv->zathura->ui.colors.render_loading_fg;
|
||||
cairo_set_source_rgb(cairo, color.red/65535.0, color.green/65535.0, color.blue/65535.0);
|
||||
}
|
||||
|
||||
|
@ -537,7 +495,6 @@ zathura_page_widget_draw(GtkWidget* widget, cairo_t* cairo)
|
|||
/* render real page */
|
||||
zathura_render_request(priv->render_request, g_get_real_time());
|
||||
}
|
||||
mutex_unlock(&(priv->lock));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -552,7 +509,6 @@ void
|
|||
zathura_page_widget_update_surface(ZathuraPage* widget, cairo_surface_t* surface)
|
||||
{
|
||||
zathura_page_widget_private_t* priv = ZATHURA_PAGE_GET_PRIVATE(widget);
|
||||
mutex_lock(&(priv->lock));
|
||||
if (priv->surface != NULL) {
|
||||
cairo_surface_destroy(priv->surface);
|
||||
priv->surface = NULL;
|
||||
|
@ -561,7 +517,6 @@ zathura_page_widget_update_surface(ZathuraPage* widget, cairo_surface_t* surface
|
|||
priv->surface = surface;
|
||||
cairo_surface_reference(surface);
|
||||
}
|
||||
mutex_unlock(&(priv->lock));
|
||||
/* force a redraw here */
|
||||
if (priv->surface != NULL) {
|
||||
zathura_page_widget_redraw_canvas(widget);
|
||||
|
@ -608,7 +563,10 @@ static void
|
|||
zathura_page_widget_size_allocate(GtkWidget* widget, GdkRectangle* allocation)
|
||||
{
|
||||
GTK_WIDGET_CLASS(zathura_page_widget_parent_class)->size_allocate(widget, allocation);
|
||||
zathura_page_widget_update_surface(ZATHURA_PAGE(widget), NULL);
|
||||
|
||||
ZathuraPage* page = ZATHURA_PAGE(widget);
|
||||
zathura_page_widget_abort_render_request(page);
|
||||
zathura_page_widget_update_surface(page, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -620,11 +578,7 @@ redraw_rect(ZathuraPage* widget, zathura_rectangle_t* rectangle)
|
|||
grect.y = rectangle->y1;
|
||||
grect.width = (rectangle->x2 + 1) - rectangle->x1;
|
||||
grect.height = (rectangle->y2 + 1) - rectangle->y1;
|
||||
#if GTK_MAJOR_VERSION == 2
|
||||
gdk_window_invalidate_rect(gtk_widget_get_window(GTK_WIDGET(widget)), &grect, TRUE);
|
||||
#else
|
||||
gtk_widget_queue_draw_area(GTK_WIDGET(widget), grect.x, grect.y, grect.width, grect.height);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -890,19 +844,7 @@ cb_menu_image_copy(GtkMenuItem* item, ZathuraPage* page)
|
|||
const int width = cairo_image_surface_get_width(surface);
|
||||
const int height = cairo_image_surface_get_height(surface);
|
||||
|
||||
#if GTK_MAJOR_VERSION == 2
|
||||
GdkPixmap* pixmap = gdk_pixmap_new(gtk_widget_get_window(GTK_WIDGET(item)), width, height, -1);
|
||||
cairo_t* cairo = gdk_cairo_create(pixmap);
|
||||
|
||||
cairo_set_source_surface(cairo, surface, 0, 0);
|
||||
cairo_paint(cairo);
|
||||
cairo_destroy(cairo);
|
||||
|
||||
GdkPixbuf* pixbuf = gdk_pixbuf_get_from_drawable(NULL, pixmap, NULL, 0, 0, 0,
|
||||
0, width, height);
|
||||
#else
|
||||
GdkPixbuf* pixbuf = gdk_pixbuf_get_from_surface(surface, 0, 0, width, height);
|
||||
#endif
|
||||
g_signal_emit(page, signals[IMAGE_SELECTED], 0, pixbuf);
|
||||
g_object_unref(pixbuf);
|
||||
cairo_surface_destroy(surface);
|
||||
|
|
5
po/ca.po
5
po/ca.po
|
@ -2,15 +2,14 @@
|
|||
# See LICENSE file for license and copyright information
|
||||
#
|
||||
# Translators:
|
||||
# norbux <manelsales@ono.com>, 2013
|
||||
# norbux <manelsales@ono.com>, 2012
|
||||
# mvdan <mvdan@mvdan.cc>, 2012
|
||||
# norbux <manelsales@ono.com>, 2012-2013
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: zathura\n"
|
||||
"Report-Msgid-Bugs-To: http://bugs.pwmt.org\n"
|
||||
"POT-Creation-Date: 2013-11-04 19:57+0100\n"
|
||||
"PO-Revision-Date: 2013-11-01 13:12+0000\n"
|
||||
"PO-Revision-Date: 2014-01-04 20:20+0100\n"
|
||||
"Last-Translator: Sebastian Ramacher <sebastian+dev@ramacher.at>\n"
|
||||
"Language-Team: Catalan (http://www.transifex.com/projects/p/zathura/language/"
|
||||
"ca/)\n"
|
||||
|
|
2
po/cs.po
2
po/cs.po
|
@ -6,7 +6,7 @@ msgstr ""
|
|||
"Project-Id-Version: zathura\n"
|
||||
"Report-Msgid-Bugs-To: http://bugs.pwmt.org\n"
|
||||
"POT-Creation-Date: 2013-11-04 19:57+0100\n"
|
||||
"PO-Revision-Date: 2013-11-01 13:12+0000\n"
|
||||
"PO-Revision-Date: 2013-11-20 09:50+0000\n"
|
||||
"Last-Translator: Martin Pelikan <pelikan@storkhole.cz>\n"
|
||||
"Language-Team: pwmt.org <mail@pwmt.org>\n"
|
||||
"Language: cs\n"
|
||||
|
|
2
po/de.po
2
po/de.po
|
@ -8,7 +8,7 @@ msgstr ""
|
|||
"Project-Id-Version: zathura\n"
|
||||
"Report-Msgid-Bugs-To: http://bugs.pwmt.org\n"
|
||||
"POT-Creation-Date: 2013-11-04 19:57+0100\n"
|
||||
"PO-Revision-Date: 2013-11-01 13:12+0000\n"
|
||||
"PO-Revision-Date: 2013-11-20 09:50+0000\n"
|
||||
"Last-Translator: Sebastian Ramacher <sebastian+dev@ramacher.at>\n"
|
||||
"Language-Team: German (http://www.transifex.com/projects/p/zathura/language/"
|
||||
"de/)\n"
|
||||
|
|
2
po/el.po
2
po/el.po
|
@ -9,7 +9,7 @@ msgstr ""
|
|||
"Project-Id-Version: zathura\n"
|
||||
"Report-Msgid-Bugs-To: http://bugs.pwmt.org\n"
|
||||
"POT-Creation-Date: 2013-11-04 19:57+0100\n"
|
||||
"PO-Revision-Date: 2013-11-01 13:12+0000\n"
|
||||
"PO-Revision-Date: 2013-11-20 09:50+0000\n"
|
||||
"Last-Translator: Sebastian Ramacher <sebastian+dev@ramacher.at>\n"
|
||||
"Language-Team: Greek (http://www.transifex.com/projects/p/zathura/language/"
|
||||
"el/)\n"
|
||||
|
|
2
po/eo.po
2
po/eo.po
|
@ -8,7 +8,7 @@ msgstr ""
|
|||
"Project-Id-Version: zathura\n"
|
||||
"Report-Msgid-Bugs-To: http://bugs.pwmt.org\n"
|
||||
"POT-Creation-Date: 2013-11-04 19:57+0100\n"
|
||||
"PO-Revision-Date: 2013-11-05 01:06+0100\n"
|
||||
"PO-Revision-Date: 2013-11-20 09:50+0000\n"
|
||||
"Last-Translator: norbux <manelsales@ono.com>\n"
|
||||
"Language-Team: Esperanto (http://www.transifex.com/projects/p/zathura/"
|
||||
"language/eo/)\n"
|
||||
|
|
2
po/es.po
2
po/es.po
|
@ -7,7 +7,7 @@ msgstr ""
|
|||
"Project-Id-Version: zathura\n"
|
||||
"Report-Msgid-Bugs-To: http://bugs.pwmt.org\n"
|
||||
"POT-Creation-Date: 2013-11-04 19:57+0100\n"
|
||||
"PO-Revision-Date: 2013-11-01 13:12+0000\n"
|
||||
"PO-Revision-Date: 2013-11-20 09:50+0000\n"
|
||||
"Last-Translator: Moritz Lipp <mlq@pwmt.org>\n"
|
||||
"Language-Team: Spanish (Castilian) (http://www.transifex.net/projects/p/"
|
||||
"zathura/language/es/)\n"
|
||||
|
|
|
@ -8,7 +8,7 @@ msgstr ""
|
|||
"Project-Id-Version: zathura\n"
|
||||
"Report-Msgid-Bugs-To: http://bugs.pwmt.org\n"
|
||||
"POT-Creation-Date: 2013-11-04 19:57+0100\n"
|
||||
"PO-Revision-Date: 2013-11-01 13:12+0000\n"
|
||||
"PO-Revision-Date: 2013-11-20 09:50+0000\n"
|
||||
"Last-Translator: watsh1ken <wat.sh1ken@gmail.com>\n"
|
||||
"Language-Team: Spanish (Chile) (http://www.transifex.net/projects/p/zathura/"
|
||||
"language/es_CL/)\n"
|
||||
|
|
2
po/et.po
2
po/et.po
|
@ -8,7 +8,7 @@ msgstr ""
|
|||
"Project-Id-Version: zathura\n"
|
||||
"Report-Msgid-Bugs-To: http://bugs.pwmt.org\n"
|
||||
"POT-Creation-Date: 2013-11-04 19:57+0100\n"
|
||||
"PO-Revision-Date: 2013-11-01 13:12+0000\n"
|
||||
"PO-Revision-Date: 2013-11-20 09:50+0000\n"
|
||||
"Last-Translator: Rivo Zängov <eraser@eraser.ee>\n"
|
||||
"Language-Team: Estonian (http://www.transifex.net/projects/p/zathura/"
|
||||
"language/et/)\n"
|
||||
|
|
39
po/fr.po
39
po/fr.po
|
@ -5,17 +5,18 @@
|
|||
# bknecht <benoit.knecht@gmail.com>, 2012
|
||||
# Dorian <munto@free.fr>, 2012
|
||||
# Quentin Stiévenart <quentin.stievenart@gmail.com>, 2012
|
||||
# rike, 2014
|
||||
# Stéphane Aulery <lkppo@free.fr>, 2012
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: zathura\n"
|
||||
"Report-Msgid-Bugs-To: http://bugs.pwmt.org\n"
|
||||
"POT-Creation-Date: 2013-11-04 19:57+0100\n"
|
||||
"PO-Revision-Date: 2013-11-01 13:12+0000\n"
|
||||
"Last-Translator: Benoît Knecht <benoit.knecht@fsfe.org>\n"
|
||||
"PO-Revision-Date: 2014-01-02 18:42+0000\n"
|
||||
"Language-Team: French (http://www.transifex.com/projects/p/zathura/language/"
|
||||
"fr/)\n"
|
||||
"Language: fr\n"
|
||||
"Last-Translator: rike\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
@ -84,35 +85,35 @@ msgstr "Aucun marque-page correspondant : %s"
|
|||
|
||||
#: ../commands.c:162
|
||||
msgid "Title"
|
||||
msgstr ""
|
||||
msgstr "Titre"
|
||||
|
||||
#: ../commands.c:163
|
||||
msgid "Author"
|
||||
msgstr ""
|
||||
msgstr "Auteur"
|
||||
|
||||
#: ../commands.c:164
|
||||
msgid "Subject"
|
||||
msgstr ""
|
||||
msgstr "Sujet"
|
||||
|
||||
#: ../commands.c:165
|
||||
msgid "Keywords"
|
||||
msgstr ""
|
||||
msgstr "Mots clé"
|
||||
|
||||
#: ../commands.c:166
|
||||
msgid "Creator"
|
||||
msgstr ""
|
||||
msgstr "Créateur"
|
||||
|
||||
#: ../commands.c:167
|
||||
msgid "Producer"
|
||||
msgstr ""
|
||||
msgstr "Producteur"
|
||||
|
||||
#: ../commands.c:168
|
||||
msgid "Creation date"
|
||||
msgstr ""
|
||||
msgstr "Date de création"
|
||||
|
||||
#: ../commands.c:169
|
||||
msgid "Modification date"
|
||||
msgstr ""
|
||||
msgstr "Date de modification"
|
||||
|
||||
#: ../commands.c:174 ../commands.c:196
|
||||
msgid "No information available."
|
||||
|
@ -229,7 +230,7 @@ msgstr "Zoom maximum"
|
|||
|
||||
#: ../config.c:151
|
||||
msgid "Maximum number of pages to keep in the cache"
|
||||
msgstr ""
|
||||
msgstr "Nombre maximum de pages à garder en cache"
|
||||
|
||||
#: ../config.c:153
|
||||
msgid "Number of positions to remember in the jumplist"
|
||||
|
@ -265,9 +266,7 @@ msgstr "Recoloriser les pages"
|
|||
|
||||
#: ../config.c:169
|
||||
msgid "When recoloring keep original hue and adjust lightness only"
|
||||
msgstr ""
|
||||
"Lors de la recoloration garder la teinte d'origine et ajuster seulement la "
|
||||
"luminosité"
|
||||
msgstr "Lors de la recoloration garder la teinte d'origine et ajuster seulement la luminosité"
|
||||
|
||||
#: ../config.c:171
|
||||
msgid "Wrap scrolling"
|
||||
|
@ -287,11 +286,11 @@ msgstr "Zoom centré horizontalement"
|
|||
|
||||
#: ../config.c:179
|
||||
msgid "Align link target to the left"
|
||||
msgstr ""
|
||||
msgstr "Aligner la cible du lien à gauche"
|
||||
|
||||
#: ../config.c:181
|
||||
msgid "Let zoom be changed when following links"
|
||||
msgstr ""
|
||||
msgstr "Autoriser la modification du zoom quand on suit un lien"
|
||||
|
||||
#: ../config.c:183
|
||||
msgid "Center result horizontally"
|
||||
|
@ -339,7 +338,7 @@ msgstr "Utiliser le nom de base du fichier dans le titre de la fenêtre"
|
|||
|
||||
#: ../config.c:204
|
||||
msgid "Display the page number in the window title"
|
||||
msgstr ""
|
||||
msgstr "Afficher le numéro de page dans le titre de la fenêtre"
|
||||
|
||||
#: ../config.c:206
|
||||
msgid "Use basename of the file in the statusbar"
|
||||
|
@ -351,7 +350,7 @@ msgstr "Activer la prise en charge de synctex"
|
|||
|
||||
#: ../config.c:210
|
||||
msgid "The clipboard into which mouse-selected data will be written"
|
||||
msgstr ""
|
||||
msgstr "Le presse-papiers qui recevra les données sélectionnées avec la souris"
|
||||
|
||||
#. define default inputbar commands
|
||||
#: ../config.c:369
|
||||
|
@ -510,11 +509,11 @@ msgstr "[Sans nom]"
|
|||
|
||||
#: ../zathura.c:486
|
||||
msgid "Could not read file from stdin and write it to a temporary file."
|
||||
msgstr ""
|
||||
msgstr "Impossible de lire le fichier depuis stdin et de le sauvegarder dans un fichier temporaire."
|
||||
|
||||
#: ../zathura.c:535
|
||||
msgid "Unsupported file type. Please install the necessary plugin."
|
||||
msgstr ""
|
||||
msgstr "Type de fichier non supporté. Veuillez installer l'extension nécessaire."
|
||||
|
||||
#: ../zathura.c:545
|
||||
msgid "Document does not contain any pages"
|
||||
|
|
2
po/he.po
2
po/he.po
|
@ -7,7 +7,7 @@ msgstr ""
|
|||
"Project-Id-Version: zathura\n"
|
||||
"Report-Msgid-Bugs-To: http://bugs.pwmt.org\n"
|
||||
"POT-Creation-Date: 2013-11-04 19:57+0100\n"
|
||||
"PO-Revision-Date: 2013-11-01 13:12+0000\n"
|
||||
"PO-Revision-Date: 2013-11-20 09:50+0000\n"
|
||||
"Last-Translator: Sebastian Ramacher <sebastian+dev@ramacher.at>\n"
|
||||
"Language-Team: Hebrew (http://www.transifex.com/projects/p/zathura/language/"
|
||||
"he/)\n"
|
||||
|
|
2
po/hr.po
2
po/hr.po
|
@ -7,7 +7,7 @@ msgstr ""
|
|||
"Project-Id-Version: zathura\n"
|
||||
"Report-Msgid-Bugs-To: http://bugs.pwmt.org\n"
|
||||
"POT-Creation-Date: 2013-11-04 19:57+0100\n"
|
||||
"PO-Revision-Date: 2013-11-01 13:12+0000\n"
|
||||
"PO-Revision-Date: 2013-11-20 09:50+0000\n"
|
||||
"Last-Translator: Sebastian Ramacher <sebastian+dev@ramacher.at>\n"
|
||||
"Language-Team: Croatian (http://www.transifex.com/projects/p/zathura/"
|
||||
"language/hr/)\n"
|
||||
|
|
46
po/id_ID.po
46
po/id_ID.po
|
@ -8,7 +8,7 @@ msgstr ""
|
|||
"Project-Id-Version: zathura\n"
|
||||
"Report-Msgid-Bugs-To: http://bugs.pwmt.org\n"
|
||||
"POT-Creation-Date: 2013-11-04 19:57+0100\n"
|
||||
"PO-Revision-Date: 2013-11-01 13:12+0000\n"
|
||||
"PO-Revision-Date: 2013-12-15 05:57+0000\n"
|
||||
"Last-Translator: andjeng <teratower8@gmail.com>\n"
|
||||
"Language-Team: Indonesian (Indonesia) (http://www.transifex.com/projects/p/"
|
||||
"zathura/language/id_ID/)\n"
|
||||
|
@ -81,35 +81,35 @@ msgstr "Tidak ada bookmark: %s"
|
|||
|
||||
#: ../commands.c:162
|
||||
msgid "Title"
|
||||
msgstr ""
|
||||
msgstr "Judul"
|
||||
|
||||
#: ../commands.c:163
|
||||
msgid "Author"
|
||||
msgstr ""
|
||||
msgstr "Penulis"
|
||||
|
||||
#: ../commands.c:164
|
||||
msgid "Subject"
|
||||
msgstr ""
|
||||
msgstr "Subjek"
|
||||
|
||||
#: ../commands.c:165
|
||||
msgid "Keywords"
|
||||
msgstr ""
|
||||
msgstr "Kata kunci"
|
||||
|
||||
#: ../commands.c:166
|
||||
msgid "Creator"
|
||||
msgstr ""
|
||||
msgstr "Pembuat"
|
||||
|
||||
#: ../commands.c:167
|
||||
msgid "Producer"
|
||||
msgstr ""
|
||||
msgstr "Produser"
|
||||
|
||||
#: ../commands.c:168
|
||||
msgid "Creation date"
|
||||
msgstr ""
|
||||
msgstr "Tanggal pembuatan"
|
||||
|
||||
#: ../commands.c:169
|
||||
msgid "Modification date"
|
||||
msgstr ""
|
||||
msgstr "Tanggal ubahan"
|
||||
|
||||
#: ../commands.c:174 ../commands.c:196
|
||||
msgid "No information available."
|
||||
|
@ -186,7 +186,7 @@ msgstr "Citra"
|
|||
#. zathura settings
|
||||
#: ../config.c:131
|
||||
msgid "Database backend"
|
||||
msgstr ""
|
||||
msgstr "backend database"
|
||||
|
||||
#: ../config.c:133
|
||||
msgid "Zoom step"
|
||||
|
@ -226,7 +226,7 @@ msgstr "Pembesaran maksimal"
|
|||
|
||||
#: ../config.c:151
|
||||
msgid "Maximum number of pages to keep in the cache"
|
||||
msgstr ""
|
||||
msgstr "Jumlah laman yang disimpan pada cache"
|
||||
|
||||
#: ../config.c:153
|
||||
msgid "Number of positions to remember in the jumplist"
|
||||
|
@ -250,11 +250,11 @@ msgstr "Warna sorotan (aktif)"
|
|||
|
||||
#: ../config.c:161
|
||||
msgid "'Loading ...' background color"
|
||||
msgstr ""
|
||||
msgstr "'Memuat ...; warna latar"
|
||||
|
||||
#: ../config.c:163
|
||||
msgid "'Loading ...' foreground color"
|
||||
msgstr ""
|
||||
msgstr "'Memuat ...' warna depan"
|
||||
|
||||
#: ../config.c:167
|
||||
msgid "Recolor pages"
|
||||
|
@ -282,11 +282,11 @@ msgstr "Pembesaran horisontal tengah"
|
|||
|
||||
#: ../config.c:179
|
||||
msgid "Align link target to the left"
|
||||
msgstr ""
|
||||
msgstr "Ratakan tautan ke kiri"
|
||||
|
||||
#: ../config.c:181
|
||||
msgid "Let zoom be changed when following links"
|
||||
msgstr ""
|
||||
msgstr "Biarkan pembesaran berubah saat mengikuti pranala"
|
||||
|
||||
#: ../config.c:183
|
||||
msgid "Center result horizontally"
|
||||
|
@ -334,11 +334,11 @@ msgstr "Gunakan nama dasar file pada judul jendela"
|
|||
|
||||
#: ../config.c:204
|
||||
msgid "Display the page number in the window title"
|
||||
msgstr ""
|
||||
msgstr "Tampilkan nomor laman pada jendela judul"
|
||||
|
||||
#: ../config.c:206
|
||||
msgid "Use basename of the file in the statusbar"
|
||||
msgstr ""
|
||||
msgstr "Gunakan nama dasar berkas pada statusbar"
|
||||
|
||||
#: ../config.c:208 ../main.c:67
|
||||
msgid "Enable synctex support"
|
||||
|
@ -346,7 +346,7 @@ msgstr "Support synctex"
|
|||
|
||||
#: ../config.c:210
|
||||
msgid "The clipboard into which mouse-selected data will be written"
|
||||
msgstr ""
|
||||
msgstr "Data yang dipilih tetikus akan ditulis ke clipboard"
|
||||
|
||||
#. define default inputbar commands
|
||||
#: ../config.c:369
|
||||
|
@ -419,7 +419,7 @@ msgstr "Jangan menyorot hasil cari sekarang"
|
|||
|
||||
#: ../config.c:386
|
||||
msgid "Highlight current search results"
|
||||
msgstr ""
|
||||
msgstr "Sorot hasil pencarian sekarang"
|
||||
|
||||
#: ../config.c:387
|
||||
msgid "Show version information"
|
||||
|
@ -469,7 +469,7 @@ msgstr "Kata sandi dokumen"
|
|||
|
||||
#: ../main.c:64
|
||||
msgid "Page number to go to"
|
||||
msgstr ""
|
||||
msgstr "Nomor halaman tujuan"
|
||||
|
||||
#: ../main.c:65
|
||||
msgid "Log level (debug, info, warning, error)"
|
||||
|
@ -505,12 +505,12 @@ msgstr "[Tidak berjudul]"
|
|||
|
||||
#: ../zathura.c:486
|
||||
msgid "Could not read file from stdin and write it to a temporary file."
|
||||
msgstr ""
|
||||
msgstr "Tidak dapat membaca berkas dari stdin dan menulisnya ke berkas sementar"
|
||||
|
||||
#: ../zathura.c:535
|
||||
msgid "Unsupported file type. Please install the necessary plugin."
|
||||
msgstr ""
|
||||
msgstr "Tipe berkas tidak didukung. Silakan memasang plugin yang dibutuhkan."
|
||||
|
||||
#: ../zathura.c:545
|
||||
msgid "Document does not contain any pages"
|
||||
msgstr ""
|
||||
msgstr "Dokumen tidak mempunyai laman apapun"
|
||||
|
|
2
po/it.po
2
po/it.po
|
@ -8,7 +8,7 @@ msgstr ""
|
|||
"Project-Id-Version: zathura\n"
|
||||
"Report-Msgid-Bugs-To: http://bugs.pwmt.org\n"
|
||||
"POT-Creation-Date: 2013-11-04 19:57+0100\n"
|
||||
"PO-Revision-Date: 2013-11-01 13:12+0000\n"
|
||||
"PO-Revision-Date: 2013-11-20 09:50+0000\n"
|
||||
"Last-Translator: Sebastian Ramacher <sebastian+dev@ramacher.at>\n"
|
||||
"Language-Team: Italian (http://www.transifex.com/projects/p/zathura/language/"
|
||||
"it/)\n"
|
||||
|
|
2
po/pl.po
2
po/pl.po
|
@ -9,7 +9,7 @@ msgstr ""
|
|||
"Project-Id-Version: zathura\n"
|
||||
"Report-Msgid-Bugs-To: http://bugs.pwmt.org\n"
|
||||
"POT-Creation-Date: 2013-11-04 19:57+0100\n"
|
||||
"PO-Revision-Date: 2013-11-01 13:12+0000\n"
|
||||
"PO-Revision-Date: 2013-11-20 09:50+0000\n"
|
||||
"Last-Translator: p <poczciwiec@gmail.com>\n"
|
||||
"Language-Team: Polish (http://www.transifex.net/projects/p/zathura/language/"
|
||||
"pl/)\n"
|
||||
|
|
30
po/pt_BR.po
30
po/pt_BR.po
|
@ -9,7 +9,7 @@ msgstr ""
|
|||
"Project-Id-Version: zathura\n"
|
||||
"Report-Msgid-Bugs-To: http://bugs.pwmt.org\n"
|
||||
"POT-Creation-Date: 2013-11-04 19:57+0100\n"
|
||||
"PO-Revision-Date: 2013-11-01 13:12+0000\n"
|
||||
"PO-Revision-Date: 2013-11-20 09:50+0000\n"
|
||||
"Last-Translator: salmora8 <shorterfire@gmail.com>\n"
|
||||
"Language-Team: Portuguese (Brazil) (http://www.transifex.com/projects/p/"
|
||||
"zathura/language/pt_BR/)\n"
|
||||
|
@ -82,35 +82,35 @@ msgstr "Não há favoritos: %s"
|
|||
|
||||
#: ../commands.c:162
|
||||
msgid "Title"
|
||||
msgstr ""
|
||||
msgstr "Título"
|
||||
|
||||
#: ../commands.c:163
|
||||
msgid "Author"
|
||||
msgstr ""
|
||||
msgstr "Autor"
|
||||
|
||||
#: ../commands.c:164
|
||||
msgid "Subject"
|
||||
msgstr ""
|
||||
msgstr "Assunto"
|
||||
|
||||
#: ../commands.c:165
|
||||
msgid "Keywords"
|
||||
msgstr ""
|
||||
msgstr "Palavras-chave"
|
||||
|
||||
#: ../commands.c:166
|
||||
msgid "Creator"
|
||||
msgstr ""
|
||||
msgstr "Criador"
|
||||
|
||||
#: ../commands.c:167
|
||||
msgid "Producer"
|
||||
msgstr ""
|
||||
msgstr "Produtor"
|
||||
|
||||
#: ../commands.c:168
|
||||
msgid "Creation date"
|
||||
msgstr ""
|
||||
msgstr "Data de criação"
|
||||
|
||||
#: ../commands.c:169
|
||||
msgid "Modification date"
|
||||
msgstr ""
|
||||
msgstr "Data de modificação"
|
||||
|
||||
#: ../commands.c:174 ../commands.c:196
|
||||
msgid "No information available."
|
||||
|
@ -263,8 +263,7 @@ msgstr "Recolorir páginas"
|
|||
|
||||
#: ../config.c:169
|
||||
msgid "When recoloring keep original hue and adjust lightness only"
|
||||
msgstr ""
|
||||
"Quando recolorir, manter tonalidade original e ajustar somente a luminosidade"
|
||||
msgstr "Quando recolorir, manter tonalidade original e ajustar somente a luminosidade"
|
||||
|
||||
#: ../config.c:171
|
||||
msgid "Wrap scrolling"
|
||||
|
@ -288,7 +287,7 @@ msgstr "Alinhe destino do link à esquerda"
|
|||
|
||||
#: ../config.c:181
|
||||
msgid "Let zoom be changed when following links"
|
||||
msgstr ""
|
||||
msgstr "Zoom será mudado quando seguir os links"
|
||||
|
||||
#: ../config.c:183
|
||||
msgid "Center result horizontally"
|
||||
|
@ -348,7 +347,7 @@ msgstr "Ativar suporte synctex"
|
|||
|
||||
#: ../config.c:210
|
||||
msgid "The clipboard into which mouse-selected data will be written"
|
||||
msgstr ""
|
||||
msgstr "A área de transferência em que o dados selecionados com o mouse vão ser escritos"
|
||||
|
||||
#. define default inputbar commands
|
||||
#: ../config.c:369
|
||||
|
@ -507,12 +506,11 @@ msgstr "[Sem nome]"
|
|||
|
||||
#: ../zathura.c:486
|
||||
msgid "Could not read file from stdin and write it to a temporary file."
|
||||
msgstr ""
|
||||
msgstr "Não foi possível ler o arquivo a partir de stdin e gravá-lo em um arquivo temporário."
|
||||
|
||||
#: ../zathura.c:535
|
||||
msgid "Unsupported file type. Please install the necessary plugin."
|
||||
msgstr ""
|
||||
"Formato de arquivo não suportado. Por favor, instale o plugin necessário."
|
||||
msgstr "Formato de arquivo não suportado. Por favor, instale o plugin necessário."
|
||||
|
||||
#: ../zathura.c:545
|
||||
msgid "Document does not contain any pages"
|
||||
|
|
117
po/ru.po
117
po/ru.po
|
@ -5,16 +5,17 @@
|
|||
# AlexanderR <alexander.r@gmx.com>, 2013
|
||||
# Alissa <Chertik89@gmail.com>, 2013
|
||||
# Mikhail Krutov <>, 2012
|
||||
# vp1981 <irk.translator@yandex.ru>, 2013
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: zathura\n"
|
||||
"Report-Msgid-Bugs-To: http://bugs.pwmt.org\n"
|
||||
"POT-Creation-Date: 2013-11-04 19:57+0100\n"
|
||||
"PO-Revision-Date: 2013-11-01 13:12+0000\n"
|
||||
"Last-Translator: Sebastian Ramacher <sebastian+dev@ramacher.at>\n"
|
||||
"PO-Revision-Date: 2013-12-16 13:11+0000\n"
|
||||
"Language-Team: Russian (http://www.transifex.com/projects/p/zathura/language/"
|
||||
"ru/)\n"
|
||||
"Language: ru\n"
|
||||
"Last-Translator: vp1981 <irk.translator@yandex.ru>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
@ -24,12 +25,12 @@ msgstr ""
|
|||
#: ../callbacks.c:297
|
||||
#, c-format
|
||||
msgid "Invalid input '%s' given."
|
||||
msgstr "Неправильный ввод: %s"
|
||||
msgstr "Неправильный ввод: %s."
|
||||
|
||||
#: ../callbacks.c:333
|
||||
#, c-format
|
||||
msgid "Invalid index '%s' given."
|
||||
msgstr "Получен неверный индекс %s"
|
||||
msgstr "Получен неверный индекс: %s."
|
||||
|
||||
#: ../callbacks.c:546
|
||||
#, c-format
|
||||
|
@ -41,11 +42,11 @@ msgstr "Выделенный текст скопирован в буфер: %s"
|
|||
#: ../commands.c:540 ../shortcuts.c:403 ../shortcuts.c:1163
|
||||
#: ../shortcuts.c:1192
|
||||
msgid "No document opened."
|
||||
msgstr "Документ не открыт"
|
||||
msgstr "Нет открытых документов."
|
||||
|
||||
#: ../commands.c:42 ../commands.c:82 ../commands.c:109 ../commands.c:424
|
||||
msgid "Invalid number of arguments given."
|
||||
msgstr "Неверное число аргументов"
|
||||
msgstr "Указано неверное число аргументов."
|
||||
|
||||
#: ../commands.c:53
|
||||
#, c-format
|
||||
|
@ -55,7 +56,7 @@ msgstr "Не могу создать закладку %s"
|
|||
#: ../commands.c:55
|
||||
#, c-format
|
||||
msgid "Could not create bookmark: %s"
|
||||
msgstr "Не могу создать закладку %s"
|
||||
msgstr "Не удалось создать закладку %s"
|
||||
|
||||
#: ../commands.c:60
|
||||
#, c-format
|
||||
|
@ -84,93 +85,93 @@ msgstr "Закладки %s не существует"
|
|||
|
||||
#: ../commands.c:162
|
||||
msgid "Title"
|
||||
msgstr ""
|
||||
msgstr "Заголовок"
|
||||
|
||||
#: ../commands.c:163
|
||||
msgid "Author"
|
||||
msgstr ""
|
||||
msgstr "Автор"
|
||||
|
||||
#: ../commands.c:164
|
||||
msgid "Subject"
|
||||
msgstr ""
|
||||
msgstr "Тема"
|
||||
|
||||
#: ../commands.c:165
|
||||
msgid "Keywords"
|
||||
msgstr ""
|
||||
msgstr "Ключевые слова"
|
||||
|
||||
#: ../commands.c:166
|
||||
msgid "Creator"
|
||||
msgstr ""
|
||||
msgstr "Создатель"
|
||||
|
||||
#: ../commands.c:167
|
||||
msgid "Producer"
|
||||
msgstr ""
|
||||
msgstr "Производитель"
|
||||
|
||||
#: ../commands.c:168
|
||||
msgid "Creation date"
|
||||
msgstr ""
|
||||
msgstr "Время создания"
|
||||
|
||||
#: ../commands.c:169
|
||||
msgid "Modification date"
|
||||
msgstr ""
|
||||
msgstr "Время изменения"
|
||||
|
||||
#: ../commands.c:174 ../commands.c:196
|
||||
msgid "No information available."
|
||||
msgstr "Нет доступной информации"
|
||||
msgstr "Нет доступной информации."
|
||||
|
||||
#: ../commands.c:234
|
||||
msgid "Too many arguments."
|
||||
msgstr "Слишком много аргументов"
|
||||
msgstr "Слишком много аргументов."
|
||||
|
||||
#: ../commands.c:245
|
||||
msgid "No arguments given."
|
||||
msgstr "Отсутствуют аргументы"
|
||||
msgstr "Отсутствуют аргументы."
|
||||
|
||||
#: ../commands.c:304 ../commands.c:330
|
||||
msgid "Document saved."
|
||||
msgstr "Документ сохранён"
|
||||
msgstr "Документ сохранён."
|
||||
|
||||
#: ../commands.c:306 ../commands.c:332
|
||||
msgid "Failed to save document."
|
||||
msgstr "Не удалось сохранить документ"
|
||||
msgstr "Не удалось сохранить документ."
|
||||
|
||||
#: ../commands.c:309 ../commands.c:335
|
||||
msgid "Invalid number of arguments."
|
||||
msgstr "Неверное количество аргументов"
|
||||
msgstr "Неверное количество аргументов."
|
||||
|
||||
#: ../commands.c:443
|
||||
#, c-format
|
||||
msgid "Couldn't write attachment '%s' to '%s'."
|
||||
msgstr "Не могу сохранить приложенный файл %s в %s"
|
||||
msgstr "Не удалось сохранить приложенный файл «%s» в «%s»."
|
||||
|
||||
#: ../commands.c:445
|
||||
#, c-format
|
||||
msgid "Wrote attachment '%s' to '%s'."
|
||||
msgstr "Файл %s сохранён в %s"
|
||||
msgstr "Файл «%s» сохранён в «%s»."
|
||||
|
||||
#: ../commands.c:489
|
||||
#, c-format
|
||||
msgid "Wrote image '%s' to '%s'."
|
||||
msgstr "Файл '%s' сохранён в '%s'"
|
||||
msgstr "Изображение «%s» сохранено в «%s»."
|
||||
|
||||
#: ../commands.c:491
|
||||
#, c-format
|
||||
msgid "Couldn't write image '%s' to '%s'."
|
||||
msgstr "Не могу сохранить приложенный файл %s в %s"
|
||||
msgstr "Не удалось записать изображение «%s» в «%s»."
|
||||
|
||||
#: ../commands.c:498
|
||||
#, c-format
|
||||
msgid "Unknown image '%s'."
|
||||
msgstr "Неизвестный файл %s."
|
||||
msgstr "Неизвестное изображение «%s»."
|
||||
|
||||
#: ../commands.c:502
|
||||
#, c-format
|
||||
msgid "Unknown attachment or image '%s'."
|
||||
msgstr "Неизвестное вложение %s."
|
||||
msgstr "Неизвестное вложение или изображение «%s»."
|
||||
|
||||
#: ../commands.c:553
|
||||
msgid "Argument must be a number."
|
||||
msgstr "Аргумент должен быть числом"
|
||||
msgstr "Аргумент должен быть числом."
|
||||
|
||||
#: ../completion.c:250
|
||||
#, c-format
|
||||
|
@ -179,7 +180,7 @@ msgstr "Страница %d"
|
|||
|
||||
#: ../completion.c:293
|
||||
msgid "Attachments"
|
||||
msgstr "Прикепленные файлы"
|
||||
msgstr "Прикреплённые файлы"
|
||||
|
||||
#. add images
|
||||
#: ../completion.c:324
|
||||
|
@ -205,7 +206,7 @@ msgstr "Количество страниц в ряд"
|
|||
|
||||
#: ../config.c:139
|
||||
msgid "Column of the first page"
|
||||
msgstr ""
|
||||
msgstr "Столбец первой страницы"
|
||||
|
||||
#: ../config.c:141
|
||||
msgid "Scroll step"
|
||||
|
@ -217,7 +218,7 @@ msgstr "Шаг горизонтальной прокрутки"
|
|||
|
||||
#: ../config.c:145
|
||||
msgid "Full page scroll overlap"
|
||||
msgstr ""
|
||||
msgstr "Перекрытие страниц при прокрутке"
|
||||
|
||||
#: ../config.c:147
|
||||
msgid "Zoom minimum"
|
||||
|
@ -229,7 +230,7 @@ msgstr "Максимальное увеличение"
|
|||
|
||||
#: ../config.c:151
|
||||
msgid "Maximum number of pages to keep in the cache"
|
||||
msgstr ""
|
||||
msgstr "Максимальное количество страниц хранимых в кэше"
|
||||
|
||||
#: ../config.c:153
|
||||
msgid "Number of positions to remember in the jumplist"
|
||||
|
@ -265,7 +266,7 @@ msgstr "Перекрасить страницы"
|
|||
|
||||
#: ../config.c:169
|
||||
msgid "When recoloring keep original hue and adjust lightness only"
|
||||
msgstr ""
|
||||
msgstr "При перекраске сохранять оттенок и изменять только осветление"
|
||||
|
||||
#: ../config.c:171
|
||||
msgid "Wrap scrolling"
|
||||
|
@ -273,7 +274,7 @@ msgstr "Плавная прокрутка"
|
|||
|
||||
#: ../config.c:173
|
||||
msgid "Page aware scrolling"
|
||||
msgstr ""
|
||||
msgstr "Постраничная прокрутка"
|
||||
|
||||
#: ../config.c:175
|
||||
msgid "Advance number of pages per row"
|
||||
|
@ -281,15 +282,15 @@ msgstr "Увеличить количество страниц в ряду"
|
|||
|
||||
#: ../config.c:177
|
||||
msgid "Horizontally centered zoom"
|
||||
msgstr ""
|
||||
msgstr "Центрировать увеличение по горизонтали"
|
||||
|
||||
#: ../config.c:179
|
||||
msgid "Align link target to the left"
|
||||
msgstr ""
|
||||
msgstr "Выровнять цель ссылки по левому краю"
|
||||
|
||||
#: ../config.c:181
|
||||
msgid "Let zoom be changed when following links"
|
||||
msgstr ""
|
||||
msgstr "Разрешить изменять размер при следовании по ссылкам"
|
||||
|
||||
#: ../config.c:183
|
||||
msgid "Center result horizontally"
|
||||
|
@ -301,19 +302,19 @@ msgstr "Прозрачность подсветки"
|
|||
|
||||
#: ../config.c:187
|
||||
msgid "Render 'Loading ...'"
|
||||
msgstr "Рендер 'Загружается ...'"
|
||||
msgstr "Рендер «Загружается ...»"
|
||||
|
||||
#: ../config.c:188
|
||||
msgid "Adjust to when opening file"
|
||||
msgstr ""
|
||||
msgstr "Подогнать размеры при открытии документа"
|
||||
|
||||
#: ../config.c:190
|
||||
msgid "Show hidden files and directories"
|
||||
msgstr "Показывать скрытые файлы и директории"
|
||||
msgstr "Показывать скрытые файлы и каталоги"
|
||||
|
||||
#: ../config.c:192
|
||||
msgid "Show directories"
|
||||
msgstr "Показывать директории"
|
||||
msgstr "Показывать каталоги"
|
||||
|
||||
#: ../config.c:194
|
||||
msgid "Always open on first page"
|
||||
|
@ -325,7 +326,7 @@ msgstr "Подсветить результаты поиска"
|
|||
|
||||
#: ../config.c:198
|
||||
msgid "Enable incremental search"
|
||||
msgstr "Инкрементальный поиск"
|
||||
msgstr "Включить инкрементальный поиск"
|
||||
|
||||
#: ../config.c:200
|
||||
msgid "Clear search results on abort"
|
||||
|
@ -337,7 +338,7 @@ msgstr "Использовать базовое имя файла в загол
|
|||
|
||||
#: ../config.c:204
|
||||
msgid "Display the page number in the window title"
|
||||
msgstr "Отображать номер страницы в заголовке"
|
||||
msgstr "Показывать номер страницы в заголовке"
|
||||
|
||||
#: ../config.c:206
|
||||
msgid "Use basename of the file in the statusbar"
|
||||
|
@ -345,11 +346,11 @@ msgstr "Использовать базовое имя файла в строк
|
|||
|
||||
#: ../config.c:208 ../main.c:67
|
||||
msgid "Enable synctex support"
|
||||
msgstr ""
|
||||
msgstr "Включить поддержку synctex"
|
||||
|
||||
#: ../config.c:210
|
||||
msgid "The clipboard into which mouse-selected data will be written"
|
||||
msgstr ""
|
||||
msgstr "Буфер для записи данных из области выделенных мышкой"
|
||||
|
||||
#. define default inputbar commands
|
||||
#: ../config.c:369
|
||||
|
@ -398,7 +399,7 @@ msgstr "Сохранить документ"
|
|||
|
||||
#: ../config.c:380
|
||||
msgid "Save document (and force overwriting)"
|
||||
msgstr "Сохранить документ (с перезапиьсю)"
|
||||
msgstr "Сохранить документ (с перезаписью)"
|
||||
|
||||
#: ../config.c:381
|
||||
msgid "Save attachments"
|
||||
|
@ -444,7 +445,7 @@ msgstr "Ссылка: %s"
|
|||
|
||||
#: ../links.c:228
|
||||
msgid "Link: Invalid"
|
||||
msgstr ""
|
||||
msgstr "Ссылка: неправильная"
|
||||
|
||||
#: ../main.c:58
|
||||
msgid "Reparents to window specified by xid"
|
||||
|
@ -452,19 +453,19 @@ msgstr "Сменить материнское окно на окно, указа
|
|||
|
||||
#: ../main.c:59
|
||||
msgid "Path to the config directory"
|
||||
msgstr "Путь к директории конфига"
|
||||
msgstr "Путь к каталогу с настройкой"
|
||||
|
||||
#: ../main.c:60
|
||||
msgid "Path to the data directory"
|
||||
msgstr "Путь к директории с данными"
|
||||
msgstr "Путь к каталогу с данными"
|
||||
|
||||
#: ../main.c:61
|
||||
msgid "Path to the directories containing plugins"
|
||||
msgstr "Путь к директории с плагинами"
|
||||
msgstr "Путь к каталогу с плагинами"
|
||||
|
||||
#: ../main.c:62
|
||||
msgid "Fork into the background"
|
||||
msgstr "Уйти в бэкграунд"
|
||||
msgstr "Запустить в фоне"
|
||||
|
||||
#: ../main.c:63
|
||||
msgid "Document password"
|
||||
|
@ -476,7 +477,7 @@ msgstr "Перейти к странице номер"
|
|||
|
||||
#: ../main.c:65
|
||||
msgid "Log level (debug, info, warning, error)"
|
||||
msgstr "Уровень логирования (debug,info,warning,error)"
|
||||
msgstr "Уровень журналирования (debug, info, warning, error)"
|
||||
|
||||
#: ../main.c:66
|
||||
msgid "Print version information"
|
||||
|
@ -484,7 +485,7 @@ msgstr "Показать информацию о файле"
|
|||
|
||||
#: ../main.c:68
|
||||
msgid "Synctex editor (forwarded to the synctex command)"
|
||||
msgstr ""
|
||||
msgstr "Редактор для synctex (передаётся далее программе synctex)"
|
||||
|
||||
#: ../page-widget.c:526
|
||||
msgid "Loading..."
|
||||
|
@ -496,19 +497,19 @@ msgstr "Скопировать изображение"
|
|||
|
||||
#: ../page-widget.c:846
|
||||
msgid "Save image as"
|
||||
msgstr "Созранить как"
|
||||
msgstr "Сохранить изображение как"
|
||||
|
||||
#: ../shortcuts.c:1076
|
||||
msgid "This document does not contain any index"
|
||||
msgstr "В документе нету индекса"
|
||||
msgstr "В документе нет индекса"
|
||||
|
||||
#: ../zathura.c:213 ../zathura.c:959
|
||||
msgid "[No name]"
|
||||
msgstr "[No name]"
|
||||
msgstr "[Без названия]"
|
||||
|
||||
#: ../zathura.c:486
|
||||
msgid "Could not read file from stdin and write it to a temporary file."
|
||||
msgstr ""
|
||||
msgstr "Не удалось прочитать файл со стандартного входа и записать его во временный файл."
|
||||
|
||||
#: ../zathura.c:535
|
||||
msgid "Unsupported file type. Please install the necessary plugin."
|
||||
|
@ -516,4 +517,4 @@ msgstr "Тип файла не поддерживается. Установит
|
|||
|
||||
#: ../zathura.c:545
|
||||
msgid "Document does not contain any pages"
|
||||
msgstr "Документ не содержит ни одной страницы"
|
||||
msgstr "В документе нет страниц"
|
||||
|
|
|
@ -8,7 +8,7 @@ msgstr ""
|
|||
"Project-Id-Version: zathura\n"
|
||||
"Report-Msgid-Bugs-To: http://bugs.pwmt.org\n"
|
||||
"POT-Creation-Date: 2013-11-04 19:57+0100\n"
|
||||
"PO-Revision-Date: 2013-11-01 13:12+0000\n"
|
||||
"PO-Revision-Date: 2013-11-20 09:50+0000\n"
|
||||
"Last-Translator: mankand007 <mankand007@gmail.com>\n"
|
||||
"Language-Team: Tamil (India) (http://www.transifex.net/projects/p/zathura/"
|
||||
"language/ta_IN/)\n"
|
||||
|
|
2
po/tr.po
2
po/tr.po
|
@ -9,7 +9,7 @@ msgstr ""
|
|||
"Project-Id-Version: zathura\n"
|
||||
"Report-Msgid-Bugs-To: http://bugs.pwmt.org\n"
|
||||
"POT-Creation-Date: 2013-11-04 19:57+0100\n"
|
||||
"PO-Revision-Date: 2013-11-01 13:12+0000\n"
|
||||
"PO-Revision-Date: 2013-11-20 09:50+0000\n"
|
||||
"Last-Translator: hsngrms <dead-bodies-everywhere@hotmail.com>\n"
|
||||
"Language-Team: Turkish (http://www.transifex.net/projects/p/zathura/language/"
|
||||
"tr/)\n"
|
||||
|
|
|
@ -8,7 +8,7 @@ msgstr ""
|
|||
"Project-Id-Version: zathura\n"
|
||||
"Report-Msgid-Bugs-To: http://bugs.pwmt.org\n"
|
||||
"POT-Creation-Date: 2013-11-04 19:57+0100\n"
|
||||
"PO-Revision-Date: 2013-11-01 13:12+0000\n"
|
||||
"PO-Revision-Date: 2013-11-20 09:50+0000\n"
|
||||
"Last-Translator: Sebastian Ramacher <sebastian+dev@ramacher.at>\n"
|
||||
"Language-Team: Ukrainian (Ukraine) (http://www.transifex.com/projects/p/"
|
||||
"zathura/language/uk_UA/)\n"
|
||||
|
|
6
print.c
6
print.c
|
@ -60,7 +60,7 @@ print(zathura_t* zathura)
|
|||
zathura->print.settings = g_object_ref(gtk_print_operation_get_print_settings(print_operation));
|
||||
zathura->print.page_setup = g_object_ref(gtk_print_operation_get_default_page_setup(print_operation));
|
||||
} else if (result == GTK_PRINT_OPERATION_RESULT_ERROR) {
|
||||
girara_error("Error occured while printing progress");
|
||||
girara_error("Error pccurred while printing progress");
|
||||
}
|
||||
|
||||
g_object_unref(print_operation);
|
||||
|
@ -168,8 +168,8 @@ cb_print_draw_page(GtkPrintOperation* print_operation, GtkPrintContext*
|
|||
|
||||
static void
|
||||
cb_print_request_page_setup(GtkPrintOperation* UNUSED(print_operation),
|
||||
GtkPrintContext* UNUSED(context), gint page_number, GtkPageSetup* setup,
|
||||
zathura_t* zathura)
|
||||
GtkPrintContext* UNUSED(context), gint page_number,
|
||||
GtkPageSetup* setup, zathura_t* zathura)
|
||||
{
|
||||
if (zathura == NULL || zathura->document == NULL) {
|
||||
return;
|
||||
|
|
76
render.c
76
render.c
|
@ -1,6 +1,7 @@
|
|||
/* See LICENSE file for license and copyright information */
|
||||
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include <girara/datastructures.h>
|
||||
#include <girara/utils.h>
|
||||
#include "glib-compat.h"
|
||||
|
@ -24,7 +25,6 @@ static void render_request_finalize(GObject* object);
|
|||
|
||||
static void render_job(void* data, void* user_data);
|
||||
static gint render_thread_sort(gconstpointer a, gconstpointer b, gpointer data);
|
||||
static void color2double(const GdkColor* col, double* v);
|
||||
static ssize_t page_cache_lru_invalidate(ZathuraRenderer* renderer);
|
||||
static void page_cache_invalidate_all(ZathuraRenderer* renderer);
|
||||
static bool page_cache_is_full(ZathuraRenderer* renderer, bool* result);
|
||||
|
@ -43,10 +43,8 @@ typedef struct private_s {
|
|||
bool enabled;
|
||||
bool hue;
|
||||
|
||||
double light[3];
|
||||
GdkColor light_gdk;
|
||||
double dark[3];
|
||||
GdkColor dark_gdk;
|
||||
GdkRGBA light;
|
||||
GdkRGBA dark;
|
||||
} recolor;
|
||||
|
||||
/*
|
||||
|
@ -317,22 +315,16 @@ zathura_renderer_enable_recolor_hue(ZathuraRenderer* renderer, bool enable)
|
|||
|
||||
void
|
||||
zathura_renderer_set_recolor_colors(ZathuraRenderer* renderer,
|
||||
const GdkColor* light, const GdkColor* dark)
|
||||
const GdkRGBA* light, const GdkRGBA* dark)
|
||||
{
|
||||
g_return_if_fail(ZATHURA_IS_RENDERER(renderer));
|
||||
|
||||
private_t* priv = GET_PRIVATE(renderer);
|
||||
if (light != NULL) {
|
||||
priv->recolor.light_gdk.red = light->red;
|
||||
priv->recolor.light_gdk.blue = light->blue;
|
||||
priv->recolor.light_gdk.green = light->green;
|
||||
color2double(light, priv->recolor.light);
|
||||
memcpy(&priv->recolor.light, light, sizeof(GdkRGBA));
|
||||
}
|
||||
if (dark != NULL) {
|
||||
priv->recolor.dark_gdk.red = dark->red;
|
||||
priv->recolor.dark_gdk.blue = dark->blue;
|
||||
priv->recolor.dark_gdk.green = dark->green;
|
||||
color2double(dark, priv->recolor.dark);
|
||||
memcpy(&priv->recolor.dark, dark, sizeof(GdkRGBA));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -343,33 +335,29 @@ zathura_renderer_set_recolor_colors_str(ZathuraRenderer* renderer,
|
|||
g_return_if_fail(ZATHURA_IS_RENDERER(renderer));
|
||||
|
||||
if (dark != NULL) {
|
||||
GdkColor color;
|
||||
gdk_color_parse(dark, &color);
|
||||
GdkRGBA color;
|
||||
gdk_rgba_parse(&color, dark);
|
||||
zathura_renderer_set_recolor_colors(renderer, NULL, &color);
|
||||
}
|
||||
if (light != NULL) {
|
||||
GdkColor color;
|
||||
gdk_color_parse(light, &color);
|
||||
GdkRGBA color;
|
||||
gdk_rgba_parse(&color, light);
|
||||
zathura_renderer_set_recolor_colors(renderer, &color, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
zathura_renderer_get_recolor_colors(ZathuraRenderer* renderer,
|
||||
GdkColor* light, GdkColor* dark)
|
||||
GdkRGBA* light, GdkRGBA* dark)
|
||||
{
|
||||
g_return_if_fail(ZATHURA_IS_RENDERER(renderer));
|
||||
|
||||
private_t* priv = GET_PRIVATE(renderer);
|
||||
if (light != NULL) {
|
||||
light->red = priv->recolor.light_gdk.red;
|
||||
light->blue = priv->recolor.light_gdk.blue;
|
||||
light->green = priv->recolor.light_gdk.green;
|
||||
memcpy(light, &priv->recolor.light, sizeof(GdkRGBA));
|
||||
}
|
||||
if (dark != NULL) {
|
||||
dark->red = priv->recolor.dark_gdk.red;
|
||||
dark->blue = priv->recolor.dark_gdk.blue;
|
||||
dark->green = priv->recolor.dark_gdk.green;
|
||||
memcpy(dark, &priv->recolor.dark, sizeof(GdkRGBA));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -503,31 +491,23 @@ emit_completed_signal(void* data)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
color2double(const GdkColor* col, double* v)
|
||||
{
|
||||
v[0] = (double) col->red / 65535.;
|
||||
v[1] = (double) col->green / 65535.;
|
||||
v[2] = (double) col->blue / 65535.;
|
||||
}
|
||||
|
||||
/* Returns the maximum possible saturation for given h and l.
|
||||
Assumes that l is in the interval l1, l2 and corrects the value to
|
||||
force u=0 on l1 and l2 */
|
||||
static double
|
||||
colorumax(const double* h, double l, double l1, double l2)
|
||||
{
|
||||
double u, uu, v, vv, lv;
|
||||
if (h[0] == 0 && h[1] == 0 && h[2] == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
lv = (l - l1)/(l2 - l1); /* Remap l to the whole interval 0,1 */
|
||||
u = v = 1000000;
|
||||
const double lv = (l - l1)/(l2 - l1); /* Remap l to the whole interval 0,1 */
|
||||
double u = 1000000;
|
||||
double v = u;
|
||||
for (int k = 0; k < 3; k++) {
|
||||
if (h[k] > 0) {
|
||||
uu = fabs((1-l)/h[k]);
|
||||
vv = fabs((1-lv)/h[k]);
|
||||
const double uu = fabs((1-l)/h[k]);
|
||||
const double vv = fabs((1-lv)/h[k]);
|
||||
|
||||
if (uu < u) {
|
||||
u = uu;
|
||||
|
@ -536,8 +516,8 @@ colorumax(const double* h, double l, double l1, double l2)
|
|||
v = vv;
|
||||
}
|
||||
} else if (h[k] < 0) {
|
||||
uu = fabs(l/h[k]);
|
||||
vv = fabs(lv/h[k]);
|
||||
const double uu = fabs(l/h[k]);
|
||||
const double vv = fabs(lv/h[k]);
|
||||
|
||||
if (uu < u) {
|
||||
u = uu;
|
||||
|
@ -575,13 +555,13 @@ recolor(private_t* priv, unsigned int page_width, unsigned int page_height,
|
|||
|
||||
#define rgb1 priv->recolor.dark
|
||||
#define rgb2 priv->recolor.light
|
||||
const double l1 = (a[0]*rgb1[0] + a[1]*rgb1[1] + a[2]*rgb1[2]);
|
||||
const double l2 = (a[0]*rgb2[0] + a[1]*rgb2[1] + a[2]*rgb2[2]);
|
||||
const double l1 = a[0]*rgb1.red + a[1]*rgb1.green + a[2]*rgb1.blue;
|
||||
const double l2 = a[0]*rgb2.red + a[1]*rgb2.green + a[2]*rgb2.blue;
|
||||
|
||||
const double rgb_diff[] = {
|
||||
rgb2[0] - rgb1[0],
|
||||
rgb2[1] - rgb1[1],
|
||||
rgb2[2] - rgb1[2]
|
||||
rgb2.red - rgb1.red,
|
||||
rgb2.green - rgb1.green,
|
||||
rgb2.blue - rgb1.blue
|
||||
};
|
||||
|
||||
for (unsigned int y = 0; y < page_height; y++) {
|
||||
|
@ -626,9 +606,9 @@ recolor(private_t* priv, unsigned int page_width, unsigned int page_height,
|
|||
} else {
|
||||
/* linear interpolation between dark and light with color ligtness as
|
||||
* a parameter */
|
||||
data[2] = (unsigned char)round(255.*(l * rgb_diff[0] + rgb1[0]));
|
||||
data[1] = (unsigned char)round(255.*(l * rgb_diff[1] + rgb1[1]));
|
||||
data[0] = (unsigned char)round(255.*(l * rgb_diff[2] + rgb1[2]));
|
||||
data[2] = (unsigned char)round(255.*(l * rgb_diff[0] + rgb1.red));
|
||||
data[1] = (unsigned char)round(255.*(l * rgb_diff[1] + rgb1.green));
|
||||
data[0] = (unsigned char)round(255.*(l * rgb_diff[2] + rgb1.blue));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
4
render.h
4
render.h
|
@ -78,7 +78,7 @@ void zathura_renderer_enable_recolor_hue(ZathuraRenderer* renderer,
|
|||
* @param dark dark color
|
||||
*/
|
||||
void zathura_renderer_set_recolor_colors(ZathuraRenderer* renderer,
|
||||
const GdkColor* light, const GdkColor* dark);
|
||||
const GdkRGBA* light, const GdkRGBA* dark);
|
||||
/**
|
||||
* Set light and dark colors for recoloring.
|
||||
* @param renderer a renderer object
|
||||
|
@ -94,7 +94,7 @@ void zathura_renderer_set_recolor_colors_str(ZathuraRenderer* renderer,
|
|||
* @param dark dark color
|
||||
*/
|
||||
void zathura_renderer_get_recolor_colors(ZathuraRenderer* renderer,
|
||||
GdkColor* light, GdkColor* dark);
|
||||
GdkRGBA* light, GdkRGBA* dark);
|
||||
/**
|
||||
* Stop rendering.
|
||||
* @param renderer a render object
|
||||
|
|
80
shortcuts.c
80
shortcuts.c
|
@ -491,17 +491,43 @@ sc_scroll(girara_session_t* session, girara_argument_t* argument,
|
|||
return false;
|
||||
}
|
||||
|
||||
/* if TOP or BOTTOM, go there and we are done */
|
||||
if (argument->n == TOP) {
|
||||
position_set(zathura, -1, 0);
|
||||
return false;
|
||||
} else if (argument->n == BOTTOM) {
|
||||
position_set(zathura, -1, 1.0);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Retrieve current page and position */
|
||||
const unsigned int page_id = zathura_document_get_current_page_number(zathura->document);
|
||||
double pos_x = zathura_document_get_position_x(zathura->document);
|
||||
double pos_y = zathura_document_get_position_y(zathura->document);
|
||||
|
||||
/* If PAGE_TOP or PAGE_BOTTOM, go there and we are done */
|
||||
if (argument->n == PAGE_TOP) {
|
||||
double dontcare = 0.5;
|
||||
page_number_to_position(zathura->document, page_id, dontcare, 0.0, &dontcare, &pos_y);
|
||||
position_set(zathura, pos_x, pos_y);
|
||||
return false;
|
||||
} else if (argument->n == PAGE_BOTTOM) {
|
||||
double dontcare = 0.5;
|
||||
page_number_to_position(zathura->document, page_id, dontcare, 1.0, &dontcare, &pos_y);
|
||||
position_set(zathura, pos_x, pos_y);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (t == 0) {
|
||||
t = 1;
|
||||
}
|
||||
|
||||
unsigned int view_width=0, view_height=0;
|
||||
unsigned int view_width = 0;
|
||||
unsigned int view_height = 0;
|
||||
zathura_document_get_viewport_size(zathura->document, &view_height, &view_width);
|
||||
|
||||
unsigned int cell_width=0, cell_height=0;
|
||||
zathura_document_get_cell_size(zathura->document, &cell_height, &cell_width);
|
||||
|
||||
unsigned int doc_width=0, doc_height=0;
|
||||
unsigned int doc_width = 0;
|
||||
unsigned int doc_height = 0;
|
||||
zathura_document_get_document_size(zathura->document, &doc_height, &doc_width);
|
||||
|
||||
float scroll_step = 40;
|
||||
|
@ -519,36 +545,18 @@ sc_scroll(girara_session_t* session, girara_argument_t* argument,
|
|||
bool scroll_wrap = false;
|
||||
girara_setting_get(session, "scroll-wrap", &scroll_wrap);
|
||||
|
||||
int padding = 1;
|
||||
girara_setting_get(session, "page-padding", &padding);
|
||||
|
||||
double pos_x = zathura_document_get_position_x(zathura->document);
|
||||
double pos_y = zathura_document_get_position_y(zathura->document);
|
||||
double page_id = zathura_document_get_current_page_number(zathura->document);
|
||||
double direction = 1.0;
|
||||
|
||||
/* if TOP or BOTTOM, go there and we are done */
|
||||
if (argument->n == TOP) {
|
||||
position_set(zathura, -1, 0);
|
||||
return false;
|
||||
} else if (argument->n == BOTTOM) {
|
||||
position_set(zathura, -1, 1.0);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* compute the direction of scrolling */
|
||||
if ( (argument->n == LEFT) || (argument->n == FULL_LEFT) || (argument->n == HALF_LEFT) ||
|
||||
(argument->n == UP) || (argument->n == FULL_UP) || (argument->n == HALF_UP)) {
|
||||
double direction = 1.0;
|
||||
if ((argument->n == LEFT) || (argument->n == FULL_LEFT) || (argument->n == HALF_LEFT) ||
|
||||
(argument->n == UP) || (argument->n == FULL_UP) || (argument->n == HALF_UP)) {
|
||||
direction = -1.0;
|
||||
} else {
|
||||
direction = 1.0;
|
||||
}
|
||||
|
||||
double vstep = (double)(cell_height + padding) / (double)doc_height;
|
||||
double hstep = (double)(cell_width + padding) / (double)doc_width;
|
||||
const double vstep = (double)view_height / (double)doc_height;
|
||||
const double hstep = (double)view_width / (double)doc_width;
|
||||
|
||||
/* compute new position */
|
||||
switch(argument->n) {
|
||||
switch (argument->n) {
|
||||
case FULL_UP:
|
||||
case FULL_DOWN:
|
||||
pos_y += direction * (1.0 - scroll_full_overlap) * vstep;
|
||||
|
@ -581,11 +589,11 @@ sc_scroll(girara_session_t* session, girara_argument_t* argument,
|
|||
}
|
||||
|
||||
/* handle boundaries */
|
||||
double end_x = 0.5 * (double)view_width / (double)doc_width;
|
||||
double end_y = 0.5 * (double)view_height / (double)doc_height;
|
||||
const double end_x = 0.5 * (double)view_width / (double)doc_width;
|
||||
const double end_y = 0.5 * (double)view_height / (double)doc_height;
|
||||
|
||||
double new_x = scroll_wrap ? 1.0 - end_x : end_x;
|
||||
double new_y = scroll_wrap ? 1.0 - end_y : end_y;
|
||||
const double new_x = scroll_wrap ? 1.0 - end_x : end_x;
|
||||
const double new_y = scroll_wrap ? 1.0 - end_y : end_y;
|
||||
|
||||
if (pos_x < end_x) {
|
||||
pos_x = new_x;
|
||||
|
@ -600,9 +608,9 @@ sc_scroll(girara_session_t* session, girara_argument_t* argument,
|
|||
}
|
||||
|
||||
/* snap to the border if we change page */
|
||||
double dummy;
|
||||
unsigned int new_page_id = position_to_page_number(zathura->document, pos_x, pos_y);
|
||||
const unsigned int new_page_id = position_to_page_number(zathura->document, pos_x, pos_y);
|
||||
if (scroll_page_aware == true && page_id != new_page_id) {
|
||||
double dummy = 0.0;
|
||||
switch(argument->n) {
|
||||
case FULL_LEFT:
|
||||
case HALF_LEFT:
|
||||
|
@ -1308,7 +1316,7 @@ sc_zoom(girara_session_t* session, girara_argument_t* argument, girara_event_t*
|
|||
|
||||
zathura_document_set_adjust_mode(zathura->document, ZATHURA_ADJUST_NONE);
|
||||
|
||||
/* retreive zoom step value */
|
||||
/* retrieve zoom step value */
|
||||
int value = 1;
|
||||
girara_setting_get(zathura->ui.session, "zoom-step", &value);
|
||||
|
||||
|
|
295
synctex-dbus.c
Normal file
295
synctex-dbus.c
Normal file
|
@ -0,0 +1,295 @@
|
|||
/* See LICENSE file for license and copyright information */
|
||||
|
||||
#include "synctex-dbus.h"
|
||||
#include "synctex.h"
|
||||
#include "macros.h"
|
||||
#include "zathura.h"
|
||||
#include "document.h"
|
||||
#include <girara/utils.h>
|
||||
#include <gio/gio.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
G_DEFINE_TYPE(ZathuraSynctexDbus, zathura_synctex_dbus, G_TYPE_OBJECT)
|
||||
|
||||
/* template for bus name */
|
||||
static const char DBUS_NAME_TEMPLATE[] = "org.pwmt.zathura.PID-%d";
|
||||
/* object path */
|
||||
static const char DBUS_OBJPATH[] = "/org/pwmt/zathura/synctex";
|
||||
/* interface name */
|
||||
static const char DBUS_INTERFACE[] = "org.pwmt.zathura.synctex";
|
||||
|
||||
typedef struct private_s {
|
||||
zathura_t* zathura;
|
||||
GDBusNodeInfo* introspection_data;
|
||||
GDBusConnection* connection;
|
||||
guint owner_id;
|
||||
guint registration_id;
|
||||
} private_t;
|
||||
|
||||
#define GET_PRIVATE(obj) \
|
||||
(G_TYPE_INSTANCE_GET_PRIVATE((obj), ZATHURA_TYPE_SYNCTEX_DBUS, \
|
||||
private_t))
|
||||
|
||||
/* Introspection data for the service we are exporting */
|
||||
static const char SYNCTEX_DBUS_INTROSPECTION[] =
|
||||
"<node>\n"
|
||||
" <interface name='org.pwmt.zathura.synctex'>\n"
|
||||
" <method name='View'>\n"
|
||||
" <arg type='s' name='position' direction='in' />\n"
|
||||
" <arg type='b' name='return' direction='out' />\n"
|
||||
" </method>\n"
|
||||
" <property type='s' name='filename' access='read' />\n"
|
||||
" </interface>\n"
|
||||
"</node>";
|
||||
|
||||
static const GDBusInterfaceVTable interface_vtable;
|
||||
|
||||
static void
|
||||
finalize(GObject* object)
|
||||
{
|
||||
ZathuraSynctexDbus* synctex_dbus = ZATHURA_SYNCTEX_DBUS(object);
|
||||
private_t* priv = GET_PRIVATE(synctex_dbus);
|
||||
|
||||
if (priv->connection != NULL && priv->registration_id > 0) {
|
||||
g_dbus_connection_unregister_object(priv->connection, priv->registration_id);
|
||||
}
|
||||
|
||||
if (priv->owner_id > 0) {
|
||||
g_bus_unown_name(priv->owner_id);
|
||||
}
|
||||
|
||||
if (priv->introspection_data != NULL) {
|
||||
g_dbus_node_info_unref(priv->introspection_data);
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS(zathura_synctex_dbus_parent_class)->finalize(object);
|
||||
}
|
||||
|
||||
static void
|
||||
zathura_synctex_dbus_class_init(ZathuraSynctexDbusClass* class)
|
||||
{
|
||||
/* add private members */
|
||||
g_type_class_add_private(class, sizeof(private_t));
|
||||
|
||||
/* overwrite methods */
|
||||
GObjectClass* object_class = G_OBJECT_CLASS(class);
|
||||
object_class->finalize = finalize;
|
||||
}
|
||||
|
||||
static void
|
||||
zathura_synctex_dbus_init(ZathuraSynctexDbus* synctex_dbus)
|
||||
{
|
||||
private_t* priv = GET_PRIVATE(synctex_dbus);
|
||||
priv->zathura = NULL;
|
||||
priv->introspection_data = NULL;
|
||||
priv->connection = NULL;
|
||||
priv->owner_id = 0;
|
||||
priv->registration_id = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
bus_acquired(GDBusConnection* connection, const gchar* name, void* data)
|
||||
{
|
||||
girara_debug("Bus acquired at '%s'.", name);
|
||||
|
||||
ZathuraSynctexDbus* dbus = data;
|
||||
private_t* priv = GET_PRIVATE(dbus);
|
||||
|
||||
GError* error = NULL;
|
||||
priv->registration_id = g_dbus_connection_register_object(connection,
|
||||
DBUS_OBJPATH, priv->introspection_data->interfaces[0],
|
||||
&interface_vtable, dbus, NULL, &error);
|
||||
|
||||
if (priv->registration_id == 0) {
|
||||
girara_warning("Failed to register object on D-Bus connection: %s",
|
||||
error->message);
|
||||
g_error_free(error);
|
||||
return;
|
||||
}
|
||||
|
||||
priv->connection = connection;
|
||||
}
|
||||
|
||||
static void
|
||||
name_acquired(GDBusConnection* UNUSED(connection), const gchar* name,
|
||||
void* UNUSED(data))
|
||||
{
|
||||
girara_debug("Acquired '%s' on session bus.", name);
|
||||
}
|
||||
|
||||
static void
|
||||
name_lost(GDBusConnection* UNUSED(connection), const gchar* name,
|
||||
void* UNUSED(data))
|
||||
{
|
||||
girara_debug("Lost connection or failed to acquire '%s' on session bus.",
|
||||
name);
|
||||
}
|
||||
|
||||
ZathuraSynctexDbus*
|
||||
zathura_synctex_dbus_new(zathura_t* zathura)
|
||||
{
|
||||
GObject* obj = g_object_new(ZATHURA_TYPE_SYNCTEX_DBUS, NULL);
|
||||
if (obj == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ZathuraSynctexDbus* synctex_dbus = ZATHURA_SYNCTEX_DBUS(obj);
|
||||
private_t* priv = GET_PRIVATE(synctex_dbus);
|
||||
priv->zathura = zathura;
|
||||
|
||||
GError* error = NULL;
|
||||
priv->introspection_data = g_dbus_node_info_new_for_xml(SYNCTEX_DBUS_INTROSPECTION, &error);
|
||||
if (priv->introspection_data == NULL) {
|
||||
girara_warning("Failed to parse introspection data: %s", error->message);
|
||||
g_error_free(error);
|
||||
g_object_unref(obj);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char* well_known_name = g_strdup_printf(DBUS_NAME_TEMPLATE, getpid());
|
||||
priv->owner_id = g_bus_own_name(G_BUS_TYPE_SESSION,
|
||||
well_known_name, G_BUS_NAME_OWNER_FLAGS_NONE, bus_acquired,
|
||||
name_acquired, name_lost, synctex_dbus, NULL);
|
||||
g_free(well_known_name);
|
||||
|
||||
return synctex_dbus;
|
||||
}
|
||||
|
||||
/* D-Bus handler */
|
||||
|
||||
static void
|
||||
handle_method_call(GDBusConnection* UNUSED(connection),
|
||||
const gchar* UNUSED(sender), const gchar* UNUSED(object_path),
|
||||
const gchar* UNUSED(interface_name),
|
||||
const gchar* method_name, GVariant* parameters,
|
||||
GDBusMethodInvocation* invocation, void* data)
|
||||
{
|
||||
ZathuraSynctexDbus* synctex_dbus = data;
|
||||
private_t* priv = GET_PRIVATE(synctex_dbus);
|
||||
|
||||
if (g_strcmp0(method_name, "View") == 0) {
|
||||
gchar* position = NULL;
|
||||
g_variant_get(parameters, "(s)", &position);
|
||||
|
||||
const bool ret = synctex_view(priv->zathura, position);
|
||||
g_free(position);
|
||||
|
||||
GVariant* result = g_variant_new("(b)", ret);
|
||||
g_dbus_method_invocation_return_value(invocation, result);
|
||||
}
|
||||
}
|
||||
|
||||
static GVariant*
|
||||
handle_get_property(GDBusConnection* UNUSED(connection),
|
||||
const gchar* UNUSED(sender), const gchar* UNUSED(object_path),
|
||||
const gchar* UNUSED(interface_name), const gchar* property_name,
|
||||
GError** UNUSED(error), void* data)
|
||||
{
|
||||
ZathuraSynctexDbus* synctex_dbus = data;
|
||||
private_t* priv = GET_PRIVATE(synctex_dbus);
|
||||
|
||||
if (g_strcmp0(property_name, "filename") == 0) {
|
||||
return g_variant_new_string(zathura_document_get_path(priv->zathura->document));
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const GDBusInterfaceVTable interface_vtable =
|
||||
{
|
||||
.method_call = handle_method_call,
|
||||
.get_property = handle_get_property,
|
||||
.set_property = NULL
|
||||
};
|
||||
|
||||
static const unsigned int TIMEOUT = 3000;
|
||||
|
||||
bool
|
||||
synctex_forward_position(const char* filename, const char* position)
|
||||
{
|
||||
if (filename == NULL || position == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
GError* error = NULL;
|
||||
GDBusConnection* connection = g_bus_get_sync(G_BUS_TYPE_SESSION,
|
||||
NULL, &error);
|
||||
/* GDBusProxy* proxy = g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SESSION,
|
||||
G_DBUS_PROXY_FLAGS_NONE, NULL, "org.freedesktop.DBus",
|
||||
"/org/freedesktop/DBus", "org.freedesktop.DBus", NULL, &error); */
|
||||
if (connection == NULL) {
|
||||
girara_error("Could not create proxy for 'org.freedesktop.DBus': %s",
|
||||
error->message);
|
||||
g_error_free(error);
|
||||
return false;
|
||||
}
|
||||
|
||||
GVariant* vnames = g_dbus_connection_call_sync(connection,
|
||||
"org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus",
|
||||
"ListNames", NULL, G_VARIANT_TYPE("(as)"), G_DBUS_CALL_FLAGS_NONE,
|
||||
TIMEOUT, NULL, &error);
|
||||
if (vnames == NULL) {
|
||||
girara_error("Could not list available names: %s", error->message);
|
||||
g_error_free(error);
|
||||
// g_object_unref(proxy);
|
||||
g_object_unref(connection);
|
||||
return false;
|
||||
}
|
||||
|
||||
GVariantIter* iter = NULL;
|
||||
g_variant_get(vnames, "(as)", &iter);
|
||||
|
||||
gchar* name = NULL;
|
||||
bool found_one = false;
|
||||
while (g_variant_iter_loop(iter, "s", &name) == TRUE) {
|
||||
if (g_str_has_prefix(name, "org.pwmt.zathura.PID") == FALSE) {
|
||||
continue;
|
||||
}
|
||||
girara_debug("Found name: %s", name);
|
||||
|
||||
GVariant* vfilename = g_dbus_connection_call_sync(connection,
|
||||
name, DBUS_OBJPATH, "org.freedesktop.DBus.Properties",
|
||||
"Get", g_variant_new("(ss)", DBUS_INTERFACE, "filename"),
|
||||
G_VARIANT_TYPE("(v)"), G_DBUS_CALL_FLAGS_NONE,
|
||||
TIMEOUT, NULL, &error);
|
||||
if (vfilename == NULL) {
|
||||
girara_error("Failed to query 'filename' property from '%s': %s",
|
||||
name, error->message);
|
||||
g_error_free(error);
|
||||
continue;
|
||||
}
|
||||
|
||||
GVariant* tmp = NULL;
|
||||
g_variant_get(vfilename, "(v)", &tmp);
|
||||
gchar* remote_filename = g_variant_dup_string(tmp, NULL);
|
||||
girara_debug("Filename from '%s': %s", name, remote_filename);
|
||||
g_variant_unref(tmp);
|
||||
g_variant_unref(vfilename);
|
||||
|
||||
if (g_strcmp0(filename, remote_filename) != 0) {
|
||||
g_free(remote_filename);
|
||||
continue;
|
||||
}
|
||||
|
||||
g_free(remote_filename);
|
||||
found_one = true;
|
||||
|
||||
GVariant* ret = g_dbus_connection_call_sync(connection,
|
||||
name, DBUS_OBJPATH, DBUS_INTERFACE, "View",
|
||||
g_variant_new("(s)", position), G_VARIANT_TYPE("(b)"),
|
||||
G_DBUS_CALL_FLAGS_NONE, TIMEOUT, NULL, &error);
|
||||
if (ret == NULL) {
|
||||
girara_error("Failed to run View on '%s': %s", name, error->message);
|
||||
g_error_free(error);
|
||||
} else {
|
||||
g_variant_unref(ret);
|
||||
}
|
||||
}
|
||||
g_variant_iter_free(iter);
|
||||
g_variant_unref(vnames);
|
||||
g_object_unref(connection);
|
||||
|
||||
return found_one;
|
||||
}
|
||||
|
52
synctex-dbus.h
Normal file
52
synctex-dbus.h
Normal file
|
@ -0,0 +1,52 @@
|
|||
/* See LICENSE file for license and copyright information */
|
||||
|
||||
#ifndef SYNCTEX_DBUS_H
|
||||
#define SYNCTEX_DBUS_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <girara/types.h>
|
||||
#include <glib-object.h>
|
||||
#include "types.h"
|
||||
|
||||
typedef struct zathura_synctex_dbus_class_s ZathuraSynctexDbusClass;
|
||||
|
||||
struct zathura_synctex_dbus_s
|
||||
{
|
||||
GObject parent;
|
||||
};
|
||||
|
||||
struct zathura_synctex_dbus_class_s
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
#define ZATHURA_TYPE_SYNCTEX_DBUS \
|
||||
(zathura_synctex_dbus_get_type())
|
||||
#define ZATHURA_SYNCTEX_DBUS(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj), ZATHURA_TYPE_SYNCTEX_DBUS, \
|
||||
ZathuraSynctexDbus))
|
||||
#define ZATHURA_SYNCTEX_DBUS_CLASS(obj) \
|
||||
(G_TYPE_CHECK_CLASS_CAST((obj), ZATHURA_TYPE_SYNCTEX_DBUS, \
|
||||
ZathuraSynctexDbus))
|
||||
#define ZATHURA_IS_SYNCTEX_DBUS(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj), ZATHURA_TYPE_SYNCTEX_DBUS))
|
||||
#define ZATHURA_IS_SYNCTEX_DBUS_CLASS(obj) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((obj), ZATHURA_TYPE_SYNCTEX_DBUS))
|
||||
#define ZATHURA_SYNCTEX_DBUS_GET_CLASS(obj) \
|
||||
(G_TYPE_INSTANCE_GET_CLASS((obj), ZATHURA_TYPE_SYNCTEX_DBUS, \
|
||||
ZathuraSynctexDbusClass))
|
||||
|
||||
GType zathura_synctex_dbus_get_type(void);
|
||||
|
||||
ZathuraSynctexDbus* zathura_synctex_dbus_new(zathura_t* zathura);
|
||||
|
||||
/**
|
||||
* Forward synctex position to zathura instance having the right file open.
|
||||
* @param filename filename
|
||||
* @param position synctex position
|
||||
* @returns true if a instance was found that has the given filename open, false
|
||||
* otherwise
|
||||
*/
|
||||
bool synctex_forward_position(const char* filename, const char* position);
|
||||
|
||||
#endif
|
47
synctex.c
47
synctex.c
|
@ -52,7 +52,6 @@ static GScannerConfig scanner_config = {
|
|||
|
||||
static void synctex_record_hits(zathura_t* zathura, int page_idx, girara_list_t* hits, bool first);
|
||||
static double scan_float(GScanner* scanner);
|
||||
static bool synctex_view(zathura_t* zathura, char* position);
|
||||
|
||||
void
|
||||
synctex_edit(zathura_t* zathura, zathura_page_t* page, int x, int y)
|
||||
|
@ -71,18 +70,19 @@ synctex_edit(zathura_t* zathura, zathura_page_t* page, int x, int y)
|
|||
return;
|
||||
}
|
||||
|
||||
int page_idx = zathura_page_get_index(page);
|
||||
char *buffer = g_strdup_printf("%d:%d:%d:%s", page_idx + 1, x, y, filename);
|
||||
|
||||
char** argv = g_malloc0(sizeof(char*) * (zathura->synctex.editor != NULL ?
|
||||
6 : 4));
|
||||
argv[0] = g_strdup("synctex");
|
||||
argv[1] = g_strdup("edit");
|
||||
argv[2] = g_strdup("-o");
|
||||
argv[3] = g_strdup_printf("%d:%d:%d:%s", zathura_page_get_index(page) + 1, x, y, filename);
|
||||
if (zathura->synctex.editor != NULL) {
|
||||
char* argv[] = {"synctex", "edit", "-o", buffer, "-x", zathura->synctex.editor, NULL};
|
||||
g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL);
|
||||
} else {
|
||||
char* argv[] = {"synctex", "edit", "-o", buffer, NULL};
|
||||
g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL);
|
||||
argv[4] = g_strdup("-x");
|
||||
argv[5] = g_strdup(zathura->synctex.editor);
|
||||
}
|
||||
|
||||
g_free(buffer);
|
||||
g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL);
|
||||
g_strfreev(argv);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -96,7 +96,7 @@ synctex_record_hits(zathura_t* zathura, int page_idx, girara_list_t* hits, bool
|
|||
g_object_set(page_widget, "draw-links", FALSE, NULL);
|
||||
g_object_set(page_widget, "search-results", hits, NULL);
|
||||
|
||||
if (first) {
|
||||
if (first == true) {
|
||||
page_set(zathura, zathura_page_get_index(page));
|
||||
g_object_set(page_widget, "search-current", 0, NULL);
|
||||
}
|
||||
|
@ -115,15 +115,26 @@ scan_float(GScanner* scanner)
|
|||
}
|
||||
}
|
||||
|
||||
static bool
|
||||
synctex_view(zathura_t* zathura, char* position)
|
||||
bool
|
||||
synctex_view(zathura_t* zathura, const char* position)
|
||||
{
|
||||
char* filename = g_strdup(zathura_document_get_path(zathura->document));
|
||||
char* argv[] = {"synctex", "view", "-i", position, "-o", filename, NULL};
|
||||
gint output;
|
||||
if (zathura->document == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ret = g_spawn_async_with_pipes(NULL, argv, NULL, G_SPAWN_SEARCH_PATH | G_SPAWN_STDERR_TO_DEV_NULL, NULL, NULL, NULL, NULL, &output, NULL, NULL);
|
||||
g_free(filename);
|
||||
char** argv = g_malloc0(sizeof(char*) * 6);
|
||||
argv[0] = g_strdup("synctex");
|
||||
argv[1] = g_strdup("view");
|
||||
argv[2] = g_strdup("-i");
|
||||
argv[3] = g_strdup(position);
|
||||
argv[4] = g_strdup("-o");
|
||||
argv[5] = g_strdup(zathura_document_get_path(zathura->document));
|
||||
|
||||
gint output;
|
||||
bool ret = g_spawn_async_with_pipes(NULL, argv, NULL,
|
||||
G_SPAWN_SEARCH_PATH | G_SPAWN_STDERR_TO_DEV_NULL, NULL, NULL, NULL, NULL,
|
||||
&output, NULL, NULL);
|
||||
g_strfreev(argv);
|
||||
|
||||
if (ret == false) {
|
||||
return false;
|
||||
|
|
|
@ -6,5 +6,6 @@
|
|||
#include "types.h"
|
||||
|
||||
void synctex_edit(zathura_t* zathura, zathura_page_t* page, int x, int y);
|
||||
bool synctex_view(zathura_t* zathura, const char* position);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -4,21 +4,6 @@
|
|||
|
||||
#include "../utils.h"
|
||||
|
||||
START_TEST(test_file_get_extension_null) {
|
||||
fail_unless(file_get_extension(NULL) == NULL, NULL);
|
||||
} END_TEST
|
||||
|
||||
START_TEST(test_file_get_extension_none) {
|
||||
const char* path = "test";
|
||||
fail_unless(file_get_extension(path) == NULL, NULL);
|
||||
} END_TEST
|
||||
|
||||
START_TEST(test_file_get_extension_single) {
|
||||
const char* path = "test.pdf";
|
||||
const char* extension = file_get_extension(path);
|
||||
fail_unless(strcmp(extension, "pdf") == 0, NULL);
|
||||
} END_TEST
|
||||
|
||||
START_TEST(test_file_valid_extension_null) {
|
||||
fail_unless(file_valid_extension(NULL, NULL) == false, NULL);
|
||||
fail_unless(file_valid_extension((void*) 0xDEAD, NULL) == false, NULL);
|
||||
|
@ -62,13 +47,6 @@ Suite* suite_utils()
|
|||
TCase* tcase = NULL;
|
||||
Suite* suite = suite_create("Utils");
|
||||
|
||||
/* file exists */
|
||||
tcase = tcase_create("file_get_extension");
|
||||
tcase_add_test(tcase, test_file_get_extension_null);
|
||||
tcase_add_test(tcase, test_file_get_extension_none);
|
||||
tcase_add_test(tcase, test_file_get_extension_single);
|
||||
suite_add_tcase(suite, tcase);
|
||||
|
||||
/* file valid extension */
|
||||
tcase = tcase_create("file_valid_extension");
|
||||
tcase_add_test(tcase, test_file_valid_extension_null);
|
||||
|
|
7
types.h
7
types.h
|
@ -33,7 +33,12 @@ typedef struct zathura_plugin_manager_s zathura_plugin_manager_t;
|
|||
/**
|
||||
* Renderer
|
||||
*/
|
||||
typedef struct zathura_renderer_s ZathuraRenderer;
|
||||
typedef struct zathura_renderer_s ZathuraRenderer;
|
||||
|
||||
/**
|
||||
* Synctex DBus manager
|
||||
*/
|
||||
typedef struct zathura_synctex_dbus_s ZathuraSynctexDbus;
|
||||
|
||||
/**
|
||||
* Error types
|
||||
|
|
145
utils.c
145
utils.c
|
@ -9,9 +9,10 @@
|
|||
#include <sys/wait.h>
|
||||
#include <math.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <girara/datastructures.h>
|
||||
#include <girara/session.h>
|
||||
#include <girara/utils.h>
|
||||
#include <girara/settings.h>
|
||||
#include <girara/utils.h>
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
#include "links.h"
|
||||
|
@ -22,25 +23,6 @@
|
|||
#include "page.h"
|
||||
#include "plugin.h"
|
||||
|
||||
#include <girara/datastructures.h>
|
||||
|
||||
#define BLOCK_SIZE 64
|
||||
|
||||
const char*
|
||||
file_get_extension(const char* path)
|
||||
{
|
||||
if (path == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char* res = strrchr(path, '.');
|
||||
if (res == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return res + 1;
|
||||
}
|
||||
|
||||
bool
|
||||
file_valid_extension(zathura_t* zathura, const char* path)
|
||||
{
|
||||
|
@ -59,82 +41,6 @@ file_valid_extension(zathura_t* zathura, const char* path)
|
|||
return (plugin == NULL) ? false : true;
|
||||
}
|
||||
|
||||
bool
|
||||
execute_command(char* const argv[], char** output)
|
||||
{
|
||||
if (!output) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int p[2];
|
||||
if (pipe(p)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
pid_t pid = fork();
|
||||
|
||||
if (pid == -1) { // failure
|
||||
return false;
|
||||
} else if (pid == 0) { // child
|
||||
dup2(p[1], 1);
|
||||
close(p[0]);
|
||||
|
||||
if (execvp(argv[0], argv) == -1) {
|
||||
return false;
|
||||
}
|
||||
} else { // parent
|
||||
dup2(p[0], 0);
|
||||
close(p[1]);
|
||||
|
||||
/* read output */
|
||||
unsigned int bc = BLOCK_SIZE;
|
||||
unsigned int i = 0;
|
||||
char* buffer = malloc(sizeof(char) * bc);
|
||||
*output = NULL;
|
||||
|
||||
if (!buffer) {
|
||||
close(p[0]);
|
||||
return false;
|
||||
}
|
||||
|
||||
char c;
|
||||
while (1 == read(p[0], &c, 1)) {
|
||||
buffer[i++] = c;
|
||||
|
||||
if (i == bc) {
|
||||
bc += BLOCK_SIZE;
|
||||
char* tmp = realloc(buffer, sizeof(char) * bc);
|
||||
|
||||
if (!tmp) {
|
||||
free(buffer);
|
||||
close(p[0]);
|
||||
return false;
|
||||
}
|
||||
|
||||
buffer = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
char* tmp = realloc(buffer, sizeof(char) * (bc + 1));
|
||||
if (!tmp) {
|
||||
free(buffer);
|
||||
close(p[0]);
|
||||
return false;
|
||||
}
|
||||
|
||||
buffer = tmp;
|
||||
buffer[i] = '\0';
|
||||
|
||||
*output = buffer;
|
||||
|
||||
/* wait for child to terminate */
|
||||
waitpid(pid, NULL, 0);
|
||||
close(p[0]);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
document_index_build(GtkTreeModel* model, GtkTreeIter* parent,
|
||||
girara_tree_node_t* tree)
|
||||
|
@ -166,17 +72,6 @@ document_index_build(GtkTreeModel* model, GtkTreeIter* parent,
|
|||
GIRARA_LIST_FOREACH_END(list, gchar*, iter, name);
|
||||
}
|
||||
|
||||
void
|
||||
page_calculate_offset(zathura_t* zathura, zathura_page_t* page, page_offset_t* offset)
|
||||
{
|
||||
g_return_if_fail(page != NULL);
|
||||
g_return_if_fail(offset != NULL);
|
||||
GtkWidget* widget = zathura_page_get_widget(zathura, page);
|
||||
|
||||
g_return_if_fail(gtk_widget_translate_coordinates(widget,
|
||||
zathura->ui.page_widget, 0, 0, &(offset->x), &(offset->y)) == true);
|
||||
}
|
||||
|
||||
zathura_rectangle_t
|
||||
rotate_rectangle(zathura_rectangle_t rectangle, unsigned int degree, double height, double width)
|
||||
{
|
||||
|
@ -315,7 +210,7 @@ replace_substring(const char* string, const char* old, const char* new)
|
|||
size_t old_len = strlen(old);
|
||||
size_t new_len = strlen(new);
|
||||
|
||||
/* count occurences */
|
||||
/* count occurrences */
|
||||
unsigned int count = 0;
|
||||
unsigned int i = 0;
|
||||
|
||||
|
@ -349,26 +244,26 @@ replace_substring(const char* string, const char* old, const char* new)
|
|||
|
||||
GdkAtom* get_selection(zathura_t* zathura)
|
||||
{
|
||||
g_return_val_if_fail(zathura != NULL, NULL);
|
||||
g_return_val_if_fail(zathura != NULL, NULL);
|
||||
|
||||
char* value;
|
||||
girara_setting_get(zathura->ui.session, "selection-clipboard", &value);
|
||||
char* value;
|
||||
girara_setting_get(zathura->ui.session, "selection-clipboard", &value);
|
||||
|
||||
GdkAtom* selection = g_malloc(sizeof(GdkAtom));
|
||||
|
||||
if (strcmp(value, "primary") == 0) {
|
||||
*selection = GDK_SELECTION_PRIMARY;
|
||||
} else if (strcmp(value, "clipboard") == 0) {
|
||||
*selection = GDK_SELECTION_CLIPBOARD;
|
||||
} else {
|
||||
girara_error("Invalid value for the selection-clipboard setting");
|
||||
g_free(value);
|
||||
g_free(selection);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
GdkAtom* selection = g_malloc(sizeof(GdkAtom));
|
||||
|
||||
if (strcmp(value, "primary") == 0) {
|
||||
*selection = GDK_SELECTION_PRIMARY;
|
||||
} else if (strcmp(value, "clipboard") == 0) {
|
||||
*selection = GDK_SELECTION_CLIPBOARD;
|
||||
} else {
|
||||
girara_error("Invalid value for the selection-clipboard setting");
|
||||
g_free(value);
|
||||
g_free(selection);
|
||||
|
||||
return selection;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
g_free(value);
|
||||
|
||||
return selection;
|
||||
}
|
||||
|
|
28
utils.h
28
utils.h
|
@ -17,14 +17,6 @@ typedef struct page_offset_s
|
|||
int y;
|
||||
} page_offset_t;
|
||||
|
||||
/**
|
||||
* Returns the file extension of a path
|
||||
*
|
||||
* @param path Path to the file
|
||||
* @return The file extension or NULL
|
||||
*/
|
||||
const char* file_get_extension(const char* path);
|
||||
|
||||
/**
|
||||
* This function checks if the file has a valid extension. A extension is
|
||||
* evaluated as valid if it matches a supported filetype.
|
||||
|
@ -35,15 +27,6 @@ const char* file_get_extension(const char* path);
|
|||
*/
|
||||
bool file_valid_extension(zathura_t* zathura, const char* path);
|
||||
|
||||
/**
|
||||
* Executes a system command and saves its output into output
|
||||
*
|
||||
* @param argv The command
|
||||
* @param output Pointer where the output will be saved
|
||||
* @return true if no error occured, otherwise false
|
||||
*/
|
||||
bool execute_command(char* const argv[], char** output);
|
||||
|
||||
/**
|
||||
* Generates the document index based upon the list retreived from the document
|
||||
* object.
|
||||
|
@ -54,17 +37,6 @@ bool execute_command(char* const argv[], char** output);
|
|||
*/
|
||||
void document_index_build(GtkTreeModel* model, GtkTreeIter* parent, girara_tree_node_t* tree);
|
||||
|
||||
/**
|
||||
* Calculates the offset of the page to the top of the viewing area as
|
||||
* well as to the left side of it. The result has to be freed.
|
||||
*
|
||||
* @param zathura Zathura session
|
||||
* @param page The Page
|
||||
* @param offset Applied offset
|
||||
* @return The calculated offset or NULL if an error occured
|
||||
*/
|
||||
void page_calculate_offset(zathura_t* zathura, zathura_page_t* page, page_offset_t* offset);
|
||||
|
||||
/**
|
||||
* Rotate a rectangle by 0, 90, 180 or 270 degree
|
||||
*
|
||||
|
|
|
@ -14,6 +14,7 @@ SYNOPOSIS
|
|||
=========
|
||||
| zathura [OPTION]...
|
||||
| zathura [OPTION]... FILE [FILE ...]
|
||||
| zathura --syntex-forward INPUT FILE
|
||||
|
||||
DESCRIPTION
|
||||
===========
|
||||
|
@ -58,11 +59,17 @@ OPTIONS
|
|||
-x [cmd], --synctex-editor-command [cmd]
|
||||
Set the synctex editor command
|
||||
|
||||
--syntex-forward [input],
|
||||
Jump to the given position. The switch expcects the same format as specified
|
||||
for syntex's view -i.
|
||||
|
||||
MOUSE AND KEY BINDINGS
|
||||
======================
|
||||
|
||||
J, K
|
||||
Go to the next or previous page
|
||||
J, PgDn
|
||||
Go to the next page
|
||||
K, PgUp
|
||||
Go to the previous page
|
||||
h, k, j, l
|
||||
Scroll to the left, down, up or right direction
|
||||
Left, Down, Up, Right
|
||||
|
@ -73,6 +80,8 @@ t, ^f, ^b, space, <S-space>, y
|
|||
Scroll a full page left, down, up or right
|
||||
gg, G, nG
|
||||
Goto to the first, the last or to the nth page
|
||||
H, L
|
||||
Goto top or bottom of the current page
|
||||
^o, ^i
|
||||
Move backward and forward through the jump list
|
||||
^j, ^k
|
||||
|
|
84
zathura.c
84
zathura.c
|
@ -34,6 +34,7 @@
|
|||
#include "page-widget.h"
|
||||
#include "plugin.h"
|
||||
#include "adjustment.h"
|
||||
#include "synctex-dbus.h"
|
||||
|
||||
typedef struct zathura_document_info_s {
|
||||
zathura_t* zathura;
|
||||
|
@ -100,26 +101,7 @@ zathura_init(zathura_t* zathura)
|
|||
|
||||
/* configuration */
|
||||
config_load_default(zathura);
|
||||
|
||||
/* load global configuration files */
|
||||
char* config_path = girara_get_xdg_path(XDG_CONFIG_DIRS);
|
||||
girara_list_t* config_dirs = girara_split_path_array(config_path);
|
||||
ssize_t size = girara_list_size(config_dirs) - 1;
|
||||
for (; size >= 0; --size) {
|
||||
const char* dir = girara_list_nth(config_dirs, size);
|
||||
char* file = g_build_filename(dir, ZATHURA_RC, NULL);
|
||||
config_load_file(zathura, file);
|
||||
g_free(file);
|
||||
}
|
||||
girara_list_free(config_dirs);
|
||||
g_free(config_path);
|
||||
|
||||
config_load_file(zathura, GLOBAL_RC);
|
||||
|
||||
/* load local configuration files */
|
||||
char* configuration_file = g_build_filename(zathura->config.config_dir, ZATHURA_RC, NULL);
|
||||
config_load_file(zathura, configuration_file);
|
||||
g_free(configuration_file);
|
||||
config_load_files(zathura);
|
||||
|
||||
/* UI */
|
||||
if (girara_session_init(zathura->ui.session, "zathura") == false) {
|
||||
|
@ -146,13 +128,9 @@ zathura_init(zathura_t* zathura)
|
|||
G_CALLBACK(cb_refresh_view), zathura);
|
||||
|
||||
/* page view */
|
||||
#if (GTK_MAJOR_VERSION == 3)
|
||||
zathura->ui.page_widget = gtk_grid_new();
|
||||
gtk_grid_set_row_homogeneous(GTK_GRID(zathura->ui.page_widget), TRUE);
|
||||
gtk_grid_set_column_homogeneous(GTK_GRID(zathura->ui.page_widget), TRUE);
|
||||
#else
|
||||
zathura->ui.page_widget = gtk_table_new(0, 0, TRUE);
|
||||
#endif
|
||||
if (zathura->ui.page_widget == NULL) {
|
||||
goto error_free;
|
||||
}
|
||||
|
@ -184,13 +162,10 @@ zathura_init(zathura_t* zathura)
|
|||
}
|
||||
gtk_container_add(GTK_CONTAINER(zathura->ui.page_widget_alignment), zathura->ui.page_widget);
|
||||
|
||||
#if (GTK_MAJOR_VERSION == 3)
|
||||
gtk_widget_set_hexpand_set(zathura->ui.page_widget_alignment, TRUE);
|
||||
gtk_widget_set_hexpand(zathura->ui.page_widget_alignment, FALSE);
|
||||
gtk_widget_set_vexpand_set(zathura->ui.page_widget_alignment, TRUE);
|
||||
gtk_widget_set_vexpand(zathura->ui.page_widget_alignment, FALSE);
|
||||
#endif
|
||||
|
||||
|
||||
gtk_widget_show(zathura->ui.page_widget);
|
||||
|
||||
|
@ -325,11 +300,7 @@ zathura_free(zathura_t* zathura)
|
|||
}
|
||||
|
||||
void
|
||||
#if (GTK_MAJOR_VERSION == 2)
|
||||
zathura_set_xid(zathura_t* zathura, GdkNativeWindow xid)
|
||||
#else
|
||||
zathura_set_xid(zathura_t* zathura, Window xid)
|
||||
#endif
|
||||
{
|
||||
g_return_if_fail(zathura != NULL);
|
||||
|
||||
|
@ -547,8 +518,17 @@ document_open(zathura_t* zathura, const char* path, const char* password,
|
|||
}
|
||||
|
||||
/* read history file */
|
||||
zathura_fileinfo_t file_info = { 0, 0, 1, 0, 0, 0, 0, 0 };
|
||||
bool known_file = zathura_db_get_fileinfo(zathura->database, file_path, &file_info);
|
||||
zathura_fileinfo_t file_info = {
|
||||
.current_page = 0,
|
||||
.page_offset = 0,
|
||||
.scale = 1,
|
||||
.rotation = 0,
|
||||
.pages_per_row = 0,
|
||||
.first_page_column = 0,
|
||||
.position_x = 0,
|
||||
.position_y = 0
|
||||
};
|
||||
const bool known_file = zathura_db_get_fileinfo(zathura->database, file_path, &file_info);
|
||||
|
||||
/* set page offset */
|
||||
zathura_document_set_page_offset(document, file_info.page_offset);
|
||||
|
@ -788,8 +768,8 @@ document_open(zathura_t* zathura, const char* path, const char* password,
|
|||
/* adjust_view calls render_all in some cases and render_all calls
|
||||
* gtk_widget_set_size_request. To be sure that it's really called, do it
|
||||
* here once again. */
|
||||
double height = zathura_page_get_height(page);
|
||||
double width = zathura_page_get_width(page);
|
||||
const double height = zathura_page_get_height(page);
|
||||
const double width = zathura_page_get_width(page);
|
||||
page_calc_height_width(zathura->document, height, width, &page_height, &page_width, true);
|
||||
gtk_widget_set_size_request(zathura->pages[page_id], page_width, page_height);
|
||||
|
||||
|
@ -797,12 +777,22 @@ document_open(zathura_t* zathura, const char* path, const char* password,
|
|||
gtk_widget_show(zathura->pages[page_id]);
|
||||
}
|
||||
|
||||
/* set position */
|
||||
/* Set page */
|
||||
page_set(zathura, zathura_document_get_current_page_number(document));
|
||||
if (file_info.position_x != 0 || file_info.position_y != 0) {
|
||||
|
||||
/* Set position (only if restoring from history file) */
|
||||
if (file_info.current_page == zathura_document_get_current_page_number(document) &&
|
||||
(file_info.position_x != 0 || file_info.position_y != 0)) {
|
||||
position_set(zathura, file_info.position_x, file_info.position_y);
|
||||
}
|
||||
|
||||
/* Start D-Bus service for synctex forward synchronization */
|
||||
bool synctex_dbus = true;
|
||||
girara_setting_get(zathura->ui.session, "synctex-dbus-service", &synctex_dbus);
|
||||
if (synctex_dbus == true) {
|
||||
zathura->synctex.dbus = zathura_synctex_dbus_new(zathura);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
error_free:
|
||||
|
@ -885,6 +875,12 @@ document_close(zathura_t* zathura, bool keep_monitor)
|
|||
/* stop rendering */
|
||||
zathura_renderer_stop(zathura->sync.render_thread);
|
||||
|
||||
/* stop D-Bus */
|
||||
if (zathura->synctex.dbus != NULL) {
|
||||
g_object_unref(zathura->synctex.dbus);
|
||||
zathura->synctex.dbus = NULL;
|
||||
}
|
||||
|
||||
/* remove monitor */
|
||||
if (keep_monitor == false) {
|
||||
if (zathura->file_monitor.monitor != NULL) {
|
||||
|
@ -1060,30 +1056,16 @@ page_widget_set_mode(zathura_t* zathura, unsigned int page_padding,
|
|||
|
||||
unsigned int number_of_pages = zathura_document_get_number_of_pages(zathura->document);
|
||||
|
||||
#if (GTK_MAJOR_VERSION == 3)
|
||||
gtk_grid_set_row_spacing(GTK_GRID(zathura->ui.page_widget), page_padding);
|
||||
gtk_grid_set_column_spacing(GTK_GRID(zathura->ui.page_widget), page_padding);
|
||||
|
||||
#else
|
||||
gtk_table_set_row_spacings(GTK_TABLE(zathura->ui.page_widget), page_padding);
|
||||
gtk_table_set_col_spacings(GTK_TABLE(zathura->ui.page_widget), page_padding);
|
||||
|
||||
unsigned int ncol = pages_per_row;
|
||||
unsigned int nrow = (number_of_pages + first_page_column - 1 + ncol - 1) / ncol;
|
||||
gtk_table_resize(GTK_TABLE(zathura->ui.page_widget), nrow, ncol);
|
||||
#endif
|
||||
|
||||
for (unsigned int i = 0; i < number_of_pages; i++) {
|
||||
int x = (i + first_page_column - 1) % pages_per_row;
|
||||
int y = (i + first_page_column - 1) / pages_per_row;
|
||||
|
||||
zathura_page_t* page = zathura_document_get_page(zathura->document, i);
|
||||
GtkWidget* page_widget = zathura_page_get_widget(zathura, page);
|
||||
#if (GTK_MAJOR_VERSION == 3)
|
||||
gtk_grid_attach(GTK_GRID(zathura->ui.page_widget), page_widget, x, y, 1, 1);
|
||||
#else
|
||||
gtk_table_attach(GTK_TABLE(zathura->ui.page_widget), page_widget, x, x + 1, y, y + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
gtk_widget_show_all(zathura->ui.page_widget);
|
||||
|
|
21
zathura.h
21
zathura.h
|
@ -6,20 +6,18 @@
|
|||
#include <stdbool.h>
|
||||
#include <girara/types.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <gtk/gtkx.h>
|
||||
#include "macros.h"
|
||||
#include "types.h"
|
||||
|
||||
#if (GTK_MAJOR_VERSION == 3)
|
||||
#include <gtk/gtkx.h>
|
||||
#endif
|
||||
|
||||
enum { NEXT, PREVIOUS, LEFT, RIGHT, UP, DOWN, BOTTOM, TOP, HIDE, HIGHLIGHT,
|
||||
DELETE_LAST_WORD, DELETE_LAST_CHAR, DEFAULT, ERROR, WARNING, NEXT_GROUP,
|
||||
PREVIOUS_GROUP, ZOOM_IN, ZOOM_OUT, ZOOM_ORIGINAL, ZOOM_SPECIFIC, FORWARD,
|
||||
BACKWARD, CONTINUOUS, DELETE_LAST, EXPAND, EXPAND_ALL, COLLAPSE_ALL, COLLAPSE,
|
||||
SELECT, GOTO_DEFAULT, GOTO_LABELS, GOTO_OFFSET, HALF_UP, HALF_DOWN, FULL_UP,
|
||||
FULL_DOWN, HALF_LEFT, HALF_RIGHT, FULL_LEFT, FULL_RIGHT, NEXT_CHAR,
|
||||
PREVIOUS_CHAR, DELETE_TO_LINE_START, APPEND_FILEPATH, ROTATE_CW, ROTATE_CCW };
|
||||
PREVIOUS_CHAR, DELETE_TO_LINE_START, APPEND_FILEPATH, ROTATE_CW, ROTATE_CCW,
|
||||
PAGE_BOTTOM, PAGE_TOP };
|
||||
|
||||
/* unspecified page number */
|
||||
enum {
|
||||
|
@ -60,10 +58,10 @@ struct zathura_s
|
|||
|
||||
struct
|
||||
{
|
||||
GdkColor highlight_color; /**< Color for highlighting */
|
||||
GdkColor highlight_color_active; /** Color for highlighting */
|
||||
GdkColor render_loading_bg; /**< Background color for render "Loading..." */
|
||||
GdkColor render_loading_fg; /**< Foreground color for render "Loading..." */
|
||||
GdkRGBA highlight_color; /**< Color for highlighting */
|
||||
GdkRGBA highlight_color_active; /** Color for highlighting */
|
||||
GdkRGBA render_loading_bg; /**< Background color for render "Loading..." */
|
||||
GdkRGBA render_loading_fg; /**< Foreground color for render "Loading..." */
|
||||
} colors;
|
||||
|
||||
GtkWidget *page_widget_alignment;
|
||||
|
@ -91,6 +89,7 @@ struct zathura_s
|
|||
{
|
||||
bool enabled;
|
||||
gchar* editor;
|
||||
ZathuraSynctexDbus* dbus;
|
||||
} synctex;
|
||||
|
||||
struct
|
||||
|
@ -191,11 +190,7 @@ void zathura_free(zathura_t* zathura);
|
|||
* @param zathura The zathura session
|
||||
* @param xid The window id
|
||||
*/
|
||||
#if (GTK_MAJOR_VERSION == 2)
|
||||
void zathura_set_xid(zathura_t* zathura, GdkNativeWindow xid);
|
||||
#else
|
||||
void zathura_set_xid(zathura_t* zathura, Window xid);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Set the path to the configuration directory
|
||||
|
|
|
@ -262,6 +262,8 @@ Possible arguments are:
|
|||
* left
|
||||
* next
|
||||
* out
|
||||
* page-bottom
|
||||
* page-top
|
||||
* previous
|
||||
* right
|
||||
* rotate-ccw
|
||||
|
@ -706,21 +708,22 @@ Defines if scrolling by half or full pages stops at page boundaries.
|
|||
|
||||
link-zoom
|
||||
^^^^^^^^^
|
||||
En/Disables the hability of changing zoom when following links.
|
||||
En/Disables the ability of changing zoom when following links.
|
||||
|
||||
* Value type: Boolean
|
||||
* Default value: true
|
||||
|
||||
link-hadjust
|
||||
^^^^^^^^^^^^
|
||||
En/Disables aligning to the left internal link targets, for example from the index
|
||||
En/Disables aligning to the left internal link targets, for example from the
|
||||
index.
|
||||
|
||||
* Value type: Boolean
|
||||
* Default value: true
|
||||
|
||||
search-hadjust
|
||||
^^^^^^^^^^^^^^
|
||||
En/Disables horizontally centered search results
|
||||
En/Disables horizontally centered search results.
|
||||
|
||||
* Value type: Boolean
|
||||
* Default value: true
|
||||
|
@ -748,21 +751,21 @@ Use basename of the file in the statusbar.
|
|||
|
||||
zoom-center
|
||||
^^^^^^^^^^^
|
||||
En/Disables horizontally centered zooming
|
||||
En/Disables horizontally centered zooming.
|
||||
|
||||
* Value type: Bool
|
||||
* Value type: Boolean
|
||||
* Default value: False
|
||||
|
||||
zoom-max
|
||||
^^^^^^^^
|
||||
Defines the maximum percentage that the zoom level can be
|
||||
Defines the maximum percentage that the zoom level can be.
|
||||
|
||||
* Value type: Integer
|
||||
* Default value: 1000
|
||||
|
||||
zoom-min
|
||||
^^^^^^^^
|
||||
Defines the minimum percentage that the zoom level can be
|
||||
Defines the minimum percentage that the zoom level can be.
|
||||
|
||||
* Value type: Integer
|
||||
* Default value: 10
|
||||
|
@ -785,6 +788,13 @@ middle mouse button, or the Shift-Insert key combination.
|
|||
* Value type: String
|
||||
* Default value: primary
|
||||
|
||||
syntex-dbus-service
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
En/Disables the D-Bus service required for synctex forward synchronization.
|
||||
|
||||
* Value type: Boolean
|
||||
* Default value: true
|
||||
|
||||
SEE ALSO
|
||||
========
|
||||
|
||||
|
|
Loading…
Reference in a new issue