add preLoadSettings methods for cache_document_size setting

cache_document_size should be configurable for
every docuemnt and it must be loaded before
document open, so I added the preLoadSettings method
pull/2/merge
Qingping Hou 12 years ago
parent bc299784ca
commit b03d589ae9

@ -49,6 +49,7 @@ function openFile(filename)
end
if reader then
InfoMessage:show("Opening document, please wait... ", 0)
reader:preLoadSettings(filename)
local ok, err = reader:open(filename)
if ok then
reader:loadSettings(filename)

@ -907,11 +907,19 @@ function UniReader:initGlobalSettings(settings)
end
end
-- Method to load settings before document open
function UniReader:preLoadSettings(filename)
self.settings = DocSettings:open(filename)
local cache_d_size = self.settings:readSetting("cache_document_size")
if cache_d_size then
self.cache_document_size = cache_d_size
end
end
-- This is a low-level method that can be shared with all readers.
function UniReader:loadSettings(filename)
if self.doc ~= nil then
self.settings = DocSettings:open(filename,self.cache_document_size)
local gamma = self.settings:readSetting("gamma")
if gamma then
self.globalgamma = gamma

Loading…
Cancel
Save