mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Merge pull request #224 from houqp/new_ui_code
some small fixes and cherry-picks for new_ui_code
This commit is contained in:
27
Makefile
27
Makefile
@@ -5,8 +5,8 @@ MUPDFDIR=mupdf
|
||||
MUPDFTARGET=build/debug
|
||||
MUPDFLIBDIR=$(MUPDFDIR)/$(MUPDFTARGET)
|
||||
DJVUDIR=djvulibre
|
||||
KPVCRLIGDIR=kpvcrlib
|
||||
CRENGINEDIR=$(KPVCRLIGDIR)/crengine
|
||||
KPVCRLIBDIR=kpvcrlib
|
||||
CRENGINEDIR=$(KPVCRLIBDIR)/crengine
|
||||
|
||||
FREETYPEDIR=$(MUPDFDIR)/thirdparty/freetype-2.4.9
|
||||
LFSDIR=luafilesystem
|
||||
@@ -32,7 +32,7 @@ CXXFLAGS:=-O3 $(SYSROOT)
|
||||
LDFLAGS:= $(SYSROOT)
|
||||
ARM_CFLAGS:=-march=armv6
|
||||
# use this for debugging:
|
||||
#CFLAGS:=-O0 -g
|
||||
#CFLAGS:=-O0 -g $(SYSROOT)
|
||||
|
||||
DYNAMICLIBSTDCPP:=-lstdc++
|
||||
ifdef STATICLIBSTDCPP
|
||||
@@ -53,6 +53,9 @@ ifdef EMULATE_READER
|
||||
-DEMULATE_READER_W=$(EMULATE_READER_W) \
|
||||
-DEMULATE_READER_H=$(EMULATE_READER_H)
|
||||
EMU_LDFLAGS?=$(shell sdl-config --libs)
|
||||
ifeq "$(shell uname -s -m)" "Darwin x86_64"
|
||||
EMU_LDFLAGS += -pagezero_size 10000 -image_base 100000000
|
||||
endif
|
||||
else
|
||||
CFLAGS+= $(ARM_CFLAGS)
|
||||
endif
|
||||
@@ -121,7 +124,7 @@ djvu.o: %.o: %.c
|
||||
$(CC) -c $(KPDFREADER_CFLAGS) -I$(DJVUDIR)/ $< -o $@
|
||||
|
||||
cre.o: %.o: %.cpp
|
||||
$(CC) -c -I$(CRENGINEDIR)/crengine/include/ -Ilua/src $< -o $@ -lstdc++
|
||||
$(CC) -c -I$(CRENGINEDIR)/crengine/include/ -I$(LUADIR)/src $< -o $@ -lstdc++
|
||||
|
||||
lfs.o: $(LFSDIR)/src/lfs.c
|
||||
$(CC) -c $(CFLAGS) -I$(LUADIR)/src -I$(LFSDIR)/src $(LFSDIR)/src/lfs.c -o $@
|
||||
@@ -143,7 +146,11 @@ fetchthirdparty:
|
||||
cd kpvcrlib/crengine/crengine/src && \
|
||||
patch -N -p0 < ../../../lvrend_node_type_face.patch || true
|
||||
unzip mupdf-thirdparty.zip -d mupdf
|
||||
# dirty patch in MuPDF's thirdparty liby for CREngine
|
||||
# check mupdf's thirdparty libs' version, if not matched, remove the old one
|
||||
# run make fetchthirdparty again to get the latest thirdparty libs.
|
||||
test -d $(FREETYPEDIR) || ( echo "error: mupdf's thirdparty libs' version not match" ; \
|
||||
rm -rf mupdf-thirdparty.zip ; exit 1 )
|
||||
# dirty patch in MuPDF's thirdparty lib for CREngine
|
||||
cd mupdf/thirdparty/jpeg-*/ && \
|
||||
patch -N -p0 < ../../../kpvcrlib/jpeg_compress_struct_size.patch &&\
|
||||
patch -N -p0 < ../../../kpvcrlib/jpeg_decompress_struct_size.patch
|
||||
@@ -158,9 +165,9 @@ cleanthirdparty:
|
||||
-make -C $(MUPDFDIR) clean
|
||||
-make -C $(CRENGINEDIR)/thirdparty/antiword clean
|
||||
test -d $(CRENGINEDIR)/thirdparty/chmlib && make -C $(CRENGINEDIR)/thirdparty/chmlib clean || echo warn: chmlib folder not found
|
||||
test -d $(CRENGINEDIR)/thirdparty/libpng && (make -C $(CRENGINEDIR)/thirdparty/libpng clean) || echo warn: chmlib folder not found
|
||||
test -d $(CRENGINEDIR)/crengine && (make -C $(CRENGINEDIR)/crengine clean) || echo warn: chmlib folder not found
|
||||
test -d $(KPVCRLIGDIR) && (make -C $(KPVCRLIGDIR) clean) || echo warn: chmlib folder not found
|
||||
test -d $(CRENGINEDIR)/thirdparty/libpng && (make -C $(CRENGINEDIR)/thirdparty/libpng clean) || echo warn: libpng folder not found
|
||||
test -d $(CRENGINEDIR)/crengine && (make -C $(CRENGINEDIR)/crengine clean) || echo warn: crengine folder not found
|
||||
test -d $(KPVCRLIBDIR) && (make -C $(KPVCRLIBDIR) clean) || echo warn: kpvcrlib folder not found
|
||||
-rm -rf $(DJVUDIR)/build
|
||||
-rm -f $(MUPDFDIR)/fontdump.host
|
||||
-rm -f $(MUPDFDIR)/cmapdump.host
|
||||
@@ -189,7 +196,7 @@ endif
|
||||
make -C $(DJVUDIR)/build
|
||||
|
||||
$(CRENGINELIBS):
|
||||
cd $(KPVCRLIGDIR) && rm -rf CMakeCache.txt CMakeFiles && \
|
||||
cd $(KPVCRLIBDIR) && rm -rf CMakeCache.txt CMakeFiles && \
|
||||
CFLAGS="$(CFLAGS)" CC="$(CC)" CXX="$(CXX)" cmake . && \
|
||||
make
|
||||
|
||||
@@ -217,7 +224,7 @@ customupdate: all
|
||||
cp -rpL data/*.css $(INSTALL_DIR)/data
|
||||
cp -rpL fonts $(INSTALL_DIR)
|
||||
cp -r resources $(INSTALL_DIR)
|
||||
cp -r frontend $(INSTALL_DIR)
|
||||
cp -rpL frontend $(INSTALL_DIR)
|
||||
mkdir $(INSTALL_DIR)/fonts/host
|
||||
zip -9 -r kindlepdfviewer-$(VERSION).zip $(INSTALL_DIR) launchpad/ kite/
|
||||
rm -Rf $(INSTALL_DIR)
|
||||
|
||||
2
djvu.c
2
djvu.c
@@ -44,7 +44,7 @@ static int handle(lua_State *L, ddjvu_context_t *ctx, int wait)
|
||||
{
|
||||
const ddjvu_message_t *msg;
|
||||
if (!ctx)
|
||||
return;
|
||||
return -1;
|
||||
if (wait)
|
||||
msg = ddjvu_message_wait(ctx);
|
||||
while ((msg = ddjvu_message_peek(ctx)))
|
||||
|
||||
@@ -70,6 +70,10 @@ function Document:new(o)
|
||||
return o
|
||||
end
|
||||
|
||||
-- override this method to open a document
|
||||
function Document:init()
|
||||
end
|
||||
|
||||
-- this might be overridden by a document implementation
|
||||
function Document:unlock(password)
|
||||
-- return true instead when the password provided unlocked the document
|
||||
|
||||
9
input.c
9
input.c
@@ -20,7 +20,12 @@
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#ifdef EMULATE_READER
|
||||
#include <SDL.h>
|
||||
#define EV_KEY 0x01
|
||||
#else
|
||||
#include <linux/input.h>
|
||||
#endif
|
||||
#include "input.h"
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
@@ -138,6 +143,7 @@ static int openInputDevice(lua_State *L) {
|
||||
}
|
||||
|
||||
static int closeInputDevices(lua_State *L) {
|
||||
#ifndef EMULATE_READER
|
||||
int i;
|
||||
for(i=0; i<NUM_FDS; i++) {
|
||||
if(inputfds[i] != -1) {
|
||||
@@ -151,6 +157,9 @@ static int closeInputDevices(lua_State *L) {
|
||||
waitpid(-1, NULL, 0);
|
||||
}
|
||||
return 0;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
static int waitForInput(lua_State *L) {
|
||||
|
||||
4
input.h
4
input.h
@@ -18,10 +18,6 @@
|
||||
#ifndef _PDF_INPUT_H
|
||||
#define _PDF_INPUT_H
|
||||
|
||||
#ifdef EMULATE_READER
|
||||
#include <SDL.h>
|
||||
#endif
|
||||
|
||||
#include <lua.h>
|
||||
#include <lualib.h>
|
||||
#include <lauxlib.h>
|
||||
|
||||
74
kpvcrlib/cr3.css
Normal file
74
kpvcrlib/cr3.css
Normal file
@@ -0,0 +1,74 @@
|
||||
body { text-align: left; text-indent: 0px }
|
||||
p { text-align: justify; text-indent: 2em; margin-top:0em; margin-bottom: 0em }
|
||||
|
||||
empty-line { height: 1em }
|
||||
|
||||
hr { height: 1px; /* background-color: #808080; */ margin-top: 0.5em; margin-bottom: 0.5em }
|
||||
|
||||
sub { vertical-align: sub; font-size: 70% }
|
||||
sup { vertical-align: super; font-size: 70% }
|
||||
strong, b { font-weight: bold }
|
||||
emphasis, i { font-style: italic }
|
||||
|
||||
a { text-decoration: underline }
|
||||
a[type="note"] { vertical-align: super; font-size: 70%; text-decoration: none }
|
||||
|
||||
image { text-align: center; text-indent: 0px }
|
||||
p image { display: inline }
|
||||
|
||||
title p, subtitle p, h1 p, h2 p, h3 p, h4 p, h5 p, h6 p { text-align: center; text-indent: 0px }
|
||||
cite p, epigraph p { text-align: left; text-indent: 0px }
|
||||
v { text-align: left; text-indent: 0px }
|
||||
|
||||
stanza + stanza { margin-top: 1em; }
|
||||
stanza { margin-left: 30%; text-align: left; font-style: italic }
|
||||
poem { margin-top: 1em; margin-bottom: 1em; text-indent: 0px }
|
||||
text-author { font-weight: bold; font-style: italic; margin-left: 5%}
|
||||
epigraph { margin-left: 25%; margin-right: 1em; text-align: left; text-indent:
|
||||
1px; font-style: italic; margin-top: 15px; margin-bottom: 25px }
|
||||
cite { font-style: italic; margin-left: 5%; margin-right: 5%; text-align: justify;
|
||||
margin-top: 20px; margin-bottom: 20px }
|
||||
|
||||
title, h1, h2 { text-align: center; text-indent: 0px; font-weight: bold; hyphenate: none;
|
||||
page-break-before: always; page-break-inside: avoid; page-break-after: avoid; }
|
||||
subtitle, h3, h4, h5, h6 { text-align: center; text-indent: 0px; font-weight: bold;
|
||||
hyphenate: none; page-break-inside: avoid; page-break-after: avoid; }
|
||||
title { font-size: 110%; margin-top: 0.7em; margin-bottom: 0.5em }
|
||||
subtitle { font-style: italic; margin-top: 0.3em; margin-bottom: 0.3em }
|
||||
h1 { font-size: 150% }
|
||||
h2 { font-size: 140% }
|
||||
h3 { font-size: 130% }
|
||||
h4 { font-size: 120% }
|
||||
h5 { font-size: 110% }
|
||||
|
||||
|
||||
table { font-size: 80% }
|
||||
td, th { text-indent: 0px; padding: 3px }
|
||||
th { font-weight: bold; /* background-color: #DDD */ }
|
||||
table > caption { text-indent: 0px; padding: 4px; /* background-color: #EEE */ }
|
||||
|
||||
code, pre { display: block; white-space: pre; text-align: left;
|
||||
font-family: "Droid Sans Mono", monospace; text-align: left }
|
||||
|
||||
body[name="notes"] { font-size: 70%; }
|
||||
body[name="notes"] section title { display: run-in; text-align: left; font-size: 110%;
|
||||
font-weight: bold; page-break-before: auto; page-break-inside: auto;
|
||||
page-break-after: auto; }
|
||||
body[name="notes"] section title p { display: inline }
|
||||
|
||||
description { display: block; }
|
||||
title-info { display: block; }
|
||||
annotation { margin-left: 5%; margin-right: 5%; font-size: 80%; font-style: italic;
|
||||
text-align: justify; text-indent: 2em }
|
||||
date { display: block; font-size: 80%; font-style: italic; text-align: center }
|
||||
genre { display: none; }
|
||||
author { display: none; }
|
||||
book-title { display: none; }
|
||||
keywords { display: none; }
|
||||
lang { display: none; }
|
||||
src-lang { display: none; }
|
||||
translator { display: none; }
|
||||
document-info { display: none; }
|
||||
publish-info { display: none; }
|
||||
custom-info { display: none; }
|
||||
coverpage { display: none }
|
||||
Reference in New Issue
Block a user