2
0
mirror of https://github.com/koreader/koreader synced 2024-10-31 21:20:20 +00:00

Merge pull request #425 from chrox/master

fix dictionary lookup crash in scroll mode
This commit is contained in:
Qingping Hou 2013-12-31 07:57:16 -08:00
commit 2fcddfa3ba
9 changed files with 13 additions and 8 deletions

View File

@ -69,6 +69,7 @@ function CreDocument:engineInit()
end
function CreDocument:init()
require "libs/libkoreader-cre"
self:engineInit()
self.configurable:loadDefaults(self.options)

View File

@ -5,7 +5,7 @@ local KoptOptions = require("ui/data/koptoptions")
local KoptInterface = require("document/koptinterface")
local Document = require("document/document")
local Configurable = require("ui/reader/configurable")
-- TBD: DrawContext
local DrawContext = require("ffi/drawcontext")
local DjvuDocument = Document:new{
_document = false,
@ -27,6 +27,7 @@ local function validDjvuFile(filename)
end
function DjvuDocument:init()
require "libs/libkoreader-djvu"
self.configurable:loadDefaults(self.options)
if not validDjvuFile(self.file) then
self.error_message = "Not a valid DjVu file"

View File

@ -1,3 +1,4 @@
local DrawContext = require("ffi/drawcontext")
local Cache = require("cache")
local CacheItem = require("cacheitem")
local TileCacheItem = require("document/tilecacheitem")

View File

@ -5,7 +5,7 @@ local Screen = require("ui/screen")
local Geom = require("ui/geometry")
local TileCacheItem = require("document/tilecacheitem")
local DEBUG = require("dbg")
-- TBD: KOPTContext
local KOPTContext = require("ffi/koptcontext")
local KoptInterface = {
ocrengine = "ocrengine",

View File

@ -4,7 +4,7 @@ local KoptOptions = require("ui/data/koptoptions")
local KoptInterface = require("document/koptinterface")
local Document = require("document/document")
local Configurable = require("ui/reader/configurable")
-- TBD: DrawContext
local DrawContext = require("ffi/drawcontext")
local PdfDocument = Document:new{
_document = false,
@ -16,6 +16,7 @@ local PdfDocument = Document:new{
}
function PdfDocument:init()
require "libs/libkoreader-pdf"
self.configurable:loadDefaults(self.options)
local ok
ok, self._document = pcall(pdf.openDocument, self.file, self.mupdf_cache_size)

View File

@ -1,12 +1,13 @@
local Document = require("document/document")
-- DrawContext
local DrawContext = require("ffi/drawcontext")
local PicDocument = Document:new{
_document = false,
dc_null = DrawContext.new(),
dc_null = DrawContext.new()
}
function PicDocument:init()
require "libs/libkoreader-pic"
ok, self._document = pcall(pic.openDocument, self.file)
if not ok then
self.error_message = "failed to open jpeg image"

View File

@ -225,7 +225,7 @@ end
function ReaderHighlight:lookup(selected_word)
-- if we extracted text directly
if selected_word.word then
local word_box = self.view:pageToScreenTransform(selected_word.page, selected_word.sbox)
local word_box = self.view:pageToScreenTransform(self.hold_pos.page, selected_word.sbox)
self.ui:handleEvent(Event:new("LookupWord", self, selected_word.word, word_box))
-- or we will do OCR
else

@ -1 +1 @@
Subproject commit ffec35674a11d13750224ce1b00704dea0f3f762
Subproject commit 8a8204cc9520a17979c12e2295e9eb4b1b24632d

View File

@ -2,7 +2,7 @@
require "defaults"
package.path = "./frontend/?.lua;./?.lua"
package.cpath = "/usr/lib/lua/?.so"
package.cpath = "?.so;/usr/lib/lua/?.so"
local UIManager = require("ui/uimanager")
local Menu = require("ui/widget/menu")
local InfoMessage = require("ui/widget/infomessage")