mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -04:00
lua print table put_line a do_menu alternative
add stylized lines to lua the exported do_menu has a severe limitation of 64 items it also requires double the memory put_line is the way rockbox builds menus update printtable user config from core -- done code cleanup fixed for 1-bit screens changed button behavior fixed for 2-bit screens Change-Id: I4de55e42685aa1d2f53a33bc8e980827864e810b
This commit is contained in:
parent
c71a47f649
commit
acda37edd1
13 changed files with 582 additions and 164 deletions
|
@ -33,7 +33,7 @@ local scrpath = rb.current_path()--rb.PLUGIN_DIR .. "/demos/lua_scripts/"
|
|||
|
||||
package.path = scrpath .. "/?.lua;" .. package.path --add lua_scripts directory to path
|
||||
|
||||
require("printmenu") --menu
|
||||
require("printmenus") --menu
|
||||
require("filebrowse") -- file browser
|
||||
|
||||
rb.actions = nil
|
||||
|
|
|
@ -33,7 +33,7 @@ local scrpath = rb.current_path()--rb.PLUGIN_DIR .. "/demos/lua_scripts/"
|
|||
|
||||
package.path = scrpath .. "/?.lua;" .. package.path --add lua_scripts directory to path
|
||||
|
||||
require("printmenu") --menu
|
||||
require("printmenus") --menu
|
||||
require("filebrowse") -- file browser
|
||||
require("fileviewers") -- fileviewer, hexviewer
|
||||
|
||||
|
|
|
@ -205,6 +205,7 @@ function print_file(filename, maxlinelen, settings)
|
|||
end
|
||||
settings.hasheader = true
|
||||
settings.co_routine = nil
|
||||
settings.ovfl = "manual"
|
||||
|
||||
local sel =
|
||||
print_table(ftable, #ftable, settings)
|
||||
|
@ -309,6 +310,7 @@ function print_file_increment(filename, settings)
|
|||
settings.hasheader = true
|
||||
settings.co_routine = co
|
||||
settings.msel = false
|
||||
settings.ovfl = "manual"
|
||||
|
||||
table.insert(file_t, 1, hstr) --position 1 is header/title
|
||||
local sel =
|
||||
|
@ -437,6 +439,7 @@ function print_file_hex(filename, bytesperline, settings)
|
|||
settings.co_routine = co
|
||||
settings.start = start
|
||||
settings.curpos = vcur
|
||||
settings.ovfl = "manual"
|
||||
|
||||
while sel > 0 do
|
||||
settings.start = start
|
||||
|
|
|
@ -1,83 +0,0 @@
|
|||
--[[
|
||||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2017 William Wilgus
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
]]
|
||||
if not rb.lcd_framebuffer then rb.splash(rb.HZ, "No Support!") return nil end
|
||||
|
||||
require("printtable")
|
||||
local _clr = require("color")
|
||||
|
||||
local _LCD = rb.lcd_framebuffer()
|
||||
--------------------------------------------------------------------------------
|
||||
-- displays text in menu_t calls function in same indice of func_t when selected
|
||||
function print_menu(menu_t, func_t, selected, settings, copy_screen)
|
||||
|
||||
local i, start, vcur, screen_img
|
||||
|
||||
if selected then vcur = selected + 1 end
|
||||
if vcur and vcur <= 1 then vcur = 2 end
|
||||
|
||||
if not settings then
|
||||
settings = {}
|
||||
settings.justify = "center"
|
||||
settings.wrap = true
|
||||
settings.hfgc = _clr.set( 0, 000, 000, 000)
|
||||
settings.hbgc = _clr.set(-1, 255, 255, 255)
|
||||
settings.ifgc = _clr.set(-1, 000, 255, 060)
|
||||
settings.ibgc = _clr.set( 0, 000, 000, 000)
|
||||
settings.iselc = _clr.set( 1, 000, 200, 100)
|
||||
settings.default = true
|
||||
end
|
||||
|
||||
settings.hasheader = true
|
||||
settings.co_routine = nil
|
||||
settings.msel = false
|
||||
settings.start = start
|
||||
settings.curpos = vcur
|
||||
|
||||
while not i or i > 0 do
|
||||
if copy_screen == true then
|
||||
--make a copy of screen for restoration
|
||||
screen_img = screen_img or rb.new_image()
|
||||
screen_img:copy(_LCD)
|
||||
else
|
||||
screen_img = nil
|
||||
end
|
||||
|
||||
_LCD:clear(settings.ibgc)
|
||||
|
||||
settings.start = start
|
||||
settings.curpos = vcur
|
||||
|
||||
i, start, vcur = print_table(menu_t, #menu_t, settings)
|
||||
--vcur = vcur + 1
|
||||
collectgarbage("collect")
|
||||
if copy_screen == true then _LCD:copy(screen_img) end
|
||||
|
||||
if func_t and func_t[i] then
|
||||
if func_t[i](i, menu_t) == true then break end
|
||||
else
|
||||
break
|
||||
end
|
||||
end
|
||||
if settings.default == true then settings = nil end
|
||||
return screen_img
|
||||
end
|
|
@ -36,7 +36,7 @@ local _draw_text = require("draw_text")
|
|||
|
||||
--package.path = scrpath .. "/?.lua;" .. package.path --add lua_scripts directory to path
|
||||
|
||||
require("printmenu") --menu
|
||||
require("printmenus") --menu
|
||||
|
||||
--[[ RBIMAGE library functions
|
||||
NOTE!! on x, y coordinates + width & height
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
--local scrpath = rb.current_path()"
|
||||
|
||||
--package.path = scrpath .. "/?.lua;" .. package.path --add lua_scripts directory to path
|
||||
require("printmenu")
|
||||
require("printmenus")
|
||||
require("printtable")
|
||||
require("dbgettags")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue