Commit 7af1064e authored by Sebastian Ramacher's avatar Sebastian Ramacher

Merge branch 'release/0.2.9'

parents 27177a20 e43ee9e0
*.o
*.do
*~
.depend
*.so
*.swp
zathura-version-check
tags
build
compile_commands.json
.ycm_extra_conf.*
# See LICENSE file for license and copyright information
# General information
PROJECT_NAME = zathura-pdf-poppler
OUTPUT_DIRECTORY = ./doc/
OUTPUT_LANGUAGE = English
TAB_SIZE = 2
EXTRACT_ALL = YES
OPTIMIZE_OUTPUT_FOR_C = YES
DOXYFILE_ENCODING = UTF-8
TYPEDEF_HIDES_STRUCT = YES
# Warning and progress messages
QUIET = YES
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
# Input files
INPUT =
FILE_PATTERNS = *.h *.c
RECURSIVE = YES
# Output files
GENERATE_HTML = YES
GENERATE_LATEX = NO
GENERATE_RTF = NO
GENERATE_XML = NO
SOURCE_BROWSER = YES
Copyright (c) 2011-2017 pwmt.org
Copyright (c) 2011-2018 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
......
# See LICENSE file for license and copyright information
include config.mk
include common.mk
PROJECT = zathura-pdf-poppler
PLUGIN = pdf
SOURCE = $(sort $(wildcard *.c))
HEADER = $(wildcard *.h)
OBJECTS = ${SOURCE:.c=.o}
DOBJECTS = ${SOURCE:.c=.do}
ifeq ($(UNAME), Darwin)
SOFILE = ${PLUGIN}.dylib
SODEBUGFILE = ${PLUGIN}-debug.dylib
ZATHURAFILE = ${PREFIX}/bin/zathura
PLATFORMFLAGS = -Wl,-dylib_install_name,${DESTDIR}${PLUGINDIR}/pdf.dylib -Wl,-bundle_loader,${ZATHURAFILE} -bundle
else
SOFILE = ${PLUGIN}.so
SODEBUGFILE = ${PLUGIN}-debug.so
PLATFORMFLAGS = -shared
endif
CPPFLAGS += "-DVERSION_MAJOR=${VERSION_MAJOR}"
CPPFLAGS += "-DVERSION_MINOR=${VERSION_MINOR}"
CPPFLAGS += "-DVERSION_REV=${VERSION_REV}"
all: options ${SOFILE}
# pkg-config based version checks
.version-checks/%: config.mk
$(QUIET)test $($(*)_VERSION_CHECK) -eq 0 || \
${PKG_CONFIG} --atleast-version $($(*)_MIN_VERSION) $($(*)_PKG_CONFIG_NAME) || ( \
echo "The minimum required version of $(*) is $($(*)_MIN_VERSION)" && \
false \
)
@mkdir -p .version-checks
$(QUIET)touch $@
options:
$(ECHO) ${PLUGIN} build options:
$(ECHO) "CFLAGS = ${CFLAGS}"
$(ECHO) "LDFLAGS = ${LDFLAGS}"
$(ECHO) "DFLAGS = ${DFLAGS}"
$(ECHO) "CC = ${CC}"
$(ECHO) "PKG_CONFIG = ${PKG_CONFIG}"
%.o: %.c
$(ECHO) CC $<
@mkdir -p .depend
$(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} -o $@ $< -MMD -MF .depend/$@.dep
%.do: %.c
$(ECHO) CC $<
@mkdir -p .depend
$(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} ${DFLAGS} -o $@ $< -MMD -MF .depend/$@.dep
${OBJECTS}: config.mk \
.version-checks/ZATHURA \
.version-checks/POPPLER
${DOBJECTS}: config.mk \
.version-checks/ZATHURA \
.version-checks/POPPLER
${SOFILE}: ${OBJECTS}
$(ECHO) LD $@
$(QUIET)${CC} ${PLATFORMFLAGS} ${LDFLAGS} -o $@ ${OBJECTS} ${LIBS}
${SODEBUGFILE}: ${DOBJECTS}
$(ECHO) LD $@
$(QUIET)${CC} ${PLATFORMFLAGS} ${LDFLAGS} -o $@ ${OBJECTS} ${LIBS}
clean:
$(QUIET)rm -rf ${OBJECTS} ${DOBJECTS} ${SOFILE} ${SODEBUGFILE} \
doc .depend ${PROJECT}-${VERSION}.tar.gz zathura-version-check
debug: options ${SODEBUGFILE}
dist: clean
$(QUIET)mkdir -p ${PROJECT}-${VERSION}
$(QUIET)cp -R LICENSE Makefile config.mk common.mk Doxyfile \
${HEADER} ${SOURCE} AUTHORS ${PROJECT}.desktop \
${PROJECT}.metainfo.xml \
${PROJECT}-${VERSION}
$(QUIET)tar -cf ${PROJECT}-${VERSION}.tar ${PROJECT}-${VERSION}
$(QUIET)gzip ${PROJECT}-${VERSION}.tar
$(QUIET)rm -rf ${PROJECT}-${VERSION}
doc: clean
$(QUIET)doxygen Doxyfile
install: all
$(ECHO) installing ${PLUGIN} plugin
$(QUIET)mkdir -p ${DESTDIR}${PLUGINDIR}
$(QUIET)cp -f ${SOFILE} ${DESTDIR}${PLUGINDIR}
$(QUIET)mkdir -m 755 -p ${DESTDIR}${DESKTOPPREFIX}
$(ECHO) installing desktop file
$(QUIET)install -m 644 ${PROJECT}.desktop ${DESTDIR}${DESKTOPPREFIX}
$(ECHO) installing AppData file
$(QUIET)mkdir -m 755 -p $(DESTDIR)$(APPDATAPREFIX)
$(QUIET)install -m 644 $(PROJECT).metainfo.xml $(DESTDIR)$(APPDATAPREFIX)
uninstall:
$(ECHO) uninstalling ${PLUGIN} plugin
$(QUIET)rm -f ${DESTDIR}${PLUGINDIR}/${SOFILE}
$(QUIET)find ${DESTDIR}${PLUGINDIR} -type d -empty -delete 2> /dev/null
$(ECHO) removing desktop file
$(QUIET)rm -f ${DESTDIR}${DESKTOPPREFIX}/${PROJECT}.desktop
$(QUIET)find ${DESTDIR}${DESKTOPPREFIX} -type d -empty -delete 2> /dev/null
$(ECHO) removing AppData file
$(QUIET)rm -f $(DESTDIR)$(APPDATAPREFIX)/$(PROJECT).metainfo.xml
-include $(wildcard .depend/*.dep)
.PHONY: all options clean debug doc dist install uninstall
# See LICENSE file for license and copyright information
ifeq "$(VERBOSE)" "0"
ECHO=@echo
QUIET=@
else
ECHO=@\#
QUIET=
endif
# See LICENSE file for license and copyright information
VERSION_MAJOR = 0
VERSION_MINOR = 2
VERSION_REV = 8
VERSION = ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REV}
PKG_CONFIG ?= pkg-config
# version checks
# If you want to disable any of the checks, set *_VERSION_CHECK to 0.
# zathura
ZATHURA_VERSION_CHECK ?= 1
ZATHURA_MIN_VERSION = 0.3.8
ZATHURA_PKG_CONFIG_NAME = zathura
# poppler
POPPLER_VERSION_CHECK ?= 1
POPPLER_MIN_VERSION = 0.18
POPPLER_PKG_CONFIG_NAME = poppler-glib
# paths
PREFIX ?= /usr
LIBDIR ?= ${PREFIX}/lib
DESKTOPPREFIX ?= ${PREFIX}/share/applications
APPDATAPREFIX ?= ${PREFIX}/share/metainfo
# libs
CAIRO_INC ?= $(shell $(PKG_CONFIG) --cflags cairo)
CAIRO_LIB ?= $(shell $(PKG_CONFIG) --libs cairo)
PDF_INC ?= $(shell $(PKG_CONFIG) --cflags poppler-glib)
PDF_LIB ?= $(shell $(PKG_CONFIG) --libs poppler-glib)
GIRARA_INC ?= $(shell $(PKG_CONFIG) --cflags girara-gtk3)
GIRARA_LIB ?= $(shell $(PKG_CONFIG) --libs girara-gtk3)
ZATHURA_INC ?= $(shell $(PKG_CONFIG) --cflags zathura)
PLUGINDIR ?= $(shell $(PKG_CONFIG) --variable=plugindir zathura)
ifeq (,${PLUGINDIR})
PLUGINDIR = ${LIBDIR}/zathura
endif
INCS = ${CAIRO_INC} ${PDF_INC} ${ZATHURA_INC} ${GIRARA_INC}
LIBS = ${GIRARA_LIB} ${CAIRO_LIB} ${PDF_LIB}
# uname
UNAME := $(shell uname -s)
# compiler flags
CFLAGS += -std=c11 -fPIC -pedantic -Wall -Wno-format-zero-length $(INCS)
# linker flags
LDFLAGS += -fPIC
ifeq ($(UNAME), Darwin)
LDFLAGS += -fno-common
endif
# debug
DFLAGS ?= -g
# compiler
CC ?= gcc
LD ?= ld
# set to something != 0 if you want verbose build output
VERBOSE ?= 0
install_data('org.pwmt.zathura-pdf-poppler.metainfo.xml', install_dir: metainfodir)
install_data('org.pwmt.zathura-pdf-poppler.desktop', install_dir: desktopdir)
[Desktop Entry]
Version=1.0
Type=Application
Name=Zathura
Comment=A minimalistic document viewer
Exec=zathura %U
Terminal=false
NoDisplay=true
Categories=Office;Viewer;
MimeType=application/pdf;
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2015 pwmt.org -->
<!-- Copyright 2015-2018 pwmt.org -->
<component type="addon">
<id>zathura-pdf-poppler.desktop</id>
<id>org.pwmt.zathura-pdf-poppler</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>Zlib</project_license>
<extends>zathura.desktop</extends>
<name>PDF plugin for Zathura</name>
<summary>PDF plugin based on Poppler</summary>
<extends>org.pwmt.zathura</extends>
<name>Zathura-PDF-Poppler</name>
<summary>PDF plugin for zathura based on Poppler</summary>
<url type="homepage">https://pwmt.org/projects/zathura-pdf-poppler/</url>
<update_contact>zathura@lists.pwmt.org</update_contact>
</component>
project('zathura-pdf-poppler', 'c',
version: '0.2.9',
meson_version: '>=0.43',
default_options: 'c_std=c11'
)
version = meson.project_version()
version_array = version.split('.')
cc = meson.get_compiler('c')
prefix = get_option('prefix')
datadir = get_option('datadir')
metainfodir = join_paths(datadir, 'metainfo')
desktopdir = join_paths(datadir, 'applications')
# required dependencies
zathura = dependency('zathura', version: '>=0.3.9')
girara = dependency('girara-gtk3')
glib = dependency('glib-2.0')
poppler = dependency('poppler-glib', version: '>=0.18')
build_dependencies = [zathura, girara, glib, poppler]
# defines
defines = [
'-DVERSION_MAJOR=@0@'.format(version_array[0]),
'-DVERSION_MINOR=@0@'.format(version_array[1]),
'-DVERSION_REV=@0@'.format(version_array[2]),
'-D_DEFAULT_SOURCE',
]
# compile flags
flags = [
'-Wall',
'-Wextra',
'-pedantic',
'-Werror=implicit-function-declaration',
'-Werror=vla',
'-fvisibility=hidden'
]
flags = cc.get_supported_arguments(flags)
sources = files(
'zathura-pdf-poppler/attachments.c',
'zathura-pdf-poppler/document.c',
'zathura-pdf-poppler/forms.c',
'zathura-pdf-poppler/image.c',
'zathura-pdf-poppler/index.c',
'zathura-pdf-poppler/links.c',
'zathura-pdf-poppler/meta.c',
'zathura-pdf-poppler/page.c',
'zathura-pdf-poppler/plugin.c',
'zathura-pdf-poppler/render.c',
'zathura-pdf-poppler/search.c',
'zathura-pdf-poppler/select.c',
'zathura-pdf-poppler/utils.c'
)
pdf = shared_module('pdf-poppler',
sources,
dependencies: build_dependencies,
c_args: defines + flags,
install: true,
install_dir: zathura.get_pkgconfig_variable('plugindir')
)
subdir('data')
[Desktop Entry]
Version=1.0
Type=Application
Name=Zathura
Comment=A minimalistic document viewer
Comment[ca]=Un visualitzador de documents minimalista
Comment[de]=Ein minimalistischer Dokumenten-Betrachter
Comment[el]=Ένας ελαφρύς προβολέας κειμένων
Comment[eo]=Malpeza dokumento spektanto
Comment[es_CL]=Un visor de documentos minimalista
Comment[fr]=Un visionneur de document minimaliste
Comment[he]=מציג מסמכים מינימליסטי
Comment[id_ID]=Pembaca dokumen minimalis
Comment[it]=Un visualizzatore di documenti minimalista
Comment[pl]=Minimalistyczna przeglądarka dokumentów
Comment[pt_BR]=Um visualizador de documentos minimalista
Comment[ru]=Минималистичный просмотрщик документов
Comment[tr]=Minimalist bir belge görüntüleyicisi
Comment[uk_UA]=Легкий переглядач документів
Exec=zathura %U
Terminal=false
NoDisplay=true
Categories=Office;Viewer;
MimeType=application/pdf;
......@@ -3,7 +3,7 @@
#include "plugin.h"
girara_list_t*
pdf_page_form_fields_get(zathura_page_t* page, void* poppler_page,
pdf_page_form_fields_get(zathura_page_t* UNUSED(page), void* UNUSED(poppler_page),
zathura_error_t* error)
{
if (error != NULL) {
......
......@@ -73,3 +73,16 @@ pdf_document_get_information(zathura_document_t* document, void* data, zathura_e
return list;
}
zathura_error_t
pdf_page_get_label(zathura_page_t* page, void* data, char** label)
{
if (page == NULL || data == NULL || label == NULL) {
return ZATHURA_ERROR_INVALID_ARGUMENTS;
}
PopplerPage* poppler_page = data;
*label = poppler_page_get_label(poppler_page);
return ZATHURA_ERROR_OK;
}
......@@ -21,7 +21,8 @@ ZATHURA_PLUGIN_REGISTER_WITH_FUNCTIONS(
.page_images_get = pdf_page_images_get,
.page_get_text = pdf_page_get_text,
.page_render_cairo = pdf_page_render_cairo,
.page_image_get_cairo = pdf_page_image_get_cairo
.page_image_get_cairo = pdf_page_image_get_cairo,
.page_get_label = pdf_page_get_label
}),
ZATHURA_PLUGIN_MIMETYPES({
"application/pdf"
......
......@@ -187,4 +187,16 @@ GIRARA_HIDDEN char* pdf_page_get_text(zathura_page_t* page, void* poppler_page,
GIRARA_HIDDEN zathura_error_t pdf_page_render_cairo(zathura_page_t* page, void*
poppler_page, cairo_t* cairo, bool printing);
/**
* Get the page label
*
* @param page Page
* @param poppler_page Internal page representation
* @param label Label
* @return ZATHURA_ERROR_OK when no error occurred, otherwise see
* zathura_error_t
*/
GIRARA_HIDDEN zathura_error_t pdf_page_get_label(zathura_page_t* page,
void* data, char** label);
#endif // PDF_H
......@@ -38,7 +38,7 @@ poppler_link_to_zathura_link(PopplerDocument* poppler_document, PopplerAction*
target.destination_type = ZATHURA_LINK_DESTINATION_XYZ;
target.page_number = poppler_destination->page_num - 1;
if (poppler_destination->change_zoom != 0) {
target.scale = poppler_destination->zoom;
target.zoom = poppler_destination->zoom;
}
if (poppler_destination->change_left != 0) {
target.left = poppler_destination->left;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment