summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2021-04-08 00:03:18 -0400
committerWilliam Wilgus <me.theuser@yahoo.com>2021-04-08 04:15:40 +0000
commitc77cd7027f3597384f4474c049b28014027845b6 (patch)
tree8bf1b92dc7b5e69f76b66e2b1c147f5176e95aaa
parentf8ce18c286b644f30839ac8db8cb04e9f10606a1 (diff)
downloadrockbox-c77cd7027f3597384f4474c049b28014027845b6.tar.gz
rockbox-c77cd7027f3597384f4474c049b28014027845b6.zip
lua print_table add ability to draw a line separator
allows you to draw a line between items Change-Id: I7e6e2f56738e12ff06d06a24f0f9d0769932a7b1
-rw-r--r--apps/plugins/lua/include_lua/print.lua8
-rw-r--r--apps/plugins/lua/include_lua/printtable.lua12
2 files changed, 16 insertions, 4 deletions
diff --git a/apps/plugins/lua/include_lua/print.lua b/apps/plugins/lua/include_lua/print.lua
index 3e92a155ba..3fb19bef1f 100644
--- a/apps/plugins/lua/include_lua/print.lua
+++ b/apps/plugins/lua/include_lua/print.lua
@@ -141,6 +141,7 @@ local _print = {} do
141 ovfl = "auto", 141 ovfl = "auto",
142 justify = "left", 142 justify = "left",
143 autoupdate = true, 143 autoupdate = true,
144 drawsep = false,
144 } 145 }
145 _p_opts.max_line = max_lines(_p_opts) 146 _p_opts.max_line = max_lines(_p_opts)
146 147
@@ -292,7 +293,12 @@ local _print = {} do
292 col_buf_insert(msg, o.line, o) 293 col_buf_insert(msg, o.line, o)
293 end 294 end
294 end 295 end
295 296 if o.drawsep == true then
297 if s_lines[o.line] == true then
298 rb.set_viewport(o) --nned to revert drawmode if selected
299 end
300 rb.lcd_drawline(0, line * h, o.width, line * h)
301 end
296 --only update the line we changed 302 --only update the line we changed
297 update_line(o.autoupdate, o, line, h) 303 update_line(o.autoupdate, o, line, h)
298 304
diff --git a/apps/plugins/lua/include_lua/printtable.lua b/apps/plugins/lua/include_lua/printtable.lua
index 24c4f73b0a..b289beeb0e 100644
--- a/apps/plugins/lua/include_lua/printtable.lua
+++ b/apps/plugins/lua/include_lua/printtable.lua
@@ -152,14 +152,15 @@ function print_table(t, t_count, settings)
152 end 152 end
153 153
154 local wrap, justify, start, curpos, co_routine, hasheader, m_sel 154 local wrap, justify, start, curpos, co_routine, hasheader, m_sel
155 local header_fgc, header_bgc, item_fgc, item_bgc, item_selc 155 local header_fgc, header_bgc, item_fgc, item_bgc, item_selc, drawsep
156 do 156 do
157 local s = settings or _print.get_settings() 157 local s = settings or _print.get_settings()
158 wrap, justify = s.wrap, s.justify 158 wrap, justify = s.wrap, s.justify
159 start, curpos = s.start, s.curpos 159 start, curpos = s.start, s.curpos
160 co_routine = s.co_routine 160 co_routine = s.co_routine
161 hasheader = s.hasheader 161 hasheader = s.hasheader
162 m_sel = false 162 drawsep = s.drawsep
163 m_sel = false
163 if co_routine == nil then 164 if co_routine == nil then
164 --no multi select in incremental mode 165 --no multi select in incremental mode
165 m_sel = s.msel 166 m_sel = s.msel
@@ -351,6 +352,11 @@ function print_table(t, t_count, settings)
351 _print.opt.overflow("manual") 352 _print.opt.overflow("manual")
352 _print.opt.justify(justify) 353 _print.opt.justify(justify)
353 354
355 local opts = _print.opt.get()
356 opts.drawsep = drawsep
357 _print.opt.set(opts)
358
359
354 -- initialize vertical scrollbar 360 -- initialize vertical scrollbar
355 set_vsb(); do 361 set_vsb(); do
356 local vsb =_print.opt.get() 362 local vsb =_print.opt.get()
@@ -359,7 +365,7 @@ function print_table(t, t_count, settings)
359 vsb.bg_pattern = 3 - vsb.bg_pattern 365 vsb.bg_pattern = 3 - vsb.bg_pattern
360 end 366 end
361 367
362 set_vsb = function (item) 368 set_vsb = function (item)
363 if t_count > (maxline or t_count) then 369 if t_count > (maxline or t_count) then
364 rb.set_viewport(vsb) 370 rb.set_viewport(vsb)
365 item = item or 0 371 item = item or 0