From cdea6e4aed34f174fb93cc5c6bc41f5300a15e57 Mon Sep 17 00:00:00 2001 From: "kepler155c@gmail.com" Date: Tue, 31 Mar 2020 10:08:07 -0600 Subject: [PATCH] canvas overhaul --- ccemux/etc/apps.db | 12 +++ ccemux/system/ccemux.lua | 8 +- common/Appstore.lua | 112 ++++++++-------------- common/Follow.lua | 1 - common/etc/apps.db | 2 +- ignore/passthrough.lua | 174 ++++++++++++++++++++++++++++++++++ ignore/twm.lua | 62 ++++-------- lzwfs/system/lzwfs.lua | 13 ++- milo/MiloRemote.lua | 2 +- milo/core/machines.lua | 6 +- milo/plugins/item/infoTab.lua | 2 +- milo/plugins/remote/setup.lua | 20 ++-- milo/plugins/statsView.lua | 1 + monitor/mwm.lua | 5 +- recipeBook/recipeBook.lua | 4 +- screenSaver/system/saver.lua | 15 +-- secure/system/secure.lua | 15 +-- swshop/shopTab.lua | 2 +- 18 files changed, 296 insertions(+), 160 deletions(-) create mode 100644 ccemux/etc/apps.db create mode 100644 ignore/passthrough.lua diff --git a/ccemux/etc/apps.db b/ccemux/etc/apps.db new file mode 100644 index 0000000..081f9f7 --- /dev/null +++ b/ccemux/etc/apps.db @@ -0,0 +1,12 @@ +{ + [ "emu_config" ] = { + title = "Config", + category = "CCEmuX", + run = "emu config", + }, + [ "emu_data" ] = { + title = "Data", + category = "CCEmuX", + run = "emu data", + }, +} diff --git a/ccemux/system/ccemux.lua b/ccemux/system/ccemux.lua index 0948583..f05df3d 100644 --- a/ccemux/system/ccemux.lua +++ b/ccemux/system/ccemux.lua @@ -9,7 +9,7 @@ local tab = UI.Tab { tabTitle = 'CCEmuX', description = 'CCEmuX peripherals', form = UI.Form { - x = 2, ex = -2, y = 1, ey = 4, + x = 2, ex = -2, y = 2, ey = 5, values = { side = 'bottom', type = 'wireless_modem', @@ -28,7 +28,7 @@ local tab = UI.Tab { }, }, drive_id = UI.TextEntry { - x = 20, y = 3, + x = 19, y = 3, formKey = 'drive_id', shadowText = 'id', width = 5, @@ -36,13 +36,13 @@ local tab = UI.Tab { transform = 'number', }, add = UI.Button { - x = 28, y = 3, + x = -6, y = 3, width = 5, text = 'Add', event = 'form_ok', help = 'Add items to turtle to add to filter', }, }, grid = UI.Grid { - x = 3, ex = -3, y = 6, ey = -2, + x = 2, ex = -2, y = 7, ey = -2, columns = { { heading = 'Side', key = 'side', width = 8 }, { heading = 'Type', key = 'type' }, diff --git a/common/Appstore.lua b/common/Appstore.lua index a94c93f..67dfb36 100644 --- a/common/Appstore.lua +++ b/common/Appstore.lua @@ -8,10 +8,10 @@ local http = _G.http local multishell = _ENV.multishell local os = _G.os local shell = _ENV.shell +local colors = _G.colors local REGISTRY_DIR = 'usr/.registry' - -- FIX SOMEDAY local function registerApp(app, key) app.key = SHA.compute(key) @@ -27,7 +27,6 @@ local function unregisterApp(key) end end - local sandboxEnv = Util.shallowCopy(_ENV) setmetatable(sandboxEnv, { __index = _G }) @@ -36,21 +35,10 @@ UI:configure('Appstore', ...) local APP_DIR = 'usr/apps' -local sources = { - - { text = "STD Default", - event = 'source', - url = "http://pastebin.com/raw/zVws7eLq" }, --stock ---[[ - { text = "Discover", - event = 'source', - generateName = true, - url = "http://pastebin.com/raw/9bXfCz6M" }, --owned by dannysmc95 - - { text = "Opus", - event = 'source', - url = "http://pastebin.com/raw/ajQ91Rmn" }, -]] +local source = { + text = "STD Default", + event = 'source', + url = "http://pastebin.com/raw/zVws7eLq", } shell.setDir(APP_DIR) @@ -87,14 +75,14 @@ local function runApp(app, checkExists, ...) error('Failed to download') end - local fn = loadstring(program, app.name) + fn = _G.loadstring(program, app.name) if not fn then error('Failed to download') end - setfenv(fn, sandboxEnv) - fn(unpack(args)) + _G.setfenv(fn, sandboxEnv) + fn(table.unpack(args)) end end @@ -134,16 +122,16 @@ local viewApp = function(app) return true end -local getSourceListing = function(source) +local getSourceListing = function() local contents = http.get(source.url) if contents then - local fn = loadstring(contents.readAll(), source.text) + local fn = _G.loadstring(contents.readAll(), source.text) contents.close() local env = { std = { } } setmetatable(env, { __index = _G }) - setfenv(fn, env) + _G.setfenv(fn, env) fn() if env.contextualGet then @@ -172,9 +160,28 @@ local getSourceListing = function(source) end end +getSourceListing() + +if not source.storeURLs then + error('Unable to download application list') +end + +local buttons = { } +for k,v in Util.spairs(source.storeCatagoryNames, + function(a, b) return a:lower() < b:lower() end) do + + if v ~= 'Operating System' then + table.insert(buttons, { + text = v, + event = 'category', + index = k, + }) + end +end +source.index, source.name = Util.first(source.storeCatagoryNames) + local appPage = UI.Page { menuBar = UI.MenuBar { --- showBackButton = not pocket, buttons = { { text = '\027', event = 'back' }, { text = 'Install', event = 'install' }, @@ -213,7 +220,7 @@ function appPage.container.viewport:draw() end end -function appPage:enable(source, app) +function appPage:enable(app) self.source = source self.app = app UI.Page.enable(self) @@ -293,8 +300,7 @@ end local categoryPage = UI.Page { menuBar = UI.MenuBar { buttons = { - { text = 'Catalog', dropdown = sources }, - { text = 'Category', name = 'categoryButton', dropdown = { } }, + { text = 'Category', name = 'categoryButton', dropdown = buttons }, }, }, grid = UI.ScrollingGrid { @@ -309,62 +315,21 @@ local categoryPage = UI.Page { l = 'lua', [ 'control-q' ] = 'quit', }, + source = source, } -function categoryPage:setCategory(source, name, index) +function categoryPage:setCategory(name, index) self.grid.values = { } for _,v in pairs(source.storeURLs) do if index == 0 or index == v.catagory then table.insert(self.grid.values, v) end end - self.statusBar:setStatus(string.format('%s: %s', source.text, name)) + self.statusBar:setStatus(string.format('%s: %s', self.source.text, name)) self.grid:update() self.grid:setIndex(1) end -function categoryPage:setSource(source) - - if not source.categoryMenu then - - self.statusBar:setStatus('Loading...') - self.statusBar:draw() - self:sync() - - getSourceListing(source) - - if not source.storeURLs then - error('Unable to download application list') - end - - local buttons = { } - for k,v in Util.spairs(source.storeCatagoryNames, - function(a, b) return a:lower() < b:lower() end) do - - if v ~= 'Operating System' then - table.insert(buttons, { - text = v, - event = 'category', - index = k, - }) - end - end - - source.categoryMenu = UI.DropMenu({ - buttons = buttons, - }) - source.index, source.name = Util.first(source.storeCatagoryNames) - - categoryPage.menuBar.categoryButton:add({ - categoryMenu = source.categoryMenu - }) - end - - self.source = source - self.menuBar.categoryButton.dropmenu = source.categoryMenu - categoryPage:setCategory(source, source.name, source.index) -end - function categoryPage.grid:sortCompare(a, b) return a.ltitle < b.ltitle end @@ -377,9 +342,8 @@ function categoryPage.grid:getRowTextColor(row, selected) end function categoryPage:eventHandler(event) - if event.type == 'grid_select' or event.type == 'select' then - UI:setPage(appPage, self.source, self.grid:getSelected()) + UI:setPage(appPage, self.grid:getSelected()) elseif event.type == 'category' then self:setCategory(self.source, event.button.text, event.button.index) @@ -401,7 +365,7 @@ function categoryPage:eventHandler(event) end print("Retrieving catalog list") -categoryPage:setSource(sources[1]) +categoryPage:setCategory(source.name, source.index) UI:setPage(categoryPage) UI:pullEvents() diff --git a/common/Follow.lua b/common/Follow.lua index 3ad0007..cd9afb2 100644 --- a/common/Follow.lua +++ b/common/Follow.lua @@ -42,7 +42,6 @@ local page = UI.Page { }, range = UI.SlideOut { y = -7, height = 7, - backgroundColor = colors.cyan, titleBar = UI.TitleBar { event = 'cancel', title = 'Enter range', diff --git a/common/etc/apps.db b/common/etc/apps.db index d12829c..f434ef9 100644 --- a/common/etc/apps.db +++ b/common/etc/apps.db @@ -57,7 +57,7 @@ category = "Apps", requires = "advancedComputer", iconExt = "\030 \031 \128\030d\159\030 \031d\140\030d\031 \155\030 \0315\140\0305\031 \155\030 \128\010\030 \031d\136\145\0315\136\145\031d\153\031 \128\0315\153\010\030 \031 \128\031d\130\140\134\0315\140\134\031 \128", - run = "packages/common/hexedit.lua", + run = "fileui --exec=hexedit.lua", }, [ "fb1c39e9f4f3c2628ad173ab401a6e4e4baf783d" ] = { title = "Sounds", diff --git a/ignore/passthrough.lua b/ignore/passthrough.lua new file mode 100644 index 0000000..dae7403 --- /dev/null +++ b/ignore/passthrough.lua @@ -0,0 +1,174 @@ +local _rep = string.rep +local _sub = string.sub +local colors = _G.colors + +local palette = { } + +for n = 1, 16 do + palette[2 ^ (n - 1)] = _sub("0123456789abcdef", n, n) +end + +local swindow = { } + +function swindow.createPassthrough(parent, wx, wy, width, height) + local window = { } + local cx, cy = 1, 1 + local blink = false + local fg = colors.white + local bg = colors.black + + local function crop(text, x) + local w = #text + + if x < 1 then + text = _sub(text, 2 - x) + w = w + x - 1 + x = 1 + end + + if x + w - 1 > width then + text = _sub(text, 1, width - x + 1) + end + + return text + end + + local function blit(text, fg, bg) + parent.setCursorPos(cx + wx - 1, cy + wy - 1) + parent.blit(text, fg, bg) + cx = cx + #text + end + + function window.write(text) + if cy > 0 and cy <= height then + text = crop(tostring(text), cx) + if #text > 0 then + --parent.setCursorPos(cx + wx - 1, cy + wy - 1) + blit(text, _rep(palette[fg], #text), _rep(palette[bg], #text)) + end + end + end + + function window.blit(text, fg, bg) + if cy > 0 and cy <= height then + text = crop(tostring(text), cx) + if #text > 0 then + blit(text, crop(tostring(fg), cx), crop(tostring(bg), cx)) + end + end + end + + function window.clear() + local filler = _rep(' ', width) + for i = 1, height do + parent.setCursorPos(wx, i + wy - 1) + parent.write(filler) + end + end + + function window.clearLine() + if cy > 0 and cy <= height then + local filler = _rep(' ', width) + parent.setCursorPos(cx + wx - 1, cy + wy - 1) + parent.write(filler) + end + end + + function window.getCursorPos() + return cx, cy + end + + function window.setCursorPos(x, y) + cx = math.floor(x) + cy = math.floor(y) + parent.setCursorPos(cx + wx - 1, cy + wy - 1) + end + + function window.setCursorBlink(b) + blink = b + parent.setCursorBlink(b) + end + + function window.getCursorBlink() + return blink + end + + window.isColor = parent.isColor + window.isColour = parent.isColour + window.setPaletteColour = parent.setPaletteColour + window.setPaletteColor = parent.setPaletteColor + window.getPaletteColour = parent.getPaletteColour + window.getPaletteColor = parent.getPaletteColour + window.setBackgroundColor = parent.setBackgroundColor + window.setBackgroundColour = parent.setBackgroundColor + window.getBackgroundColor = parent.getBackgroundColor + window.getBackgroundColour = parent.getBackgroundColor + window.setVisible = parent.setVisible + window.redraw = function() end --parent.redraw + + function window.getTextColor() + return fg + end + window.getTextColour = window.getTextColor + + function window.setTextColor(textColor) + fg = textColor + parent.setTextColor(fg) + end + window.setTextColour = window.setTextColor + + function window.restoreCursor() + parent.setCursorPos(cx + wx - 1, cy + wy - 1) + parent.setTextColor(fg) + parent.setCursorBlink(blink) + end + + function window.getSize() + return width, height + end + + function window.scroll( n ) + if n ~= 0 then + local lines = { } + for i = 1, height do + lines[i] = { parent.getLine(wy + i - 1) } + end + + for newY = 1, height do + local y = newY + n + parent.setCursorPos(wx, wy + newY - 1) + if y >= 1 and y <= height then + parent.blit(table.unpack(lines[y])) + else + parent.blit( + _rep(' ', width), + _rep(palette[fg], width), + _rep(palette[bg], width)) + end + end + parent.setCursorPos(cx + wx - 1, cy + wy - 1) + end + end + + function window.getLine(y) + local t, tc, bc = parent.getLine(y + cy - 1) + return t:sub(1, width), tc:sub(1, width), bc:sub(1, width) + end + + function window.getPosition() + return wx, wy + end + + function window.reposition(nNewX, nNewY, nNewWidth, nNewHeight, newParent) + wx = nNewX + wy = nNewY + width = nNewWidth + height = nNewHeight + + window.restoreCursor() + end + + return window +end + +return swindow diff --git a/ignore/twm.lua b/ignore/twm.lua index 24f908a..07bfc3e 100644 --- a/ignore/twm.lua +++ b/ignore/twm.lua @@ -4,42 +4,21 @@ local Util = require('opus.util') local colors = _G.colors local os = _G.os -local peripheral = _G.peripheral local printError = _G.printError -local shell = _ENV.shell local term = _G.term local window = _G.window -local function syntax() - printError('Syntax:') - error('mwm [--config=filename] [monitor]') -end - -local args = Util.parse(...) local UID = 0 local multishell = { } local processes = { } local parentTerm = term.current() -local sessionFile = args.config or 'usr/config/mwm' -local monName = args[1] +local sessionFile = 'usr/config/twm' local running -local parentMon +local parentMon = term.current() local defaultEnv = Util.shallowCopy(_ENV) defaultEnv.multishell = multishell -if monName == 'terminal' then - parentMon = term.current() -elseif monName then - parentMon = peripheral.wrap(monName) or syntax() -else - parentMon = peripheral.find('monitor') or syntax() -end - -if parentMon.setTextScale then - parentMon.setTextScale(.5) -end - local monDim, termDim = { }, { } monDim.width, monDim.height = parentMon.getSize() termDim.width, termDim.height = parentTerm.getSize() @@ -73,13 +52,10 @@ local function write(win, x, y, text) end local function redraw() - --monitor.clear() monitor.canvas:dirty() - --monitor.setBackgroundColor(colors.gray) monitor.canvas:clear(colors.gray) - for k, process in ipairs(processes) do + for _, process in ipairs(processes) do process.container.canvas:dirty() - process:focus(k == #processes) end end @@ -112,7 +88,8 @@ function Process:new(args) height = args.height + 1, path = args.path, args = args.args or { }, - title = args.title or 'shell', + title = args.title or 'shell', + timestamp = os.clock(), isMoving = false, isResizing = false, }, { __index = Process }) @@ -155,20 +132,12 @@ function Process:new(args) end function Process:focus(focused) - if focused then - self.container.setBackgroundColor(colors.yellow) - else - self.container.setBackgroundColor(colors.lightGray) - end + self.container.setBackgroundColor(focused and colors.yellow or colors.lightGray) self.container.setTextColor(colors.black) write(self.container, 1, 1, string.rep(' ', self.width)) write(self.container, 2, 1, self.title) write(self.container, self.width - 1, 1, '*') write(self.container, self.width - 3, 1, '\029') - - if focused then - self.window.restoreCursor() - end end function Process:drawSizers() @@ -188,17 +157,18 @@ function Process:adjustDimensions() self.y = math.min(self.y, monDim.height - self.height + 1) end -function Process:reposition() +function Process:reposition(resizing) self:adjustDimensions() self.container.reposition(self.x, self.y, self.width, self.height) - self.container.setBackgroundColor(colors.black) - self.container.clear() self.window.reposition(1, 2, self.width, self.height - 1) if self.window ~= self.terminal then if self.terminal.reposition then -- ?? self.terminal.reposition(1, 1, self.width, self.height - 1) end - end + end + if resizing then + self:focus(self == processes[#processes]) + end redraw() end @@ -225,7 +195,7 @@ function Process:resize(x, y) self.height = y - self.isResizing.y + self.isResizing.h self.width = x - self.isResizing.x + self.isResizing.w - self:reposition() + self:reposition(true) self:resume('term_resize') self:drawSizers() multishell.saveSession(sessionFile) @@ -278,7 +248,8 @@ function multishell.setFocus(uid) process.container.canvas:raise() process:focus(true) - process.container.canvas:dirty() + process.container.canvas:dirty() + process.window.restoreCursor() end return true end @@ -423,14 +394,15 @@ function multishell.start() elseif focused.isMoving then focused.x = event[3] - focused.isMoving.x + focused.isMoving.ox focused.y = event[4] - focused.isMoving.y + focused.isMoving.oy - focused:reposition() + focused:reposition(false) end end elseif event[1] == 'char' or event[1] == 'key' or event[1] == 'key_up' or - event[1] == 'paste' then + event[1] == 'paste' or + event[1] == 'mouse_scroll' then local focused = processes[#processes] if focused then diff --git a/lzwfs/system/lzwfs.lua b/lzwfs/system/lzwfs.lua index 2c76f30..3f0a7a2 100644 --- a/lzwfs/system/lzwfs.lua +++ b/lzwfs/system/lzwfs.lua @@ -16,16 +16,19 @@ local config = Config.load('lzwfs', { local tab = UI.Tab { tabTitle = 'Compression', description = 'Disk compression', + [1] = UI.Window { + x = 2, y = 2, ex = -2, ey = 6, + }, label1 = UI.Text { - x = 2, y = 2, + x = 3, y = 3, value = 'Enable compression', }, checkbox = UI.Checkbox { - x = 20, y = 2, + x = 21, y = 3, value = config.enabled }, entry = UI.TextEntry { - x = 2, y = 4, ex = -2, + x = 3, y = 5 , ex = -3, limit = 256, shadowText = 'enter new path', accelerators = { @@ -34,7 +37,7 @@ local tab = UI.Tab { help = 'add a new path', }, grid = UI.Grid { - x = 2, ex = -2, y = 6, ey = -5, + x = 2, ex = -2, y = 8, ey = -5, disableHeader = true, columns = { { key = 'value' } }, autospace = true, @@ -45,7 +48,7 @@ local tab = UI.Tab { }, }, button = UI.Button { - x = -9, ex = -2, y = -3, + x = -8, ex = -2, y = -3, text = 'Apply', event = 'apply', }, diff --git a/milo/MiloRemote.lua b/milo/MiloRemote.lua index e85de5c..bf628cf 100644 --- a/milo/MiloRemote.lua +++ b/milo/MiloRemote.lua @@ -517,7 +517,7 @@ local function loadDirectory(dir) }) end end - page.menuBar.config:add({ dropmenu = UI.DropMenu { buttons = dropdown } }) + page.menuBar.config.dropdown = dropdown end local programDir = fs.getDir(shell.getRunningProgram()) diff --git a/milo/core/machines.lua b/milo/core/machines.lua index 844e491..99c61b5 100644 --- a/milo/core/machines.lua +++ b/milo/core/machines.lua @@ -241,6 +241,7 @@ The settings will take effect immediately!]], notification = UI.Notification { }, filter = UI.SlideOut { backgroundColor = colors.cyan, + noFill = true, menuBar = UI.MenuBar { buttons = { { text = 'Save', event = 'save' }, @@ -248,7 +249,8 @@ The settings will take effect immediately!]], }, }, grid = UI.ScrollingGrid { - x = 2, ex = -6, y = 2, ey = -6, + x = 2, ex = -6, y = 3, ey = -7, + disableHeader = true, columns = { { heading = 'Name', key = 'displayName' }, }, @@ -262,7 +264,7 @@ The settings will take effect immediately!]], text = '-', event = 'remove_entry', help = 'Remove', }, form = UI.Form { - x = 2, y = -4, height = 3, + x = 2, y = -5, height = 3, margin = 1, manualControls = true, [1] = UI.Checkbox { diff --git a/milo/plugins/item/infoTab.lua b/milo/plugins/item/infoTab.lua index 7ae99c7..76ce95c 100644 --- a/milo/plugins/item/infoTab.lua +++ b/milo/plugins/item/infoTab.lua @@ -8,7 +8,7 @@ local infoTab = UI.Tab { index = 4, backgroundColor = colors.cyan, textArea = UI.TextArea { - x = 2, ex = -2, y = 2, + x = 2, ex = -2, y = 2, ey = -2, }, } diff --git a/milo/plugins/remote/setup.lua b/milo/plugins/remote/setup.lua index 5d12d21..1ea8de3 100644 --- a/milo/plugins/remote/setup.lua +++ b/milo/plugins/remote/setup.lua @@ -15,7 +15,7 @@ local setup = UI.SlideOut { title = 'Remote Setup', }, form = UI.Form { - x = 2, ex = -2, y = 2, ey = -1, + y = 2, ey = -1, [1] = UI.TextEntry { formLabel = 'Server', formKey = 'server', help = 'ID for the server', @@ -40,15 +40,15 @@ local setup = UI.SlideOut { formLabel = 'Run on startup', formKey = 'runOnStartup', help = 'Run this program on startup' }, - info = UI.TextArea { - x = 1, ex = -1, y = 6, ey = -4, - textColor = colors.yellow, - marginLeft = 0, - marginRight = 0, - value = [[The Milo turtle must connect to a manipulator with a ]] .. - [[bound introspection module. The neural interface must ]] .. - [[also have an introspection module.]], - }, + }, + info = UI.TextArea { + x = 2, ex = -2, y = 8, ey = -4, + textColor = colors.yellow, + marginLeft = 0, + marginRight = 0, + value = [[The Milo turtle must connect to a manipulator with a ]] .. + [[bound introspection module. The neural interface must ]] .. + [[also have an introspection module.]], }, statusBar = UI.StatusBar { backgroundColor = colors.cyan, diff --git a/milo/plugins/statsView.lua b/milo/plugins/statsView.lua index 9f9c0a2..4f70601 100644 --- a/milo/plugins/statsView.lua +++ b/milo/plugins/statsView.lua @@ -86,6 +86,7 @@ local function createPage(node) [1] = UI.Tab { tabTitle = 'Overview', backgroundColor = colors.black, + noFill = true, onlineLabel = UI.Text { x = 2, y = 2, value = 'Storage Status', diff --git a/monitor/mwm.lua b/monitor/mwm.lua index a1e5eb1..a397606 100644 --- a/monitor/mwm.lua +++ b/monitor/mwm.lua @@ -121,7 +121,10 @@ function Process:new(args) self.terminal = self.window self.container.canvas.parent = monitor.canvas - table.insert(monitor.canvas.layers, 1, self.container.canvas) + if not monitor.canvas.children then + monitor.canvas.children = { } + end + table.insert(monitor.canvas.children, 1, self.container.canvas) self.container.canvas:setVisible(true) --self.container.getSize = self.window.getSize diff --git a/recipeBook/recipeBook.lua b/recipeBook/recipeBook.lua index 3aa67c3..4922929 100644 --- a/recipeBook/recipeBook.lua +++ b/recipeBook/recipeBook.lua @@ -61,12 +61,12 @@ local page = UI.Page { autospace = true, }, add = UI.SlideOut { - backgroundColor = colors.cyan, + height = 9, y = -9, titleBar = UI.TitleBar { title = 'Add a new book', }, form = UI.Form { - x = 2, ex = -2, y = 2, ey = -1, + y = 2, [1] = UI.TextEntry { formLabel = 'Name', formKey = 'name', shadowText = 'Friendly name', diff --git a/screenSaver/system/saver.lua b/screenSaver/system/saver.lua index b8fa7a3..2813173 100644 --- a/screenSaver/system/saver.lua +++ b/screenSaver/system/saver.lua @@ -9,20 +9,23 @@ local config = Config.load('saver', { local tab = UI.Tab { tabTitle = 'Screen Saver', description = 'Screen saver', + [1] = UI.Window { + x = 2, y = 2, ex = -2, ey = 5, + }, label1 = UI.Text { - x = 2, y = 3, + x = 3, y = 3, value = 'Enabled', }, checkbox = UI.Checkbox { - x = 20, y = 3, + x = 21, y = 3, value = config.enabled }, label2 = UI.Text { - x = 2, y = 4, + x = 3, y = 4, value = 'Timeout', }, timeout = UI.TextEntry { - x = 20, y = 4, width = 6, + x = 21, y = 4, width = 6, limit = 4, transform = 'number', value = config.timeout, @@ -31,8 +34,8 @@ local tab = UI.Tab { }, }, button = UI.Button { - x = 20, y = 6, - text = 'Update', + x = -8, ex = -2, y = -2, + text = 'Apply', event = 'update', }, } diff --git a/secure/system/secure.lua b/secure/system/secure.lua index 113ad9b..9fd0137 100644 --- a/secure/system/secure.lua +++ b/secure/system/secure.lua @@ -9,20 +9,23 @@ local config = Config.load('secure', { local tab = UI.Tab { tabTitle = 'Secure', description = 'Secure options', + [1] = UI.Window { + x = 2, y = 2, ex = -2, ey = 5, + }, label1 = UI.Text { - x = 2, y = 3, + x = 3, y = 3, value = 'Screen Locking', }, checkbox = UI.Checkbox { - x = 20, y = 3, + x = 21, y = 3, value = config.enabled }, label2 = UI.Text { - x = 2, y = 4, + x = 3, y = 4, value = 'Lock timeout', }, timeout = UI.TextEntry { - x = 20, y = 4, width = 6, + x = 21, y = 4, width = 6, limit = 4, transform = 'number', value = config.timeout, @@ -31,8 +34,8 @@ local tab = UI.Tab { }, }, button = UI.Button { - x = 20, y = 6, - text = 'Update', + x = -8, ex = -2, y = -2, + text = 'Apply', event = 'update', }, } diff --git a/swshop/shopTab.lua b/swshop/shopTab.lua index 6bfabb5..63e3220 100644 --- a/swshop/shopTab.lua +++ b/swshop/shopTab.lua @@ -10,7 +10,7 @@ local shopTab = UI.Tab { tabTitle = 'Store', index = 2, form = UI.Form { - x = 2, ex = -2, y = 1, ey = -2, + x = 2, ex = -2, y = 2, ey = -2, manualControls = true, [1] = UI.TextEntry { formLabel = 'Name', formKey = 'name',