require "rendertext" require "keys" require "graphics" require "font" require "inputbox" require "selectmenu" require "commands" HelpPage = { -- Other Class vars: -- spacing between lines spacing = 25, -- state buffer commands = nil, items = 0, page = 1 } -- Other Class vars: -- font for displaying keys HelpPage.fsize = 20 HelpPage.face, HelpPage.fhash = Font:getFaceAndHash(HelpPage.fsize, "mono") -- font for displaying help messages HelpPage.hfsize = 20 HelpPage.hface, HelpPage.hfhash = Font:getFaceAndHash(HelpPage.hfsize, "sans") -- font for paging display HelpPage.ffsize = 15 HelpPage.fface, HelpPage.ffhash = Font:getFaceAndHash(HelpPage.ffsize, "sans") function HelpPage:show(ypos, height,commands) self.commands = {} self.items = 0 local keys = {} for k,v in pairs(commands.map) do local key = v.keygroup or v.keydef:display() --print("order: "..v.order.." command: "..tostring(v.keydef).." - keygroup:"..(v.keygroup or "nil").." -keys[key]:"..(keys[key] or "nil")) if keys[key] == nil then keys[key] = 1 table.insert(self.commands,{shortcut=key,help=v.help,order=v.order}) self.items = self.items + 1 end end table.sort(self.commands,function(w1,w2) return w1.order 1 then self.page = self.page - 1 pagedirty = true end elseif ev.code == KEY_BACK or ev.code == KEY_HOME then return nil end end end end