From 37dfc84d5ae69f77a120160e49d5de99553314b2 Mon Sep 17 00:00:00 2001 From: Qingping Hou Date: Fri, 30 Mar 2012 14:10:04 +0800 Subject: [PATCH] fix: move commands initilization from global init to local If we call addAllCommands in initGlobalSettings, all the readers will share the same commands and we cannot adjust commands for a specific reader. I thus moved this method call to Unireader:init() method. --- crereader.lua | 1 + reader.lua | 1 - unireader.lua | 4 ++-- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crereader.lua b/crereader.lua index 21826b202..f6081ecb0 100644 --- a/crereader.lua +++ b/crereader.lua @@ -7,6 +7,7 @@ CREReader = UniReader:new{ } function CREReader:init() + self:addAllCommands() self:adjustCreReaderCommands() end diff --git a/reader.lua b/reader.lua index 087dc72a2..adbd99447 100755 --- a/reader.lua +++ b/reader.lua @@ -50,7 +50,6 @@ function openFile(filename) local ok, err = reader:open(filename) if ok then reader:loadSettings(filename) - page_num = reader.settings:readSetting("last_page") or 1 page_num = reader:getLastPageOrPos() reader:goto(tonumber(page_num)) reader_settings:savesetting("lastfile", filename) diff --git a/unireader.lua b/unireader.lua index 51c02c5cf..a45776042 100644 --- a/unireader.lua +++ b/unireader.lua @@ -101,6 +101,8 @@ end -- overwrite other methods if needed. ---------------------------------------------------- function UniReader:init() + -- initialize commands + self:addAllCommands() end -- open a file and its settings store @@ -133,8 +135,6 @@ function UniReader:initGlobalSettings(settings) if pan_overlap_vertical then self.pan_overlap_vertical = pan_overlap_vertical end - -- initialize commands - self:addAllCommands() local cache_max_memsize = settings:readSetting("cache_max_memsize") if cache_max_memsize then