Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
70a278d950 |
32 changed files with 106 additions and 6495 deletions
|
|
@ -26,7 +26,6 @@
|
|||
#include <libview/ev-document-model.h>
|
||||
#include <libview/ev-print-operation.h>
|
||||
#include <libview/ev-view.h>
|
||||
#include <libview/ev-web-view.h>
|
||||
#include <libview/ev-view-type-builtins.h>
|
||||
#include <libview/ev-stock-icons.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -6,10 +6,6 @@ if ENABLE_PDF
|
|||
SUBDIRS += pdf
|
||||
endif
|
||||
|
||||
if ENABLE_EPUB
|
||||
SUBDIRS += epub
|
||||
endif
|
||||
|
||||
if ENABLE_PS
|
||||
SUBDIRS += ps
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -1,37 +0,0 @@
|
|||
SUBDIRS = minizip
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-I$(top_srcdir) \
|
||||
-I$(top_srcdir)/libdocument \
|
||||
-I$(srcdir)/minizip \
|
||||
-DMATELOCALEDIR=\"$(datadir)/locale\" \
|
||||
-DATRIL_COMPILATION \
|
||||
$(BACKEND_CFLAGS) \
|
||||
$(WARN_CXXFLAGS) \
|
||||
$(EPUB_CFLAGS) \
|
||||
$(DISABLE_DEPRECATED)
|
||||
|
||||
backend_LTLIBRARIES = libepubdocument.la
|
||||
|
||||
libepubdocument_la_SOURCES = \
|
||||
epub-document.c \
|
||||
epub-document.h
|
||||
|
||||
libepubdocument_la_LDFLAGS = $(BACKEND_LIBTOOL_FLAGS)
|
||||
libepubdocument_la_LIBADD = \
|
||||
$(top_builddir)/libdocument/libatrildocument.la \
|
||||
minizip/libminizip.la \
|
||||
$(EPUB_LIBS) \
|
||||
$(BACKEND_LIBS)
|
||||
|
||||
|
||||
backend_in_files = epubdocument.atril-backend.in
|
||||
backend_DATA = $(backend_in_files:.atril-backend.in=.atril-backend)
|
||||
|
||||
EXTRA_DIST = $(backend_in_files)
|
||||
|
||||
CLEANFILES = $(backend_DATA)
|
||||
|
||||
@EV_INTLTOOL_ATRIL_BACKEND_RULE@
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,21 +0,0 @@
|
|||
#ifndef __EPUB_DOCUMENT_H__
|
||||
#define __EPUB_DOCUMENT_H__
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include "ev-document.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define EPUB_TYPE_DOCUMENT (epub_document_get_type ())
|
||||
#define EPUB_DOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EPUB_TYPE_DOCUMENT, EpubDocument))
|
||||
#define EPUB_IS_DOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EPUB_TYPE_DOCUMENT))
|
||||
|
||||
typedef struct _EpubDocument EpubDocument;
|
||||
|
||||
GType epub_document_get_type (void) G_GNUC_CONST;
|
||||
|
||||
G_MODULE_EXPORT GType register_atril_backend (GTypeModule *module);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __EPUB_DOCUMENT_H__ */
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
[Atril Backend]
|
||||
Module=epubdocument
|
||||
_TypeDescription=epub Documents
|
||||
MimeType=application/epub+zip;
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
AM_CPPFLAGS = \
|
||||
$(WARN_CFLAGS) \
|
||||
$(ZLIB_CFLAGS)
|
||||
|
||||
noinst_LTLIBRARIES = libminizip.la
|
||||
|
||||
libminizip_la_SOURCES = \
|
||||
unzip.c \
|
||||
ioapi.c \
|
||||
unzip.h \
|
||||
ioapi.h
|
||||
|
||||
libminizip_la_LIBADD = \
|
||||
$(ZLIB_LIBS)
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
||||
|
|
@ -1,247 +0,0 @@
|
|||
/* ioapi.h -- IO base function header for compress/uncompress .zip
|
||||
part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )
|
||||
|
||||
Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html )
|
||||
|
||||
Modifications for Zip64 support
|
||||
Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
|
||||
|
||||
For more info read MiniZip_info.txt
|
||||
|
||||
*/
|
||||
|
||||
#if defined(_WIN32) && (!(defined(_CRT_SECURE_NO_WARNINGS)))
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__) || defined(IOAPI_NO_64)
|
||||
// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
|
||||
#define FOPEN_FUNC(filename, mode) fopen(filename, mode)
|
||||
#define FTELLO_FUNC(stream) ftello(stream)
|
||||
#define FSEEKO_FUNC(stream, offset, origin) fseeko(stream, offset, origin)
|
||||
#else
|
||||
#define FOPEN_FUNC(filename, mode) fopen64(filename, mode)
|
||||
#define FTELLO_FUNC(stream) ftello64(stream)
|
||||
#define FSEEKO_FUNC(stream, offset, origin) fseeko64(stream, offset, origin)
|
||||
#endif
|
||||
|
||||
|
||||
#include "ioapi.h"
|
||||
|
||||
voidpf call_zopen64 (const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode)
|
||||
{
|
||||
if (pfilefunc->zfile_func64.zopen64_file != NULL)
|
||||
return (*(pfilefunc->zfile_func64.zopen64_file)) (pfilefunc->zfile_func64.opaque,filename,mode);
|
||||
else
|
||||
{
|
||||
return (*(pfilefunc->zopen32_file))(pfilefunc->zfile_func64.opaque,(const char*)filename,mode);
|
||||
}
|
||||
}
|
||||
|
||||
long call_zseek64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin)
|
||||
{
|
||||
if (pfilefunc->zfile_func64.zseek64_file != NULL)
|
||||
return (*(pfilefunc->zfile_func64.zseek64_file)) (pfilefunc->zfile_func64.opaque,filestream,offset,origin);
|
||||
else
|
||||
{
|
||||
uLong offsetTruncated = (uLong)offset;
|
||||
if (offsetTruncated != offset)
|
||||
return -1;
|
||||
else
|
||||
return (*(pfilefunc->zseek32_file))(pfilefunc->zfile_func64.opaque,filestream,offsetTruncated,origin);
|
||||
}
|
||||
}
|
||||
|
||||
ZPOS64_T call_ztell64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream)
|
||||
{
|
||||
if (pfilefunc->zfile_func64.zseek64_file != NULL)
|
||||
return (*(pfilefunc->zfile_func64.ztell64_file)) (pfilefunc->zfile_func64.opaque,filestream);
|
||||
else
|
||||
{
|
||||
uLong tell_uLong = (*(pfilefunc->ztell32_file))(pfilefunc->zfile_func64.opaque,filestream);
|
||||
if ((tell_uLong) == MAXU32)
|
||||
return (ZPOS64_T)-1;
|
||||
else
|
||||
return tell_uLong;
|
||||
}
|
||||
}
|
||||
|
||||
void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32)
|
||||
{
|
||||
p_filefunc64_32->zfile_func64.zopen64_file = NULL;
|
||||
p_filefunc64_32->zopen32_file = p_filefunc32->zopen_file;
|
||||
p_filefunc64_32->zfile_func64.zerror_file = p_filefunc32->zerror_file;
|
||||
p_filefunc64_32->zfile_func64.zread_file = p_filefunc32->zread_file;
|
||||
p_filefunc64_32->zfile_func64.zwrite_file = p_filefunc32->zwrite_file;
|
||||
p_filefunc64_32->zfile_func64.ztell64_file = NULL;
|
||||
p_filefunc64_32->zfile_func64.zseek64_file = NULL;
|
||||
p_filefunc64_32->zfile_func64.zclose_file = p_filefunc32->zclose_file;
|
||||
p_filefunc64_32->zfile_func64.zerror_file = p_filefunc32->zerror_file;
|
||||
p_filefunc64_32->zfile_func64.opaque = p_filefunc32->opaque;
|
||||
p_filefunc64_32->zseek32_file = p_filefunc32->zseek_file;
|
||||
p_filefunc64_32->ztell32_file = p_filefunc32->ztell_file;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static voidpf ZCALLBACK fopen_file_func OF((voidpf opaque, const char* filename, int mode));
|
||||
static uLong ZCALLBACK fread_file_func OF((voidpf opaque, voidpf stream, void* buf, uLong size));
|
||||
static uLong ZCALLBACK fwrite_file_func OF((voidpf opaque, voidpf stream, const void* buf,uLong size));
|
||||
static ZPOS64_T ZCALLBACK ftell64_file_func OF((voidpf opaque, voidpf stream));
|
||||
static long ZCALLBACK fseek64_file_func OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin));
|
||||
static int ZCALLBACK fclose_file_func OF((voidpf opaque, voidpf stream));
|
||||
static int ZCALLBACK ferror_file_func OF((voidpf opaque, voidpf stream));
|
||||
|
||||
static voidpf ZCALLBACK fopen_file_func (voidpf opaque, const char* filename, int mode)
|
||||
{
|
||||
FILE* file = NULL;
|
||||
const char* mode_fopen = NULL;
|
||||
if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
|
||||
mode_fopen = "rb";
|
||||
else
|
||||
if (mode & ZLIB_FILEFUNC_MODE_EXISTING)
|
||||
mode_fopen = "r+b";
|
||||
else
|
||||
if (mode & ZLIB_FILEFUNC_MODE_CREATE)
|
||||
mode_fopen = "wb";
|
||||
|
||||
if ((filename!=NULL) && (mode_fopen != NULL))
|
||||
file = fopen(filename, mode_fopen);
|
||||
return file;
|
||||
}
|
||||
|
||||
static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename, int mode)
|
||||
{
|
||||
FILE* file = NULL;
|
||||
const char* mode_fopen = NULL;
|
||||
if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
|
||||
mode_fopen = "rb";
|
||||
else
|
||||
if (mode & ZLIB_FILEFUNC_MODE_EXISTING)
|
||||
mode_fopen = "r+b";
|
||||
else
|
||||
if (mode & ZLIB_FILEFUNC_MODE_CREATE)
|
||||
mode_fopen = "wb";
|
||||
|
||||
if ((filename!=NULL) && (mode_fopen != NULL))
|
||||
file = FOPEN_FUNC((const char*)filename, mode_fopen);
|
||||
return file;
|
||||
}
|
||||
|
||||
|
||||
static uLong ZCALLBACK fread_file_func (voidpf opaque, voidpf stream, void* buf, uLong size)
|
||||
{
|
||||
uLong ret;
|
||||
ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static uLong ZCALLBACK fwrite_file_func (voidpf opaque, voidpf stream, const void* buf, uLong size)
|
||||
{
|
||||
uLong ret;
|
||||
ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream)
|
||||
{
|
||||
long ret;
|
||||
ret = ftell((FILE *)stream);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static ZPOS64_T ZCALLBACK ftell64_file_func (voidpf opaque, voidpf stream)
|
||||
{
|
||||
ZPOS64_T ret;
|
||||
ret = FTELLO_FUNC((FILE *)stream);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static long ZCALLBACK fseek_file_func (voidpf opaque, voidpf stream, uLong offset, int origin)
|
||||
{
|
||||
int fseek_origin=0;
|
||||
long ret;
|
||||
switch (origin)
|
||||
{
|
||||
case ZLIB_FILEFUNC_SEEK_CUR :
|
||||
fseek_origin = SEEK_CUR;
|
||||
break;
|
||||
case ZLIB_FILEFUNC_SEEK_END :
|
||||
fseek_origin = SEEK_END;
|
||||
break;
|
||||
case ZLIB_FILEFUNC_SEEK_SET :
|
||||
fseek_origin = SEEK_SET;
|
||||
break;
|
||||
default: return -1;
|
||||
}
|
||||
ret = 0;
|
||||
if (fseek((FILE *)stream, offset, fseek_origin) != 0)
|
||||
ret = -1;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T offset, int origin)
|
||||
{
|
||||
int fseek_origin=0;
|
||||
long ret;
|
||||
switch (origin)
|
||||
{
|
||||
case ZLIB_FILEFUNC_SEEK_CUR :
|
||||
fseek_origin = SEEK_CUR;
|
||||
break;
|
||||
case ZLIB_FILEFUNC_SEEK_END :
|
||||
fseek_origin = SEEK_END;
|
||||
break;
|
||||
case ZLIB_FILEFUNC_SEEK_SET :
|
||||
fseek_origin = SEEK_SET;
|
||||
break;
|
||||
default: return -1;
|
||||
}
|
||||
ret = 0;
|
||||
|
||||
if(FSEEKO_FUNC((FILE *)stream, offset, fseek_origin) != 0)
|
||||
ret = -1;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static int ZCALLBACK fclose_file_func (voidpf opaque, voidpf stream)
|
||||
{
|
||||
int ret;
|
||||
ret = fclose((FILE *)stream);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int ZCALLBACK ferror_file_func (voidpf opaque, voidpf stream)
|
||||
{
|
||||
int ret;
|
||||
ret = ferror((FILE *)stream);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void fill_fopen_filefunc (pzlib_filefunc_def)
|
||||
zlib_filefunc_def* pzlib_filefunc_def;
|
||||
{
|
||||
pzlib_filefunc_def->zopen_file = fopen_file_func;
|
||||
pzlib_filefunc_def->zread_file = fread_file_func;
|
||||
pzlib_filefunc_def->zwrite_file = fwrite_file_func;
|
||||
pzlib_filefunc_def->ztell_file = ftell_file_func;
|
||||
pzlib_filefunc_def->zseek_file = fseek_file_func;
|
||||
pzlib_filefunc_def->zclose_file = fclose_file_func;
|
||||
pzlib_filefunc_def->zerror_file = ferror_file_func;
|
||||
pzlib_filefunc_def->opaque = NULL;
|
||||
}
|
||||
|
||||
void fill_fopen64_filefunc (zlib_filefunc64_def* pzlib_filefunc_def)
|
||||
{
|
||||
pzlib_filefunc_def->zopen64_file = fopen64_file_func;
|
||||
pzlib_filefunc_def->zread_file = fread_file_func;
|
||||
pzlib_filefunc_def->zwrite_file = fwrite_file_func;
|
||||
pzlib_filefunc_def->ztell64_file = ftell64_file_func;
|
||||
pzlib_filefunc_def->zseek64_file = fseek64_file_func;
|
||||
pzlib_filefunc_def->zclose_file = fclose_file_func;
|
||||
pzlib_filefunc_def->zerror_file = ferror_file_func;
|
||||
pzlib_filefunc_def->opaque = NULL;
|
||||
}
|
||||
|
|
@ -1,210 +0,0 @@
|
|||
/* ioapi.h -- IO base function header for compress/uncompress .zip
|
||||
part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )
|
||||
|
||||
Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html )
|
||||
|
||||
Modifications for Zip64 support
|
||||
Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
|
||||
|
||||
For more info read MiniZip_info.txt
|
||||
|
||||
Changes
|
||||
|
||||
Oct-2009 - Defined ZPOS64_T to fpos_t on windows and u_int64_t on linux. (might need to find a better why for this)
|
||||
Oct-2009 - Change to fseeko64, ftello64 and fopen64 so large files would work on linux.
|
||||
More if/def section may be needed to support other platforms
|
||||
Oct-2009 - Defined fxxxx64 calls to normal fopen/ftell/fseek so they would compile on windows.
|
||||
(but you should use iowin32.c for windows instead)
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _ZLIBIOAPI64_H
|
||||
#define _ZLIBIOAPI64_H
|
||||
|
||||
#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__))
|
||||
|
||||
// Linux needs this to support file operation on files larger then 4+GB
|
||||
// But might need better if/def to select just the platforms that needs them.
|
||||
|
||||
#ifndef __USE_FILE_OFFSET64
|
||||
#define __USE_FILE_OFFSET64
|
||||
#endif
|
||||
#ifndef __USE_LARGEFILE64
|
||||
#define __USE_LARGEFILE64
|
||||
#endif
|
||||
#ifndef _LARGEFILE64_SOURCE
|
||||
#define _LARGEFILE64_SOURCE
|
||||
#endif
|
||||
#ifndef _FILE_OFFSET_BIT
|
||||
#define _FILE_OFFSET_BIT 64
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "zlib.h"
|
||||
|
||||
#if defined(USE_FILE32API)
|
||||
#define fopen64 fopen
|
||||
#define ftello64 ftell
|
||||
#define fseeko64 fseek
|
||||
#else
|
||||
#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
#define fopen64 fopen
|
||||
#define ftello64 ftello
|
||||
#define fseeko64 fseeko
|
||||
#endif
|
||||
#ifdef _MSC_VER
|
||||
#define fopen64 fopen
|
||||
#if (_MSC_VER >= 1400) && (!(defined(NO_MSCVER_FILE64_FUNC)))
|
||||
#define ftello64 _ftelli64
|
||||
#define fseeko64 _fseeki64
|
||||
#else // old MSC
|
||||
#define ftello64 ftell
|
||||
#define fseeko64 fseek
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
#ifndef ZPOS64_T
|
||||
#ifdef _WIN32
|
||||
#define ZPOS64_T fpos_t
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#define ZPOS64_T uint64_t
|
||||
#endif
|
||||
#endif
|
||||
*/
|
||||
|
||||
#ifdef HAVE_MINIZIP64_CONF_H
|
||||
#include "mz64conf.h"
|
||||
#endif
|
||||
|
||||
/* a type choosen by DEFINE */
|
||||
#ifdef HAVE_64BIT_INT_CUSTOM
|
||||
typedef 64BIT_INT_CUSTOM_TYPE ZPOS64_T;
|
||||
#else
|
||||
#ifdef HAS_STDINT_H
|
||||
#include "stdint.h"
|
||||
typedef uint64_t ZPOS64_T;
|
||||
#else
|
||||
|
||||
/* Maximum unsigned 32-bit value used as placeholder for zip64 */
|
||||
#define MAXU32 0xffffffff
|
||||
|
||||
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
||||
typedef unsigned __int64 ZPOS64_T;
|
||||
#else
|
||||
typedef unsigned long long int ZPOS64_T;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef OF
|
||||
#define OF _Z_OF
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#define ZLIB_FILEFUNC_SEEK_CUR (1)
|
||||
#define ZLIB_FILEFUNC_SEEK_END (2)
|
||||
#define ZLIB_FILEFUNC_SEEK_SET (0)
|
||||
|
||||
#define ZLIB_FILEFUNC_MODE_READ (1)
|
||||
#define ZLIB_FILEFUNC_MODE_WRITE (2)
|
||||
#define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3)
|
||||
|
||||
#define ZLIB_FILEFUNC_MODE_EXISTING (4)
|
||||
#define ZLIB_FILEFUNC_MODE_CREATE (8)
|
||||
|
||||
|
||||
#ifndef ZCALLBACK
|
||||
#if (defined(WIN32) || defined(_WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK)
|
||||
#define ZCALLBACK CALLBACK
|
||||
#else
|
||||
#define ZCALLBACK
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode));
|
||||
typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size));
|
||||
typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
|
||||
typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream));
|
||||
typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream));
|
||||
|
||||
typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream));
|
||||
typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin));
|
||||
|
||||
|
||||
/* here is the "old" 32 bits structure structure */
|
||||
typedef struct zlib_filefunc_def_s
|
||||
{
|
||||
open_file_func zopen_file;
|
||||
read_file_func zread_file;
|
||||
write_file_func zwrite_file;
|
||||
tell_file_func ztell_file;
|
||||
seek_file_func zseek_file;
|
||||
close_file_func zclose_file;
|
||||
testerror_file_func zerror_file;
|
||||
voidpf opaque;
|
||||
} zlib_filefunc_def;
|
||||
|
||||
typedef ZPOS64_T (ZCALLBACK *tell64_file_func) OF((voidpf opaque, voidpf stream));
|
||||
typedef long (ZCALLBACK *seek64_file_func) OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin));
|
||||
typedef voidpf (ZCALLBACK *open64_file_func) OF((voidpf opaque, const void* filename, int mode));
|
||||
|
||||
typedef struct zlib_filefunc64_def_s
|
||||
{
|
||||
open64_file_func zopen64_file;
|
||||
read_file_func zread_file;
|
||||
write_file_func zwrite_file;
|
||||
tell64_file_func ztell64_file;
|
||||
seek64_file_func zseek64_file;
|
||||
close_file_func zclose_file;
|
||||
testerror_file_func zerror_file;
|
||||
voidpf opaque;
|
||||
} zlib_filefunc64_def;
|
||||
|
||||
void fill_fopen64_filefunc OF((zlib_filefunc64_def* pzlib_filefunc_def));
|
||||
void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def));
|
||||
|
||||
/* now internal definition, only for zip.c and unzip.h */
|
||||
typedef struct zlib_filefunc64_32_def_s
|
||||
{
|
||||
zlib_filefunc64_def zfile_func64;
|
||||
open_file_func zopen32_file;
|
||||
tell_file_func ztell32_file;
|
||||
seek_file_func zseek32_file;
|
||||
} zlib_filefunc64_32_def;
|
||||
|
||||
|
||||
#define ZREAD64(filefunc,filestream,buf,size) ((*((filefunc).zfile_func64.zread_file)) ((filefunc).zfile_func64.opaque,filestream,buf,size))
|
||||
#define ZWRITE64(filefunc,filestream,buf,size) ((*((filefunc).zfile_func64.zwrite_file)) ((filefunc).zfile_func64.opaque,filestream,buf,size))
|
||||
//#define ZTELL64(filefunc,filestream) ((*((filefunc).ztell64_file)) ((filefunc).opaque,filestream))
|
||||
//#define ZSEEK64(filefunc,filestream,pos,mode) ((*((filefunc).zseek64_file)) ((filefunc).opaque,filestream,pos,mode))
|
||||
#define ZCLOSE64(filefunc,filestream) ((*((filefunc).zfile_func64.zclose_file)) ((filefunc).zfile_func64.opaque,filestream))
|
||||
#define ZERROR64(filefunc,filestream) ((*((filefunc).zfile_func64.zerror_file)) ((filefunc).zfile_func64.opaque,filestream))
|
||||
|
||||
voidpf call_zopen64 OF((const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode));
|
||||
long call_zseek64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin));
|
||||
ZPOS64_T call_ztell64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream));
|
||||
|
||||
void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32);
|
||||
|
||||
#define ZOPEN64(filefunc,filename,mode) (call_zopen64((&(filefunc)),(filename),(mode)))
|
||||
#define ZTELL64(filefunc,filestream) (call_ztell64((&(filefunc)),(filestream)))
|
||||
#define ZSEEK64(filefunc,filestream,pos,mode) (call_zseek64((&(filefunc)),(filestream),(pos),(mode)))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,437 +0,0 @@
|
|||
/* unzip.h -- IO for uncompress .zip files using zlib
|
||||
Version 1.1, February 14h, 2010
|
||||
part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )
|
||||
|
||||
Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html )
|
||||
|
||||
Modifications of Unzip for Zip64
|
||||
Copyright (C) 2007-2008 Even Rouault
|
||||
|
||||
Modifications for Zip64 support on both zip and unzip
|
||||
Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
|
||||
|
||||
For more info read MiniZip_info.txt
|
||||
|
||||
---------------------------------------------------------------------------------
|
||||
|
||||
Condition of use and distribution are the same than zlib :
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
---------------------------------------------------------------------------------
|
||||
|
||||
Changes
|
||||
|
||||
See header of unzip64.c
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _unz64_H
|
||||
#define _unz64_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef _ZLIB_H
|
||||
#include "zlib.h"
|
||||
#endif
|
||||
|
||||
#ifndef _ZLIBIOAPI_H
|
||||
#include "ioapi.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_BZIP2
|
||||
#include "bzlib.h"
|
||||
#endif
|
||||
|
||||
#define Z_BZIP2ED 12
|
||||
|
||||
#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP)
|
||||
/* like the STRICT of WIN32, we define a pointer that cannot be converted
|
||||
from (void*) without cast */
|
||||
typedef struct TagunzFile__ { int unused; } unzFile__;
|
||||
typedef unzFile__ *unzFile;
|
||||
#else
|
||||
typedef voidp unzFile;
|
||||
#endif
|
||||
|
||||
|
||||
#define UNZ_OK (0)
|
||||
#define UNZ_END_OF_LIST_OF_FILE (-100)
|
||||
#define UNZ_ERRNO (Z_ERRNO)
|
||||
#define UNZ_EOF (0)
|
||||
#define UNZ_PARAMERROR (-102)
|
||||
#define UNZ_BADZIPFILE (-103)
|
||||
#define UNZ_INTERNALERROR (-104)
|
||||
#define UNZ_CRCERROR (-105)
|
||||
|
||||
/* tm_unz contain date/time info */
|
||||
typedef struct tm_unz_s
|
||||
{
|
||||
uInt tm_sec; /* seconds after the minute - [0,59] */
|
||||
uInt tm_min; /* minutes after the hour - [0,59] */
|
||||
uInt tm_hour; /* hours since midnight - [0,23] */
|
||||
uInt tm_mday; /* day of the month - [1,31] */
|
||||
uInt tm_mon; /* months since January - [0,11] */
|
||||
uInt tm_year; /* years - [1980..2044] */
|
||||
} tm_unz;
|
||||
|
||||
/* unz_global_info structure contain global data about the ZIPfile
|
||||
These data comes from the end of central dir */
|
||||
typedef struct unz_global_info64_s
|
||||
{
|
||||
ZPOS64_T number_entry; /* total number of entries in
|
||||
the central dir on this disk */
|
||||
uLong size_comment; /* size of the global comment of the zipfile */
|
||||
} unz_global_info64;
|
||||
|
||||
typedef struct unz_global_info_s
|
||||
{
|
||||
uLong number_entry; /* total number of entries in
|
||||
the central dir on this disk */
|
||||
uLong size_comment; /* size of the global comment of the zipfile */
|
||||
} unz_global_info;
|
||||
|
||||
/* unz_file_info contain information about a file in the zipfile */
|
||||
typedef struct unz_file_info64_s
|
||||
{
|
||||
uLong version; /* version made by 2 bytes */
|
||||
uLong version_needed; /* version needed to extract 2 bytes */
|
||||
uLong flag; /* general purpose bit flag 2 bytes */
|
||||
uLong compression_method; /* compression method 2 bytes */
|
||||
uLong dosDate; /* last mod file date in Dos fmt 4 bytes */
|
||||
uLong crc; /* crc-32 4 bytes */
|
||||
ZPOS64_T compressed_size; /* compressed size 8 bytes */
|
||||
ZPOS64_T uncompressed_size; /* uncompressed size 8 bytes */
|
||||
uLong size_filename; /* filename length 2 bytes */
|
||||
uLong size_file_extra; /* extra field length 2 bytes */
|
||||
uLong size_file_comment; /* file comment length 2 bytes */
|
||||
|
||||
uLong disk_num_start; /* disk number start 2 bytes */
|
||||
uLong internal_fa; /* internal file attributes 2 bytes */
|
||||
uLong external_fa; /* external file attributes 4 bytes */
|
||||
|
||||
tm_unz tmu_date;
|
||||
} unz_file_info64;
|
||||
|
||||
typedef struct unz_file_info_s
|
||||
{
|
||||
uLong version; /* version made by 2 bytes */
|
||||
uLong version_needed; /* version needed to extract 2 bytes */
|
||||
uLong flag; /* general purpose bit flag 2 bytes */
|
||||
uLong compression_method; /* compression method 2 bytes */
|
||||
uLong dosDate; /* last mod file date in Dos fmt 4 bytes */
|
||||
uLong crc; /* crc-32 4 bytes */
|
||||
uLong compressed_size; /* compressed size 4 bytes */
|
||||
uLong uncompressed_size; /* uncompressed size 4 bytes */
|
||||
uLong size_filename; /* filename length 2 bytes */
|
||||
uLong size_file_extra; /* extra field length 2 bytes */
|
||||
uLong size_file_comment; /* file comment length 2 bytes */
|
||||
|
||||
uLong disk_num_start; /* disk number start 2 bytes */
|
||||
uLong internal_fa; /* internal file attributes 2 bytes */
|
||||
uLong external_fa; /* external file attributes 4 bytes */
|
||||
|
||||
tm_unz tmu_date;
|
||||
} unz_file_info;
|
||||
|
||||
extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1,
|
||||
const char* fileName2,
|
||||
int iCaseSensitivity));
|
||||
/*
|
||||
Compare two filename (fileName1,fileName2).
|
||||
If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
|
||||
If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
|
||||
or strcasecmp)
|
||||
If iCaseSenisivity = 0, case sensitivity is defaut of your operating system
|
||||
(like 1 on Unix, 2 on Windows)
|
||||
*/
|
||||
|
||||
|
||||
extern unzFile ZEXPORT unzOpen OF((const char *path));
|
||||
extern unzFile ZEXPORT unzOpen64 OF((const void *path));
|
||||
/*
|
||||
Open a Zip file. path contain the full pathname (by example,
|
||||
on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix computer
|
||||
"zlib/zlib113.zip".
|
||||
If the zipfile cannot be opened (file don't exist or in not valid), the
|
||||
return value is NULL.
|
||||
Else, the return value is a unzFile Handle, usable with other function
|
||||
of this unzip package.
|
||||
the "64" function take a const void* pointer, because the path is just the
|
||||
value passed to the open64_file_func callback.
|
||||
Under Windows, if UNICODE is defined, using fill_fopen64_filefunc, the path
|
||||
is a pointer to a wide unicode string (LPCTSTR is LPCWSTR), so const char*
|
||||
does not describe the reality
|
||||
*/
|
||||
|
||||
|
||||
extern unzFile ZEXPORT unzOpen2 OF((const char *path,
|
||||
zlib_filefunc_def* pzlib_filefunc_def));
|
||||
/*
|
||||
Open a Zip file, like unzOpen, but provide a set of file low level API
|
||||
for read/write the zip file (see ioapi.h)
|
||||
*/
|
||||
|
||||
extern unzFile ZEXPORT unzOpen2_64 OF((const void *path,
|
||||
zlib_filefunc64_def* pzlib_filefunc_def));
|
||||
/*
|
||||
Open a Zip file, like unz64Open, but provide a set of file low level API
|
||||
for read/write the zip file (see ioapi.h)
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzClose OF((unzFile file));
|
||||
/*
|
||||
Close a ZipFile opened with unzOpen.
|
||||
If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
|
||||
these files MUST be closed with unzCloseCurrentFile before call unzClose.
|
||||
return UNZ_OK if there is no problem. */
|
||||
|
||||
extern int ZEXPORT unzGetGlobalInfo OF((unzFile file,
|
||||
unz_global_info *pglobal_info));
|
||||
|
||||
extern int ZEXPORT unzGetGlobalInfo64 OF((unzFile file,
|
||||
unz_global_info64 *pglobal_info));
|
||||
/*
|
||||
Write info about the ZipFile in the *pglobal_info structure.
|
||||
No preparation of the structure is needed
|
||||
return UNZ_OK if there is no problem. */
|
||||
|
||||
|
||||
extern int ZEXPORT unzGetGlobalComment OF((unzFile file,
|
||||
char *szComment,
|
||||
uLong uSizeBuf));
|
||||
/*
|
||||
Get the global comment string of the ZipFile, in the szComment buffer.
|
||||
uSizeBuf is the size of the szComment buffer.
|
||||
return the number of byte copied or an error code <0
|
||||
*/
|
||||
|
||||
|
||||
/***************************************************************************/
|
||||
/* Unzip package allow you browse the directory of the zipfile */
|
||||
|
||||
extern int ZEXPORT unzGoToFirstFile OF((unzFile file));
|
||||
/*
|
||||
Set the current file of the zipfile to the first file.
|
||||
return UNZ_OK if there is no problem
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzGoToNextFile OF((unzFile file));
|
||||
/*
|
||||
Set the current file of the zipfile to the next file.
|
||||
return UNZ_OK if there is no problem
|
||||
return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzLocateFile OF((unzFile file,
|
||||
const char *szFileName,
|
||||
int iCaseSensitivity));
|
||||
/*
|
||||
Try locate the file szFileName in the zipfile.
|
||||
For the iCaseSensitivity signification, see unzStringFileNameCompare
|
||||
|
||||
return value :
|
||||
UNZ_OK if the file is found. It becomes the current file.
|
||||
UNZ_END_OF_LIST_OF_FILE if the file is not found
|
||||
*/
|
||||
|
||||
|
||||
/* ****************************************** */
|
||||
/* Ryan supplied functions */
|
||||
/* unz_file_info contain information about a file in the zipfile */
|
||||
typedef struct unz_file_pos_s
|
||||
{
|
||||
uLong pos_in_zip_directory; /* offset in zip file directory */
|
||||
uLong num_of_file; /* # of file */
|
||||
} unz_file_pos;
|
||||
|
||||
extern int ZEXPORT unzGetFilePos(
|
||||
unzFile file,
|
||||
unz_file_pos* file_pos);
|
||||
|
||||
extern int ZEXPORT unzGoToFilePos(
|
||||
unzFile file,
|
||||
unz_file_pos* file_pos);
|
||||
|
||||
typedef struct unz64_file_pos_s
|
||||
{
|
||||
ZPOS64_T pos_in_zip_directory; /* offset in zip file directory */
|
||||
ZPOS64_T num_of_file; /* # of file */
|
||||
} unz64_file_pos;
|
||||
|
||||
extern int ZEXPORT unzGetFilePos64(
|
||||
unzFile file,
|
||||
unz64_file_pos* file_pos);
|
||||
|
||||
extern int ZEXPORT unzGoToFilePos64(
|
||||
unzFile file,
|
||||
const unz64_file_pos* file_pos);
|
||||
|
||||
/* ****************************************** */
|
||||
|
||||
extern int ZEXPORT unzGetCurrentFileInfo64 OF((unzFile file,
|
||||
unz_file_info64 *pfile_info,
|
||||
char *szFileName,
|
||||
uLong fileNameBufferSize,
|
||||
void *extraField,
|
||||
uLong extraFieldBufferSize,
|
||||
char *szComment,
|
||||
uLong commentBufferSize));
|
||||
|
||||
extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file,
|
||||
unz_file_info *pfile_info,
|
||||
char *szFileName,
|
||||
uLong fileNameBufferSize,
|
||||
void *extraField,
|
||||
uLong extraFieldBufferSize,
|
||||
char *szComment,
|
||||
uLong commentBufferSize));
|
||||
/*
|
||||
Get Info about the current file
|
||||
if pfile_info!=NULL, the *pfile_info structure will contain somes info about
|
||||
the current file
|
||||
if szFileName!=NULL, the filemane string will be copied in szFileName
|
||||
(fileNameBufferSize is the size of the buffer)
|
||||
if extraField!=NULL, the extra field information will be copied in extraField
|
||||
(extraFieldBufferSize is the size of the buffer).
|
||||
This is the Central-header version of the extra field
|
||||
if szComment!=NULL, the comment string of the file will be copied in szComment
|
||||
(commentBufferSize is the size of the buffer)
|
||||
*/
|
||||
|
||||
|
||||
/** Addition for GDAL : START */
|
||||
|
||||
extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64 OF((unzFile file));
|
||||
|
||||
/** Addition for GDAL : END */
|
||||
|
||||
|
||||
/***************************************************************************/
|
||||
/* for reading the content of the current zipfile, you can open it, read data
|
||||
from it, and close it (you can close it before reading all the file)
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzOpenCurrentFile OF((unzFile file));
|
||||
/*
|
||||
Open for reading data the current file in the zipfile.
|
||||
If there is no error, the return value is UNZ_OK.
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzOpenCurrentFilePassword OF((unzFile file,
|
||||
const char* password));
|
||||
/*
|
||||
Open for reading data the current file in the zipfile.
|
||||
password is a crypting password
|
||||
If there is no error, the return value is UNZ_OK.
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzOpenCurrentFile2 OF((unzFile file,
|
||||
int* method,
|
||||
int* level,
|
||||
int raw));
|
||||
/*
|
||||
Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
|
||||
if raw==1
|
||||
*method will receive method of compression, *level will receive level of
|
||||
compression
|
||||
note : you can set level parameter as NULL (if you did not want known level,
|
||||
but you CANNOT set method parameter as NULL
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzOpenCurrentFile3 OF((unzFile file,
|
||||
int* method,
|
||||
int* level,
|
||||
int raw,
|
||||
const char* password));
|
||||
/*
|
||||
Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
|
||||
if raw==1
|
||||
*method will receive method of compression, *level will receive level of
|
||||
compression
|
||||
note : you can set level parameter as NULL (if you did not want known level,
|
||||
but you CANNOT set method parameter as NULL
|
||||
*/
|
||||
|
||||
|
||||
extern int ZEXPORT unzCloseCurrentFile OF((unzFile file));
|
||||
/*
|
||||
Close the file in zip opened with unzOpenCurrentFile
|
||||
Return UNZ_CRCERROR if all the file was read but the CRC is not good
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzReadCurrentFile OF((unzFile file,
|
||||
voidp buf,
|
||||
unsigned len));
|
||||
/*
|
||||
Read bytes from the current file (opened by unzOpenCurrentFile)
|
||||
buf contain buffer where data must be copied
|
||||
len the size of buf.
|
||||
|
||||
return the number of byte copied if somes bytes are copied
|
||||
return 0 if the end of file was reached
|
||||
return <0 with error code if there is an error
|
||||
(UNZ_ERRNO for IO error, or zLib error for uncompress error)
|
||||
*/
|
||||
|
||||
extern z_off_t ZEXPORT unztell OF((unzFile file));
|
||||
|
||||
extern ZPOS64_T ZEXPORT unztell64 OF((unzFile file));
|
||||
/*
|
||||
Give the current position in uncompressed data
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzeof OF((unzFile file));
|
||||
/*
|
||||
return 1 if the end of file was reached, 0 elsewhere
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file,
|
||||
voidp buf,
|
||||
unsigned len));
|
||||
/*
|
||||
Read extra field from the current file (opened by unzOpenCurrentFile)
|
||||
This is the local-header version of the extra field (sometimes, there is
|
||||
more info in the local-header version than in the central-header)
|
||||
|
||||
if buf==NULL, it return the size of the local extra field
|
||||
|
||||
if buf!=NULL, len is the size of the buffer, the extra header is copied in
|
||||
buf.
|
||||
the return value is the number of bytes copied in buf, or (if <0)
|
||||
the error code
|
||||
*/
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
/* Get the current file offset */
|
||||
extern ZPOS64_T ZEXPORT unzGetOffset64 (unzFile file);
|
||||
extern uLong ZEXPORT unzGetOffset (unzFile file);
|
||||
|
||||
/* Set the current file offset */
|
||||
extern int ZEXPORT unzSetOffset64 (unzFile file, ZPOS64_T pos);
|
||||
extern int ZEXPORT unzSetOffset (unzFile file, uLong pos);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _unz64_H */
|
||||
37
configure.ac
37
configure.ac
|
|
@ -85,7 +85,6 @@ dnl Specify required versions of dependencies
|
|||
CAIRO_REQUIRED=1.10.0
|
||||
GLIB_REQUIRED=2.50.0
|
||||
GTK_REQUIRED=3.22.0
|
||||
WEBKIT_REQUIRED=2.4.3
|
||||
LIBSECRET_REQUIRED=0.5
|
||||
LIBXML_REQUIRED=2.5.0
|
||||
|
||||
|
|
@ -591,36 +590,6 @@ AM_CONDITIONAL(ENABLE_XPS, test x$enable_xps = xyes)
|
|||
|
||||
dnl ================== End of XPS checks ===================================================
|
||||
|
||||
|
||||
dnl ================== EPUB checks ===================================================
|
||||
|
||||
AC_ARG_ENABLE(epub,
|
||||
[AS_HELP_STRING([--enable-epub],
|
||||
[Compile with support for epub documents.])],
|
||||
[enable_epub=$enableval],
|
||||
[enable_epub=yes])
|
||||
|
||||
have_webkit="no"
|
||||
if test "x$enable_epub" = "xyes"; then
|
||||
PKG_CHECK_MODULES(EPUB, webkit2gtk-4.0 >= $WEBKIT_REQUIRED \
|
||||
libxml-2.0 >= $LIBXML_REQUIRED zlib,have_webkit=yes,have_webkit=no)
|
||||
if test "x$have_webkit" = "xno"; then
|
||||
AC_MSG_NOTICE([Webkit2 4.0 not found, trying 3.0])
|
||||
PKG_CHECK_MODULES(EPUB, webkit2gtk-3.0 >= $WEBKIT_REQUIRED \
|
||||
libxml-2.0 >= $LIBXML_REQUIRED zlib,have_webkit=yes,have_webkit=no)
|
||||
fi
|
||||
|
||||
if test "x$have_webkit" = "xyes"; then
|
||||
AC_DEFINE([ENABLE_EPUB], [1], [Enable support for ePub documents.])
|
||||
else
|
||||
AC_MSG_WARN(["ePub support is disabled."])
|
||||
fi
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(ENABLE_EPUB, test x$have_webkit = xyes)
|
||||
|
||||
dnl ================== End of EPUB checks ===================================================
|
||||
|
||||
dnl =================== Mime types list ====================================================
|
||||
|
||||
if test "x$enable_pdf" = "xyes" ; then
|
||||
|
|
@ -647,9 +616,6 @@ fi
|
|||
if test "x$enable_xps" = "xyes"; then
|
||||
ATRIL_MIME_TYPES="${ATRIL_MIME_TYPES}application/oxps;application/vnd.ms-xpsdocument;"
|
||||
fi
|
||||
if test "x$have_webkit" = "xyes"; then
|
||||
ATRIL_MIME_TYPES="${ATRIL_MIME_TYPES}application/epub+zip;"
|
||||
fi
|
||||
|
||||
AC_SUBST(ATRIL_MIME_TYPES)
|
||||
|
||||
|
|
@ -703,8 +669,6 @@ backend/comics/Makefile
|
|||
backend/djvu/Makefile
|
||||
backend/dvi/Makefile
|
||||
backend/dvi/mdvi-lib/Makefile
|
||||
backend/epub/Makefile
|
||||
backend/epub/minizip/Makefile
|
||||
backend/pdf/Makefile
|
||||
backend/pixbuf/Makefile
|
||||
backend/ps/Makefile
|
||||
|
|
@ -789,5 +753,4 @@ Configure summary:
|
|||
Pixbuf Backend......: $enable_pixbuf
|
||||
Comics Backend......: $enable_comics
|
||||
XPS Backend.........: $enable_xps
|
||||
ePub Backend........: $have_webkit
|
||||
"
|
||||
|
|
|
|||
|
|
@ -111,14 +111,12 @@ GTKDOC_CFLAGS = \
|
|||
$(AM_CFLAGS) \
|
||||
$(LIBVIEW_CFLAGS) \
|
||||
$(WARN_CFLAGS) \
|
||||
$(WEBKIT_CFLAGS) \
|
||||
$(DISABLE_DEPRECATED)
|
||||
|
||||
GTKDOC_LIBS = \
|
||||
$(top_builddir)/libdocument/libatrildocument.la \
|
||||
$(top_builddir)/libview/libatrilview.la \
|
||||
$(LIBDOCUMENT_LIBS) \
|
||||
$(WEBKIT_LIBS)
|
||||
$(LIBDOCUMENT_LIBS)
|
||||
|
||||
# This includes the standard gtk-doc make rules, copied by gtkdocize.
|
||||
include $(top_srcdir)/gtk-doc.make
|
||||
|
|
|
|||
|
|
@ -49,12 +49,3 @@ ev_document_find_find_text (EvDocumentFind *document_find,
|
|||
return iface->find_text (document_find, page, text, case_sensitive);
|
||||
}
|
||||
|
||||
guint
|
||||
ev_document_find_check_for_hits(EvDocumentFind *document_find,
|
||||
EvPage *page,
|
||||
const gchar *text,
|
||||
gboolean case_sensitive)
|
||||
{
|
||||
EvDocumentFindInterface *iface = EV_DOCUMENT_FIND_GET_IFACE (document_find);
|
||||
return iface->check_for_hits (document_find, page, text, case_sensitive);
|
||||
}
|
||||
|
|
@ -52,11 +52,6 @@ struct _EvDocumentFindInterface
|
|||
EvPage *page,
|
||||
const gchar *text,
|
||||
gboolean case_sensitive);
|
||||
|
||||
guint (* check_for_hits) (EvDocumentFind *document_find,
|
||||
EvPage *page,
|
||||
const gchar *text,
|
||||
gboolean case_sensitive);
|
||||
};
|
||||
|
||||
GType ev_document_find_get_type (void) G_GNUC_CONST;
|
||||
|
|
@ -65,10 +60,6 @@ GList *ev_document_find_find_text (EvDocumentFind *document_find,
|
|||
const gchar *text,
|
||||
gboolean case_sensitive);
|
||||
|
||||
guint ev_document_find_check_for_hits (EvDocumentFind *document_find,
|
||||
EvPage *page,
|
||||
const gchar *text,
|
||||
gboolean case_sensitive);
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* EV_DOCUMENT_FIND_H */
|
||||
|
|
|
|||
|
|
@ -59,4 +59,5 @@ ev_document_thumbnails_get_dimensions (EvDocumentThumbnails *document,
|
|||
|
||||
iface = EV_DOCUMENT_THUMBNAILS_GET_IFACE (document);
|
||||
iface->get_dimensions (document, rc, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,6 @@ struct _EvDocumentThumbnailsInterface {
|
|||
EvRenderContext *rc,
|
||||
gint *width,
|
||||
gint *height);
|
||||
|
||||
};
|
||||
|
||||
GType ev_document_thumbnails_get_type (void) G_GNUC_CONST;
|
||||
|
|
@ -63,6 +62,7 @@ void ev_document_thumbnails_get_dimensions (EvDocumentThumbnails *document
|
|||
EvRenderContext *rc,
|
||||
gint *width,
|
||||
gint *height);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* EV_DOCUMENT_THUMBNAILS_H */
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@
|
|||
|
||||
#include "ev-document.h"
|
||||
#include "synctex_parser.h"
|
||||
#include "ev-file-helpers.h"
|
||||
|
||||
#define EV_DOCUMENT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EV_TYPE_DOCUMENT, EvDocumentPrivate))
|
||||
|
||||
|
|
@ -142,8 +141,6 @@ ev_document_init (EvDocument *document)
|
|||
|
||||
/* Assume all pages are the same size until proven otherwise */
|
||||
document->priv->uniform = TRUE;
|
||||
/* Assume that the document is not a web document*/
|
||||
document->iswebdocument = FALSE ;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -222,14 +219,6 @@ ev_document_load (EvDocument *document,
|
|||
gboolean retval;
|
||||
GError *err = NULL;
|
||||
|
||||
/*
|
||||
* Hardcoding a check for ePub documents, cause it needs a web document DOM
|
||||
* and webkit, support for any other web document types can be added similarly.
|
||||
*/
|
||||
|
||||
if ( !g_strcmp0 (ev_file_get_mime_type(uri,TRUE,&err),"application/epub+zip") )
|
||||
document->iswebdocument=TRUE ;
|
||||
|
||||
retval = klass->load (document, uri, &err);
|
||||
if (!retval) {
|
||||
if (err) {
|
||||
|
|
@ -251,34 +240,18 @@ ev_document_load (EvDocument *document,
|
|||
/* Cache some info about the document to avoid
|
||||
* going to the backends since it requires locks
|
||||
*/
|
||||
|
||||
priv->uri = g_strdup (uri);
|
||||
|
||||
priv->n_pages = _ev_document_get_n_pages (document);
|
||||
|
||||
for (i = 0; i < priv->n_pages; i++) {
|
||||
|
||||
/*
|
||||
* Since there is no sense of paging in an ePub,it makes no sense to have pages sizes.
|
||||
* We are however geeneralising the scenario by considering epub as a type of web document.
|
||||
* FIXME: Labels, or bookmarks though, can be done.
|
||||
*/
|
||||
|
||||
for (i = 0; i < priv->n_pages; i++) {
|
||||
EvPage *page = ev_document_get_page (document, i);
|
||||
gdouble page_width = 0;
|
||||
gdouble page_height = 0;
|
||||
EvPageSize *page_size;
|
||||
gchar *page_label;
|
||||
|
||||
if ( document->iswebdocument == FALSE ) {
|
||||
_ev_document_get_page_size (document, page, &page_width, &page_height);
|
||||
}
|
||||
else {
|
||||
//Fixed page sized to resolve the X-windowing system error.
|
||||
page_width = 800;
|
||||
page_height= 600;
|
||||
}
|
||||
|
||||
|
||||
_ev_document_get_page_size (document, page, &page_width, &page_height);
|
||||
|
||||
if (i == 0) {
|
||||
priv->uniform_width = page_width;
|
||||
priv->uniform_height = page_height;
|
||||
|
|
@ -286,21 +259,14 @@ ev_document_load (EvDocument *document,
|
|||
priv->max_height = priv->uniform_height;
|
||||
priv->min_width = priv->uniform_width;
|
||||
priv->min_height = priv->uniform_height;
|
||||
if (document->iswebdocument == TRUE ) {
|
||||
priv->page_sizes = g_new0 (EvPageSize, 1);
|
||||
priv->page_sizes->width = priv->uniform_width;
|
||||
priv->page_sizes->height = priv->uniform_height;
|
||||
priv->uniform = TRUE ;
|
||||
break;
|
||||
}
|
||||
} else if (priv->uniform &&
|
||||
(priv->uniform_width != page_width ||
|
||||
priv->uniform_height != page_height)) {
|
||||
/* It's a different page size. Backfill the array. */
|
||||
int j;
|
||||
|
||||
|
||||
priv->page_sizes = g_new0 (EvPageSize, priv->n_pages);
|
||||
|
||||
|
||||
for (j = 0; j < i; j++) {
|
||||
page_size = &(priv->page_sizes[j]);
|
||||
page_size->width = priv->uniform_width;
|
||||
|
|
@ -531,21 +497,15 @@ ev_document_get_page_size (EvDocument *document,
|
|||
{
|
||||
g_return_if_fail (EV_IS_DOCUMENT (document));
|
||||
g_return_if_fail (page_index >= 0 || page_index < document->priv->n_pages);
|
||||
if (document->iswebdocument == TRUE ) {
|
||||
if (width)
|
||||
*width = document->priv->uniform_width;
|
||||
if (height)
|
||||
*height = document->priv->uniform_height;
|
||||
} else {
|
||||
if (width)
|
||||
*width = document->priv->uniform ?
|
||||
document->priv->uniform_width :
|
||||
document->priv->page_sizes[page_index].width;
|
||||
if (height)
|
||||
*height = document->priv->uniform ?
|
||||
document->priv->uniform_height :
|
||||
document->priv->page_sizes[page_index].height;
|
||||
}
|
||||
|
||||
if (width)
|
||||
*width = document->priv->uniform ?
|
||||
document->priv->uniform_width :
|
||||
document->priv->page_sizes[page_index].width;
|
||||
if (height)
|
||||
*height = document->priv->uniform ?
|
||||
document->priv->uniform_height :
|
||||
document->priv->page_sizes[page_index].height;
|
||||
}
|
||||
|
||||
static gchar *
|
||||
|
|
@ -934,17 +894,3 @@ ev_rect_cmp (EvRectangle *a,
|
|||
(ABS (a->x2 - b->x2) < EPSILON) &&
|
||||
(ABS (a->y2 - b->y2) < EPSILON));
|
||||
}
|
||||
|
||||
void
|
||||
ev_document_toggle_night_mode(EvDocument *document,gboolean night)
|
||||
{
|
||||
EvDocumentClass *klass = EV_DOCUMENT_GET_CLASS(document);
|
||||
return klass->toggle_night_mode(document,night) ;
|
||||
}
|
||||
|
||||
void
|
||||
ev_document_check_add_night_sheet(EvDocument *document)
|
||||
{
|
||||
EvDocumentClass *klass = EV_DOCUMENT_GET_CLASS(document);
|
||||
return klass->check_add_night_sheet(document) ;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,11 +80,6 @@ struct _EvDocument
|
|||
GObject base;
|
||||
|
||||
EvDocumentPrivate *priv;
|
||||
/*
|
||||
* Since we can only access the members of this structure from the window frontend,
|
||||
* we need a flag to detemine whether to replace the atril-view with a web-view.
|
||||
*/
|
||||
gboolean iswebdocument;
|
||||
};
|
||||
|
||||
struct _EvDocumentClass
|
||||
|
|
@ -113,9 +108,6 @@ struct _EvDocumentClass
|
|||
gboolean (* get_backend_info)(EvDocument *document,
|
||||
EvDocumentBackendInfo *info);
|
||||
gboolean (* support_synctex) (EvDocument *document);
|
||||
|
||||
void (* toggle_night_mode) (EvDocument *document,gboolean night);
|
||||
void (*check_add_night_sheet)(EvDocument *document);
|
||||
};
|
||||
|
||||
GType ev_document_get_type (void) G_GNUC_CONST;
|
||||
|
|
@ -182,8 +174,6 @@ EvMapping *ev_document_synctex_forward_search
|
|||
|
||||
gint ev_rect_cmp (EvRectangle *a,
|
||||
EvRectangle *b);
|
||||
void ev_document_toggle_night_mode (EvDocument *document,gboolean night);
|
||||
void ev_document_check_add_night_sheet (EvDocument *document);
|
||||
|
||||
#define EV_TYPE_RECTANGLE (ev_rectangle_get_type ())
|
||||
struct _EvRectangle
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ INST_H_SRC_FILES = \
|
|||
ev-print-operation.h \
|
||||
ev-stock-icons.h \
|
||||
ev-view.h \
|
||||
ev-web-view.h \
|
||||
ev-view-presentation.h
|
||||
|
||||
INST_H_FILES = \
|
||||
|
|
@ -48,7 +47,6 @@ libatrilview_la_SOURCES = \
|
|||
ev-timeline.c \
|
||||
ev-transition-animation.c \
|
||||
ev-view.c \
|
||||
ev-web-view.c \
|
||||
ev-view-accessible.c \
|
||||
ev-view-marshal.c \
|
||||
ev-view-cursor.c \
|
||||
|
|
@ -71,7 +69,6 @@ libatrilview_la_CFLAGS = \
|
|||
$(LIBVIEW_CFLAGS) \
|
||||
$(WARN_CFLAGS) \
|
||||
$(DISABLE_DEPRECATED) \
|
||||
$(EPUB_CFLAGS) \
|
||||
$(AM_CFLAGS)
|
||||
|
||||
libatrilview_la_LDFLAGS = \
|
||||
|
|
@ -82,8 +79,7 @@ libatrilview_la_LDFLAGS = \
|
|||
|
||||
libatrilview_la_LIBADD = \
|
||||
$(top_builddir)/libdocument/libatrildocument.la \
|
||||
$(LIBVIEW_LIBS) \
|
||||
$(EPUB_LIBS)
|
||||
$(LIBVIEW_LIBS)
|
||||
|
||||
BUILT_SOURCES = \
|
||||
ev-view-marshal.h \
|
||||
|
|
|
|||
|
|
@ -82,8 +82,6 @@ void ev_document_model_set_rotation (EvDocumentModel *model,
|
|||
gint ev_document_model_get_rotation (EvDocumentModel *model);
|
||||
void ev_document_model_set_inverted_colors (EvDocumentModel *model,
|
||||
gboolean inverted_colors);
|
||||
void atril_web_document_set_inverted_colors(EvDocumentModel *model,
|
||||
gboolean inverted_colors);
|
||||
gboolean ev_document_model_get_inverted_colors (EvDocumentModel *model);
|
||||
void ev_document_model_set_continuous (EvDocumentModel *model,
|
||||
gboolean continuous);
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@
|
|||
#include "ev-document-thumbnails.h"
|
||||
#include "ev-document-links.h"
|
||||
#include "ev-document-images.h"
|
||||
#include "ev-job-scheduler.h"
|
||||
#include "ev-document-forms.h"
|
||||
#include "ev-file-exporter.h"
|
||||
#include "ev-document-factory.h"
|
||||
|
|
@ -41,9 +40,6 @@
|
|||
#include "ev-debug.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#if ENABLE_EPUB
|
||||
#include <webkit2/webkit2.h>
|
||||
#endif
|
||||
#include <errno.h>
|
||||
#include <glib/gstdio.h>
|
||||
#include <glib/gi18n-lib.h>
|
||||
|
|
@ -63,8 +59,8 @@ static void ev_job_page_data_init (EvJobPageData *job);
|
|||
static void ev_job_page_data_class_init (EvJobPageDataClass *class);
|
||||
static void ev_job_thumbnail_init (EvJobThumbnail *job);
|
||||
static void ev_job_thumbnail_class_init (EvJobThumbnailClass *class);
|
||||
static void ev_job_load_init (EvJobLoad *job);
|
||||
static void ev_job_load_class_init (EvJobLoadClass *class);
|
||||
static void ev_job_load_init (EvJobLoad *job);
|
||||
static void ev_job_load_class_init (EvJobLoadClass *class);
|
||||
static void ev_job_save_init (EvJobSave *job);
|
||||
static void ev_job_save_class_init (EvJobSaveClass *class);
|
||||
static void ev_job_find_init (EvJobFind *job);
|
||||
|
|
@ -216,7 +212,7 @@ ev_job_run (EvJob *job)
|
|||
{
|
||||
EvJobClass *class = EV_JOB_GET_CLASS (job);
|
||||
|
||||
return class-> run (job);
|
||||
return class->run (job);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -618,24 +614,6 @@ ev_job_render_run (EvJob *job)
|
|||
ev_document_fc_mutex_lock ();
|
||||
|
||||
ev_page = ev_document_get_page (job->document, job_render->page);
|
||||
|
||||
if ( job->document->iswebdocument == TRUE )
|
||||
{
|
||||
return TRUE;
|
||||
|
||||
if (g_cancellable_is_cancelled (job->cancellable)) {
|
||||
ev_document_fc_mutex_unlock ();
|
||||
ev_document_doc_mutex_unlock ();
|
||||
g_object_unref (rc);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ev_document_fc_mutex_unlock ();
|
||||
ev_document_doc_mutex_unlock ();
|
||||
ev_job_succeeded (job);
|
||||
return FALSE;
|
||||
}
|
||||
rc = ev_render_context_new (ev_page, job_render->rotation, job_render->scale);
|
||||
g_object_unref (ev_page);
|
||||
|
||||
|
|
@ -819,7 +797,7 @@ ev_job_page_data_new (EvDocument *document,
|
|||
static void
|
||||
ev_job_thumbnail_init (EvJobThumbnail *job)
|
||||
{
|
||||
EV_JOB (job)->run_mode = EV_JOB_RUN_THREAD;
|
||||
EV_JOB (job)->run_mode = EV_JOB_RUN_THREAD;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -839,77 +817,6 @@ ev_job_thumbnail_dispose (GObject *object)
|
|||
(* G_OBJECT_CLASS (ev_job_thumbnail_parent_class)->dispose) (object);
|
||||
}
|
||||
|
||||
#if ENABLE_EPUB
|
||||
static void
|
||||
snapshot_callback(WebKitWebView *webview,
|
||||
GAsyncResult *results,
|
||||
EvJobThumbnail *job_thumb)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
ev_document_doc_mutex_lock ();
|
||||
|
||||
EvPage *page = ev_document_get_page (EV_JOB(job_thumb)->document, job_thumb->page);
|
||||
job_thumb->surface = webkit_web_view_get_snapshot_finish (webview,
|
||||
results,
|
||||
&error);
|
||||
|
||||
if (error) {
|
||||
g_warning ("Error retrieving a snapshot: %s", error->message);
|
||||
}
|
||||
|
||||
EvRenderContext *rc = ev_render_context_new (page, job_thumb->rotation, job_thumb->scale);
|
||||
EvPage *screenshotpage;
|
||||
screenshotpage = ev_page_new(job_thumb->page);
|
||||
screenshotpage->backend_page = (EvBackendPage)job_thumb->surface;
|
||||
screenshotpage->backend_destroy_func = (EvBackendPageDestroyFunc)cairo_surface_destroy;
|
||||
ev_render_context_set_page(rc,screenshotpage);
|
||||
|
||||
job_thumb->thumbnail = ev_document_thumbnails_get_thumbnail (EV_DOCUMENT_THUMBNAILS (EV_JOB(job_thumb)->document),
|
||||
rc, TRUE);
|
||||
g_object_unref(screenshotpage);
|
||||
g_object_unref(rc);
|
||||
|
||||
ev_document_doc_mutex_unlock ();
|
||||
ev_job_succeeded (EV_JOB(job_thumb));
|
||||
|
||||
gtk_widget_destroy (gtk_widget_get_toplevel (GTK_WIDGET (webview)));
|
||||
}
|
||||
|
||||
static void
|
||||
web_thumbnail_get_screenshot_cb (WebKitWebView *webview,
|
||||
WebKitLoadEvent event,
|
||||
EvJobThumbnail *job_thumb)
|
||||
{
|
||||
if (event != WEBKIT_LOAD_FINISHED || ev_job_is_failed (EV_JOB(job_thumb))) {
|
||||
return;
|
||||
}
|
||||
|
||||
webkit_web_view_get_snapshot (webview,
|
||||
WEBKIT_SNAPSHOT_REGION_VISIBLE,
|
||||
WEBKIT_SNAPSHOT_OPTIONS_NONE,
|
||||
NULL,
|
||||
(GAsyncReadyCallback)snapshot_callback,
|
||||
g_object_ref (job_thumb));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
webview_load_failed_cb (WebKitWebView *webview,
|
||||
WebKitLoadEvent event,
|
||||
gchar *failing_uri,
|
||||
gpointer error,
|
||||
EvJobThumbnail *job_thumb)
|
||||
{
|
||||
GError *e = (GError *) error;
|
||||
g_warning ("Error loading data from %s: %s", failing_uri, e->message);
|
||||
ev_job_failed_from_error (EV_JOB(job_thumb), e);
|
||||
|
||||
gtk_widget_destroy (gtk_widget_get_toplevel (GTK_WIDGET (webview)));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif /* ENABLE_EPUB */
|
||||
|
||||
static gboolean
|
||||
ev_job_thumbnail_run (EvJob *job)
|
||||
{
|
||||
|
|
@ -919,53 +826,19 @@ ev_job_thumbnail_run (EvJob *job)
|
|||
ev_debug_message (DEBUG_JOBS, "%d (%p)", job_thumb->page, job);
|
||||
ev_profiler_start (EV_PROFILE_JOBS, "%s (%p)", EV_GET_TYPE_NAME (job), job);
|
||||
|
||||
if (job->document->iswebdocument) {
|
||||
/* Do not block the main loop */
|
||||
if (!ev_document_doc_mutex_trylock ())
|
||||
return TRUE;
|
||||
} else {
|
||||
ev_document_doc_mutex_lock ();
|
||||
}
|
||||
ev_document_doc_mutex_lock ();
|
||||
|
||||
page = ev_document_get_page (job->document, job_thumb->page);
|
||||
ev_document_doc_mutex_unlock ();
|
||||
|
||||
if (job->document->iswebdocument == TRUE ) {
|
||||
rc = ev_render_context_new (page, 0, job_thumb->scale);
|
||||
} else {
|
||||
rc = ev_render_context_new (page, job_thumb->rotation, job_thumb->scale);
|
||||
}
|
||||
rc = ev_render_context_new (page, job_thumb->rotation, job_thumb->scale);
|
||||
g_object_unref (page);
|
||||
|
||||
#if ENABLE_EPUB
|
||||
if (job->document->iswebdocument == TRUE) {
|
||||
GtkWidget *webview;
|
||||
GtkWidget *offscreenwindow;
|
||||
|
||||
webview = webkit_web_view_new ();
|
||||
offscreenwindow = gtk_offscreen_window_new ();
|
||||
|
||||
gtk_container_add (GTK_CONTAINER(offscreenwindow), GTK_WIDGET (webview));
|
||||
gtk_window_set_default_size (GTK_WINDOW(offscreenwindow), 800, 1080);
|
||||
gtk_widget_show_all (offscreenwindow);
|
||||
|
||||
g_signal_connect (WEBKIT_WEB_VIEW (webview), "load-changed",
|
||||
G_CALLBACK (web_thumbnail_get_screenshot_cb),
|
||||
g_object_ref (job_thumb));
|
||||
g_signal_connect (WEBKIT_WEB_VIEW(webview), "load-failed",
|
||||
G_CALLBACK(webview_load_failed_cb),
|
||||
g_object_ref (job_thumb));
|
||||
webkit_web_view_load_uri (WEBKIT_WEB_VIEW (webview), (gchar*) rc->page->backend_page);
|
||||
}
|
||||
else
|
||||
#endif /* ENABLE_EPUB */
|
||||
{
|
||||
ev_document_doc_mutex_lock ();
|
||||
job_thumb->thumbnail = ev_document_thumbnails_get_thumbnail (EV_DOCUMENT_THUMBNAILS (job->document),
|
||||
rc, TRUE);
|
||||
ev_document_doc_mutex_unlock ();
|
||||
ev_job_succeeded (job);
|
||||
}
|
||||
ev_document_doc_mutex_lock ();
|
||||
job_thumb->thumbnail = ev_document_thumbnails_get_thumbnail (EV_DOCUMENT_THUMBNAILS (job->document),
|
||||
rc, TRUE);
|
||||
ev_document_doc_mutex_unlock ();
|
||||
ev_job_succeeded (job);
|
||||
g_object_unref (rc);
|
||||
|
||||
return FALSE;
|
||||
|
|
@ -1372,10 +1245,6 @@ ev_job_find_dispose (GObject *object)
|
|||
g_free (job->pages);
|
||||
job->pages = NULL;
|
||||
}
|
||||
|
||||
if (job->results) {
|
||||
g_free(job->results);
|
||||
}
|
||||
|
||||
(* G_OBJECT_CLASS (ev_job_find_parent_class)->dispose) (object);
|
||||
}
|
||||
|
|
@ -1387,6 +1256,7 @@ ev_job_find_run (EvJob *job)
|
|||
EvDocumentFind *find = EV_DOCUMENT_FIND (job->document);
|
||||
EvPage *ev_page;
|
||||
GList *matches;
|
||||
|
||||
ev_debug_message (DEBUG_JOBS, NULL);
|
||||
|
||||
/* Do not block the main loop */
|
||||
|
|
@ -1400,30 +1270,16 @@ ev_job_find_run (EvJob *job)
|
|||
#endif
|
||||
|
||||
ev_page = ev_document_get_page (job->document, job_find->current_page);
|
||||
|
||||
if (job->document->iswebdocument) {
|
||||
job_find->results[job_find->current_page] = ev_document_find_check_for_hits(find, ev_page, job_find->text,
|
||||
job_find->case_sensitive);
|
||||
}else {
|
||||
matches = ev_document_find_find_text (find, ev_page, job_find->text,
|
||||
job_find->case_sensitive);
|
||||
}
|
||||
|
||||
matches = ev_document_find_find_text (find, ev_page, job_find->text,
|
||||
job_find->case_sensitive);
|
||||
g_object_unref (ev_page);
|
||||
|
||||
ev_document_doc_mutex_unlock ();
|
||||
|
||||
if (!job_find->has_results && !job->document->iswebdocument) {
|
||||
if (!job_find->has_results)
|
||||
job_find->has_results = (matches != NULL);
|
||||
}
|
||||
else if (!job_find->has_results && job->document->iswebdocument){
|
||||
job_find->has_results = (job_find->results[job_find->current_page] > 0);
|
||||
}
|
||||
|
||||
if (job->document->iswebdocument == FALSE) {
|
||||
job_find->pages[job_find->current_page] = matches;
|
||||
}
|
||||
|
||||
job_find->pages[job_find->current_page] = matches;
|
||||
g_signal_emit (job_find, job_find_signals[FIND_UPDATED], 0, job_find->current_page);
|
||||
|
||||
job_find->current_page = (job_find->current_page + 1) % job_find->n_pages;
|
||||
|
|
@ -1473,13 +1329,7 @@ ev_job_find_new (EvDocument *document,
|
|||
job->start_page = start_page;
|
||||
job->current_page = start_page;
|
||||
job->n_pages = n_pages;
|
||||
|
||||
if (document->iswebdocument) {
|
||||
job->results = g_malloc0 (sizeof(guint) *n_pages);
|
||||
}
|
||||
else {
|
||||
job->pages = g_new0 (GList *, n_pages);
|
||||
}
|
||||
job->pages = g_new0 (GList *, n_pages);
|
||||
job->text = g_strdup (text);
|
||||
job->case_sensitive = case_sensitive;
|
||||
job->has_results = FALSE;
|
||||
|
|
@ -1491,12 +1341,7 @@ gint
|
|||
ev_job_find_get_n_results (EvJobFind *job,
|
||||
gint page)
|
||||
{
|
||||
if (EV_JOB(job)->document->iswebdocument) {
|
||||
return job->results[page];
|
||||
}
|
||||
else {
|
||||
return g_list_length (job->pages[page]);
|
||||
}
|
||||
return g_list_length (job->pages[page]);
|
||||
}
|
||||
|
||||
gdouble
|
||||
|
|
|
|||
|
|
@ -45,9 +45,6 @@ typedef struct _EvJobPageDataClass EvJobPageDataClass;
|
|||
typedef struct _EvJobThumbnail EvJobThumbnail;
|
||||
typedef struct _EvJobThumbnailClass EvJobThumbnailClass;
|
||||
|
||||
typedef struct _EvJobWebThumbnail EvJobWebThumbnail;
|
||||
typedef struct _EvJobWebThumbnailClass EvJobWebThumbnailClass;
|
||||
|
||||
typedef struct _EvJobLinks EvJobLinks;
|
||||
typedef struct _EvJobLinksClass EvJobLinksClass;
|
||||
|
||||
|
|
@ -114,11 +111,6 @@ typedef struct _EvJobPrintClass EvJobPrintClass;
|
|||
#define EV_JOB_THUMBNAIL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), EV_TYPE_JOB_THUMBNAIL, EvJobThumbnailClass))
|
||||
#define EV_IS_JOB_THUMBNAIL(object) (G_TYPE_CHECK_INSTANCE_TYPE((object), EV_TYPE_JOB_THUMBNAIL))
|
||||
|
||||
#define EV_TYPE_JOB_WEB_THUMBNAIL (ev_job_web_thumbnail_get_type())
|
||||
#define EV_JOB_WEB_THUMBNAIL(object) (G_TYPE_CHECK_INSTANCE_CAST((object), EV_TYPE_JOB_WEB_THUMBNAIL, EvJobWebThumbnail))
|
||||
#define EV_JOB_WEB_THUMBNAIL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), EV_TYPE_JOB_WEB_THUMBNAIL, EvJobWebThumbnailClass))
|
||||
#define EV_IS_JOB_WEB_THUMBNAIL(object) (G_TYPE_CHECK_INSTANCE_TYPE((object), EV_TYPE_JOB_WEB_THUMBNAIL))
|
||||
|
||||
#define EV_TYPE_JOB_FONTS (ev_job_fonts_get_type())
|
||||
#define EV_JOB_FONTS(object) (G_TYPE_CHECK_INSTANCE_CAST((object), EV_TYPE_JOB_FONTS, EvJobFonts))
|
||||
#define EV_JOB_FONTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), EV_TYPE_JOB_FONTS, EvJobFontsClass))
|
||||
|
|
@ -294,10 +286,11 @@ struct _EvJobPageDataClass
|
|||
struct _EvJobThumbnail
|
||||
{
|
||||
EvJob parent;
|
||||
|
||||
gint page;
|
||||
gint rotation;
|
||||
gdouble scale;
|
||||
cairo_surface_t *surface;
|
||||
|
||||
GdkPixbuf *thumbnail;
|
||||
};
|
||||
|
||||
|
|
@ -355,7 +348,6 @@ struct _EvJobFind
|
|||
gint current_page;
|
||||
gint n_pages;
|
||||
GList **pages;
|
||||
guint *results;
|
||||
gchar *text;
|
||||
gboolean case_sensitive;
|
||||
gboolean has_results;
|
||||
|
|
@ -463,7 +455,6 @@ EvJob *ev_job_thumbnail_new (EvDocument *document,
|
|||
gint page,
|
||||
gint rotation,
|
||||
gdouble scale);
|
||||
|
||||
/* EvJobFonts */
|
||||
GType ev_job_fonts_get_type (void) G_GNUC_CONST;
|
||||
EvJob *ev_job_fonts_new (EvDocument *document);
|
||||
|
|
|
|||
|
|
@ -8121,42 +8121,3 @@ ev_view_previous_page (EvView *view)
|
|||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* ev_view_disconnect_handlers
|
||||
* @view: #EvView instance
|
||||
*
|
||||
* Disconnect all signal handlers from the model, to ensure error free operation of the webview,
|
||||
* we have an equivalent function for the webview.
|
||||
*/
|
||||
void
|
||||
ev_view_disconnect_handlers(EvView *view)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func(view->model,
|
||||
G_CALLBACK (ev_view_rotation_changed_cb),
|
||||
view);
|
||||
g_signal_handlers_disconnect_by_func(view->model,
|
||||
G_CALLBACK (ev_view_inverted_colors_changed_cb),
|
||||
view);
|
||||
g_signal_handlers_disconnect_by_func(view->model,
|
||||
G_CALLBACK (ev_view_sizing_mode_changed_cb),
|
||||
view);
|
||||
g_signal_handlers_disconnect_by_func(view->model,
|
||||
G_CALLBACK (ev_view_page_layout_changed_cb),
|
||||
view);
|
||||
g_signal_handlers_disconnect_by_func(view->model,
|
||||
G_CALLBACK (ev_view_scale_changed_cb),
|
||||
view);
|
||||
g_signal_handlers_disconnect_by_func(view->model,
|
||||
G_CALLBACK (ev_view_continuous_changed_cb),
|
||||
view);
|
||||
g_signal_handlers_disconnect_by_func(view->model,
|
||||
G_CALLBACK (ev_view_fullscreen_changed_cb),
|
||||
view);
|
||||
g_signal_handlers_disconnect_by_func(view->model,
|
||||
G_CALLBACK (ev_view_page_changed_cb),
|
||||
view);
|
||||
g_signal_handlers_disconnect_by_func(view->model,
|
||||
G_CALLBACK (ev_view_document_changed_cb),
|
||||
view);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,9 +114,6 @@ void ev_view_cancel_add_annotation (EvView *view);
|
|||
void ev_view_remove_annotation (EvView *view,
|
||||
EvAnnotation *annot);
|
||||
|
||||
/*For epub*/
|
||||
void ev_view_disconnect_handlers (EvView *view);
|
||||
|
||||
/* Caret navigation */
|
||||
gboolean ev_view_supports_caret_navigation (EvView *view);
|
||||
gboolean ev_view_is_caret_navigation_enabled (EvView *view);
|
||||
|
|
|
|||
|
|
@ -1,724 +0,0 @@
|
|||
/* this file is part of atril, a mate document viewer
|
||||
*
|
||||
* Copyright (C) 2014 Avishkar Gupta
|
||||
* Based on ev-view.c, also a part of atril, a mate document viewer.
|
||||
*
|
||||
* Atril is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Atril is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#if ENABLE_EPUB
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <webkit2/webkit2.h>
|
||||
|
||||
#include "ev-web-view.h"
|
||||
#include "ev-document-model.h"
|
||||
#include "ev-jobs.h"
|
||||
|
||||
#define EV_WEB_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EV_TYPE_WEB_VIEW, EvWebViewClass))
|
||||
#define EV_IS_WEB_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EV_TYPE_WEB_VIEW))
|
||||
#define EV_WEB_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EV_TYPE_WEB_VIEW, EvWebViewClass))
|
||||
|
||||
typedef enum {
|
||||
EV_WEB_VIEW_FIND_NEXT,
|
||||
EV_WEB_VIEW_FIND_PREV
|
||||
} EvWebViewFindDirection;
|
||||
|
||||
typedef struct _SearchParams {
|
||||
gboolean case_sensitive;
|
||||
gchar* search_string;
|
||||
EvWebViewFindDirection direction;
|
||||
gboolean search_jump;
|
||||
gint on_result;
|
||||
guint *results;
|
||||
}SearchParams;
|
||||
|
||||
struct _EvWebView
|
||||
{
|
||||
WebKitWebView web_view;
|
||||
EvDocument *document;
|
||||
EvDocumentModel *model;
|
||||
gint current_page;
|
||||
gboolean inverted_stylesheet ;
|
||||
gboolean fullscreen;
|
||||
SearchParams *search;
|
||||
WebKitFindController *findcontroller;
|
||||
WebKitFindOptions findoptions;
|
||||
gdouble zoom_level;
|
||||
gchar *hlink;
|
||||
};
|
||||
|
||||
struct _EvWebViewClass
|
||||
{
|
||||
WebKitWebViewClass base_class;
|
||||
};
|
||||
|
||||
/*** Callbacks ***/
|
||||
static void ev_web_view_change_page (EvWebView *webview,
|
||||
gint new_page);
|
||||
|
||||
static void ev_web_view_page_changed_cb (EvDocumentModel *model,
|
||||
gint old_page,
|
||||
gint new_page,
|
||||
EvWebView *webview);
|
||||
/*** GObject ***/
|
||||
static void ev_web_view_dispose (GObject *object);
|
||||
|
||||
static void ev_web_view_finalize (GObject *object);
|
||||
static void ev_web_view_class_init (EvWebViewClass *klass);
|
||||
static void ev_web_view_init (EvWebView *webview);
|
||||
|
||||
G_DEFINE_TYPE (EvWebView, ev_web_view, WEBKIT_TYPE_WEB_VIEW)
|
||||
|
||||
static void
|
||||
web_view_update_range_and_current_page (EvWebView *webview)
|
||||
{
|
||||
g_return_if_fail(EV_IS_WEB_VIEW(webview));
|
||||
|
||||
if (ev_document_get_n_pages (webview->document) <= 0)
|
||||
return;
|
||||
|
||||
ev_document_model_set_page(webview->model, 0);
|
||||
webview->current_page = 0;
|
||||
EvPage *webpage = ev_document_get_page(webview->document,0);
|
||||
webkit_web_view_load_uri(WEBKIT_WEB_VIEW(webview),(gchar*)webpage->backend_page);
|
||||
}
|
||||
|
||||
static void
|
||||
ev_web_view_dispose (GObject *object)
|
||||
{
|
||||
EvWebView *webview = EV_WEB_VIEW (object);
|
||||
|
||||
if (webview->document) {
|
||||
g_object_unref(webview->document);
|
||||
webview->document = NULL ;
|
||||
}
|
||||
|
||||
if (webview->model) {
|
||||
g_object_unref(webview->model);
|
||||
webview->model = NULL;
|
||||
}
|
||||
|
||||
if (webview->hlink) {
|
||||
g_free(webview->hlink);
|
||||
webview->hlink = NULL;
|
||||
}
|
||||
|
||||
if (webview->search) {
|
||||
g_free(webview->search);
|
||||
webview->search = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (ev_web_view_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
ev_web_view_class_init (EvWebViewClass *klass)
|
||||
{
|
||||
G_OBJECT_CLASS(klass)->finalize = ev_web_view_finalize;
|
||||
G_OBJECT_CLASS(klass)->dispose = ev_web_view_dispose;
|
||||
}
|
||||
|
||||
static void
|
||||
ev_web_view_init (EvWebView *webview)
|
||||
{
|
||||
gtk_widget_set_can_focus (GTK_WIDGET (webview), TRUE);
|
||||
|
||||
gtk_widget_set_has_window (GTK_WIDGET (webview), TRUE);
|
||||
|
||||
webview->current_page = 0;
|
||||
|
||||
webview->search = g_new0(SearchParams, 1);
|
||||
webview->search->search_string = NULL;
|
||||
|
||||
webview->search->on_result = -1 ;
|
||||
webview->search->results = NULL;
|
||||
webview->search->search_jump = TRUE ;
|
||||
|
||||
webview->fullscreen = FALSE;
|
||||
webview->inverted_stylesheet = FALSE;
|
||||
webview->hlink = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
ev_web_view_finalize (GObject *object)
|
||||
{
|
||||
G_OBJECT_CLASS(ev_web_view_parent_class)->finalize(object);
|
||||
}
|
||||
|
||||
/*** Callbacks ***/
|
||||
|
||||
static void
|
||||
ev_web_view_change_page (EvWebView *webview,
|
||||
gint new_page)
|
||||
{
|
||||
g_return_if_fail(EV_IS_WEB_VIEW(webview));
|
||||
|
||||
EvDocumentClass *klass = EV_DOCUMENT_GET_CLASS(webview->document);
|
||||
|
||||
webview->current_page = new_page;
|
||||
ev_document_model_set_page(webview->model,new_page);
|
||||
webkit_find_controller_search_finish(webview->findcontroller);
|
||||
if (webview->hlink) {
|
||||
webkit_web_view_load_uri(WEBKIT_WEB_VIEW(webview),(gchar*)webview->hlink);
|
||||
g_free(webview->hlink);
|
||||
webview->hlink = NULL;
|
||||
}
|
||||
else {
|
||||
EvPage *page = klass->get_page(webview->document,new_page);
|
||||
webkit_web_view_load_uri(WEBKIT_WEB_VIEW(webview),(gchar*)page->backend_page);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ev_web_view_page_changed_cb (EvDocumentModel *model,
|
||||
gint old_page,
|
||||
gint new_page,
|
||||
EvWebView *webview)
|
||||
{
|
||||
if (!webview->document)
|
||||
return;
|
||||
|
||||
if (webview->current_page != new_page) {
|
||||
ev_web_view_change_page (webview, new_page);
|
||||
} else {
|
||||
webkit_web_view_reload (WEBKIT_WEB_VIEW(webview));
|
||||
}
|
||||
}
|
||||
|
||||
GtkWidget*
|
||||
ev_web_view_new (void)
|
||||
{
|
||||
GtkWidget *webview;
|
||||
|
||||
webview = g_object_new (EV_TYPE_WEB_VIEW, NULL);
|
||||
|
||||
EV_WEB_VIEW(webview)->findcontroller = webkit_web_view_get_find_controller (WEBKIT_WEB_VIEW(webview));
|
||||
EV_WEB_VIEW(webview)->findoptions = webkit_find_controller_get_options (EV_WEB_VIEW(webview)->findcontroller);
|
||||
|
||||
EV_WEB_VIEW(webview)->zoom_level = 1.0;
|
||||
|
||||
EV_WEB_VIEW(webview)->findoptions |= WEBKIT_FIND_OPTIONS_NONE;
|
||||
|
||||
return webview;
|
||||
}
|
||||
|
||||
static void
|
||||
ev_web_view_document_changed_cb (EvDocumentModel *model,
|
||||
GParamSpec *pspec,
|
||||
EvWebView *webview)
|
||||
{
|
||||
g_return_if_fail(EV_IS_WEB_VIEW(webview));
|
||||
|
||||
EvDocument *document = ev_document_model_get_document (model);
|
||||
|
||||
if (document != webview->document) {
|
||||
|
||||
if (webview->document )
|
||||
g_object_unref(webview->document);
|
||||
|
||||
webview->document = document ;
|
||||
|
||||
if(webview->document) {
|
||||
g_object_ref(webview->document);
|
||||
}
|
||||
webview->inverted_stylesheet = FALSE;
|
||||
gint current_page = ev_document_model_get_page(model);
|
||||
|
||||
ev_web_view_change_page (webview, current_page);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ev_web_view_inverted_colors_changed_cb (EvDocumentModel *model,
|
||||
GParamSpec *pspec,
|
||||
EvWebView *webview)
|
||||
{
|
||||
EvDocument *document = ev_document_model_get_document(model);
|
||||
|
||||
if (!document || !document->iswebdocument)
|
||||
return;
|
||||
|
||||
if (ev_document_model_get_inverted_colors(model) == TRUE) {
|
||||
if (document == NULL) {
|
||||
ev_document_model_set_inverted_colors(model,FALSE);
|
||||
return;
|
||||
}
|
||||
if (webview->inverted_stylesheet == FALSE) {
|
||||
ev_document_check_add_night_sheet(document);
|
||||
webview->inverted_stylesheet = TRUE;
|
||||
}
|
||||
ev_document_toggle_night_mode(document,TRUE);
|
||||
webkit_web_view_reload(WEBKIT_WEB_VIEW(webview));
|
||||
}
|
||||
else {
|
||||
if (document != NULL) {
|
||||
ev_document_toggle_night_mode(document,FALSE);
|
||||
webkit_web_view_reload(WEBKIT_WEB_VIEW(webview));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ev_web_view_set_model (EvWebView *webview,
|
||||
EvDocumentModel *model)
|
||||
{
|
||||
g_return_if_fail (EV_IS_WEB_VIEW (webview));
|
||||
g_return_if_fail (EV_IS_DOCUMENT_MODEL (model));
|
||||
|
||||
if (model == webview->model)
|
||||
return;
|
||||
|
||||
if (webview->model) {
|
||||
g_signal_handlers_disconnect_by_func (webview->model,
|
||||
ev_web_view_document_changed_cb,
|
||||
webview);
|
||||
g_signal_handlers_disconnect_by_func (webview->model,
|
||||
ev_web_view_page_changed_cb,
|
||||
webview);
|
||||
g_object_unref (webview->model);
|
||||
}
|
||||
webview->model = g_object_ref (model);
|
||||
|
||||
/* Initialize webview from model */
|
||||
webview->fullscreen = ev_document_model_get_fullscreen (webview->model);
|
||||
webview->document = ev_document_model_get_document(webview->model);
|
||||
|
||||
ev_web_view_document_changed_cb (webview->model, NULL, webview);
|
||||
|
||||
g_signal_connect (webview->model, "notify::document",
|
||||
G_CALLBACK (ev_web_view_document_changed_cb),
|
||||
webview);
|
||||
g_signal_connect (webview->model, "notify::inverted-colors",
|
||||
G_CALLBACK (ev_web_view_inverted_colors_changed_cb),
|
||||
webview);
|
||||
g_signal_connect (webview->model,"page-changed",
|
||||
G_CALLBACK(ev_web_view_page_changed_cb),
|
||||
webview);
|
||||
}
|
||||
|
||||
void
|
||||
ev_web_view_reload_page (EvWebView *webview,
|
||||
gint page)
|
||||
{
|
||||
webkit_web_view_reload (WEBKIT_WEB_VIEW(webview));
|
||||
}
|
||||
|
||||
void
|
||||
ev_web_view_reload (EvWebView *webview)
|
||||
{
|
||||
web_view_update_range_and_current_page (webview);
|
||||
}
|
||||
|
||||
|
||||
gboolean
|
||||
ev_web_view_next_page (EvWebView *webview)
|
||||
{
|
||||
int page, n_pages;
|
||||
|
||||
g_return_val_if_fail (EV_IS_WEB_VIEW (webview), FALSE);
|
||||
|
||||
if (!webview->document)
|
||||
return FALSE;
|
||||
|
||||
page = ev_document_model_get_page (webview->model);
|
||||
n_pages = ev_document_get_n_pages (webview->document);
|
||||
|
||||
page = page + 1;
|
||||
|
||||
if (page < n_pages) {
|
||||
ev_document_model_set_page (webview->model, page);
|
||||
EvPage *webpage = ev_document_get_page(webview->document,page);
|
||||
webview->current_page = page ;
|
||||
webkit_web_view_load_uri(WEBKIT_WEB_VIEW(webview),(gchar*)webpage->backend_page);
|
||||
return TRUE;
|
||||
} else if (page == n_pages) {
|
||||
ev_document_model_set_page (webview->model, page - 1);
|
||||
EvPage *webpage = ev_document_get_page(webview->document,page);
|
||||
webkit_web_view_load_uri(WEBKIT_WEB_VIEW(webview),(gchar*)webpage->backend_page);
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
ev_web_view_previous_page (EvWebView *webview)
|
||||
{
|
||||
int page;
|
||||
|
||||
g_return_val_if_fail (EV_IS_WEB_VIEW (webview), FALSE);
|
||||
|
||||
if (!webview->document)
|
||||
return FALSE;
|
||||
|
||||
page = ev_document_model_get_page (webview->model);
|
||||
|
||||
page = page - 1 ;
|
||||
|
||||
if (page >= 0) {
|
||||
ev_document_model_set_page (webview->model, page);
|
||||
EvPage *webpage = ev_document_get_page(webview->document,page);
|
||||
webkit_web_view_load_uri(WEBKIT_WEB_VIEW(webview),(gchar*)webpage->backend_page);
|
||||
return TRUE;
|
||||
} else if (page == -1) {
|
||||
ev_document_model_set_page (webview->model, 0);
|
||||
EvPage *webpage = ev_document_get_page(webview->document,page);
|
||||
webkit_web_view_load_uri(WEBKIT_WEB_VIEW(webview),(gchar*)webpage->backend_page);
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ev_web_view_handle_link(EvWebView *webview,EvLink *link)
|
||||
{
|
||||
EvLinkAction *action = NULL;
|
||||
EvLinkDest *dest = NULL;
|
||||
EvLinkDestType dest_type ;
|
||||
action = ev_link_get_action(link);
|
||||
|
||||
if (action == NULL)
|
||||
return;
|
||||
|
||||
dest = ev_link_action_get_dest(action);
|
||||
|
||||
if (dest == NULL)
|
||||
return;
|
||||
|
||||
dest_type = ev_link_dest_get_dest_type(dest);
|
||||
|
||||
switch(dest_type) {
|
||||
case EV_LINK_DEST_TYPE_PAGE: {
|
||||
ev_document_model_set_page(webview->model,ev_link_dest_get_page(dest));
|
||||
break;
|
||||
}
|
||||
|
||||
case EV_LINK_DEST_TYPE_PAGE_LABEL: {
|
||||
const gchar *text = ev_link_dest_get_page_label (dest);
|
||||
gint page = atoi(text);
|
||||
|
||||
if (page <= ev_document_get_n_pages(webview->document) && page > 0) {
|
||||
ev_document_model_set_page(webview->model,page-1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EV_LINK_DEST_TYPE_HLINK: {
|
||||
const gchar *uri = ev_link_dest_get_named_dest(dest);
|
||||
ev_document_model_set_page(webview->model,ev_link_dest_get_page(dest));
|
||||
webkit_web_view_load_uri(WEBKIT_WEB_VIEW(webview),uri);
|
||||
break;
|
||||
|
||||
default:return;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Searching */
|
||||
|
||||
static void
|
||||
results_counted_cb(WebKitFindController *findcontroller,
|
||||
guint match_count,
|
||||
EvWebView *webview)
|
||||
{
|
||||
if (match_count > 0 && webview->search->on_result < match_count) {
|
||||
webkit_find_controller_search(findcontroller,
|
||||
webview->search->search_string,
|
||||
webview->findoptions,
|
||||
match_count);
|
||||
webview->search->search_jump = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Jump to find results once we have changed the page in the webview.
|
||||
*/
|
||||
static void
|
||||
jump_to_find_results(EvWebView *webview,
|
||||
WebKitLoadEvent load_event,
|
||||
gpointer data)
|
||||
{
|
||||
if ( load_event != WEBKIT_LOAD_FINISHED) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!webview->search->search_string) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (webview->search->direction == EV_WEB_VIEW_FIND_NEXT) {
|
||||
webview->findoptions &= ~WEBKIT_FIND_OPTIONS_BACKWARDS;
|
||||
webview->findoptions &= ~WEBKIT_FIND_OPTIONS_WRAP_AROUND;
|
||||
}
|
||||
else {
|
||||
webview->findoptions |= WEBKIT_FIND_OPTIONS_BACKWARDS;
|
||||
webview->findoptions |= WEBKIT_FIND_OPTIONS_WRAP_AROUND;
|
||||
}
|
||||
|
||||
webkit_find_controller_count_matches (webview->findcontroller,
|
||||
webview->search->search_string,
|
||||
webview->findoptions,
|
||||
G_MAXUINT);
|
||||
webview->search->search_jump = FALSE;
|
||||
}
|
||||
|
||||
static gint
|
||||
ev_web_view_find_get_n_results (EvWebView *webview, gint page)
|
||||
{
|
||||
return webview->search->results[page];
|
||||
}
|
||||
|
||||
/**
|
||||
* jump_to_find_page
|
||||
* @webview: #EvWebView instance
|
||||
* @direction: Direction to look
|
||||
* @shift: Shift from current page
|
||||
*
|
||||
* Jumps to the first page that has occurences of searched word.
|
||||
* Uses a direction where to look and a shift from current page.
|
||||
**/
|
||||
static void
|
||||
jump_to_find_page (EvWebView *webview, EvWebViewFindDirection direction, gint shift)
|
||||
{
|
||||
int n_pages, i;
|
||||
|
||||
n_pages = ev_document_get_n_pages (webview->document);
|
||||
|
||||
for (i = 0; i < n_pages; i++) {
|
||||
int page;
|
||||
|
||||
if (direction == EV_WEB_VIEW_FIND_NEXT)
|
||||
page = webview->current_page + i;
|
||||
else
|
||||
page = webview->current_page - i;
|
||||
page += shift;
|
||||
|
||||
if (page >= n_pages) {
|
||||
page = page - n_pages;
|
||||
} else if (page < 0)
|
||||
page = page + n_pages;
|
||||
|
||||
if (page == webview->current_page && ev_web_view_find_get_n_results(webview,page) > 0) {
|
||||
if (direction == EV_WEB_VIEW_FIND_PREV) {
|
||||
webview->findoptions |= WEBKIT_FIND_OPTIONS_WRAP_AROUND;
|
||||
webview->findoptions |= WEBKIT_FIND_OPTIONS_BACKWARDS;
|
||||
}
|
||||
else {
|
||||
if (webview->search->search_jump)
|
||||
webview->findoptions |= WEBKIT_FIND_OPTIONS_WRAP_AROUND;
|
||||
else
|
||||
webview->findoptions &= ~WEBKIT_FIND_OPTIONS_WRAP_AROUND;
|
||||
|
||||
webview->findoptions &= ~WEBKIT_FIND_OPTIONS_BACKWARDS;
|
||||
}
|
||||
|
||||
webkit_find_controller_search (webview->findcontroller,
|
||||
webview->search->search_string,
|
||||
webview->findoptions,
|
||||
/*Highlight all the results.*/
|
||||
G_MAXUINT);
|
||||
webview->search->search_jump = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (ev_web_view_find_get_n_results (webview, page) > 0) {
|
||||
webview->search->direction = direction;
|
||||
webkit_find_controller_search_finish(webview->findcontroller);
|
||||
ev_document_model_set_page (webview->model, page);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ev_web_view_find_changed (EvWebView *webview, guint *results, gchar *text,gboolean case_sensitive)
|
||||
{
|
||||
webview->search->results = results;
|
||||
webview->search->on_result = 0;
|
||||
webview->search->search_string = g_strdup(text);
|
||||
webview->search->case_sensitive = case_sensitive;
|
||||
if (webview->search->search_jump == TRUE) {
|
||||
if (!case_sensitive) {
|
||||
webview->findoptions |= WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE;
|
||||
}
|
||||
else {
|
||||
webview->findoptions &= ~WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE;
|
||||
}
|
||||
jump_to_find_page (webview, EV_WEB_VIEW_FIND_NEXT, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ev_web_view_find_next (EvWebView *webview)
|
||||
{
|
||||
gint n_results;
|
||||
|
||||
n_results = ev_web_view_find_get_n_results (webview, webview->current_page);
|
||||
webview->search->on_result++;
|
||||
|
||||
if (webview->search->on_result >= n_results) {
|
||||
webview->search->on_result = 0;
|
||||
jump_to_find_page (webview, EV_WEB_VIEW_FIND_NEXT, 1);
|
||||
}
|
||||
else {
|
||||
webkit_find_controller_search_next(webview->findcontroller);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ev_web_view_find_previous (EvWebView *webview)
|
||||
{
|
||||
webview->search->on_result--;
|
||||
|
||||
if (webview->search->on_result < 0) {
|
||||
jump_to_find_page (webview, EV_WEB_VIEW_FIND_PREV, -1);
|
||||
webview->search->on_result = MAX (0, ev_web_view_find_get_n_results (webview, webview->current_page) - 1);
|
||||
} else {
|
||||
webkit_find_controller_search_previous(webview->findcontroller);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ev_web_view_find_search_changed (EvWebView *webview)
|
||||
{
|
||||
/* search string has changed, focus on new search result */
|
||||
if (webview->search->search_string) {
|
||||
g_free(webview->search->search_string);
|
||||
webview->search->search_string = NULL;
|
||||
}
|
||||
|
||||
webkit_find_controller_search_finish(webview->findcontroller);
|
||||
webview->search->search_jump = TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
ev_web_view_find_cancel (EvWebView *webview)
|
||||
{
|
||||
webkit_find_controller_search_finish (webview->findcontroller);
|
||||
}
|
||||
|
||||
void
|
||||
ev_web_view_set_handler(EvWebView *webview,gboolean visible)
|
||||
{
|
||||
if (visible) {
|
||||
g_signal_connect(webview,
|
||||
"load-changed",
|
||||
G_CALLBACK(jump_to_find_results),
|
||||
NULL);
|
||||
g_signal_connect(webview->findcontroller,
|
||||
"counted-matches",
|
||||
G_CALLBACK(results_counted_cb),
|
||||
webview);
|
||||
}
|
||||
else {
|
||||
g_signal_handlers_disconnect_by_func(webview,
|
||||
jump_to_find_results,
|
||||
NULL);
|
||||
g_signal_handlers_disconnect_by_func(webview,
|
||||
results_counted_cb,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/* Selection and copying*/
|
||||
void
|
||||
ev_web_view_select_all(EvWebView *webview)
|
||||
{
|
||||
webkit_web_view_execute_editing_command(WEBKIT_WEB_VIEW(webview),
|
||||
WEBKIT_EDITING_COMMAND_SELECT_ALL);
|
||||
}
|
||||
|
||||
static void
|
||||
copy_text_cb(WebKitWebView *webview,
|
||||
GAsyncResult *res,
|
||||
gpointer data)
|
||||
{
|
||||
gboolean okay_to_copy = webkit_web_view_can_execute_editing_command_finish (WEBKIT_WEB_VIEW(webview),
|
||||
res,
|
||||
NULL);
|
||||
|
||||
if (okay_to_copy) {
|
||||
webkit_web_view_execute_editing_command (WEBKIT_WEB_VIEW(webview),
|
||||
WEBKIT_EDITING_COMMAND_COPY);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ev_web_view_copy(EvWebView *webview)
|
||||
{
|
||||
webkit_web_view_can_execute_editing_command(WEBKIT_WEB_VIEW(webview),
|
||||
WEBKIT_EDITING_COMMAND_COPY,
|
||||
NULL,
|
||||
(GAsyncReadyCallback)copy_text_cb,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/*Zoom control*/
|
||||
gboolean
|
||||
ev_web_view_zoom_in(EvWebView *webview)
|
||||
{
|
||||
webkit_web_view_set_zoom_level (WEBKIT_WEB_VIEW(webview),
|
||||
(webview->zoom_level+= 0.1));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
ev_web_view_zoom_out(EvWebView *webview)
|
||||
{
|
||||
if (webview->zoom_level == 1)
|
||||
return FALSE;
|
||||
|
||||
webkit_web_view_set_zoom_level (WEBKIT_WEB_VIEW(webview),
|
||||
(webview->zoom_level -= 0.1));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
ev_web_view_zoom_reset(EvWebView *webview)
|
||||
{
|
||||
if (webview->zoom_level == 1)
|
||||
return FALSE;
|
||||
|
||||
webkit_web_view_set_zoom_level (WEBKIT_WEB_VIEW(webview),
|
||||
1.0);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* ev_web_view_disconnect_handlers
|
||||
* @webview : #EvWebView instance
|
||||
*
|
||||
* This function call will disconnect all model signal handlers from the webview, to ensure smooth operation of the Atril-view.
|
||||
* Equivalent to function ev_view_disconnect_handlers in ev-view.c
|
||||
*/
|
||||
void
|
||||
ev_web_view_disconnect_handlers(EvWebView *webview)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func(webview->model,
|
||||
ev_web_view_document_changed_cb,
|
||||
webview);
|
||||
g_signal_handlers_disconnect_by_func(webview->model,
|
||||
ev_web_view_inverted_colors_changed_cb,
|
||||
webview);
|
||||
g_signal_handlers_disconnect_by_func(webview->model,
|
||||
ev_web_view_page_changed_cb,
|
||||
webview);
|
||||
}
|
||||
#endif
|
||||
|
|
@ -1,93 +0,0 @@
|
|||
/* this file is part of atril, a mate document viewer
|
||||
*
|
||||
* Copyright (C) 2014 Avishkar Gupta
|
||||
* Based on ev-view.h, also a part of atril, a mate document viewer
|
||||
*
|
||||
* Atril is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Atril is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#if !defined (__EV_ATRIL_VIEW_H_INSIDE__) && !defined (ATRIL_COMPILATION)
|
||||
#error "Only <atril-view.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include "config.h"
|
||||
#if ENABLE_EPUB
|
||||
#ifndef __EV_WEB_VIEW_H__
|
||||
#define __EV_WEB_VIEW_H__
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include <atril-document.h>
|
||||
#include "ev-jobs.h"
|
||||
#include "ev-document-model.h"
|
||||
#include <glib-object.h>
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
typedef struct _EvWebView EvWebView;
|
||||
typedef struct _EvWebViewClass EvWebViewClass;
|
||||
|
||||
#define EV_TYPE_WEB_VIEW (ev_web_view_get_type ())
|
||||
#define EV_WEB_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EV_TYPE_WEB_VIEW, EvWebView))
|
||||
#define EV_IS_WEB_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EV_TYPE_WEB_VIEW))
|
||||
|
||||
GType ev_web_view_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkWidget* ev_web_view_new (void);
|
||||
|
||||
void ev_web_view_set_model (EvWebView *webview,
|
||||
EvDocumentModel *model);
|
||||
|
||||
void ev_web_view_reload (EvWebView *webview);
|
||||
|
||||
void ev_web_view_reload_page (EvWebView *webview,
|
||||
gint page);
|
||||
|
||||
/* Navigation */
|
||||
gboolean ev_web_view_next_page (EvWebView *webview);
|
||||
gboolean ev_web_view_previous_page (EvWebView *webview);
|
||||
|
||||
/* Sidebar links */
|
||||
void ev_web_view_handle_link (EvWebView *webview, EvLink* link);
|
||||
|
||||
/* Searching */
|
||||
void ev_web_view_find_next (EvWebView *webview);
|
||||
void ev_web_view_find_previous (EvWebView *webview);
|
||||
|
||||
void ev_web_view_find_changed (EvWebView *webview,
|
||||
guint *results,
|
||||
gchar *text,
|
||||
gboolean case_sensitive);
|
||||
|
||||
void ev_web_view_find_search_changed (EvWebView *webview);
|
||||
void ev_web_view_find_cancel (EvWebView *webview);
|
||||
void ev_web_view_find_set_highlight_search (EvWebView *webview,gboolean visible);
|
||||
void ev_web_view_set_handler (EvWebView *webview,gboolean visible);
|
||||
/* Selection */
|
||||
gboolean ev_web_view_get_has_selection (EvWebView *webview);
|
||||
void ev_web_view_select_all (EvWebView *webview);
|
||||
void ev_web_view_copy (EvWebView *webview);
|
||||
|
||||
/* Zoom control */
|
||||
gboolean ev_web_view_zoom_in (EvWebView *webview);
|
||||
gboolean ev_web_view_zoom_out (EvWebView *webview);
|
||||
gboolean ev_web_view_zoom_reset (EvWebView *webview);
|
||||
|
||||
/*For safe replacement by an EvView*/
|
||||
void ev_web_view_disconnect_handlers (EvWebView *webview);
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __EV_WEB_VIEW_H__ */
|
||||
#endif /* ENABLE_EPUB */
|
||||
|
|
@ -7,8 +7,6 @@ backend/djvu/djvu-document.c
|
|||
[type: gettext/ini] backend/djvu/djvudocument.atril-backend.in
|
||||
backend/dvi/dvi-document.c
|
||||
[type: gettext/ini] backend/dvi/dvidocument.atril-backend.in
|
||||
backend/epub/epub-document.c
|
||||
[type: gettext/ini] backend/epub/epubdocument.atril-backend.in
|
||||
backend/pdf/ev-poppler.cc
|
||||
[type: gettext/ini] backend/pdf/pdfdocument.atril-backend.in
|
||||
[type: gettext/ini] backend/pixbuf/pixbufdocument.atril-backend.in
|
||||
|
|
|
|||
|
|
@ -22,8 +22,7 @@ atril_previewer_CFLAGS = \
|
|||
$(PREVIEWER_CFLAGS) \
|
||||
$(WARN_CFLAGS) \
|
||||
$(DISABLE_DEPRECATED) \
|
||||
$(AM_CFLAGS) \
|
||||
$(WEBKIT_CFLAGS)
|
||||
$(AM_CFLAGS)
|
||||
|
||||
atril_previewer_LDFLAGS = $(AM_LDFLAGS)
|
||||
|
||||
|
|
@ -31,8 +30,7 @@ atril_previewer_LDADD = \
|
|||
$(top_builddir)/libdocument/libatrildocument.la \
|
||||
$(top_builddir)/libview/libatrilview.la \
|
||||
$(top_builddir)/libmisc/libevmisc.la \
|
||||
$(PREVIEWER_LIBS) \
|
||||
$(WEBKIT_LIBS)
|
||||
$(PREVIEWER_LIBS)
|
||||
|
||||
ev-previewer-resources.c: previewer.gresource.xml Makefile $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies --sourcedir $(srcdir) $(srcdir)/previewer.gresource.xml)
|
||||
$(AM_V_GEN) XMLLINT=$(XMLLINT) $(GLIB_COMPILE_RESOURCES) --target $@ --sourcedir $(srcdir) --generate-source --c-name ev_previewer $<
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ struct _EvSidebarThumbnailsPrivate {
|
|||
EvDocument *document;
|
||||
EvDocumentModel *model;
|
||||
EvThumbsSizeCache *size_cache;
|
||||
|
||||
gint n_pages, pages_done;
|
||||
|
||||
int rotation;
|
||||
|
|
@ -135,14 +136,8 @@ ev_thumbnails_size_cache_new (EvDocument *document)
|
|||
|
||||
page = ev_document_get_page (document, i);
|
||||
|
||||
if (document->iswebdocument == FALSE ) {
|
||||
ev_document_get_page_size (document, i, &page_width, &page_height);
|
||||
}
|
||||
else {
|
||||
/* Hardcoding these values to a large enough dimesnsion so as to achieve max content without loss in visibility*/
|
||||
page_width = 800;
|
||||
page_height = 1080;
|
||||
}
|
||||
ev_document_get_page_size (document, i, &page_width, &page_height);
|
||||
|
||||
if (!rc) {
|
||||
rc = ev_render_context_new (page, 0, (gdouble)THUMBNAIL_WIDTH / page_width);
|
||||
} else {
|
||||
|
|
@ -421,12 +416,9 @@ get_scale_for_page (EvSidebarThumbnails *sidebar_thumbnails,
|
|||
{
|
||||
EvSidebarThumbnailsPrivate *priv = sidebar_thumbnails->priv;
|
||||
gdouble width;
|
||||
if (priv->document->iswebdocument == TRUE ) {
|
||||
/* Hardcoded for epub documents*/
|
||||
width = 800;
|
||||
} else {
|
||||
ev_document_get_page_size (priv->document, page, &width, NULL);
|
||||
}
|
||||
|
||||
ev_document_get_page_size (priv->document, page, &width, NULL);
|
||||
|
||||
return (gdouble)THUMBNAIL_WIDTH / width;
|
||||
}
|
||||
|
||||
|
|
@ -460,10 +452,6 @@ add_range (EvSidebarThumbnails *sidebar_thumbnails,
|
|||
page, priv->rotation,
|
||||
get_scale_for_page (sidebar_thumbnails, page));
|
||||
|
||||
if (priv->document->iswebdocument) {
|
||||
ev_job_set_run_mode(job, EV_JOB_RUN_MAIN_LOOP);
|
||||
}
|
||||
|
||||
g_object_set_data_full (G_OBJECT (job), "tree_iter",
|
||||
gtk_tree_iter_copy (&iter),
|
||||
(GDestroyNotify) gtk_tree_iter_free);
|
||||
|
|
@ -898,7 +886,7 @@ thumbnail_job_completed_callback (EvJobThumbnail *job,
|
|||
GtkTreeIter *iter;
|
||||
|
||||
iter = (GtkTreeIter *) g_object_get_data (G_OBJECT (job), "tree_iter");
|
||||
if (priv->inverted_colors && priv->document->iswebdocument == FALSE)
|
||||
if (priv->inverted_colors)
|
||||
ev_document_misc_invert_pixbuf (job->thumbnail);
|
||||
gtk_list_store_set (priv->list_store,
|
||||
iter,
|
||||
|
|
|
|||
|
|
@ -88,7 +88,6 @@
|
|||
#include "ev-utils.h"
|
||||
#include "ev-keyring.h"
|
||||
#include "ev-view.h"
|
||||
#include "ev-web-view.h"
|
||||
#include "ev-view-presentation.h"
|
||||
#include "ev-view-type-builtins.h"
|
||||
#include "ev-window.h"
|
||||
|
|
@ -150,9 +149,6 @@ struct _EvWindowPrivate {
|
|||
GtkWidget *sidebar_bookmarks;
|
||||
EggToolbarsModel *toolbars_model;
|
||||
GSettings *interface_settings;
|
||||
#if ENABLE_EPUB
|
||||
GtkWidget *webview;
|
||||
#endif
|
||||
/* Settings */
|
||||
GSettings *settings;
|
||||
GSettings *default_settings;
|
||||
|
|
@ -446,9 +442,7 @@ ev_window_setup_action_sensitivity (EvWindow *ev_window)
|
|||
if (has_document && EV_IS_SELECTION (document)) {
|
||||
can_get_text = TRUE;
|
||||
}
|
||||
else if (has_document && document->iswebdocument) {
|
||||
can_get_text = TRUE;
|
||||
}
|
||||
|
||||
if (has_pages && EV_IS_DOCUMENT_FIND (document)) {
|
||||
can_find = TRUE;
|
||||
}
|
||||
|
|
@ -489,22 +483,19 @@ ev_window_setup_action_sensitivity (EvWindow *ev_window)
|
|||
ev_window_set_action_sensitive (ev_window, "EditSelectAll", has_pages && can_get_text);
|
||||
ev_window_set_action_sensitive (ev_window, "EditFind", can_find);
|
||||
ev_window_set_action_sensitive (ev_window, "Slash", can_find);
|
||||
ev_window_set_action_sensitive (ev_window, "EditRotateLeft", has_pages && !(document->iswebdocument));
|
||||
ev_window_set_action_sensitive (ev_window, "EditRotateRight", has_pages && !(document->iswebdocument));
|
||||
ev_window_set_action_sensitive (ev_window, "EditRotateLeft", has_pages);
|
||||
ev_window_set_action_sensitive (ev_window, "EditRotateRight", has_pages);
|
||||
|
||||
/* View menu */
|
||||
/*If it has pages it is a document, so our check for a webdocument won't lead to a crash. We need to switch these view modes off since more than one
|
||||
*webview is hard to manage, and would lead to unexpected behaviour in case the number of webviews gets too large.
|
||||
*/
|
||||
ev_window_set_action_sensitive (ev_window, "ViewContinuous", has_pages && !(document->iswebdocument));
|
||||
ev_window_set_action_sensitive (ev_window, "ViewDual", has_pages && !(document->iswebdocument));
|
||||
ev_window_set_action_sensitive (ev_window, "ViewContinuous", has_pages);
|
||||
ev_window_set_action_sensitive (ev_window, "ViewDual", has_pages);
|
||||
ev_window_set_action_sensitive (ev_window, "ViewDualOddLeft", has_pages);
|
||||
ev_window_set_action_sensitive (ev_window, "ViewFitPage", has_pages && !(document->iswebdocument));
|
||||
ev_window_set_action_sensitive (ev_window, "ViewFitWidth", has_pages && !(document->iswebdocument));
|
||||
ev_window_set_action_sensitive (ev_window, "ViewFitPage", has_pages);
|
||||
ev_window_set_action_sensitive (ev_window, "ViewFitWidth", has_pages);
|
||||
ev_window_set_action_sensitive (ev_window, "ViewReload", has_pages);
|
||||
ev_window_set_action_sensitive (ev_window, "ViewAutoscroll", has_pages && !(document->iswebdocument));
|
||||
ev_window_set_action_sensitive (ev_window, "ViewAutoscroll", has_pages);
|
||||
ev_window_set_action_sensitive (ev_window, "ViewInvertedColors", has_pages);
|
||||
ev_window_set_action_sensitive (ev_window, "ViewExpandWindow", has_pages && !(document->iswebdocument));
|
||||
ev_window_set_action_sensitive (ev_window, "ViewExpandWindow", has_pages);
|
||||
|
||||
/* Bookmarks menu */
|
||||
ev_window_set_action_sensitive (ev_window, "BookmarksAdd",
|
||||
|
|
@ -522,11 +513,8 @@ ev_window_setup_action_sensitivity (EvWindow *ev_window)
|
|||
static void
|
||||
ev_window_update_actions (EvWindow *ev_window)
|
||||
{
|
||||
#if ENABLE_EPUB
|
||||
EvWebView *webview = NULL;
|
||||
#endif
|
||||
EvView *view = NULL;
|
||||
|
||||
|
||||
int n_pages = 0, page = -1;
|
||||
gboolean has_pages = FALSE;
|
||||
gboolean presentation_mode;
|
||||
|
|
@ -540,11 +528,6 @@ ev_window_update_actions (EvWindow *ev_window)
|
|||
has_pages = n_pages > 0;
|
||||
dual_mode = ev_document_model_get_dual_page (ev_window->priv->model);
|
||||
}
|
||||
#if ENABLE_EPUB
|
||||
if (ev_window->priv->document && ev_window->priv->document->iswebdocument == TRUE ) {
|
||||
webview = EV_WEB_VIEW(ev_window->priv->webview);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
view = EV_VIEW (ev_window->priv->view);
|
||||
}
|
||||
|
|
@ -556,17 +539,6 @@ ev_window_update_actions (EvWindow *ev_window)
|
|||
has_pages &&
|
||||
ev_view_get_has_selection (view));
|
||||
}
|
||||
#if ENABLE_EPUB
|
||||
else if (webview) {
|
||||
/*
|
||||
* The webkit2 function for this is an asynchronous call,
|
||||
* so our only option is to set this to always on, and we'll take care of whether we can copy
|
||||
* or not when this command is actually given.
|
||||
*/
|
||||
ev_window_set_action_sensitive (ev_window,"EditCopy",
|
||||
has_pages);
|
||||
}
|
||||
#endif
|
||||
ev_window_set_action_sensitive (ev_window, "EditFindNext",
|
||||
has_pages && can_find_in_page);
|
||||
ev_window_set_action_sensitive (ev_window, "EditFindPrevious",
|
||||
|
|
@ -576,7 +548,7 @@ ev_window_update_actions (EvWindow *ev_window)
|
|||
|
||||
presentation_mode = EV_WINDOW_IS_PRESENTATION (ev_window);
|
||||
|
||||
if (ev_window->priv->document && ev_window->priv->document->iswebdocument == FALSE ) {
|
||||
if (ev_window->priv->document) {
|
||||
ev_window_set_action_sensitive (ev_window, "ViewZoomIn",
|
||||
has_pages &&
|
||||
ev_view_can_zoom_in (view) &&
|
||||
|
|
@ -591,12 +563,6 @@ ev_window_update_actions (EvWindow *ev_window)
|
|||
ev_window_set_action_sensitive (ev_window, "ViewDualOddLeft",
|
||||
dual_mode);
|
||||
}
|
||||
#if ENABLE_EPUB
|
||||
else if (webview ) {
|
||||
ev_window_set_action_sensitive (ev_window, "ViewDualOddLeft",
|
||||
!dual_mode);
|
||||
}
|
||||
#endif
|
||||
/* Go menu */
|
||||
if (has_pages) {
|
||||
ev_window_set_action_sensitive (ev_window, "GoPreviousPage", page > 0);
|
||||
|
|
@ -616,18 +582,6 @@ ev_window_update_actions (EvWindow *ev_window)
|
|||
ev_view_supports_caret_navigation (view) &&
|
||||
!presentation_mode);
|
||||
}
|
||||
#if ENABLE_EPUB
|
||||
else if (webview) {
|
||||
ev_window_set_action_sensitive (ev_window, "F7",
|
||||
has_pages &&
|
||||
!presentation_mode &&
|
||||
!EV_WEB_VIEW(ev_window->priv->webview));
|
||||
ev_window_set_action_sensitive (ev_window, "ViewCaretNavigation",
|
||||
has_pages &&
|
||||
!presentation_mode &&
|
||||
!EV_WEB_VIEW(ev_window->priv->webview));
|
||||
}
|
||||
#endif
|
||||
|
||||
sizing_mode = ev_document_model_get_sizing_mode (ev_window->priv->model);
|
||||
if (has_pages && sizing_mode != EV_SIZING_FIT_WIDTH && sizing_mode != EV_SIZING_FIT_PAGE) {
|
||||
|
|
@ -741,7 +695,7 @@ update_sizing_buttons (EvWindow *window)
|
|||
ephy_zoom_action_set_zoom_level (EPHY_ZOOM_ACTION (action),
|
||||
EPHY_ZOOM_FIT_PAGE);
|
||||
} else if (fit_width) {
|
||||
if (!window->priv->document || (window->priv->document && !window->priv->document->iswebdocument)) {
|
||||
if (!window->priv->document || (window->priv->document)) {
|
||||
ephy_zoom_action_set_zoom_level (EPHY_ZOOM_ACTION (action),
|
||||
EPHY_ZOOM_FIT_WIDTH);
|
||||
}
|
||||
|
|
@ -1156,12 +1110,6 @@ static void
|
|||
update_document_mode (EvWindow *window, EvDocumentMode mode)
|
||||
{
|
||||
if (mode == EV_DOCUMENT_MODE_PRESENTATION) {
|
||||
if (window->priv->document) {
|
||||
if (window->priv->document->iswebdocument) {
|
||||
ev_window_warning_message(window,_("Cannot enter presentation mode with ePub documents, use fullscreen mode instead."));
|
||||
return;
|
||||
}
|
||||
}
|
||||
ev_window_run_presentation (window);
|
||||
}
|
||||
else if (mode == EV_DOCUMENT_MODE_FULL_SCREEN) {
|
||||
|
|
@ -1448,16 +1396,10 @@ setup_view_from_metadata (EvWindow *window)
|
|||
/* Presentation */
|
||||
if (ev_metadata_get_boolean (window->priv->metadata, "presentation", &presentation)) {
|
||||
if (presentation) {
|
||||
if (window->priv->document->iswebdocument == TRUE ) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
ev_window_run_presentation (window);
|
||||
}
|
||||
ev_window_run_presentation (window);
|
||||
}
|
||||
}
|
||||
|
||||
#if !ENABLE_EPUB
|
||||
/* Caret navigation mode */
|
||||
if (ev_view_supports_caret_navigation (EV_VIEW (window->priv->view))) {
|
||||
gboolean caret_navigation;
|
||||
|
|
@ -1481,7 +1423,6 @@ setup_view_from_metadata (EvWindow *window)
|
|||
if (ev_metadata_get_boolean (window->priv->metadata, "caret-navigation", &caret_navigation))
|
||||
ev_view_set_caret_navigation_enabled (EV_VIEW (window->priv->view), caret_navigation);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -1573,10 +1514,6 @@ ev_window_refresh_window_thumbnail (EvWindow *ev_window)
|
|||
rotation = ev_document_model_get_rotation (ev_window->priv->model);
|
||||
|
||||
ev_window->priv->thumbnail_job = ev_job_thumbnail_new (document, 0, rotation, scale);
|
||||
|
||||
if (document->iswebdocument) {
|
||||
ev_job_set_run_mode(EV_JOB(ev_window->priv->thumbnail_job), EV_JOB_RUN_MAIN_LOOP);
|
||||
}
|
||||
g_signal_connect (ev_window->priv->thumbnail_job, "finished",
|
||||
G_CALLBACK (ev_window_set_icon_from_thumbnail),
|
||||
ev_window);
|
||||
|
|
@ -1659,9 +1596,9 @@ ev_window_setup_document (EvWindow *ev_window)
|
|||
|
||||
ev_window->priv->setup_document_idle = 0;
|
||||
ev_window_refresh_window_thumbnail (ev_window);
|
||||
|
||||
|
||||
ev_window_set_page_mode (ev_window, PAGE_MODE_DOCUMENT);
|
||||
|
||||
|
||||
ev_window_title_set_document (ev_window->priv->title, document);
|
||||
ev_window_title_set_uri (ev_window->priv->title, ev_window->priv->uri);
|
||||
|
||||
|
|
@ -1706,17 +1643,10 @@ ev_window_setup_document (EvWindow *ev_window)
|
|||
g_clear_pointer (&ev_window->priv->search_string, g_free);
|
||||
}
|
||||
|
||||
/*FIXME*/
|
||||
if (EV_WINDOW_IS_PRESENTATION (ev_window) && document->iswebdocument == FALSE)
|
||||
if (EV_WINDOW_IS_PRESENTATION (ev_window))
|
||||
gtk_widget_grab_focus (ev_window->priv->presentation_view);
|
||||
else if (!gtk_widget_get_visible (ev_window->priv->find_bar)) {
|
||||
if ( document->iswebdocument == FALSE )
|
||||
gtk_widget_grab_focus (ev_window->priv->view);
|
||||
#if ENABLE_EPUB
|
||||
else
|
||||
gtk_widget_grab_focus (ev_window->priv->webview);
|
||||
#endif
|
||||
|
||||
gtk_widget_grab_focus (ev_window->priv->view);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -1738,34 +1668,12 @@ ev_window_set_document (EvWindow *ev_window, EvDocument *document)
|
|||
if (ev_document_get_n_pages (document) <= 0) {
|
||||
ev_window_warning_message (ev_window, "%s",
|
||||
_("The document contains no pages"));
|
||||
} else if (!ev_document_check_dimensions (document) && document->iswebdocument == FALSE) {
|
||||
} else if (!ev_document_check_dimensions (document)) {
|
||||
ev_window_warning_message (ev_window, "%s",
|
||||
_("The document contains only empty pages"));
|
||||
}
|
||||
|
||||
#if ENABLE_EPUB
|
||||
if (document->iswebdocument == TRUE &&
|
||||
ev_window->priv->view != NULL)
|
||||
{
|
||||
/*We have encountered a web document, replace the atril view with a web view, if the web view is not already loaded.*/
|
||||
gtk_container_remove (GTK_CONTAINER(ev_window->priv->scrolled_window),
|
||||
ev_window->priv->view);
|
||||
ev_view_disconnect_handlers(EV_VIEW(ev_window->priv->view));
|
||||
g_object_unref(ev_window->priv->view);
|
||||
ev_window->priv->view = NULL;
|
||||
gtk_container_add (GTK_CONTAINER (ev_window->priv->scrolled_window),
|
||||
ev_window->priv->webview);
|
||||
gtk_widget_show(ev_window->priv->webview);
|
||||
}
|
||||
else if(ev_window->priv->webview != NULL && document->iswebdocument == FALSE) {
|
||||
/*Since the document is not a webdocument might as well get rid of the webview now*/
|
||||
ev_web_view_disconnect_handlers(EV_WEB_VIEW(ev_window->priv->webview));
|
||||
g_object_ref_sink(ev_window->priv->webview);
|
||||
g_object_unref(ev_window->priv->webview);
|
||||
ev_window->priv->webview = NULL;
|
||||
}
|
||||
#endif
|
||||
if (EV_WINDOW_IS_PRESENTATION (ev_window) && document->iswebdocument == FALSE) {
|
||||
if (EV_WINDOW_IS_PRESENTATION (ev_window)) {
|
||||
gint current_page;
|
||||
|
||||
current_page = ev_view_presentation_get_current_page (
|
||||
|
|
@ -1776,10 +1684,6 @@ ev_window_set_document (EvWindow *ev_window, EvDocument *document)
|
|||
/* Update the model with the current presentation page */
|
||||
ev_document_model_set_page (ev_window->priv->model, current_page);
|
||||
ev_window_run_presentation (ev_window);
|
||||
} else if ( EV_WINDOW_IS_PRESENTATION (ev_window) && document->iswebdocument == TRUE )
|
||||
{
|
||||
ev_window_warning_message (ev_window, "%s",
|
||||
_("Presentation mode is not supported for ePub documents."));
|
||||
}
|
||||
|
||||
if (ev_window->priv->setup_document_idle > 0)
|
||||
|
|
@ -1849,9 +1753,6 @@ static void
|
|||
ev_window_handle_link (EvWindow *ev_window,
|
||||
EvLinkDest *dest)
|
||||
{
|
||||
if (ev_window->priv->document->iswebdocument == TRUE ) {
|
||||
return;
|
||||
}
|
||||
if (dest) {
|
||||
EvLink *link;
|
||||
EvLinkAction *link_action;
|
||||
|
|
@ -2407,6 +2308,9 @@ ev_window_open_document (EvWindow *ev_window,
|
|||
EvWindowRunMode mode,
|
||||
const gchar *search_string)
|
||||
{
|
||||
if (document == ev_window->priv->document)
|
||||
return;
|
||||
|
||||
ev_window_close_dialogs (ev_window);
|
||||
ev_window_clear_load_job (ev_window);
|
||||
ev_window_clear_local_uri (ev_window);
|
||||
|
|
@ -2428,7 +2332,7 @@ ev_window_open_document (EvWindow *ev_window,
|
|||
setup_document_from_metadata (ev_window);
|
||||
setup_view_from_metadata (ev_window);
|
||||
|
||||
if (dest && document->iswebdocument == FALSE) {
|
||||
if (dest) {
|
||||
EvLink *link;
|
||||
EvLinkAction *link_action;
|
||||
|
||||
|
|
@ -4019,20 +3923,12 @@ ev_window_cmd_focus_page_selector (GtkAction *act, EvWindow *window)
|
|||
static void
|
||||
ev_window_cmd_scroll_forward (GtkAction *action, EvWindow *window)
|
||||
{
|
||||
/* If the webview is occupying the window */
|
||||
if (window->priv->document && window->priv->document->iswebdocument == TRUE)
|
||||
return;
|
||||
|
||||
g_signal_emit_by_name (window->priv->view, "scroll", GTK_SCROLL_PAGE_FORWARD, GTK_ORIENTATION_VERTICAL);
|
||||
}
|
||||
|
||||
static void
|
||||
ev_window_cmd_scroll_backward (GtkAction *action, EvWindow *window)
|
||||
{
|
||||
/* If the webview is occupying the window */
|
||||
if (window->priv->document && window->priv->document->iswebdocument == TRUE)
|
||||
return;
|
||||
|
||||
g_signal_emit_by_name (window->priv->view, "scroll", GTK_SCROLL_PAGE_BACKWARD, GTK_ORIENTATION_VERTICAL);
|
||||
}
|
||||
|
||||
|
|
@ -4116,14 +4012,9 @@ ev_window_cmd_edit_select_all (GtkAction *action, EvWindow *ev_window)
|
|||
*/
|
||||
if (ev_window->priv->chrome & EV_CHROME_FINDBAR) {
|
||||
egg_find_bar_grab_focus(ev_window->priv->find_bar);
|
||||
} else if (ev_window->priv->document->iswebdocument == FALSE ) {
|
||||
} else {
|
||||
ev_view_select_all (EV_VIEW (ev_window->priv->view));
|
||||
}
|
||||
#if ENABLE_EPUB
|
||||
else {
|
||||
ev_web_view_select_all(EV_WEB_VIEW(ev_window->priv->webview));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -4151,14 +4042,7 @@ ev_window_cmd_edit_find_next (GtkAction *action, EvWindow *ev_window)
|
|||
update_chrome_flag (ev_window, EV_CHROME_FINDBAR, TRUE);
|
||||
update_chrome_visibility (ev_window);
|
||||
gtk_widget_grab_focus (ev_window->priv->find_bar);
|
||||
if (ev_window->priv->document->iswebdocument == FALSE) {
|
||||
ev_view_find_next (EV_VIEW (ev_window->priv->view));
|
||||
}
|
||||
#if ENABLE_EPUB
|
||||
else {
|
||||
ev_web_view_find_next(EV_WEB_VIEW(ev_window->priv->webview));
|
||||
}
|
||||
#endif
|
||||
ev_view_find_next (EV_VIEW (ev_window->priv->view));
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -4170,28 +4054,15 @@ ev_window_cmd_edit_find_previous (GtkAction *action, EvWindow *ev_window)
|
|||
update_chrome_flag (ev_window, EV_CHROME_FINDBAR, TRUE);
|
||||
update_chrome_visibility (ev_window);
|
||||
gtk_widget_grab_focus (ev_window->priv->find_bar);
|
||||
if (ev_window->priv->document->iswebdocument == FALSE) {
|
||||
ev_view_find_previous (EV_VIEW (ev_window->priv->view));
|
||||
}
|
||||
#if ENABLE_EPUB
|
||||
else {
|
||||
ev_web_view_find_previous(EV_WEB_VIEW(ev_window->priv->webview));
|
||||
}
|
||||
#endif
|
||||
ev_view_find_previous (EV_VIEW (ev_window->priv->view));
|
||||
}
|
||||
|
||||
static void
|
||||
ev_window_cmd_edit_copy (GtkAction *action, EvWindow *ev_window)
|
||||
{
|
||||
g_return_if_fail (EV_IS_WINDOW (ev_window));
|
||||
#if ENABLE_EPUB
|
||||
if (ev_window->priv->document->iswebdocument) {
|
||||
ev_web_view_copy(EV_WEB_VIEW(ev_window->priv->webview));
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
ev_view_copy (EV_VIEW (ev_window->priv->view));
|
||||
}
|
||||
|
||||
ev_view_copy (EV_VIEW (ev_window->priv->view));
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -4283,14 +4154,8 @@ ev_window_run_fullscreen (EvWindow *window)
|
|||
|
||||
if (fullscreen_window)
|
||||
gtk_window_fullscreen (GTK_WINDOW (window));
|
||||
if (window->priv->view) {
|
||||
gtk_widget_grab_focus (window->priv->view);
|
||||
}
|
||||
#if ENABLE_EPUB
|
||||
else {
|
||||
gtk_widget_grab_focus(window->priv->webview);
|
||||
}
|
||||
#endif
|
||||
gtk_widget_grab_focus (window->priv->view);
|
||||
|
||||
if (window->priv->metadata && !ev_window_is_empty (window))
|
||||
ev_metadata_set_boolean (window->priv->metadata, "fullscreen", TRUE);
|
||||
}
|
||||
|
|
@ -4405,11 +4270,7 @@ ev_window_run_presentation (EvWindow *window)
|
|||
|
||||
if (EV_WINDOW_IS_PRESENTATION (window))
|
||||
return;
|
||||
|
||||
if (window->priv->document->iswebdocument) {
|
||||
ev_window_warning_message(window,_("Presentation mode is not supported for ePub documents"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (ev_document_model_get_fullscreen (window->priv->model)) {
|
||||
ev_window_stop_fullscreen (window, FALSE);
|
||||
fullscreen_window = FALSE;
|
||||
|
|
@ -4484,11 +4345,6 @@ ev_window_stop_presentation (EvWindow *window,
|
|||
if (window->priv->view) {
|
||||
gtk_widget_grab_focus (window->priv->view);
|
||||
}
|
||||
#if ENABLE_EPUB
|
||||
else {
|
||||
gtk_widget_grab_focus (window->priv->webview);
|
||||
}
|
||||
#endif
|
||||
ev_window_uninhibit_screensaver (window);
|
||||
|
||||
if (window->priv->metadata && !ev_window_is_empty (window))
|
||||
|
|
@ -4626,14 +4482,7 @@ ev_window_set_page_mode (EvWindow *window,
|
|||
|
||||
switch (page_mode) {
|
||||
case PAGE_MODE_DOCUMENT:
|
||||
if ( window->priv->document && window->priv->document->iswebdocument == FALSE ) {
|
||||
child = window->priv->view;
|
||||
}
|
||||
#if ENABLE_EPUB
|
||||
else {
|
||||
child=window->priv->webview;
|
||||
}
|
||||
#endif
|
||||
child = window->priv->view;
|
||||
break;
|
||||
case PAGE_MODE_PASSWORD:
|
||||
child = window->priv->password_view;
|
||||
|
|
@ -4793,15 +4642,7 @@ ev_window_cmd_view_zoom_in (GtkAction *action, EvWindow *ev_window)
|
|||
g_return_if_fail (EV_IS_WINDOW (ev_window));
|
||||
|
||||
ev_document_model_set_sizing_mode (ev_window->priv->model, EV_SIZING_FREE);
|
||||
#if ENABLE_EPUB
|
||||
if (ev_window->priv->document->iswebdocument) {
|
||||
ev_web_view_zoom_in(EV_WEB_VIEW(ev_window->priv->webview));
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
ev_view_zoom_in (EV_VIEW (ev_window->priv->view));
|
||||
}
|
||||
ev_view_zoom_in (EV_VIEW (ev_window->priv->view));
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -4810,12 +4651,6 @@ ev_window_cmd_view_zoom_out (GtkAction *action, EvWindow *ev_window)
|
|||
g_return_if_fail (EV_IS_WINDOW (ev_window));
|
||||
|
||||
ev_document_model_set_sizing_mode (ev_window->priv->model, EV_SIZING_FREE);
|
||||
#if ENABLE_EPUB
|
||||
if ( ev_window->priv->document->iswebdocument) {
|
||||
ev_web_view_zoom_out(EV_WEB_VIEW(ev_window->priv->webview));
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
ev_view_zoom_out (EV_VIEW (ev_window->priv->view));
|
||||
}
|
||||
|
|
@ -4827,44 +4662,21 @@ ev_window_cmd_view_zoom_reset (GtkAction *action, EvWindow *ev_window)
|
|||
g_return_if_fail (EV_IS_WINDOW (ev_window));
|
||||
|
||||
ev_document_model_set_sizing_mode (ev_window->priv->model, EV_SIZING_FREE);
|
||||
#if ENABLE_EPUB
|
||||
if ( ev_window->priv->document->iswebdocument) {
|
||||
ev_web_view_zoom_reset(EV_WEB_VIEW(ev_window->priv->webview));
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
ev_view_zoom_reset (EV_VIEW (ev_window->priv->view));
|
||||
}
|
||||
ev_view_zoom_reset (EV_VIEW (ev_window->priv->view));
|
||||
}
|
||||
|
||||
static void
|
||||
ev_window_cmd_go_previous_page (GtkAction *action, EvWindow *ev_window)
|
||||
{
|
||||
g_return_if_fail (EV_IS_WINDOW (ev_window));
|
||||
#if ENABLE_EPUB
|
||||
if ( ev_window->priv->document->iswebdocument == TRUE ) {
|
||||
ev_web_view_previous_page(EV_WEB_VIEW(ev_window->priv->webview));
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
ev_view_previous_page (EV_VIEW (ev_window->priv->view));
|
||||
}
|
||||
ev_view_previous_page (EV_VIEW (ev_window->priv->view));
|
||||
}
|
||||
|
||||
static void
|
||||
ev_window_cmd_go_next_page (GtkAction *action, EvWindow *ev_window)
|
||||
{
|
||||
g_return_if_fail (EV_IS_WINDOW (ev_window));
|
||||
#if ENABLE_EPUB
|
||||
if ( ev_window->priv->document->iswebdocument == TRUE ) {
|
||||
ev_web_view_next_page(EV_WEB_VIEW(ev_window->priv->webview));
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
ev_view_next_page (EV_VIEW (ev_window->priv->view));
|
||||
}
|
||||
ev_view_next_page (EV_VIEW (ev_window->priv->view));
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -5016,12 +4828,7 @@ ev_window_cmd_view_expand_window (GtkAction *action, EvWindow *ev_window)
|
|||
static void
|
||||
ev_window_cmd_view_autoscroll (GtkAction *action, EvWindow *ev_window)
|
||||
{
|
||||
EvDocument* document = ev_window->priv->document;
|
||||
if (document->iswebdocument == TRUE ) {
|
||||
return ;
|
||||
}else {
|
||||
ev_view_autoscroll_start (EV_VIEW (ev_window->priv->view));
|
||||
}
|
||||
ev_view_autoscroll_start (EV_VIEW (ev_window->priv->view));
|
||||
}
|
||||
|
||||
#define EV_HELP "help:atril"
|
||||
|
|
@ -5060,7 +4867,7 @@ ev_window_cmd_escape (GtkAction *action, EvWindow *window)
|
|||
{
|
||||
GtkWidget *widget;
|
||||
|
||||
if (window->priv->document && !window->priv->document->iswebdocument && window->priv->view)
|
||||
if (window->priv->document && window->priv->view)
|
||||
ev_view_autoscroll_stop (EV_VIEW (window->priv->view));
|
||||
|
||||
widget = gtk_window_get_focus (GTK_WINDOW (window));
|
||||
|
|
@ -5070,10 +4877,6 @@ ev_window_cmd_escape (GtkAction *action, EvWindow *window)
|
|||
|
||||
if (window->priv->view)
|
||||
gtk_widget_grab_focus (window->priv->view);
|
||||
#if ENABLE_EPUB
|
||||
else
|
||||
gtk_widget_grab_focus (window->priv->webview);
|
||||
#endif
|
||||
} else {
|
||||
gboolean fullscreen;
|
||||
|
||||
|
|
@ -5085,12 +4888,7 @@ ev_window_cmd_escape (GtkAction *action, EvWindow *window)
|
|||
ev_window_stop_presentation (window, TRUE);
|
||||
gtk_widget_grab_focus (window->priv->view);
|
||||
} else {
|
||||
if (window->priv->view)
|
||||
gtk_widget_grab_focus (window->priv->view);
|
||||
#if ENABLE_EPUB
|
||||
else
|
||||
gtk_widget_grab_focus (window->priv->webview);
|
||||
#endif
|
||||
gtk_widget_grab_focus (window->priv->view);
|
||||
}
|
||||
|
||||
if (fullscreen && EV_WINDOW_IS_PRESENTATION (window))
|
||||
|
|
@ -5446,8 +5244,6 @@ view_menu_link_popup (EvWindow *ev_window,
|
|||
gboolean show_external = FALSE;
|
||||
gboolean show_internal = FALSE;
|
||||
GtkAction *action;
|
||||
|
||||
if ( ev_window->priv->document->iswebdocument == TRUE ) return ;
|
||||
|
||||
if (ev_window->priv->link)
|
||||
g_object_unref (ev_window->priv->link);
|
||||
|
|
@ -5500,8 +5296,7 @@ view_menu_image_popup (EvWindow *ev_window,
|
|||
{
|
||||
GtkAction *action;
|
||||
gboolean show_image = FALSE;
|
||||
|
||||
if (ev_window->priv->document->iswebdocument == TRUE ) return ;
|
||||
|
||||
if (ev_window->priv->image)
|
||||
g_object_unref (ev_window->priv->image);
|
||||
|
||||
|
|
@ -5529,7 +5324,6 @@ view_menu_annot_popup (EvWindow *ev_window,
|
|||
gboolean show_annot = FALSE;
|
||||
gboolean can_remove_annots = FALSE;
|
||||
|
||||
if (ev_window->priv->document->iswebdocument == TRUE ) return ;
|
||||
if (ev_window->priv->annot)
|
||||
g_object_unref (ev_window->priv->annot);
|
||||
ev_window->priv->annot = (annot) ? g_object_ref (annot) : NULL;
|
||||
|
|
@ -5682,18 +5476,10 @@ ev_window_find_job_updated_cb (EvJobFind *job,
|
|||
EvWindow *ev_window)
|
||||
{
|
||||
ev_window_update_actions (ev_window);
|
||||
#if ENABLE_EPUB
|
||||
if (ev_window->priv->document->iswebdocument == TRUE ) {
|
||||
ev_web_view_find_changed(EV_WEB_VIEW(ev_window->priv->webview),
|
||||
job->results,job->text, job->case_sensitive);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
ev_view_find_changed (EV_VIEW (ev_window->priv->view),
|
||||
ev_job_find_get_results (job),
|
||||
page);
|
||||
}
|
||||
|
||||
ev_view_find_changed (EV_VIEW (ev_window->priv->view),
|
||||
ev_job_find_get_results (job),
|
||||
page);
|
||||
ev_window_update_find_status_message (ev_window);
|
||||
}
|
||||
|
||||
|
|
@ -5719,43 +5505,21 @@ static void
|
|||
find_bar_previous_cb (EggFindBar *find_bar,
|
||||
EvWindow *ev_window)
|
||||
{
|
||||
#if ENABLE_EPUB
|
||||
if (ev_window->priv->document->iswebdocument == TRUE ) {
|
||||
ev_web_view_find_previous(EV_WEB_VIEW(ev_window->priv->webview));
|
||||
}else
|
||||
#endif
|
||||
{
|
||||
ev_view_find_previous (EV_VIEW (ev_window->priv->view));
|
||||
}
|
||||
ev_view_find_previous (EV_VIEW (ev_window->priv->view));
|
||||
}
|
||||
|
||||
static void
|
||||
find_bar_next_cb (EggFindBar *find_bar,
|
||||
EvWindow *ev_window)
|
||||
{
|
||||
#if ENABLE_EPUB
|
||||
if (ev_window->priv->document->iswebdocument == TRUE ) {
|
||||
ev_web_view_find_next(EV_WEB_VIEW(ev_window->priv->webview));
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
ev_view_find_next (EV_VIEW (ev_window->priv->view));
|
||||
}
|
||||
ev_view_find_next (EV_VIEW (ev_window->priv->view));
|
||||
}
|
||||
|
||||
static void
|
||||
find_bar_close_cb (EggFindBar *find_bar,
|
||||
EvWindow *ev_window)
|
||||
{
|
||||
#if ENABLE_EPUB
|
||||
if (ev_window->priv->document->iswebdocument == TRUE ) {
|
||||
ev_web_view_find_cancel(EV_WEB_VIEW(ev_window->priv->webview));
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
ev_view_find_cancel (EV_VIEW (ev_window->priv->view));
|
||||
}
|
||||
ev_view_find_cancel (EV_VIEW (ev_window->priv->view));
|
||||
ev_window_clear_find_job (ev_window);
|
||||
update_chrome_flag (ev_window, EV_CHROME_FINDBAR, FALSE);
|
||||
update_chrome_visibility (ev_window);
|
||||
|
|
@ -5791,9 +5555,7 @@ ev_window_search_start (EvWindow *ev_window)
|
|||
} else {
|
||||
ev_window_update_actions (ev_window);
|
||||
egg_find_bar_set_status_text (find_bar, NULL);
|
||||
if (ev_window->priv->document->iswebdocument == FALSE) {
|
||||
gtk_widget_queue_draw (GTK_WIDGET (ev_window->priv->view));
|
||||
}
|
||||
gtk_widget_queue_draw (GTK_WIDGET (ev_window->priv->view));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -5803,14 +5565,7 @@ find_bar_search_changed_cb (EggFindBar *find_bar,
|
|||
EvWindow *ev_window)
|
||||
{
|
||||
/* Either the string or case sensitivity could have changed. */
|
||||
#if ENABLE_EPUB
|
||||
if (ev_window->priv->document->iswebdocument) {
|
||||
ev_web_view_find_search_changed(EV_WEB_VIEW (ev_window->priv->webview));
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
ev_view_find_search_changed (EV_VIEW (ev_window->priv->view));
|
||||
}
|
||||
ev_view_find_search_changed (EV_VIEW (ev_window->priv->view));
|
||||
|
||||
ev_window_search_start (ev_window);
|
||||
}
|
||||
|
|
@ -5826,15 +5581,7 @@ find_bar_visibility_changed_cb (EggFindBar *find_bar,
|
|||
if (ev_window->priv->document &&
|
||||
EV_IS_DOCUMENT_FIND (ev_window->priv->document)) {
|
||||
|
||||
if (!ev_window->priv->document->iswebdocument) {
|
||||
ev_view_find_set_highlight_search (EV_VIEW (ev_window->priv->view), visible);
|
||||
}
|
||||
#if ENABLE_EPUB
|
||||
else {
|
||||
ev_web_view_find_search_changed(EV_WEB_VIEW(ev_window->priv->webview));
|
||||
ev_web_view_set_handler(EV_WEB_VIEW(ev_window->priv->webview),visible);
|
||||
}
|
||||
#endif
|
||||
ev_view_find_set_highlight_search (EV_VIEW (ev_window->priv->view), visible);
|
||||
ev_window_update_actions (ev_window);
|
||||
|
||||
if (visible)
|
||||
|
|
@ -6171,7 +5918,7 @@ ev_window_dispose (GObject *object)
|
|||
}
|
||||
|
||||
if (priv->view) {
|
||||
g_object_unref (priv->view);
|
||||
g_object_unref (priv->view);
|
||||
priv->view = NULL;
|
||||
}
|
||||
|
||||
|
|
@ -6574,14 +6321,7 @@ static const GtkActionEntry attachment_popup_entries [] = {
|
|||
static void
|
||||
sidebar_links_link_activated_cb (EvSidebarLinks *sidebar_links, EvLink *link, EvWindow *window)
|
||||
{
|
||||
if (window->priv->document->iswebdocument == FALSE ) {
|
||||
ev_view_handle_link (EV_VIEW (window->priv->view), link);
|
||||
}
|
||||
#if ENABLE_EPUB
|
||||
else {
|
||||
ev_web_view_handle_link(EV_WEB_VIEW(window->priv->webview), link);
|
||||
}
|
||||
#endif
|
||||
ev_view_handle_link (EV_VIEW (window->priv->view), link);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -6591,24 +6331,12 @@ activate_link_cb (EvPageAction *page_action, EvLink *link, EvWindow *window)
|
|||
ev_view_handle_link (EV_VIEW (window->priv->view), link);
|
||||
gtk_widget_grab_focus (window->priv->view);
|
||||
}
|
||||
#if ENABLE_EPUB
|
||||
else {
|
||||
ev_web_view_handle_link (EV_WEB_VIEW (window->priv->webview), link);
|
||||
gtk_widget_grab_focus (window->priv->webview);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
navigation_action_activate_link_cb (EvNavigationAction *action, EvLink *link, EvWindow *window)
|
||||
{
|
||||
#if ENABLE_EPUB
|
||||
if (window->priv->document->iswebdocument == TRUE ) {
|
||||
ev_web_view_handle_link(EV_WEB_VIEW(window->priv->webview),link);
|
||||
gtk_widget_grab_focus (window->priv->webview);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
ev_view_handle_link (EV_VIEW (window->priv->view), link);
|
||||
gtk_widget_grab_focus (window->priv->view);
|
||||
}
|
||||
|
|
@ -6617,15 +6345,7 @@ static void
|
|||
sidebar_layers_visibility_changed (EvSidebarLayers *layers,
|
||||
EvWindow *window)
|
||||
{
|
||||
if (window->priv->document->iswebdocument == FALSE ) {
|
||||
ev_view_reload (EV_VIEW (window->priv->view));
|
||||
}
|
||||
#if ENABLE_EPUB
|
||||
else
|
||||
{
|
||||
ev_web_view_reload(EV_WEB_VIEW(window->priv->webview));
|
||||
}
|
||||
#endif
|
||||
ev_view_reload (EV_VIEW (window->priv->view));
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -6633,7 +6353,6 @@ sidebar_annots_annot_activated_cb (EvSidebarAnnotations *sidebar_annots,
|
|||
EvMapping *annot_mapping,
|
||||
EvWindow *window)
|
||||
{
|
||||
if (window->priv->document->iswebdocument == TRUE ) return;
|
||||
ev_view_focus_annotation (EV_VIEW (window->priv->view), annot_mapping);
|
||||
}
|
||||
|
||||
|
|
@ -6642,7 +6361,6 @@ sidebar_annots_begin_annot_add (EvSidebarAnnotations *sidebar_annots,
|
|||
EvAnnotationType annot_type,
|
||||
EvWindow *window)
|
||||
{
|
||||
if (window->priv->document->iswebdocument == TRUE ) return;
|
||||
ev_view_begin_add_annotation (EV_VIEW (window->priv->view), annot_type);
|
||||
}
|
||||
|
||||
|
|
@ -6667,7 +6385,6 @@ static void
|
|||
sidebar_annots_annot_add_cancelled (EvSidebarAnnotations *sidebar_annots,
|
||||
EvWindow *window)
|
||||
{
|
||||
if (window->priv->document->iswebdocument == TRUE ) return;
|
||||
ev_view_cancel_add_annotation (EV_VIEW (window->priv->view));
|
||||
}
|
||||
|
||||
|
|
@ -7074,7 +6791,6 @@ view_external_link_cb (EvWindow *window, EvLinkAction *action)
|
|||
static void
|
||||
ev_view_popup_cmd_open_link (GtkAction *action, EvWindow *window)
|
||||
{
|
||||
if (window->priv->document->iswebdocument == TRUE ) return;
|
||||
ev_view_handle_link (EV_VIEW (window->priv->view), window->priv->link);
|
||||
}
|
||||
|
||||
|
|
@ -7099,7 +6815,7 @@ static void
|
|||
ev_view_popup_cmd_copy_link_address (GtkAction *action, EvWindow *window)
|
||||
{
|
||||
EvLinkAction *ev_action;
|
||||
if (window->priv->document->iswebdocument == TRUE ) return;
|
||||
|
||||
ev_action = ev_link_get_action (window->priv->link);
|
||||
if (!ev_action)
|
||||
return;
|
||||
|
|
@ -7289,8 +7005,6 @@ static void
|
|||
ev_view_popup_cmd_annot_properties (GtkAction *action,
|
||||
EvWindow *window)
|
||||
{
|
||||
if (window->priv->document->iswebdocument == TRUE ) return;
|
||||
|
||||
const gchar *author;
|
||||
GdkRGBA rgba;
|
||||
gdouble opacity;
|
||||
|
|
@ -7989,10 +7703,6 @@ ev_window_init (EvWindow *ev_window)
|
|||
|
||||
ev_window->priv->view = ev_view_new ();
|
||||
|
||||
#if ENABLE_EPUB /*The webview, we won't add it now but it will replace the atril-view if a web(epub) document is encountered.*/
|
||||
ev_window->priv->webview = ev_web_view_new();
|
||||
ev_web_view_set_model(EV_WEB_VIEW(ev_window->priv->webview),ev_window->priv->model);
|
||||
#endif
|
||||
page_cache_mb = g_settings_get_uint (ev_window_ensure_settings (ev_window),
|
||||
GS_PAGE_CACHE_SIZE);
|
||||
ev_view_set_page_cache_size (EV_VIEW (ev_window->priv->view),
|
||||
|
|
@ -8051,9 +7761,9 @@ ev_window_init (EvWindow *ev_window)
|
|||
/* We own a ref on these widgets, as we can swap them in and out */
|
||||
g_object_ref (ev_window->priv->view);
|
||||
g_object_ref (ev_window->priv->password_view);
|
||||
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (ev_window->priv->scrolled_window),
|
||||
ev_window->priv->view);
|
||||
ev_window->priv->view);
|
||||
|
||||
/* Connect to model signals */
|
||||
g_signal_connect_swapped (ev_window->priv->model,
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ thumbnailer_DATA = $(thumbnailer_in_files:.thumbnailer.in=.thumbnailer)
|
|||
atril.thumbnailer: $(thumbnailer_in_files)
|
||||
$(AM_V_GEN)sed \
|
||||
-e "s|\@ATRIL_MIME_TYPES\@|$(ATRIL_MIME_TYPES)|" \
|
||||
-e "s|application/epub+zip;||" \
|
||||
$< > $@
|
||||
|
||||
EXTRA_DIST = \
|
||||
|
|
|
|||
Loading…
Reference in a new issue