canvas overhaul
This commit is contained in:
12
ccemux/etc/apps.db
Normal file
12
ccemux/etc/apps.db
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
[ "emu_config" ] = {
|
||||||
|
title = "Config",
|
||||||
|
category = "CCEmuX",
|
||||||
|
run = "emu config",
|
||||||
|
},
|
||||||
|
[ "emu_data" ] = {
|
||||||
|
title = "Data",
|
||||||
|
category = "CCEmuX",
|
||||||
|
run = "emu data",
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -9,7 +9,7 @@ local tab = UI.Tab {
|
|||||||
tabTitle = 'CCEmuX',
|
tabTitle = 'CCEmuX',
|
||||||
description = 'CCEmuX peripherals',
|
description = 'CCEmuX peripherals',
|
||||||
form = UI.Form {
|
form = UI.Form {
|
||||||
x = 2, ex = -2, y = 1, ey = 4,
|
x = 2, ex = -2, y = 2, ey = 5,
|
||||||
values = {
|
values = {
|
||||||
side = 'bottom',
|
side = 'bottom',
|
||||||
type = 'wireless_modem',
|
type = 'wireless_modem',
|
||||||
@@ -28,7 +28,7 @@ local tab = UI.Tab {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
drive_id = UI.TextEntry {
|
drive_id = UI.TextEntry {
|
||||||
x = 20, y = 3,
|
x = 19, y = 3,
|
||||||
formKey = 'drive_id',
|
formKey = 'drive_id',
|
||||||
shadowText = 'id',
|
shadowText = 'id',
|
||||||
width = 5,
|
width = 5,
|
||||||
@@ -36,13 +36,13 @@ local tab = UI.Tab {
|
|||||||
transform = 'number',
|
transform = 'number',
|
||||||
},
|
},
|
||||||
add = UI.Button {
|
add = UI.Button {
|
||||||
x = 28, y = 3,
|
x = -6, y = 3, width = 5,
|
||||||
text = 'Add', event = 'form_ok',
|
text = 'Add', event = 'form_ok',
|
||||||
help = 'Add items to turtle to add to filter',
|
help = 'Add items to turtle to add to filter',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
grid = UI.Grid {
|
grid = UI.Grid {
|
||||||
x = 3, ex = -3, y = 6, ey = -2,
|
x = 2, ex = -2, y = 7, ey = -2,
|
||||||
columns = {
|
columns = {
|
||||||
{ heading = 'Side', key = 'side', width = 8 },
|
{ heading = 'Side', key = 'side', width = 8 },
|
||||||
{ heading = 'Type', key = 'type' },
|
{ heading = 'Type', key = 'type' },
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ local http = _G.http
|
|||||||
local multishell = _ENV.multishell
|
local multishell = _ENV.multishell
|
||||||
local os = _G.os
|
local os = _G.os
|
||||||
local shell = _ENV.shell
|
local shell = _ENV.shell
|
||||||
|
local colors = _G.colors
|
||||||
|
|
||||||
local REGISTRY_DIR = 'usr/.registry'
|
local REGISTRY_DIR = 'usr/.registry'
|
||||||
|
|
||||||
|
|
||||||
-- FIX SOMEDAY
|
-- FIX SOMEDAY
|
||||||
local function registerApp(app, key)
|
local function registerApp(app, key)
|
||||||
app.key = SHA.compute(key)
|
app.key = SHA.compute(key)
|
||||||
@@ -27,7 +27,6 @@ local function unregisterApp(key)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local sandboxEnv = Util.shallowCopy(_ENV)
|
local sandboxEnv = Util.shallowCopy(_ENV)
|
||||||
setmetatable(sandboxEnv, { __index = _G })
|
setmetatable(sandboxEnv, { __index = _G })
|
||||||
|
|
||||||
@@ -36,21 +35,10 @@ UI:configure('Appstore', ...)
|
|||||||
|
|
||||||
local APP_DIR = 'usr/apps'
|
local APP_DIR = 'usr/apps'
|
||||||
|
|
||||||
local sources = {
|
local source = {
|
||||||
|
text = "STD Default",
|
||||||
{ text = "STD Default",
|
event = 'source',
|
||||||
event = 'source',
|
url = "http://pastebin.com/raw/zVws7eLq",
|
||||||
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" },
|
|
||||||
]]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
shell.setDir(APP_DIR)
|
shell.setDir(APP_DIR)
|
||||||
@@ -87,14 +75,14 @@ local function runApp(app, checkExists, ...)
|
|||||||
error('Failed to download')
|
error('Failed to download')
|
||||||
end
|
end
|
||||||
|
|
||||||
local fn = loadstring(program, app.name)
|
fn = _G.loadstring(program, app.name)
|
||||||
|
|
||||||
if not fn then
|
if not fn then
|
||||||
error('Failed to download')
|
error('Failed to download')
|
||||||
end
|
end
|
||||||
|
|
||||||
setfenv(fn, sandboxEnv)
|
_G.setfenv(fn, sandboxEnv)
|
||||||
fn(unpack(args))
|
fn(table.unpack(args))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -134,16 +122,16 @@ local viewApp = function(app)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
local getSourceListing = function(source)
|
local getSourceListing = function()
|
||||||
local contents = http.get(source.url)
|
local contents = http.get(source.url)
|
||||||
if contents then
|
if contents then
|
||||||
|
|
||||||
local fn = loadstring(contents.readAll(), source.text)
|
local fn = _G.loadstring(contents.readAll(), source.text)
|
||||||
contents.close()
|
contents.close()
|
||||||
|
|
||||||
local env = { std = { } }
|
local env = { std = { } }
|
||||||
setmetatable(env, { __index = _G })
|
setmetatable(env, { __index = _G })
|
||||||
setfenv(fn, env)
|
_G.setfenv(fn, env)
|
||||||
fn()
|
fn()
|
||||||
|
|
||||||
if env.contextualGet then
|
if env.contextualGet then
|
||||||
@@ -172,9 +160,28 @@ local getSourceListing = function(source)
|
|||||||
end
|
end
|
||||||
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 {
|
local appPage = UI.Page {
|
||||||
menuBar = UI.MenuBar {
|
menuBar = UI.MenuBar {
|
||||||
-- showBackButton = not pocket,
|
|
||||||
buttons = {
|
buttons = {
|
||||||
{ text = '\027', event = 'back' },
|
{ text = '\027', event = 'back' },
|
||||||
{ text = 'Install', event = 'install' },
|
{ text = 'Install', event = 'install' },
|
||||||
@@ -213,7 +220,7 @@ function appPage.container.viewport:draw()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function appPage:enable(source, app)
|
function appPage:enable(app)
|
||||||
self.source = source
|
self.source = source
|
||||||
self.app = app
|
self.app = app
|
||||||
UI.Page.enable(self)
|
UI.Page.enable(self)
|
||||||
@@ -293,8 +300,7 @@ end
|
|||||||
local categoryPage = UI.Page {
|
local categoryPage = UI.Page {
|
||||||
menuBar = UI.MenuBar {
|
menuBar = UI.MenuBar {
|
||||||
buttons = {
|
buttons = {
|
||||||
{ text = 'Catalog', dropdown = sources },
|
{ text = 'Category', name = 'categoryButton', dropdown = buttons },
|
||||||
{ text = 'Category', name = 'categoryButton', dropdown = { } },
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
grid = UI.ScrollingGrid {
|
grid = UI.ScrollingGrid {
|
||||||
@@ -309,62 +315,21 @@ local categoryPage = UI.Page {
|
|||||||
l = 'lua',
|
l = 'lua',
|
||||||
[ 'control-q' ] = 'quit',
|
[ 'control-q' ] = 'quit',
|
||||||
},
|
},
|
||||||
|
source = source,
|
||||||
}
|
}
|
||||||
|
|
||||||
function categoryPage:setCategory(source, name, index)
|
function categoryPage:setCategory(name, index)
|
||||||
self.grid.values = { }
|
self.grid.values = { }
|
||||||
for _,v in pairs(source.storeURLs) do
|
for _,v in pairs(source.storeURLs) do
|
||||||
if index == 0 or index == v.catagory then
|
if index == 0 or index == v.catagory then
|
||||||
table.insert(self.grid.values, v)
|
table.insert(self.grid.values, v)
|
||||||
end
|
end
|
||||||
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:update()
|
||||||
self.grid:setIndex(1)
|
self.grid:setIndex(1)
|
||||||
end
|
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)
|
function categoryPage.grid:sortCompare(a, b)
|
||||||
return a.ltitle < b.ltitle
|
return a.ltitle < b.ltitle
|
||||||
end
|
end
|
||||||
@@ -377,9 +342,8 @@ function categoryPage.grid:getRowTextColor(row, selected)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function categoryPage:eventHandler(event)
|
function categoryPage:eventHandler(event)
|
||||||
|
|
||||||
if event.type == 'grid_select' or event.type == 'select' then
|
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
|
elseif event.type == 'category' then
|
||||||
self:setCategory(self.source, event.button.text, event.button.index)
|
self:setCategory(self.source, event.button.text, event.button.index)
|
||||||
@@ -401,7 +365,7 @@ function categoryPage:eventHandler(event)
|
|||||||
end
|
end
|
||||||
|
|
||||||
print("Retrieving catalog list")
|
print("Retrieving catalog list")
|
||||||
categoryPage:setSource(sources[1])
|
categoryPage:setCategory(source.name, source.index)
|
||||||
|
|
||||||
UI:setPage(categoryPage)
|
UI:setPage(categoryPage)
|
||||||
UI:pullEvents()
|
UI:pullEvents()
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ local page = UI.Page {
|
|||||||
},
|
},
|
||||||
range = UI.SlideOut {
|
range = UI.SlideOut {
|
||||||
y = -7, height = 7,
|
y = -7, height = 7,
|
||||||
backgroundColor = colors.cyan,
|
|
||||||
titleBar = UI.TitleBar {
|
titleBar = UI.TitleBar {
|
||||||
event = 'cancel',
|
event = 'cancel',
|
||||||
title = 'Enter range',
|
title = 'Enter range',
|
||||||
|
|||||||
@@ -57,7 +57,7 @@
|
|||||||
category = "Apps",
|
category = "Apps",
|
||||||
requires = "advancedComputer",
|
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",
|
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" ] = {
|
[ "fb1c39e9f4f3c2628ad173ab401a6e4e4baf783d" ] = {
|
||||||
title = "Sounds",
|
title = "Sounds",
|
||||||
|
|||||||
174
ignore/passthrough.lua
Normal file
174
ignore/passthrough.lua
Normal file
@@ -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
|
||||||
@@ -4,42 +4,21 @@ local Util = require('opus.util')
|
|||||||
|
|
||||||
local colors = _G.colors
|
local colors = _G.colors
|
||||||
local os = _G.os
|
local os = _G.os
|
||||||
local peripheral = _G.peripheral
|
|
||||||
local printError = _G.printError
|
local printError = _G.printError
|
||||||
local shell = _ENV.shell
|
|
||||||
local term = _G.term
|
local term = _G.term
|
||||||
local window = _G.window
|
local window = _G.window
|
||||||
|
|
||||||
local function syntax()
|
|
||||||
printError('Syntax:')
|
|
||||||
error('mwm [--config=filename] [monitor]')
|
|
||||||
end
|
|
||||||
|
|
||||||
local args = Util.parse(...)
|
|
||||||
local UID = 0
|
local UID = 0
|
||||||
local multishell = { }
|
local multishell = { }
|
||||||
local processes = { }
|
local processes = { }
|
||||||
local parentTerm = term.current()
|
local parentTerm = term.current()
|
||||||
local sessionFile = args.config or 'usr/config/mwm'
|
local sessionFile = 'usr/config/twm'
|
||||||
local monName = args[1]
|
|
||||||
local running
|
local running
|
||||||
local parentMon
|
local parentMon = term.current()
|
||||||
|
|
||||||
local defaultEnv = Util.shallowCopy(_ENV)
|
local defaultEnv = Util.shallowCopy(_ENV)
|
||||||
defaultEnv.multishell = multishell
|
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 = { }, { }
|
local monDim, termDim = { }, { }
|
||||||
monDim.width, monDim.height = parentMon.getSize()
|
monDim.width, monDim.height = parentMon.getSize()
|
||||||
termDim.width, termDim.height = parentTerm.getSize()
|
termDim.width, termDim.height = parentTerm.getSize()
|
||||||
@@ -73,13 +52,10 @@ local function write(win, x, y, text)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function redraw()
|
local function redraw()
|
||||||
--monitor.clear()
|
|
||||||
monitor.canvas:dirty()
|
monitor.canvas:dirty()
|
||||||
--monitor.setBackgroundColor(colors.gray)
|
|
||||||
monitor.canvas:clear(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.container.canvas:dirty()
|
||||||
process:focus(k == #processes)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -112,7 +88,8 @@ function Process:new(args)
|
|||||||
height = args.height + 1,
|
height = args.height + 1,
|
||||||
path = args.path,
|
path = args.path,
|
||||||
args = args.args or { },
|
args = args.args or { },
|
||||||
title = args.title or 'shell',
|
title = args.title or 'shell',
|
||||||
|
timestamp = os.clock(),
|
||||||
isMoving = false,
|
isMoving = false,
|
||||||
isResizing = false,
|
isResizing = false,
|
||||||
}, { __index = Process })
|
}, { __index = Process })
|
||||||
@@ -155,20 +132,12 @@ function Process:new(args)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Process:focus(focused)
|
function Process:focus(focused)
|
||||||
if focused then
|
self.container.setBackgroundColor(focused and colors.yellow or colors.lightGray)
|
||||||
self.container.setBackgroundColor(colors.yellow)
|
|
||||||
else
|
|
||||||
self.container.setBackgroundColor(colors.lightGray)
|
|
||||||
end
|
|
||||||
self.container.setTextColor(colors.black)
|
self.container.setTextColor(colors.black)
|
||||||
write(self.container, 1, 1, string.rep(' ', self.width))
|
write(self.container, 1, 1, string.rep(' ', self.width))
|
||||||
write(self.container, 2, 1, self.title)
|
write(self.container, 2, 1, self.title)
|
||||||
write(self.container, self.width - 1, 1, '*')
|
write(self.container, self.width - 1, 1, '*')
|
||||||
write(self.container, self.width - 3, 1, '\029')
|
write(self.container, self.width - 3, 1, '\029')
|
||||||
|
|
||||||
if focused then
|
|
||||||
self.window.restoreCursor()
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function Process:drawSizers()
|
function Process:drawSizers()
|
||||||
@@ -188,17 +157,18 @@ function Process:adjustDimensions()
|
|||||||
self.y = math.min(self.y, monDim.height - self.height + 1)
|
self.y = math.min(self.y, monDim.height - self.height + 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Process:reposition()
|
function Process:reposition(resizing)
|
||||||
self:adjustDimensions()
|
self:adjustDimensions()
|
||||||
self.container.reposition(self.x, self.y, self.width, self.height)
|
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)
|
self.window.reposition(1, 2, self.width, self.height - 1)
|
||||||
if self.window ~= self.terminal then
|
if self.window ~= self.terminal then
|
||||||
if self.terminal.reposition then -- ??
|
if self.terminal.reposition then -- ??
|
||||||
self.terminal.reposition(1, 1, self.width, self.height - 1)
|
self.terminal.reposition(1, 1, self.width, self.height - 1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if resizing then
|
||||||
|
self:focus(self == processes[#processes])
|
||||||
|
end
|
||||||
redraw()
|
redraw()
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -225,7 +195,7 @@ function Process:resize(x, y)
|
|||||||
self.height = y - self.isResizing.y + self.isResizing.h
|
self.height = y - self.isResizing.y + self.isResizing.h
|
||||||
self.width = x - self.isResizing.x + self.isResizing.w
|
self.width = x - self.isResizing.x + self.isResizing.w
|
||||||
|
|
||||||
self:reposition()
|
self:reposition(true)
|
||||||
self:resume('term_resize')
|
self:resume('term_resize')
|
||||||
self:drawSizers()
|
self:drawSizers()
|
||||||
multishell.saveSession(sessionFile)
|
multishell.saveSession(sessionFile)
|
||||||
@@ -278,7 +248,8 @@ function multishell.setFocus(uid)
|
|||||||
|
|
||||||
process.container.canvas:raise()
|
process.container.canvas:raise()
|
||||||
process:focus(true)
|
process:focus(true)
|
||||||
process.container.canvas:dirty()
|
process.container.canvas:dirty()
|
||||||
|
process.window.restoreCursor()
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@@ -423,14 +394,15 @@ function multishell.start()
|
|||||||
elseif focused.isMoving then
|
elseif focused.isMoving then
|
||||||
focused.x = event[3] - focused.isMoving.x + focused.isMoving.ox
|
focused.x = event[3] - focused.isMoving.x + focused.isMoving.ox
|
||||||
focused.y = event[4] - focused.isMoving.y + focused.isMoving.oy
|
focused.y = event[4] - focused.isMoving.y + focused.isMoving.oy
|
||||||
focused:reposition()
|
focused:reposition(false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif event[1] == 'char' or
|
elseif event[1] == 'char' or
|
||||||
event[1] == 'key' or
|
event[1] == 'key' or
|
||||||
event[1] == 'key_up' or
|
event[1] == 'key_up' or
|
||||||
event[1] == 'paste' then
|
event[1] == 'paste' or
|
||||||
|
event[1] == 'mouse_scroll' then
|
||||||
|
|
||||||
local focused = processes[#processes]
|
local focused = processes[#processes]
|
||||||
if focused then
|
if focused then
|
||||||
|
|||||||
@@ -16,16 +16,19 @@ local config = Config.load('lzwfs', {
|
|||||||
local tab = UI.Tab {
|
local tab = UI.Tab {
|
||||||
tabTitle = 'Compression',
|
tabTitle = 'Compression',
|
||||||
description = 'Disk compression',
|
description = 'Disk compression',
|
||||||
|
[1] = UI.Window {
|
||||||
|
x = 2, y = 2, ex = -2, ey = 6,
|
||||||
|
},
|
||||||
label1 = UI.Text {
|
label1 = UI.Text {
|
||||||
x = 2, y = 2,
|
x = 3, y = 3,
|
||||||
value = 'Enable compression',
|
value = 'Enable compression',
|
||||||
},
|
},
|
||||||
checkbox = UI.Checkbox {
|
checkbox = UI.Checkbox {
|
||||||
x = 20, y = 2,
|
x = 21, y = 3,
|
||||||
value = config.enabled
|
value = config.enabled
|
||||||
},
|
},
|
||||||
entry = UI.TextEntry {
|
entry = UI.TextEntry {
|
||||||
x = 2, y = 4, ex = -2,
|
x = 3, y = 5 , ex = -3,
|
||||||
limit = 256,
|
limit = 256,
|
||||||
shadowText = 'enter new path',
|
shadowText = 'enter new path',
|
||||||
accelerators = {
|
accelerators = {
|
||||||
@@ -34,7 +37,7 @@ local tab = UI.Tab {
|
|||||||
help = 'add a new path',
|
help = 'add a new path',
|
||||||
},
|
},
|
||||||
grid = UI.Grid {
|
grid = UI.Grid {
|
||||||
x = 2, ex = -2, y = 6, ey = -5,
|
x = 2, ex = -2, y = 8, ey = -5,
|
||||||
disableHeader = true,
|
disableHeader = true,
|
||||||
columns = { { key = 'value' } },
|
columns = { { key = 'value' } },
|
||||||
autospace = true,
|
autospace = true,
|
||||||
@@ -45,7 +48,7 @@ local tab = UI.Tab {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
button = UI.Button {
|
button = UI.Button {
|
||||||
x = -9, ex = -2, y = -3,
|
x = -8, ex = -2, y = -3,
|
||||||
text = 'Apply',
|
text = 'Apply',
|
||||||
event = 'apply',
|
event = 'apply',
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -517,7 +517,7 @@ local function loadDirectory(dir)
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
page.menuBar.config:add({ dropmenu = UI.DropMenu { buttons = dropdown } })
|
page.menuBar.config.dropdown = dropdown
|
||||||
end
|
end
|
||||||
|
|
||||||
local programDir = fs.getDir(shell.getRunningProgram())
|
local programDir = fs.getDir(shell.getRunningProgram())
|
||||||
|
|||||||
@@ -241,6 +241,7 @@ The settings will take effect immediately!]],
|
|||||||
notification = UI.Notification { },
|
notification = UI.Notification { },
|
||||||
filter = UI.SlideOut {
|
filter = UI.SlideOut {
|
||||||
backgroundColor = colors.cyan,
|
backgroundColor = colors.cyan,
|
||||||
|
noFill = true,
|
||||||
menuBar = UI.MenuBar {
|
menuBar = UI.MenuBar {
|
||||||
buttons = {
|
buttons = {
|
||||||
{ text = 'Save', event = 'save' },
|
{ text = 'Save', event = 'save' },
|
||||||
@@ -248,7 +249,8 @@ The settings will take effect immediately!]],
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
grid = UI.ScrollingGrid {
|
grid = UI.ScrollingGrid {
|
||||||
x = 2, ex = -6, y = 2, ey = -6,
|
x = 2, ex = -6, y = 3, ey = -7,
|
||||||
|
disableHeader = true,
|
||||||
columns = {
|
columns = {
|
||||||
{ heading = 'Name', key = 'displayName' },
|
{ heading = 'Name', key = 'displayName' },
|
||||||
},
|
},
|
||||||
@@ -262,7 +264,7 @@ The settings will take effect immediately!]],
|
|||||||
text = '-', event = 'remove_entry', help = 'Remove',
|
text = '-', event = 'remove_entry', help = 'Remove',
|
||||||
},
|
},
|
||||||
form = UI.Form {
|
form = UI.Form {
|
||||||
x = 2, y = -4, height = 3,
|
x = 2, y = -5, height = 3,
|
||||||
margin = 1,
|
margin = 1,
|
||||||
manualControls = true,
|
manualControls = true,
|
||||||
[1] = UI.Checkbox {
|
[1] = UI.Checkbox {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ local infoTab = UI.Tab {
|
|||||||
index = 4,
|
index = 4,
|
||||||
backgroundColor = colors.cyan,
|
backgroundColor = colors.cyan,
|
||||||
textArea = UI.TextArea {
|
textArea = UI.TextArea {
|
||||||
x = 2, ex = -2, y = 2,
|
x = 2, ex = -2, y = 2, ey = -2,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ local setup = UI.SlideOut {
|
|||||||
title = 'Remote Setup',
|
title = 'Remote Setup',
|
||||||
},
|
},
|
||||||
form = UI.Form {
|
form = UI.Form {
|
||||||
x = 2, ex = -2, y = 2, ey = -1,
|
y = 2, ey = -1,
|
||||||
[1] = UI.TextEntry {
|
[1] = UI.TextEntry {
|
||||||
formLabel = 'Server', formKey = 'server',
|
formLabel = 'Server', formKey = 'server',
|
||||||
help = 'ID for the server',
|
help = 'ID for the server',
|
||||||
@@ -40,15 +40,15 @@ local setup = UI.SlideOut {
|
|||||||
formLabel = 'Run on startup', formKey = 'runOnStartup',
|
formLabel = 'Run on startup', formKey = 'runOnStartup',
|
||||||
help = 'Run this program on startup'
|
help = 'Run this program on startup'
|
||||||
},
|
},
|
||||||
info = UI.TextArea {
|
},
|
||||||
x = 1, ex = -1, y = 6, ey = -4,
|
info = UI.TextArea {
|
||||||
textColor = colors.yellow,
|
x = 2, ex = -2, y = 8, ey = -4,
|
||||||
marginLeft = 0,
|
textColor = colors.yellow,
|
||||||
marginRight = 0,
|
marginLeft = 0,
|
||||||
value = [[The Milo turtle must connect to a manipulator with a ]] ..
|
marginRight = 0,
|
||||||
[[bound introspection module. The neural interface must ]] ..
|
value = [[The Milo turtle must connect to a manipulator with a ]] ..
|
||||||
[[also have an introspection module.]],
|
[[bound introspection module. The neural interface must ]] ..
|
||||||
},
|
[[also have an introspection module.]],
|
||||||
},
|
},
|
||||||
statusBar = UI.StatusBar {
|
statusBar = UI.StatusBar {
|
||||||
backgroundColor = colors.cyan,
|
backgroundColor = colors.cyan,
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ local function createPage(node)
|
|||||||
[1] = UI.Tab {
|
[1] = UI.Tab {
|
||||||
tabTitle = 'Overview',
|
tabTitle = 'Overview',
|
||||||
backgroundColor = colors.black,
|
backgroundColor = colors.black,
|
||||||
|
noFill = true,
|
||||||
onlineLabel = UI.Text {
|
onlineLabel = UI.Text {
|
||||||
x = 2, y = 2,
|
x = 2, y = 2,
|
||||||
value = 'Storage Status',
|
value = 'Storage Status',
|
||||||
|
|||||||
@@ -121,7 +121,10 @@ function Process:new(args)
|
|||||||
self.terminal = self.window
|
self.terminal = self.window
|
||||||
|
|
||||||
self.container.canvas.parent = monitor.canvas
|
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.canvas:setVisible(true)
|
||||||
|
|
||||||
--self.container.getSize = self.window.getSize
|
--self.container.getSize = self.window.getSize
|
||||||
|
|||||||
@@ -61,12 +61,12 @@ local page = UI.Page {
|
|||||||
autospace = true,
|
autospace = true,
|
||||||
},
|
},
|
||||||
add = UI.SlideOut {
|
add = UI.SlideOut {
|
||||||
backgroundColor = colors.cyan,
|
height = 9, y = -9,
|
||||||
titleBar = UI.TitleBar {
|
titleBar = UI.TitleBar {
|
||||||
title = 'Add a new book',
|
title = 'Add a new book',
|
||||||
},
|
},
|
||||||
form = UI.Form {
|
form = UI.Form {
|
||||||
x = 2, ex = -2, y = 2, ey = -1,
|
y = 2,
|
||||||
[1] = UI.TextEntry {
|
[1] = UI.TextEntry {
|
||||||
formLabel = 'Name', formKey = 'name',
|
formLabel = 'Name', formKey = 'name',
|
||||||
shadowText = 'Friendly name',
|
shadowText = 'Friendly name',
|
||||||
|
|||||||
@@ -9,20 +9,23 @@ local config = Config.load('saver', {
|
|||||||
local tab = UI.Tab {
|
local tab = UI.Tab {
|
||||||
tabTitle = 'Screen Saver',
|
tabTitle = 'Screen Saver',
|
||||||
description = 'Screen saver',
|
description = 'Screen saver',
|
||||||
|
[1] = UI.Window {
|
||||||
|
x = 2, y = 2, ex = -2, ey = 5,
|
||||||
|
},
|
||||||
label1 = UI.Text {
|
label1 = UI.Text {
|
||||||
x = 2, y = 3,
|
x = 3, y = 3,
|
||||||
value = 'Enabled',
|
value = 'Enabled',
|
||||||
},
|
},
|
||||||
checkbox = UI.Checkbox {
|
checkbox = UI.Checkbox {
|
||||||
x = 20, y = 3,
|
x = 21, y = 3,
|
||||||
value = config.enabled
|
value = config.enabled
|
||||||
},
|
},
|
||||||
label2 = UI.Text {
|
label2 = UI.Text {
|
||||||
x = 2, y = 4,
|
x = 3, y = 4,
|
||||||
value = 'Timeout',
|
value = 'Timeout',
|
||||||
},
|
},
|
||||||
timeout = UI.TextEntry {
|
timeout = UI.TextEntry {
|
||||||
x = 20, y = 4, width = 6,
|
x = 21, y = 4, width = 6,
|
||||||
limit = 4,
|
limit = 4,
|
||||||
transform = 'number',
|
transform = 'number',
|
||||||
value = config.timeout,
|
value = config.timeout,
|
||||||
@@ -31,8 +34,8 @@ local tab = UI.Tab {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
button = UI.Button {
|
button = UI.Button {
|
||||||
x = 20, y = 6,
|
x = -8, ex = -2, y = -2,
|
||||||
text = 'Update',
|
text = 'Apply',
|
||||||
event = 'update',
|
event = 'update',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,20 +9,23 @@ local config = Config.load('secure', {
|
|||||||
local tab = UI.Tab {
|
local tab = UI.Tab {
|
||||||
tabTitle = 'Secure',
|
tabTitle = 'Secure',
|
||||||
description = 'Secure options',
|
description = 'Secure options',
|
||||||
|
[1] = UI.Window {
|
||||||
|
x = 2, y = 2, ex = -2, ey = 5,
|
||||||
|
},
|
||||||
label1 = UI.Text {
|
label1 = UI.Text {
|
||||||
x = 2, y = 3,
|
x = 3, y = 3,
|
||||||
value = 'Screen Locking',
|
value = 'Screen Locking',
|
||||||
},
|
},
|
||||||
checkbox = UI.Checkbox {
|
checkbox = UI.Checkbox {
|
||||||
x = 20, y = 3,
|
x = 21, y = 3,
|
||||||
value = config.enabled
|
value = config.enabled
|
||||||
},
|
},
|
||||||
label2 = UI.Text {
|
label2 = UI.Text {
|
||||||
x = 2, y = 4,
|
x = 3, y = 4,
|
||||||
value = 'Lock timeout',
|
value = 'Lock timeout',
|
||||||
},
|
},
|
||||||
timeout = UI.TextEntry {
|
timeout = UI.TextEntry {
|
||||||
x = 20, y = 4, width = 6,
|
x = 21, y = 4, width = 6,
|
||||||
limit = 4,
|
limit = 4,
|
||||||
transform = 'number',
|
transform = 'number',
|
||||||
value = config.timeout,
|
value = config.timeout,
|
||||||
@@ -31,8 +34,8 @@ local tab = UI.Tab {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
button = UI.Button {
|
button = UI.Button {
|
||||||
x = 20, y = 6,
|
x = -8, ex = -2, y = -2,
|
||||||
text = 'Update',
|
text = 'Apply',
|
||||||
event = 'update',
|
event = 'update',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ local shopTab = UI.Tab {
|
|||||||
tabTitle = 'Store',
|
tabTitle = 'Store',
|
||||||
index = 2,
|
index = 2,
|
||||||
form = UI.Form {
|
form = UI.Form {
|
||||||
x = 2, ex = -2, y = 1, ey = -2,
|
x = 2, ex = -2, y = 2, ey = -2,
|
||||||
manualControls = true,
|
manualControls = true,
|
||||||
[1] = UI.TextEntry {
|
[1] = UI.TextEntry {
|
||||||
formLabel = 'Name', formKey = 'name',
|
formLabel = 'Name', formKey = 'name',
|
||||||
|
|||||||
Reference in New Issue
Block a user