require "rendertext" require "keys" require "graphics" require "font" require "inputbox" require "selectmenu" require "commands" HelpPage = { -- Other Class vars: -- title height title_H = 40, -- horisontal margin margin_H = 10, -- foot height foot_H = 28, -- background color bg_color = 4, -- spacing between lines spacing = 25, -- state buffer commands = nil, items = 0, page = 1, -- font for displaying keys fsize = 20, face = Font:getFace("hpkfont", 20), -- font for displaying help messages hfsize = 20, hface = Font:getFace("hfont", 20), -- font for paging display ffsize = 15, fface = Font:getFace("pgfont", 15) } -- Other Class vars: 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() --Debug("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 is_pagedirty = true end elseif ev.code == KEY_BACK or ev.code == KEY_HOME then return nil end end end end