summaryrefslogtreecommitdiff
path: root/apps/plugins/lua_scripts/printmenu.lua
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/lua_scripts/printmenu.lua')
-rwxr-xr-xapps/plugins/lua_scripts/printmenu.lua83
1 files changed, 0 insertions, 83 deletions
diff --git a/apps/plugins/lua_scripts/printmenu.lua b/apps/plugins/lua_scripts/printmenu.lua
deleted file mode 100755
index 3cb17d8026..0000000000
--- a/apps/plugins/lua_scripts/printmenu.lua
+++ /dev/null
@@ -1,83 +0,0 @@
1--[[
2/***************************************************************************
3 * __________ __ ___.
4 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
5 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
6 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
7 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
8 * \/ \/ \/ \/ \/
9 * $Id$
10 *
11 * Copyright (C) 2017 William Wilgus
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
17 *
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
20 *
21 ****************************************************************************/
22]]
23if not rb.lcd_framebuffer then rb.splash(rb.HZ, "No Support!") return nil end
24
25require("printtable")
26local _clr = require("color")
27
28local _LCD = rb.lcd_framebuffer()
29--------------------------------------------------------------------------------
30-- displays text in menu_t calls function in same indice of func_t when selected
31function print_menu(menu_t, func_t, selected, settings, copy_screen)
32
33 local i, start, vcur, screen_img
34
35 if selected then vcur = selected + 1 end
36 if vcur and vcur <= 1 then vcur = 2 end
37
38 if not settings then
39 settings = {}
40 settings.justify = "center"
41 settings.wrap = true
42 settings.hfgc = _clr.set( 0, 000, 000, 000)
43 settings.hbgc = _clr.set(-1, 255, 255, 255)
44 settings.ifgc = _clr.set(-1, 000, 255, 060)
45 settings.ibgc = _clr.set( 0, 000, 000, 000)
46 settings.iselc = _clr.set( 1, 000, 200, 100)
47 settings.default = true
48 end
49
50 settings.hasheader = true
51 settings.co_routine = nil
52 settings.msel = false
53 settings.start = start
54 settings.curpos = vcur
55
56 while not i or i > 0 do
57 if copy_screen == true then
58 --make a copy of screen for restoration
59 screen_img = screen_img or rb.new_image()
60 screen_img:copy(_LCD)
61 else
62 screen_img = nil
63 end
64
65 _LCD:clear(settings.ibgc)
66
67 settings.start = start
68 settings.curpos = vcur
69
70 i, start, vcur = print_table(menu_t, #menu_t, settings)
71 --vcur = vcur + 1
72 collectgarbage("collect")
73 if copy_screen == true then _LCD:copy(screen_img) end
74
75 if func_t and func_t[i] then
76 if func_t[i](i, menu_t) == true then break end
77 else
78 break
79 end
80 end
81 if settings.default == true then settings = nil end
82 return screen_img
83end