diff --git a/commands.lua b/commands.lua index 2b5b58aef..1d7064b03 100644 --- a/commands.lua +++ b/commands.lua @@ -88,6 +88,7 @@ function Commands:addGroup(keygroup,keys,help,func) end end +--@TODO handle MOD_ANY 06.04 2012 (houqp) function Commands:del(keycode, modifier, keydescr) local keydef = nil @@ -106,6 +107,16 @@ function Commands:del(keycode, modifier, keydescr) self.map[keydef] = nil end +function Commands:delGroup(keygroup) + if keygroup then + for k,v in pairs(self.map) do + if v.keygroup == keygroup then + self.map[k] = nil + end + end -- EOF for + end +end + function Commands:_addImpl(keydef,help,func,keygroup) if keydef.modifier==MOD_ANY then self:addGroup(keygroup or keydef.descr,{Keydef:new(keydef.keycode,nil), Keydef:new(keydef.keycode,MOD_SHIFT), Keydef:new(keydef.keycode,MOD_ALT)},help,func) diff --git a/crereader.lua b/crereader.lua index ba1d77e86..41fc5e20c 100644 --- a/crereader.lua +++ b/crereader.lua @@ -131,6 +131,7 @@ end function CREReader:adjustCreReaderCommands() -- delete commands + self.commands:delGroup("[joypad]") self.commands:del(KEY_G, nil, "G") self.commands:del(KEY_J, nil, "J") self.commands:del(KEY_K, nil, "K") diff --git a/djvureader.lua b/djvureader.lua index be72ec4c0..c9ec0cdf4 100644 --- a/djvureader.lua +++ b/djvureader.lua @@ -13,6 +13,27 @@ function DJVUReader:open(filename) return ok end +function DJVUReader:init() + self:addAllCommands() + self:adjustDjvuReaderCommand() +end + +function DJVUReader:adjustDjvuReaderCommand() + self.commands:add(KEY_N, nil, "N", + "start highlight mode", + function(unireader) + unireader:startHighLightMode() + unireader:goto(unireader.pageno) + end + ) + self.commands:add(KEY_N, MOD_SHIFT, "N", + "display all highlights", + function(unireader) + unireader:showHighLight() + unireader:goto(unireader.pageno) + end + ) +end -----------[ highlight support ]---------- diff --git a/unireader.lua b/unireader.lua index d37fc1f87..4d010de80 100644 --- a/unireader.lua +++ b/unireader.lua @@ -1096,18 +1096,6 @@ function UniReader:addAllCommands() function(unireader) unireader:screenRotate("anticlockwise") end) - self.commands:add(KEY_N, nil, "N", - "start highlight mode", - function(unireader) - unireader:startHighLightMode() - unireader:goto(unireader.pageno) - end) - self.commands:add(KEY_N, MOD_SHIFT, "N", - "display all highlights", - function(unireader) - unireader:showHighLight() - unireader:goto(unireader.pageno) - end) self.commands:add(KEY_R, MOD_SHIFT, "R", "manual full screen refresh", function(unireader)