mirror of
https://github.com/IgorTimofeev/MineOS.git
synced 2025-12-20 02:59:20 +01:00
))
This commit is contained in:
parent
67d38da1ce
commit
3846eddc61
@ -1244,9 +1244,7 @@ local function toggleTopToolBar()
|
||||
calculateSizes()
|
||||
end
|
||||
|
||||
local function createEditOrRightClickMenu(x, y)
|
||||
local menu = GUI.addContextMenu(mainContainer, x, y)
|
||||
|
||||
local function createEditOrRightClickMenu(menu)
|
||||
menu:addItem(localization.cut, not codeView.selections[1], "^X").onTouch = function()
|
||||
cut()
|
||||
end
|
||||
@ -1311,14 +1309,12 @@ local function createEditOrRightClickMenu(x, y)
|
||||
menu:addItem(localization.clearBreakpoints, not breakpointLines, "^F9").onTouch = function()
|
||||
clearBreakpoints()
|
||||
end
|
||||
|
||||
mainContainer:drawOnScreen()
|
||||
end
|
||||
|
||||
codeView.eventHandler = function(mainContainer, object, e1, e2, e3, e4, e5)
|
||||
if e1 == "touch" then
|
||||
if e5 == 1 then
|
||||
createEditOrRightClickMenu(e3, e4)
|
||||
createEditOrRightClickMenu(GUI.addContextMenu(mainContainer, e3, e4))
|
||||
else
|
||||
setCursorPositionAndClearSelection(convertScreenCoordinatesToTextPosition(e3, e4))
|
||||
end
|
||||
@ -1531,206 +1527,180 @@ leftTreeView.onItemSelected = function(path)
|
||||
mainContainer:drawOnScreen()
|
||||
end
|
||||
|
||||
local topMenuMineCode = topMenu:addItem("MineCode", 0x0)
|
||||
topMenuMineCode.onTouch = function()
|
||||
local menu = GUI.addContextMenu(mainContainer, topMenuMineCode.x, topMenuMineCode.y + 1)
|
||||
local MineCodeContextMenu = topMenu:addContextMenu("MineCode", 0x0)
|
||||
MineCodeContextMenu:addItem(localization.about).onTouch = function()
|
||||
local container = addBackgroundContainer(localization.about)
|
||||
|
||||
menu:addItem(localization.about).onTouch = function()
|
||||
local container = addBackgroundContainer(localization.about)
|
||||
|
||||
local about = {
|
||||
"MineCode IDE",
|
||||
"Copyright © 2014-2018 ECS Inc.",
|
||||
" ",
|
||||
"Developers:",
|
||||
" ",
|
||||
"Timofeev Igor, vk.com/id7799889",
|
||||
"Trifonov Gleb, vk.com/id88323331",
|
||||
" ",
|
||||
"Testers:",
|
||||
" ",
|
||||
"Semyonov Semyon, vk.com/id92656626",
|
||||
"Prosin Mihail, vk.com/id75667079",
|
||||
"Shestakov Timofey, vk.com/id113499693",
|
||||
"Bogushevich Victoria, vk.com/id171497518",
|
||||
"Vitvitskaya Yana, vk.com/id183425349",
|
||||
"Golovanova Polina, vk.com/id226251826",
|
||||
}
|
||||
local about = {
|
||||
"MineCode IDE",
|
||||
"Copyright © 2014-2018 ECS Inc.",
|
||||
" ",
|
||||
"Developers:",
|
||||
" ",
|
||||
"Timofeev Igor, vk.com/id7799889",
|
||||
"Trifonov Gleb, vk.com/id88323331",
|
||||
" ",
|
||||
"Testers:",
|
||||
" ",
|
||||
"Semyonov Semyon, vk.com/id92656626",
|
||||
"Prosin Mihail, vk.com/id75667079",
|
||||
"Shestakov Timofey, vk.com/id113499693",
|
||||
"Bogushevich Victoria, vk.com/id171497518",
|
||||
"Vitvitskaya Yana, vk.com/id183425349",
|
||||
"Golovanova Polina, vk.com/id226251826",
|
||||
}
|
||||
|
||||
local textBox = container.layout:addChild(GUI.textBox(1, 1, 36, #about, nil, 0xB4B4B4, about, 1, 0, 0, true, false))
|
||||
textBox:setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP)
|
||||
textBox.eventHandler = nil
|
||||
|
||||
mainContainer:drawOnScreen()
|
||||
end
|
||||
|
||||
menu:addItem(localization.quit, false, "^W").onTouch = function()
|
||||
mainContainer:stopEventHandling()
|
||||
end
|
||||
local textBox = container.layout:addChild(GUI.textBox(1, 1, 36, #about, nil, 0xB4B4B4, about, 1, 0, 0, true, false))
|
||||
textBox:setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP)
|
||||
textBox.eventHandler = nil
|
||||
|
||||
mainContainer:drawOnScreen()
|
||||
end
|
||||
|
||||
local topMenuFile = topMenu:addItem(localization.file)
|
||||
topMenuFile.onTouch = function()
|
||||
local menu = GUI.addContextMenu(mainContainer, topMenuFile.x, topMenuFile.y + 1)
|
||||
|
||||
menu:addItem(localization.new, false, "^N").onTouch = function()
|
||||
newFile()
|
||||
mainContainer:drawOnScreen()
|
||||
end
|
||||
|
||||
menu:addItem(localization.open, false, "^O").onTouch = function()
|
||||
openFileWindow()
|
||||
end
|
||||
|
||||
if component.isAvailable("internet") then
|
||||
menu:addItem(localization.getFromWeb, false, "^U").onTouch = function()
|
||||
downloadFileFromWeb()
|
||||
end
|
||||
end
|
||||
|
||||
menu:addSeparator()
|
||||
|
||||
menu:addItem(localization.save, not leftTreeView.selectedItem, "^S").onTouch = function()
|
||||
saveFileWindow()
|
||||
end
|
||||
|
||||
menu:addItem(localization.saveAs, false, "^⇧S").onTouch = function()
|
||||
saveFileAsWindow()
|
||||
end
|
||||
|
||||
menu:addItem(localization.launchWithArguments, false, "^F5").onTouch = function()
|
||||
launchWithArgumentsWindow()
|
||||
end
|
||||
MineCodeContextMenu:addItem(localization.quit, false, "^W").onTouch = function()
|
||||
mainContainer:stopEventHandling()
|
||||
end
|
||||
|
||||
local fileContextMenu = topMenu:addContextMenu(localization.file)
|
||||
fileContextMenu:addItem(localization.new, false, "^N").onTouch = function()
|
||||
newFile()
|
||||
mainContainer:drawOnScreen()
|
||||
end
|
||||
|
||||
local topMenuEdit = topMenu:addItem(localization.edit)
|
||||
topMenuEdit.onTouch = function()
|
||||
createEditOrRightClickMenu(topMenuEdit.x, topMenuEdit.y + 1)
|
||||
fileContextMenu:addItem(localization.open, false, "^O").onTouch = function()
|
||||
openFileWindow()
|
||||
end
|
||||
|
||||
local topMenuGoto = topMenu:addItem(localization.gotoCyka)
|
||||
topMenuGoto.onTouch = function()
|
||||
local menu = GUI.addContextMenu(mainContainer, topMenuGoto.x, topMenuGoto.y + 1)
|
||||
|
||||
menu:addItem(localization.pageUp, false, "PgUp").onTouch = function()
|
||||
pageUp()
|
||||
if component.isAvailable("internet") then
|
||||
fileContextMenu:addItem(localization.getFromWeb, false, "^U").onTouch = function()
|
||||
downloadFileFromWeb()
|
||||
end
|
||||
|
||||
menu:addItem(localization.pageDown, false, "PgDn").onTouch = function()
|
||||
pageDown()
|
||||
end
|
||||
|
||||
menu:addItem(localization.gotoStart, false, "Home").onTouch = function()
|
||||
setCursorPositionToHome()
|
||||
end
|
||||
|
||||
menu:addItem(localization.gotoEnd, false, "End").onTouch = function()
|
||||
setCursorPositionToEnd()
|
||||
end
|
||||
|
||||
menu:addSeparator()
|
||||
|
||||
menu:addItem(localization.gotoLine, false, "^L").onTouch = function()
|
||||
gotoLineWindow()
|
||||
end
|
||||
|
||||
mainContainer:drawOnScreen()
|
||||
end
|
||||
|
||||
local topMenuProperties = topMenu:addItem(localization.properties)
|
||||
topMenuProperties.onTouch = function()
|
||||
local menu = GUI.addContextMenu(mainContainer, topMenuProperties.x, topMenuProperties.y + 1)
|
||||
fileContextMenu:addSeparator()
|
||||
|
||||
fileContextMenu:addItem(localization.save, not leftTreeView.selectedItem, "^S").onTouch = function()
|
||||
saveFileWindow()
|
||||
end
|
||||
|
||||
fileContextMenu:addItem(localization.saveAs, false, "^⇧S").onTouch = function()
|
||||
saveFileAsWindow()
|
||||
end
|
||||
|
||||
fileContextMenu:addItem(localization.launchWithArguments, false, "^F5").onTouch = function()
|
||||
launchWithArgumentsWindow()
|
||||
end
|
||||
|
||||
local topMenuEdit = topMenu:addContextMenu(localization.edit)
|
||||
createEditOrRightClickMenu(topMenuEdit)
|
||||
|
||||
local gotoContextMenu = topMenu:addContextMenu(localization.gotoCyka)
|
||||
gotoContextMenu:addItem(localization.pageUp, false, "PgUp").onTouch = function()
|
||||
pageUp()
|
||||
end
|
||||
|
||||
gotoContextMenu:addItem(localization.pageDown, false, "PgDn").onTouch = function()
|
||||
pageDown()
|
||||
end
|
||||
|
||||
gotoContextMenu:addItem(localization.gotoStart, false, "Home").onTouch = function()
|
||||
setCursorPositionToHome()
|
||||
end
|
||||
|
||||
gotoContextMenu:addItem(localization.gotoEnd, false, "End").onTouch = function()
|
||||
setCursorPositionToEnd()
|
||||
end
|
||||
|
||||
gotoContextMenu:addSeparator()
|
||||
|
||||
gotoContextMenu:addItem(localization.gotoLine, false, "^L").onTouch = function()
|
||||
gotoLineWindow()
|
||||
end
|
||||
|
||||
local propertiesContextMenu = topMenu:addContextMenu(localization.properties)
|
||||
propertiesContextMenu:addItem(localization.colorScheme).onTouch = function()
|
||||
local container = GUI.addBackgroundContainer(mainContainer, true, false, localization.colorScheme)
|
||||
|
||||
local colorSelectorsCount, colorSelectorCountX = 0, 4; for key in pairs(config.syntaxColorScheme) do colorSelectorsCount = colorSelectorsCount + 1 end
|
||||
local colorSelectorCountY = math.ceil(colorSelectorsCount / colorSelectorCountX)
|
||||
local colorSelectorWidth, colorSelectorHeight, colorSelectorSpaceX, colorSelectorSpaceY = math.floor(container.width / colorSelectorCountX * 0.8), 3, 2, 1
|
||||
|
||||
menu:addItem(localization.colorScheme).onTouch = function()
|
||||
local container = GUI.addBackgroundContainer(mainContainer, true, false, localization.colorScheme)
|
||||
|
||||
local colorSelectorsCount, colorSelectorCountX = 0, 4; for key in pairs(config.syntaxColorScheme) do colorSelectorsCount = colorSelectorsCount + 1 end
|
||||
local colorSelectorCountY = math.ceil(colorSelectorsCount / colorSelectorCountX)
|
||||
local colorSelectorWidth, colorSelectorHeight, colorSelectorSpaceX, colorSelectorSpaceY = math.floor(container.width / colorSelectorCountX * 0.8), 3, 2, 1
|
||||
|
||||
local startX, y = math.floor(container.width / 2 - (colorSelectorCountX * (colorSelectorWidth + colorSelectorSpaceX) - colorSelectorSpaceX) / 2), math.floor(container.height / 2 - (colorSelectorCountY * (colorSelectorHeight + colorSelectorSpaceY) - colorSelectorSpaceY + 3) / 2)
|
||||
container:addChild(GUI.label(1, y, container.width, 1, 0xFFFFFF, localization.colorScheme)):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP); y = y + 3
|
||||
local x, counter = startX, 1
|
||||
local startX, y = math.floor(container.width / 2 - (colorSelectorCountX * (colorSelectorWidth + colorSelectorSpaceX) - colorSelectorSpaceX) / 2), math.floor(container.height / 2 - (colorSelectorCountY * (colorSelectorHeight + colorSelectorSpaceY) - colorSelectorSpaceY + 3) / 2)
|
||||
container:addChild(GUI.label(1, y, container.width, 1, 0xFFFFFF, localization.colorScheme)):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP); y = y + 3
|
||||
local x, counter = startX, 1
|
||||
|
||||
local colors = {}
|
||||
for key in pairs(config.syntaxColorScheme) do
|
||||
table.insert(colors, {key})
|
||||
end
|
||||
|
||||
aplhabeticalSort(colors)
|
||||
|
||||
for i = 1, #colors do
|
||||
local colorSelector = container:addChild(GUI.colorSelector(x, y, colorSelectorWidth, colorSelectorHeight, config.syntaxColorScheme[colors[i][1]], colors[i][1]))
|
||||
colorSelector.onColorSelected = function()
|
||||
config.syntaxColorScheme[colors[i][1]] = colorSelector.color
|
||||
GUI.LUA_SYNTAX_COLOR_SCHEME = config.syntaxColorScheme
|
||||
saveConfig()
|
||||
end
|
||||
|
||||
x, counter = x + colorSelectorWidth + colorSelectorSpaceX, counter + 1
|
||||
if counter > colorSelectorCountX then
|
||||
x, y, counter = startX, y + colorSelectorHeight + colorSelectorSpaceY, 1
|
||||
end
|
||||
end
|
||||
|
||||
mainContainer:drawOnScreen()
|
||||
local colors = {}
|
||||
for key in pairs(config.syntaxColorScheme) do
|
||||
table.insert(colors, {key})
|
||||
end
|
||||
|
||||
menu:addItem(localization.cursorProperties).onTouch = function()
|
||||
local container = addBackgroundContainer(localization.cursorProperties)
|
||||
aplhabeticalSort(colors)
|
||||
|
||||
local input = container.layout:addChild(GUI.input(1, 1, 36, 3, 0xC3C3C3, 0x787878, 0x787878, 0xC3C3C3, 0x2D2D2D, config.cursorSymbol, localization.cursorSymbol))
|
||||
input.onInputFinished = function()
|
||||
if #input.text == 1 then
|
||||
config.cursorSymbol = input.text
|
||||
saveConfig()
|
||||
end
|
||||
end
|
||||
|
||||
local colorSelector = container.layout:addChild(GUI.colorSelector(1, 1, 36, 3, config.cursorColor, localization.cursorColor))
|
||||
for i = 1, #colors do
|
||||
local colorSelector = container:addChild(GUI.colorSelector(x, y, colorSelectorWidth, colorSelectorHeight, config.syntaxColorScheme[colors[i][1]], colors[i][1]))
|
||||
colorSelector.onColorSelected = function()
|
||||
config.cursorColor = colorSelector.color
|
||||
config.syntaxColorScheme[colors[i][1]] = colorSelector.color
|
||||
GUI.LUA_SYNTAX_COLOR_SCHEME = config.syntaxColorScheme
|
||||
saveConfig()
|
||||
end
|
||||
|
||||
local slider = container.layout:addChild(GUI.slider(1, 1, 36, 0xFFDB80, 0x000000, 0xFFDB40, 0xDDDDDD, 1, 1000, config.cursorBlinkDelay * 1000, false, localization.cursorBlinkDelay .. ": ", " ms"))
|
||||
slider.onValueChanged = function()
|
||||
config.cursorBlinkDelay = slider.value / 1000
|
||||
x, counter = x + colorSelectorWidth + colorSelectorSpaceX, counter + 1
|
||||
if counter > colorSelectorCountX then
|
||||
x, y, counter = startX, y + colorSelectorHeight + colorSelectorSpaceY, 1
|
||||
end
|
||||
end
|
||||
|
||||
mainContainer:drawOnScreen()
|
||||
end
|
||||
|
||||
propertiesContextMenu:addItem(localization.cursorProperties).onTouch = function()
|
||||
local container = addBackgroundContainer(localization.cursorProperties)
|
||||
|
||||
local input = container.layout:addChild(GUI.input(1, 1, 36, 3, 0xC3C3C3, 0x787878, 0x787878, 0xC3C3C3, 0x2D2D2D, config.cursorSymbol, localization.cursorSymbol))
|
||||
input.onInputFinished = function()
|
||||
if #input.text == 1 then
|
||||
config.cursorSymbol = input.text
|
||||
saveConfig()
|
||||
end
|
||||
|
||||
mainContainer:drawOnScreen()
|
||||
end
|
||||
|
||||
if topToolBar.hidden then
|
||||
menu:addItem(localization.toggleTopToolBar).onTouch = function()
|
||||
toggleTopToolBar()
|
||||
end
|
||||
end
|
||||
|
||||
menu:addSeparator()
|
||||
|
||||
menu:addItem(config.syntaxHighlight and localization.disableSyntaxHighlight or localization.enableSyntaxHighlight).onTouch = function()
|
||||
syntaxHighlightingButton.pressed = not syntaxHighlightingButton.pressed
|
||||
syntaxHighlightingButton.onTouch()
|
||||
end
|
||||
|
||||
menu:addItem(config.enableAutoBrackets and localization.disableAutoBrackets or localization.enableAutoBrackets, false, "^]").onTouch = function()
|
||||
config.enableAutoBrackets = not config.enableAutoBrackets
|
||||
local colorSelector = container.layout:addChild(GUI.colorSelector(1, 1, 36, 3, config.cursorColor, localization.cursorColor))
|
||||
colorSelector.onColorSelected = function()
|
||||
config.cursorColor = colorSelector.color
|
||||
saveConfig()
|
||||
end
|
||||
|
||||
menu:addItem(config.enableAutocompletion and localization.disableAutocompletion or localization.enableAutocompletion, false, "^I").onTouch = function()
|
||||
toggleEnableAutocompleteDatabase()
|
||||
local slider = container.layout:addChild(GUI.slider(1, 1, 36, 0xFFDB80, 0x000000, 0xFFDB40, 0xDDDDDD, 1, 1000, config.cursorBlinkDelay * 1000, false, localization.cursorBlinkDelay .. ": ", " ms"))
|
||||
slider.onValueChanged = function()
|
||||
config.cursorBlinkDelay = slider.value / 1000
|
||||
saveConfig()
|
||||
end
|
||||
|
||||
mainContainer:drawOnScreen()
|
||||
end
|
||||
|
||||
if topToolBar.hidden then
|
||||
propertiesContextMenu:addItem(localization.toggleTopToolBar).onTouch = function()
|
||||
toggleTopToolBar()
|
||||
end
|
||||
end
|
||||
|
||||
propertiesContextMenu:addSeparator()
|
||||
|
||||
propertiesContextMenu:addItem(config.syntaxHighlight and localization.disableSyntaxHighlight or localization.enableSyntaxHighlight).onTouch = function()
|
||||
syntaxHighlightingButton.pressed = not syntaxHighlightingButton.pressed
|
||||
syntaxHighlightingButton.onTouch()
|
||||
end
|
||||
|
||||
propertiesContextMenu:addItem(config.enableAutoBrackets and localization.disableAutoBrackets or localization.enableAutoBrackets, false, "^]").onTouch = function()
|
||||
config.enableAutoBrackets = not config.enableAutoBrackets
|
||||
saveConfig()
|
||||
end
|
||||
|
||||
propertiesContextMenu:addItem(config.enableAutocompletion and localization.disableAutocompletion or localization.enableAutocompletion, false, "^I").onTouch = function()
|
||||
toggleEnableAutocompleteDatabase()
|
||||
end
|
||||
|
||||
leftTreeViewResizer.onResize = function(dragWidth, dragHeight)
|
||||
leftTreeView.width = leftTreeView.width + dragWidth
|
||||
calculateSizes()
|
||||
|
||||
@ -339,93 +339,87 @@ end
|
||||
|
||||
mainContainer.menu:addItem("PE", 0x00B6FF)
|
||||
|
||||
local fileItem = mainContainer.menu:addItem("File")
|
||||
fileItem.onTouch = function()
|
||||
local menu = GUI.addContextMenu(mainContainer, fileItem.x, fileItem.y + 1)
|
||||
|
||||
menu:addItem("New").onTouch = new
|
||||
local fileItem = mainContainer.menu:addContextMenu("File")
|
||||
fileItem:addItem("New").onTouch = new
|
||||
|
||||
menu:addSeparator()
|
||||
fileItem:addSeparator()
|
||||
|
||||
menu:addItem("Open").onTouch = function()
|
||||
local filesystemDialog = GUI.addFilesystemDialog(mainContainer, true, 50, math.floor(mainContainer.height * 0.8), "Open", "Cancel", "File name", "/")
|
||||
filesystemDialog:setMode(GUI.IO_MODE_OPEN, GUI.IO_MODE_FILE)
|
||||
filesystemDialog:addExtensionFilter(".pic")
|
||||
filesystemDialog:expandPath(MineOSPaths.desktop)
|
||||
filesystemDialog:show()
|
||||
|
||||
filesystemDialog.onSubmit = function(path)
|
||||
loadImage(path)
|
||||
mainContainer:drawOnScreen()
|
||||
end
|
||||
end
|
||||
|
||||
local subMenu = menu:addSubMenu("Open recent", #config.recentFiles == 0)
|
||||
for i = 1, #config.recentFiles do
|
||||
subMenu:addItem(string.limit(config.recentFiles[i], 32, "left")).onTouch = function()
|
||||
loadImage(config.recentFiles[i])
|
||||
mainContainer:drawOnScreen()
|
||||
end
|
||||
end
|
||||
|
||||
menu:addItem("Open from URL").onTouch = function()
|
||||
local container = MineOSInterface.addBackgroundContainer(mainContainer, "Open from URL")
|
||||
|
||||
local input = container.layout:addChild(GUI.input(1, 1, 36, 3, 0xE1E1E1, 0x696969, 0x969696, 0xE1E1E1, 0x2D2D2D, "", "http://example.com/test.pic"))
|
||||
input.onInputFinished = function()
|
||||
if #input.text > 0 then
|
||||
input:remove()
|
||||
container.layout:addChild(GUI.label(1, 1, container.width, 1, 0x969696, "Downloading file..."):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP))
|
||||
mainContainer:drawOnScreen()
|
||||
|
||||
local temporaryPath = MineOSCore.getTemporaryPath() .. ".pic"
|
||||
local result, reason = web.download(input.text, temporaryPath)
|
||||
|
||||
container:remove()
|
||||
|
||||
if result then
|
||||
loadImage(temporaryPath)
|
||||
fs.remove(temporaryPath)
|
||||
savePath = nil
|
||||
else
|
||||
GUI.alert(reason)
|
||||
end
|
||||
|
||||
mainContainer:drawOnScreen()
|
||||
end
|
||||
end
|
||||
fileItem:addItem("Open").onTouch = function()
|
||||
local filesystemDialog = GUI.addFilesystemDialog(mainContainer, true, 50, math.floor(mainContainer.height * 0.8), "Open", "Cancel", "File name", "/")
|
||||
filesystemDialog:setMode(GUI.IO_MODE_OPEN, GUI.IO_MODE_FILE)
|
||||
filesystemDialog:addExtensionFilter(".pic")
|
||||
filesystemDialog:expandPath(MineOSPaths.desktop)
|
||||
filesystemDialog:show()
|
||||
|
||||
filesystemDialog.onSubmit = function(path)
|
||||
loadImage(path)
|
||||
mainContainer:drawOnScreen()
|
||||
end
|
||||
end
|
||||
|
||||
menu:addSeparator()
|
||||
|
||||
menu:addItem("Save", not savePath).onTouch = function()
|
||||
saveImage(savePath)
|
||||
local fileItemSubMenu = fileItem:addSubMenu("Open recent", #config.recentFiles == 0)
|
||||
for i = 1, #config.recentFiles do
|
||||
fileItemSubMenu:addItem(string.limit(config.recentFiles[i], 32, "left")).onTouch = function()
|
||||
loadImage(config.recentFiles[i])
|
||||
mainContainer:drawOnScreen()
|
||||
end
|
||||
end
|
||||
|
||||
menu:addItem("Save as").onTouch = function()
|
||||
local filesystemDialog = GUI.addFilesystemDialog(mainContainer, true, 50, math.floor(mainContainer.height * 0.8), "Save", "Cancel", "File name", "/")
|
||||
filesystemDialog:setMode(GUI.IO_MODE_SAVE, GUI.IO_MODE_FILE)
|
||||
filesystemDialog:addExtensionFilter(".pic")
|
||||
filesystemDialog:expandPath(MineOSPaths.desktop)
|
||||
filesystemDialog.filesystemTree.selectedItem = MineOSPaths.desktop
|
||||
filesystemDialog:show()
|
||||
fileItem:addItem("Open from URL").onTouch = function()
|
||||
local container = MineOSInterface.addBackgroundContainer(mainContainer, "Open from URL")
|
||||
|
||||
filesystemDialog.onSubmit = function(path)
|
||||
saveImage(path)
|
||||
local input = container.layout:addChild(GUI.input(1, 1, 36, 3, 0xE1E1E1, 0x696969, 0x969696, 0xE1E1E1, 0x2D2D2D, "", "http://example.com/test.pic"))
|
||||
input.onInputFinished = function()
|
||||
if #input.text > 0 then
|
||||
input:remove()
|
||||
container.layout:addChild(GUI.label(1, 1, container.width, 1, 0x969696, "Downloading file..."):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP))
|
||||
mainContainer:drawOnScreen()
|
||||
|
||||
local temporaryPath = MineOSCore.getTemporaryPath() .. ".pic"
|
||||
local result, reason = web.download(input.text, temporaryPath)
|
||||
|
||||
container:remove()
|
||||
|
||||
if result then
|
||||
loadImage(temporaryPath)
|
||||
fs.remove(temporaryPath)
|
||||
savePath = nil
|
||||
else
|
||||
GUI.alert(reason)
|
||||
end
|
||||
|
||||
mainContainer:drawOnScreen()
|
||||
end
|
||||
end
|
||||
|
||||
menu:addSeparator()
|
||||
|
||||
menu:addItem("Exit").onTouch = function()
|
||||
mainContainer:stopEventHandling()
|
||||
end
|
||||
|
||||
mainContainer:drawOnScreen()
|
||||
end
|
||||
|
||||
fileItem:addSeparator()
|
||||
|
||||
fileItem:addItem("Save", not savePath).onTouch = function()
|
||||
saveImage(savePath)
|
||||
end
|
||||
|
||||
fileItem:addItem("Save as").onTouch = function()
|
||||
local filesystemDialog = GUI.addFilesystemDialog(mainContainer, true, 50, math.floor(mainContainer.height * 0.8), "Save", "Cancel", "File name", "/")
|
||||
filesystemDialog:setMode(GUI.IO_MODE_SAVE, GUI.IO_MODE_FILE)
|
||||
filesystemDialog:addExtensionFilter(".pic")
|
||||
filesystemDialog:expandPath(MineOSPaths.desktop)
|
||||
filesystemDialog.filesystemTree.selectedItem = MineOSPaths.desktop
|
||||
filesystemDialog:show()
|
||||
|
||||
filesystemDialog.onSubmit = function(path)
|
||||
saveImage(path)
|
||||
end
|
||||
end
|
||||
|
||||
fileItem:addSeparator()
|
||||
|
||||
fileItem:addItem("Exit").onTouch = function()
|
||||
mainContainer:stopEventHandling()
|
||||
end
|
||||
|
||||
mainContainer.menu:addItem("View").onTouch = function()
|
||||
local container = MineOSInterface.addBackgroundContainer(mainContainer, "View")
|
||||
|
||||
|
||||
703
OS.lua
703
OS.lua
@ -512,87 +512,82 @@ local function createOSWidgets()
|
||||
MineOSInterface.mainContainer.windowsContainer = MineOSInterface.mainContainer:addChild(GUI.container(1, 2, 1, 1))
|
||||
|
||||
MineOSInterface.mainContainer.menu = MineOSInterface.mainContainer:addChild(GUI.menu(1, 1, MineOSInterface.mainContainer.width, MineOSCore.properties.menuColor, 0x696969, 0x3366CC, 0xFFFFFF))
|
||||
local item1 = MineOSInterface.mainContainer.menu:addItem("MineOS", 0x000000)
|
||||
item1.onTouch = function()
|
||||
local menu = MineOSInterface.addContextMenu(MineOSInterface.mainContainer, item1.x, item1.y + 1)
|
||||
|
||||
local MineOSContextMenu = MineOSInterface.mainContainer.menu:addContextMenu("MineOS", 0x000000)
|
||||
MineOSContextMenu:addItem(MineOSCore.localization.aboutSystem).onTouch = function()
|
||||
local container = MineOSInterface.addBackgroundContainer(MineOSInterface.mainContainer, MineOSCore.localization.aboutSystem)
|
||||
container.layout:setFitting(2, 1, false, false)
|
||||
container.layout:removeChildren()
|
||||
|
||||
local lines = {
|
||||
"MineOS",
|
||||
"Copyright © 2014-" .. os.date("%Y", realTimestamp),
|
||||
" ",
|
||||
"Developers:",
|
||||
" ",
|
||||
"Igor Timofeev, vk.com/id7799889",
|
||||
"Gleb Trifonov, vk.com/id88323331",
|
||||
"Yakov Verevkin, vk.com/id60991376",
|
||||
"Alexey Smirnov, vk.com/id23897419",
|
||||
"Timofey Shestakov, vk.com/id113499693",
|
||||
" ",
|
||||
"UX-advisers:",
|
||||
" ",
|
||||
"Nikita Yarichev, vk.com/id65873873",
|
||||
"Vyacheslav Sazonov, vk.com/id21321257",
|
||||
"Michail Prosin, vk.com/id75667079",
|
||||
"Dmitrii Tiunov, vk.com/id151541414",
|
||||
"Egor Paliev, vk.com/id83795932",
|
||||
"Maxim Pakin, vk.com/id100687922",
|
||||
"Andrey Kakoito, vk.com/id201043162",
|
||||
"Maxim Omelaenko, vk.com/id54662296",
|
||||
"Konstantin Mayakovskiy, vk.com/id10069748",
|
||||
" ",
|
||||
"Translators:",
|
||||
" ",
|
||||
"06Games, github.com/06Games",
|
||||
"Ksenia Mazneva, vk.com/id5564402",
|
||||
"Yana Dmitrieva, vk.com/id155326634",
|
||||
}
|
||||
|
||||
menu:addItem(MineOSCore.localization.aboutSystem).onTouch = function()
|
||||
local container = MineOSInterface.addBackgroundContainer(MineOSInterface.mainContainer, MineOSCore.localization.aboutSystem)
|
||||
container.layout:setFitting(2, 1, false, false)
|
||||
container.layout:removeChildren()
|
||||
|
||||
local lines = {
|
||||
"MineOS",
|
||||
"Copyright © 2014-" .. os.date("%Y", realTimestamp),
|
||||
" ",
|
||||
"Developers:",
|
||||
" ",
|
||||
"Igor Timofeev, vk.com/id7799889",
|
||||
"Gleb Trifonov, vk.com/id88323331",
|
||||
"Yakov Verevkin, vk.com/id60991376",
|
||||
"Alexey Smirnov, vk.com/id23897419",
|
||||
"Timofey Shestakov, vk.com/id113499693",
|
||||
" ",
|
||||
"UX-advisers:",
|
||||
" ",
|
||||
"Nikita Yarichev, vk.com/id65873873",
|
||||
"Vyacheslav Sazonov, vk.com/id21321257",
|
||||
"Michail Prosin, vk.com/id75667079",
|
||||
"Dmitrii Tiunov, vk.com/id151541414",
|
||||
"Egor Paliev, vk.com/id83795932",
|
||||
"Maxim Pakin, vk.com/id100687922",
|
||||
"Andrey Kakoito, vk.com/id201043162",
|
||||
"Maxim Omelaenko, vk.com/id54662296",
|
||||
"Konstantin Mayakovskiy, vk.com/id10069748",
|
||||
" ",
|
||||
"Translators:",
|
||||
" ",
|
||||
"06Games, github.com/06Games",
|
||||
"Ksenia Mazneva, vk.com/id5564402",
|
||||
"Yana Dmitrieva, vk.com/id155326634",
|
||||
}
|
||||
|
||||
local textBox = container.layout:addChild(GUI.textBox(1, 1, container.layout.width, #lines, nil, 0xB4B4B4, lines, 1, 0, 0))
|
||||
textBox:setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP)
|
||||
textBox.eventHandler = container.panel.eventHandler
|
||||
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
end
|
||||
|
||||
menu:addItem(MineOSCore.localization.updates).onTouch = function()
|
||||
MineOSInterface.safeLaunch(MineOSPaths.applications .. "App Market.app/Main.lua", "updates")
|
||||
end
|
||||
|
||||
menu:addSeparator()
|
||||
|
||||
menu:addItem(MineOSCore.localization.logout, MineOSCore.properties.protectionMethod == "withoutProtection").onTouch = function()
|
||||
login()
|
||||
end
|
||||
|
||||
menu:addItem(MineOSCore.localization.reboot).onTouch = function()
|
||||
MineOSNetwork.broadcastComputerState(false)
|
||||
require("computer").shutdown(true)
|
||||
end
|
||||
|
||||
menu:addItem(MineOSCore.localization.shutdown).onTouch = function()
|
||||
MineOSNetwork.broadcastComputerState(false)
|
||||
require("computer").shutdown()
|
||||
end
|
||||
|
||||
menu:addSeparator()
|
||||
|
||||
menu:addItem(MineOSCore.localization.returnToShell).onTouch = function()
|
||||
MineOSNetwork.broadcastComputerState(false)
|
||||
MineOSInterface.mainContainer:stopEventHandling()
|
||||
MineOSInterface.clearTerminal()
|
||||
os.exit()
|
||||
end
|
||||
local textBox = container.layout:addChild(GUI.textBox(1, 1, container.layout.width, #lines, nil, 0xB4B4B4, lines, 1, 0, 0))
|
||||
textBox:setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP)
|
||||
textBox.eventHandler = container.panel.eventHandler
|
||||
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
end
|
||||
|
||||
local item2 = MineOSInterface.mainContainer.menu:addItem(MineOSCore.localization.network)
|
||||
item2.onTouch = function()
|
||||
MineOSContextMenu:addItem(MineOSCore.localization.updates).onTouch = function()
|
||||
MineOSInterface.safeLaunch(MineOSPaths.applications .. "App Market.app/Main.lua", "updates")
|
||||
end
|
||||
|
||||
MineOSContextMenu:addSeparator()
|
||||
|
||||
MineOSContextMenu:addItem(MineOSCore.localization.logout, MineOSCore.properties.protectionMethod == "withoutProtection").onTouch = function()
|
||||
login()
|
||||
end
|
||||
|
||||
MineOSContextMenu:addItem(MineOSCore.localization.reboot).onTouch = function()
|
||||
MineOSNetwork.broadcastComputerState(false)
|
||||
require("computer").shutdown(true)
|
||||
end
|
||||
|
||||
MineOSContextMenu:addItem(MineOSCore.localization.shutdown).onTouch = function()
|
||||
MineOSNetwork.broadcastComputerState(false)
|
||||
require("computer").shutdown()
|
||||
end
|
||||
|
||||
MineOSContextMenu:addSeparator()
|
||||
|
||||
MineOSContextMenu:addItem(MineOSCore.localization.returnToShell).onTouch = function()
|
||||
MineOSNetwork.broadcastComputerState(false)
|
||||
MineOSInterface.mainContainer:stopEventHandling()
|
||||
MineOSInterface.clearTerminal()
|
||||
os.exit()
|
||||
end
|
||||
|
||||
local networkItem = MineOSInterface.mainContainer.menu:addItem(MineOSCore.localization.network)
|
||||
networkItem.onTouch = function()
|
||||
local container = MineOSInterface.addBackgroundContainer(MineOSInterface.mainContainer, MineOSCore.localization.network)
|
||||
local insertModemTextBox = container.layout:addChild(GUI.textBox(1, 1, 36, 1, nil, 0x5A5A5A, {MineOSCore.localization.networkModemNotAvailable}, 1, 0, 0, true, true))
|
||||
local stateSwitchAndLabel = container.layout:addChild(GUI.switchAndLabel(1, 1, 36, 8, 0x66DB80, 0x2D2D2D, 0xE1E1E1, 0x878787, MineOSCore.localization.networkState .. ":", MineOSCore.properties.network.enabled))
|
||||
@ -682,323 +677,317 @@ local function createOSWidgets()
|
||||
check()
|
||||
end
|
||||
|
||||
local item3 = MineOSInterface.mainContainer.menu:addItem(MineOSCore.localization.settings)
|
||||
item3.onTouch = function()
|
||||
local menu = MineOSInterface.addContextMenu(MineOSInterface.mainContainer, item3.x, item3.y + 1)
|
||||
|
||||
if computer.getArchitectures then
|
||||
menu:addItem(MineOSCore.localization.CPUArchitecture).onTouch = function()
|
||||
local container = MineOSInterface.addBackgroundContainer(MineOSInterface.mainContainer, MineOSCore.localization.CPUArchitecture)
|
||||
|
||||
local comboBox = container.layout:addChild(GUI.comboBox(1, 1, 36, 3, 0xE1E1E1, 0x2D2D2D, 0x4B4B4B, 0x969696))
|
||||
local architectures, architecture = computer.getArchitectures(), computer.getArchitecture()
|
||||
for i = 1, #architectures do
|
||||
comboBox:addItem(architectures[i]).onTouch = function()
|
||||
computer.setArchitecture(architectures[i])
|
||||
computer.shutdown(true)
|
||||
end
|
||||
|
||||
if architecture == architectures[i] then
|
||||
comboBox.selectedItem = i
|
||||
end
|
||||
end
|
||||
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
end
|
||||
end
|
||||
|
||||
menu:addItem(MineOSCore.localization.RAMControl).onTouch = function()
|
||||
local container = MineOSInterface.addBackgroundContainer(MineOSInterface.mainContainer, MineOSCore.localization.RAMControl)
|
||||
|
||||
local comboBox = container.layout:addChild(GUI.comboBox(1, 1, 36, 3, 0xE1E1E1, 0x2D2D2D, 0x4B4B4B, 0x969696))
|
||||
comboBox.dropDownMenu.itemHeight = 1
|
||||
|
||||
local function update()
|
||||
local libraries = {}
|
||||
for key in pairs(package.loaded) do
|
||||
if not _G[key] then
|
||||
table.insert(libraries, key)
|
||||
end
|
||||
end
|
||||
|
||||
table.sort(libraries, function(a, b) return a < b end)
|
||||
|
||||
comboBox:clear()
|
||||
for i = 1, #libraries do
|
||||
comboBox:addItem(libraries[i]).onTouch = function()
|
||||
package.loaded[libraries[i]] = nil
|
||||
update()
|
||||
end
|
||||
end
|
||||
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
end
|
||||
|
||||
local switch = container.layout:addChild(GUI.switchAndLabel(1, 1, 36, 8, 0x66DB80, 0x2D2D2D, 0xE1E1E1, 0x878787, MineOSCore.localization.packageUnloading .. ":", MineOSCore.properties.packageUnloading)).switch
|
||||
switch.onStateChanged = function()
|
||||
MineOSCore.properties.packageUnloading = switch.state
|
||||
MineOSCore.setPackageUnloading(MineOSCore.properties.packageUnloading)
|
||||
MineOSCore.saveProperties()
|
||||
end
|
||||
|
||||
update()
|
||||
end
|
||||
|
||||
menu:addItem(MineOSCore.localization.screenResolution).onTouch = function()
|
||||
local container = MineOSInterface.addBackgroundContainer(MineOSInterface.mainContainer, MineOSCore.localization.screenResolution)
|
||||
|
||||
local widthTextBox = container.layout:addChild(GUI.input(1, 1, 36, 3, 0xE1E1E1, 0x696969, 0x878787, 0xE1E1E1, 0x2D2D2D, tostring(MineOSCore.properties.resolution and MineOSCore.properties.resolution[1] or 160), "Width", true))
|
||||
widthTextBox.validator = function(text)
|
||||
local number = tonumber(text)
|
||||
if number then return number >= 1 and number <= 160 end
|
||||
end
|
||||
|
||||
local heightTextBox = container.layout:addChild(GUI.input(1, 1, 36, 3, 0xE1E1E1, 0x696969, 0x878787, 0xE1E1E1, 0x2D2D2D, tostring(MineOSCore.properties.resolution and MineOSCore.properties.resolution[2] or 50), "Height", true))
|
||||
heightTextBox.validator = function(text)
|
||||
local number = tonumber(text)
|
||||
if number then return number >= 1 and number <= 50 end
|
||||
end
|
||||
|
||||
container.panel.eventHandler = function(mainContainer, object, e1)
|
||||
if e1 == "touch" then
|
||||
container:remove()
|
||||
MineOSCore.properties.resolution = {tonumber(widthTextBox.text), tonumber(heightTextBox.text)}
|
||||
MineOSCore.saveProperties()
|
||||
changeResolution()
|
||||
changeWallpaper()
|
||||
MineOSInterface.mainContainer.updateFileListAndDraw()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
menu:addSeparator()
|
||||
|
||||
menu:addItem(MineOSCore.localization.systemLanguage).onTouch = function()
|
||||
local container = MineOSInterface.addBackgroundContainer(MineOSInterface.mainContainer, MineOSCore.localization.systemLanguage)
|
||||
|
||||
local comboBox = container.layout:addChild(GUI.comboBox(1, 1, 36, 3, 0xE1E1E1, 0x2D2D2D, 0x4B4B4B, 0x969696))
|
||||
for file in fs.list(MineOSPaths.localizationFiles) do
|
||||
local name = fs.hideExtension(file)
|
||||
comboBox:addItem(name).onTouch = function()
|
||||
MineOSCore.properties.language = name
|
||||
MineOSCore.localization = MineOSCore.getLocalization(MineOSPaths.localizationFiles)
|
||||
|
||||
createOSWidgets()
|
||||
changeResolution()
|
||||
changeWallpaper()
|
||||
MineOSCore.OSUpdateDate()
|
||||
|
||||
MineOSInterface.mainContainer.updateFileListAndDraw()
|
||||
MineOSCore.saveProperties()
|
||||
end
|
||||
|
||||
if name == MineOSCore.properties.language then
|
||||
comboBox.selectedItem = comboBox:count()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
menu:addItem(MineOSCore.localization.wallpaper).onTouch = function()
|
||||
local container = MineOSInterface.addBackgroundContainer(MineOSInterface.mainContainer, MineOSCore.localization.wallpaper)
|
||||
|
||||
local filesystemChooser = container.layout:addChild(GUI.filesystemChooser(1, 1, 36, 3, 0xE1E1E1, 0x2D2D2D, 0x4B4B4B, 0x969696, MineOSCore.properties.wallpaper, MineOSCore.localization.open, MineOSCore.localization.cancel, MineOSCore.localization.wallpaperPath, "/"))
|
||||
filesystemChooser:addExtensionFilter(".pic")
|
||||
filesystemChooser.onSubmit = function(path)
|
||||
MineOSCore.properties.wallpaper = path
|
||||
MineOSCore.saveProperties()
|
||||
changeWallpaper()
|
||||
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
end
|
||||
|
||||
local comboBox = container.layout:addChild(GUI.comboBox(1, 1, 36, 3, 0xE1E1E1, 0x2D2D2D, 0x4B4B4B, 0x969696))
|
||||
comboBox.selectedItem = MineOSCore.properties.wallpaperMode or 1
|
||||
comboBox:addItem(MineOSCore.localization.wallpaperModeStretch)
|
||||
comboBox:addItem(MineOSCore.localization.wallpaperModeCenter)
|
||||
|
||||
local switch = container.layout:addChild(GUI.switchAndLabel(1, 1, 36, 8, 0x66DB80, 0x2D2D2D, 0xE1E1E1, 0xE1E1E1, MineOSCore.localization.wallpaperEnabled .. ":", MineOSCore.properties.wallpaperEnabled)).switch
|
||||
switch.onStateChanged = function()
|
||||
MineOSCore.properties.wallpaperEnabled = switch.state
|
||||
MineOSCore.saveProperties()
|
||||
changeWallpaper()
|
||||
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
end
|
||||
|
||||
container.layout:addChild(GUI.textBox(1, 1, 36, 1, nil, 0x5A5A5A, {MineOSCore.localization.wallpaperSwitchInfo}, 1, 0, 0, true, true))
|
||||
|
||||
local slider = container.layout:addChild(GUI.slider(1, 1, 36, 0x66DB80, 0x2D2D2D, 0xE1E1E1, 0x878787, 0, 100, MineOSCore.properties.wallpaperBrightness * 100, false, MineOSCore.localization.wallpaperBrightness .. ": ", "%"))
|
||||
slider.roundValues = true
|
||||
slider.onValueChanged = function()
|
||||
MineOSCore.properties.wallpaperBrightness = slider.value / 100
|
||||
MineOSCore.saveProperties()
|
||||
changeWallpaper()
|
||||
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
end
|
||||
container.layout:addChild(GUI.object(1, 1, 1, 1))
|
||||
local settingsContextMenu = MineOSInterface.mainContainer.menu:addContextMenu(MineOSCore.localization.settings)
|
||||
if computer.getArchitectures then
|
||||
settingsContextMenu:addItem(MineOSCore.localization.CPUArchitecture).onTouch = function()
|
||||
local container = MineOSInterface.addBackgroundContainer(MineOSInterface.mainContainer, MineOSCore.localization.CPUArchitecture)
|
||||
|
||||
comboBox.onItemSelected = function()
|
||||
MineOSCore.properties.wallpaperMode = comboBox.selectedItem
|
||||
MineOSCore.saveProperties()
|
||||
changeWallpaper()
|
||||
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
end
|
||||
end
|
||||
|
||||
menu:addItem(MineOSCore.localization.screensaver).onTouch = function()
|
||||
local container = MineOSInterface.addBackgroundContainer(MineOSInterface.mainContainer, MineOSCore.localization.screensaver)
|
||||
|
||||
local comboBox = container.layout:addChild(GUI.comboBox(1, 1, 36, 3, 0xE1E1E1, 0x2D2D2D, 0x4B4B4B, 0x969696))
|
||||
local fileList = fs.sortedList(screensaversPath, "name", false)
|
||||
for i = 1, #fileList do
|
||||
comboBox:addItem(fs.hideExtension(fileList[i]))
|
||||
if MineOSCore.properties.screensaver == fileList[i] then
|
||||
local architectures, architecture = computer.getArchitectures(), computer.getArchitecture()
|
||||
for i = 1, #architectures do
|
||||
comboBox:addItem(architectures[i]).onTouch = function()
|
||||
computer.setArchitecture(architectures[i])
|
||||
computer.shutdown(true)
|
||||
end
|
||||
|
||||
if architecture == architectures[i] then
|
||||
comboBox.selectedItem = i
|
||||
end
|
||||
end
|
||||
local switch = container.layout:addChild(GUI.switchAndLabel(1, 1, 36, 8, 0x66DB80, 0x2D2D2D, 0xE1E1E1, 0xE1E1E1, MineOSCore.localization.screensaverEnabled .. ":", MineOSCore.properties.screensaverEnabled)).switch
|
||||
local slider = container.layout:addChild(GUI.slider(1, 1, 36, 0x66DB80, 0x2D2D2D, 0xE1E1E1, 0x878787, 1, 80, MineOSCore.properties.screensaverDelay, false, MineOSCore.localization.screensaverDelay .. ": ", ""))
|
||||
|
||||
container.panel.eventHandler = function(mainContainer, object, e1)
|
||||
if e1 == "touch" then
|
||||
container:remove()
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
end
|
||||
end
|
||||
|
||||
MineOSCore.properties.screensaverEnabled = switch.state
|
||||
MineOSCore.properties.screensaver = fileList[comboBox.selectedItem]
|
||||
MineOSCore.properties.screensaverDelay = slider.value
|
||||
settingsContextMenu:addItem(MineOSCore.localization.RAMControl).onTouch = function()
|
||||
local container = MineOSInterface.addBackgroundContainer(MineOSInterface.mainContainer, MineOSCore.localization.RAMControl)
|
||||
|
||||
MineOSCore.saveProperties()
|
||||
local comboBox = container.layout:addChild(GUI.comboBox(1, 1, 36, 3, 0xE1E1E1, 0x2D2D2D, 0x4B4B4B, 0x969696))
|
||||
comboBox.dropDownMenu.itemHeight = 1
|
||||
|
||||
local function update()
|
||||
local libraries = {}
|
||||
for key in pairs(package.loaded) do
|
||||
if not _G[key] then
|
||||
table.insert(libraries, key)
|
||||
end
|
||||
end
|
||||
|
||||
table.sort(libraries, function(a, b) return a < b end)
|
||||
|
||||
comboBox:clear()
|
||||
for i = 1, #libraries do
|
||||
comboBox:addItem(libraries[i]).onTouch = function()
|
||||
package.loaded[libraries[i]] = nil
|
||||
update()
|
||||
end
|
||||
end
|
||||
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
end
|
||||
|
||||
menu:addItem(MineOSCore.localization.colorScheme).onTouch = function()
|
||||
local container = MineOSInterface.addBackgroundContainer(MineOSInterface.mainContainer, MineOSCore.localization.colorScheme)
|
||||
|
||||
local backgroundColorSelector = container.layout:addChild(GUI.colorSelector(1, 1, 36, 3, MineOSCore.properties.backgroundColor, MineOSCore.localization.backgroundColor))
|
||||
local menuColorSelector = container.layout:addChild(GUI.colorSelector(1, 1, 36, 3, MineOSCore.properties.menuColor, MineOSCore.localization.menuColor))
|
||||
local dockColorSelector = container.layout:addChild(GUI.colorSelector(1, 1, 36, 3, MineOSCore.properties.dockColor, MineOSCore.localization.dockColor))
|
||||
|
||||
local switch = container.layout:addChild(GUI.switchAndLabel(1, 1, 36, 8, 0x66DB80, 0x2D2D2D, 0xE1E1E1, 0xE1E1E1, MineOSCore.localization.transparencyEnabled .. ":", MineOSCore.properties.transparencyEnabled)).switch
|
||||
switch.onStateChanged = function()
|
||||
MineOSCore.properties.transparencyEnabled = switch.state
|
||||
MineOSCore.saveProperties()
|
||||
MineOSInterface.mainContainer.menu.colors.transparency = MineOSCore.properties.transparencyEnabled and menuTransparency
|
||||
container.panel.colors.background = switch.state and GUI.BACKGROUND_CONTAINER_PANEL_COLOR or (MineOSCore.properties.backgroundColor)
|
||||
container.panel.colors.transparency = switch.state and GUI.BACKGROUND_CONTAINER_PANEL_TRANSPARENCY
|
||||
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
end
|
||||
container.layout:addChild(GUI.textBox(1, 1, 36, 1, nil, 0x5A5A5A, {MineOSCore.localization.transparencySwitchInfo}, 1, 0, 0, true, true))
|
||||
|
||||
backgroundColorSelector.onColorSelected = function()
|
||||
MineOSCore.properties.backgroundColor = backgroundColorSelector.color
|
||||
MineOSCore.properties.menuColor = menuColorSelector.color
|
||||
MineOSCore.properties.dockColor = dockColorSelector.color
|
||||
MineOSInterface.mainContainer.menu.colors.default.background = MineOSCore.properties.menuColor
|
||||
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
end
|
||||
menuColorSelector.onColorSelected = backgroundColorSelector.onColorSelected
|
||||
dockColorSelector.onColorSelected = backgroundColorSelector.onColorSelected
|
||||
|
||||
container.panel.eventHandler = function(mainContainer, object, e1)
|
||||
if e1 == "touch" then
|
||||
container:remove()
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
|
||||
MineOSCore.saveProperties()
|
||||
end
|
||||
end
|
||||
local switch = container.layout:addChild(GUI.switchAndLabel(1, 1, 36, 8, 0x66DB80, 0x2D2D2D, 0xE1E1E1, 0x878787, MineOSCore.localization.packageUnloading .. ":", MineOSCore.properties.packageUnloading)).switch
|
||||
switch.onStateChanged = function()
|
||||
MineOSCore.properties.packageUnloading = switch.state
|
||||
MineOSCore.setPackageUnloading(MineOSCore.properties.packageUnloading)
|
||||
MineOSCore.saveProperties()
|
||||
end
|
||||
|
||||
menu:addItem(MineOSCore.localization.iconProperties).onTouch = function()
|
||||
local container = MineOSInterface.addBackgroundContainer(MineOSInterface.mainContainer, MineOSCore.localization.iconProperties)
|
||||
update()
|
||||
end
|
||||
|
||||
local showExtensionSwitch = container.layout:addChild(GUI.switchAndLabel(1, 1, 36, 8, 0x66DB80, 0x2D2D2D, 0xE1E1E1, 0x878787, MineOSCore.localization.showExtension .. ":", MineOSCore.properties.showExtension)).switch
|
||||
local showHiddenFilesSwitch = container.layout:addChild(GUI.switchAndLabel(1, 1, 36, 8, 0x66DB80, 0x2D2D2D, 0xE1E1E1, 0x878787, MineOSCore.localization.showHiddenFiles .. ":", MineOSCore.properties.showHiddenFiles)).switch
|
||||
local showApplicationIconsSwitch = container.layout:addChild(GUI.switchAndLabel(1, 1, 36, 8, 0x66DB80, 0x2D2D2D, 0xE1E1E1, 0x878787, MineOSCore.localization.showApplicationIcons .. ":", MineOSCore.properties.showApplicationIcons)).switch
|
||||
settingsContextMenu:addItem(MineOSCore.localization.screenResolution).onTouch = function()
|
||||
local container = MineOSInterface.addBackgroundContainer(MineOSInterface.mainContainer, MineOSCore.localization.screenResolution)
|
||||
|
||||
container.layout:addChild(GUI.label(1, 1, container.width, 1, 0xE1E1E1, MineOSCore.localization.sizeOfIcons):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP))
|
||||
|
||||
local iconWidthSlider = container.layout:addChild(GUI.slider(1, 1, 36, 0x66DB80, 0x2D2D2D, 0xE1E1E1, 0x878787, 8, 16, MineOSCore.properties.iconWidth, false, MineOSCore.localization.byHorizontal .. ": ", ""))
|
||||
local iconHeightSlider = container.layout:addChild(GUI.slider(1, 1, 36, 0x66DB80, 0x2D2D2D, 0xE1E1E1, 0x878787, 6, 16, MineOSCore.properties.iconHeight, false, MineOSCore.localization.byVertical .. ": ", ""))
|
||||
|
||||
container.layout:addChild(GUI.object(1, 1, 1, 0))
|
||||
container.layout:addChild(GUI.label(1, 1, container.width, 1, 0xE1E1E1, MineOSCore.localization.spaceBetweenIcons):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP))
|
||||
|
||||
local iconHorizontalSpaceBetweenSlider = container.layout:addChild(GUI.slider(1, 1, 36, 0x66DB80, 0x2D2D2D, 0xE1E1E1, 0x878787, 0, 5, MineOSCore.properties.iconHorizontalSpaceBetween, false, MineOSCore.localization.byHorizontal .. ": ", ""))
|
||||
local iconVerticalSpaceBetweenSlider = container.layout:addChild(GUI.slider(1, 1, 36, 0x66DB80, 0x2D2D2D, 0xE1E1E1, 0x878787, 0, 5, MineOSCore.properties.iconVerticalSpaceBetween, false, MineOSCore.localization.byVertical .. ": ", ""))
|
||||
|
||||
iconHorizontalSpaceBetweenSlider.roundValues, iconVerticalSpaceBetweenSlider.roundValues = true, true
|
||||
iconWidthSlider.roundValues, iconHeightSlider.roundValues = true, true
|
||||
|
||||
iconWidthSlider.onValueChanged = function()
|
||||
MineOSInterface.setIconProperties(math.floor(iconWidthSlider.value), math.floor(iconHeightSlider.value), MineOSCore.properties.iconHorizontalSpaceBetween, MineOSCore.properties.iconVerticalSpaceBetween)
|
||||
end
|
||||
iconHeightSlider.onValueChanged = iconWidthSlider.onValueChanged
|
||||
|
||||
iconHorizontalSpaceBetweenSlider.onValueChanged = function()
|
||||
MineOSInterface.setIconProperties(MineOSCore.properties.iconWidth, MineOSCore.properties.iconHeight, math.floor(iconHorizontalSpaceBetweenSlider.value), math.floor(iconVerticalSpaceBetweenSlider.value))
|
||||
end
|
||||
iconVerticalSpaceBetweenSlider.onValueChanged = iconHorizontalSpaceBetweenSlider.onValueChanged
|
||||
|
||||
showExtensionSwitch.onStateChanged = function()
|
||||
MineOSCore.properties.showExtension = showExtensionSwitch.state
|
||||
MineOSCore.properties.showHiddenFiles = showHiddenFilesSwitch.state
|
||||
MineOSCore.properties.showApplicationIcons = showApplicationIconsSwitch.state
|
||||
MineOSCore.saveProperties()
|
||||
|
||||
computer.pushSignal("MineOSCore", "updateFileList")
|
||||
end
|
||||
showHiddenFilesSwitch.onStateChanged, showApplicationIconsSwitch.onStateChanged = showExtensionSwitch.onStateChanged, showExtensionSwitch.onStateChanged
|
||||
local widthTextBox = container.layout:addChild(GUI.input(1, 1, 36, 3, 0xE1E1E1, 0x696969, 0x878787, 0xE1E1E1, 0x2D2D2D, tostring(MineOSCore.properties.resolution and MineOSCore.properties.resolution[1] or 160), "Width", true))
|
||||
widthTextBox.validator = function(text)
|
||||
local number = tonumber(text)
|
||||
if number then return number >= 1 and number <= 160 end
|
||||
end
|
||||
|
||||
menu:addItem(MineOSCore.localization.dateAndTime).onTouch = function()
|
||||
local container = MineOSInterface.addBackgroundContainer(MineOSInterface.mainContainer, MineOSCore.localization.timezone)
|
||||
|
||||
local comboBox = container.layout:addChild(GUI.comboBox(1, 1, 36, 3, 0xE1E1E1, 0x2D2D2D, 0x4B4B4B, 0x969696))
|
||||
comboBox.dropDownMenu.itemHeight = 1
|
||||
|
||||
local label = container.layout:addChild(GUI.label(1, 1, container.width, 1, 0xE1E1E1, MineOSCore.localization.dateFormat):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP))
|
||||
local heightTextBox = container.layout:addChild(GUI.input(1, 1, 36, 3, 0xE1E1E1, 0x696969, 0x878787, 0xE1E1E1, 0x2D2D2D, tostring(MineOSCore.properties.resolution and MineOSCore.properties.resolution[2] or 50), "Height", true))
|
||||
heightTextBox.validator = function(text)
|
||||
local number = tonumber(text)
|
||||
if number then return number >= 1 and number <= 50 end
|
||||
end
|
||||
|
||||
local input = container.layout:addChild(GUI.input(1, 1, 36, 3, 0xE1E1E1, 0x696969, 0x878787, 0xE1E1E1, 0x2D2D2D, MineOSCore.properties.dateFormat or ""))
|
||||
input.onInputFinished = function()
|
||||
MineOSCore.properties.dateFormat = input.text
|
||||
container.panel.eventHandler = function(mainContainer, object, e1)
|
||||
if e1 == "touch" then
|
||||
container:remove()
|
||||
MineOSCore.properties.resolution = {tonumber(widthTextBox.text), tonumber(heightTextBox.text)}
|
||||
MineOSCore.saveProperties()
|
||||
changeResolution()
|
||||
changeWallpaper()
|
||||
MineOSInterface.mainContainer.updateFileListAndDraw()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
settingsContextMenu:addSeparator()
|
||||
|
||||
settingsContextMenu:addItem(MineOSCore.localization.systemLanguage).onTouch = function()
|
||||
local container = MineOSInterface.addBackgroundContainer(MineOSInterface.mainContainer, MineOSCore.localization.systemLanguage)
|
||||
|
||||
local comboBox = container.layout:addChild(GUI.comboBox(1, 1, 36, 3, 0xE1E1E1, 0x2D2D2D, 0x4B4B4B, 0x969696))
|
||||
for file in fs.list(MineOSPaths.localizationFiles) do
|
||||
local name = fs.hideExtension(file)
|
||||
comboBox:addItem(name).onTouch = function()
|
||||
MineOSCore.properties.language = name
|
||||
MineOSCore.localization = MineOSCore.getLocalization(MineOSPaths.localizationFiles)
|
||||
|
||||
createOSWidgets()
|
||||
changeResolution()
|
||||
changeWallpaper()
|
||||
MineOSCore.OSUpdateDate()
|
||||
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
MineOSInterface.mainContainer.updateFileListAndDraw()
|
||||
MineOSCore.saveProperties()
|
||||
end
|
||||
|
||||
for i = -12, 12 do
|
||||
comboBox:addItem("GMT" .. (i >= 0 and "+" or "") .. i).onTouch = function()
|
||||
MineOSCore.properties.timezone = i
|
||||
MineOSCore.OSUpdateTimezone(i)
|
||||
MineOSCore.OSUpdateDate()
|
||||
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
MineOSCore.saveProperties()
|
||||
end
|
||||
if name == MineOSCore.properties.language then
|
||||
comboBox.selectedItem = comboBox:count()
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
settingsContextMenu:addItem(MineOSCore.localization.wallpaper).onTouch = function()
|
||||
local container = MineOSInterface.addBackgroundContainer(MineOSInterface.mainContainer, MineOSCore.localization.wallpaper)
|
||||
|
||||
local filesystemChooser = container.layout:addChild(GUI.filesystemChooser(1, 1, 36, 3, 0xE1E1E1, 0x2D2D2D, 0x4B4B4B, 0x969696, MineOSCore.properties.wallpaper, MineOSCore.localization.open, MineOSCore.localization.cancel, MineOSCore.localization.wallpaperPath, "/"))
|
||||
filesystemChooser:addExtensionFilter(".pic")
|
||||
filesystemChooser.onSubmit = function(path)
|
||||
MineOSCore.properties.wallpaper = path
|
||||
MineOSCore.saveProperties()
|
||||
changeWallpaper()
|
||||
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
end
|
||||
|
||||
menu:addSeparator()
|
||||
local comboBox = container.layout:addChild(GUI.comboBox(1, 1, 36, 3, 0xE1E1E1, 0x2D2D2D, 0x4B4B4B, 0x969696))
|
||||
comboBox.selectedItem = MineOSCore.properties.wallpaperMode or 1
|
||||
comboBox:addItem(MineOSCore.localization.wallpaperModeStretch)
|
||||
comboBox:addItem(MineOSCore.localization.wallpaperModeCenter)
|
||||
|
||||
menu:addItem(MineOSCore.localization.setProtectionMethod).onTouch = function()
|
||||
setProtectionMethod()
|
||||
local switch = container.layout:addChild(GUI.switchAndLabel(1, 1, 36, 8, 0x66DB80, 0x2D2D2D, 0xE1E1E1, 0xE1E1E1, MineOSCore.localization.wallpaperEnabled .. ":", MineOSCore.properties.wallpaperEnabled)).switch
|
||||
switch.onStateChanged = function()
|
||||
MineOSCore.properties.wallpaperEnabled = switch.state
|
||||
MineOSCore.saveProperties()
|
||||
changeWallpaper()
|
||||
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
end
|
||||
|
||||
container.layout:addChild(GUI.textBox(1, 1, 36, 1, nil, 0x5A5A5A, {MineOSCore.localization.wallpaperSwitchInfo}, 1, 0, 0, true, true))
|
||||
|
||||
local slider = container.layout:addChild(GUI.slider(1, 1, 36, 0x66DB80, 0x2D2D2D, 0xE1E1E1, 0x878787, 0, 100, MineOSCore.properties.wallpaperBrightness * 100, false, MineOSCore.localization.wallpaperBrightness .. ": ", "%"))
|
||||
slider.roundValues = true
|
||||
slider.onValueChanged = function()
|
||||
MineOSCore.properties.wallpaperBrightness = slider.value / 100
|
||||
MineOSCore.saveProperties()
|
||||
changeWallpaper()
|
||||
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
end
|
||||
container.layout:addChild(GUI.object(1, 1, 1, 1))
|
||||
|
||||
comboBox.onItemSelected = function()
|
||||
MineOSCore.properties.wallpaperMode = comboBox.selectedItem
|
||||
MineOSCore.saveProperties()
|
||||
changeWallpaper()
|
||||
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
end
|
||||
end
|
||||
|
||||
settingsContextMenu:addItem(MineOSCore.localization.screensaver).onTouch = function()
|
||||
local container = MineOSInterface.addBackgroundContainer(MineOSInterface.mainContainer, MineOSCore.localization.screensaver)
|
||||
|
||||
local comboBox = container.layout:addChild(GUI.comboBox(1, 1, 36, 3, 0xE1E1E1, 0x2D2D2D, 0x4B4B4B, 0x969696))
|
||||
local fileList = fs.sortedList(screensaversPath, "name", false)
|
||||
for i = 1, #fileList do
|
||||
comboBox:addItem(fs.hideExtension(fileList[i]))
|
||||
if MineOSCore.properties.screensaver == fileList[i] then
|
||||
comboBox.selectedItem = i
|
||||
end
|
||||
end
|
||||
local switch = container.layout:addChild(GUI.switchAndLabel(1, 1, 36, 8, 0x66DB80, 0x2D2D2D, 0xE1E1E1, 0xE1E1E1, MineOSCore.localization.screensaverEnabled .. ":", MineOSCore.properties.screensaverEnabled)).switch
|
||||
local slider = container.layout:addChild(GUI.slider(1, 1, 36, 0x66DB80, 0x2D2D2D, 0xE1E1E1, 0x878787, 1, 80, MineOSCore.properties.screensaverDelay, false, MineOSCore.localization.screensaverDelay .. ": ", ""))
|
||||
|
||||
container.panel.eventHandler = function(mainContainer, object, e1)
|
||||
if e1 == "touch" then
|
||||
container:remove()
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
|
||||
MineOSCore.properties.screensaverEnabled = switch.state
|
||||
MineOSCore.properties.screensaver = fileList[comboBox.selectedItem]
|
||||
MineOSCore.properties.screensaverDelay = slider.value
|
||||
|
||||
MineOSCore.saveProperties()
|
||||
end
|
||||
end
|
||||
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
end
|
||||
|
||||
settingsContextMenu:addItem(MineOSCore.localization.colorScheme).onTouch = function()
|
||||
local container = MineOSInterface.addBackgroundContainer(MineOSInterface.mainContainer, MineOSCore.localization.colorScheme)
|
||||
|
||||
local backgroundColorSelector = container.layout:addChild(GUI.colorSelector(1, 1, 36, 3, MineOSCore.properties.backgroundColor, MineOSCore.localization.backgroundColor))
|
||||
local menuColorSelector = container.layout:addChild(GUI.colorSelector(1, 1, 36, 3, MineOSCore.properties.menuColor, MineOSCore.localization.menuColor))
|
||||
local dockColorSelector = container.layout:addChild(GUI.colorSelector(1, 1, 36, 3, MineOSCore.properties.dockColor, MineOSCore.localization.dockColor))
|
||||
|
||||
local switch = container.layout:addChild(GUI.switchAndLabel(1, 1, 36, 8, 0x66DB80, 0x2D2D2D, 0xE1E1E1, 0xE1E1E1, MineOSCore.localization.transparencyEnabled .. ":", MineOSCore.properties.transparencyEnabled)).switch
|
||||
switch.onStateChanged = function()
|
||||
MineOSCore.properties.transparencyEnabled = switch.state
|
||||
MineOSCore.saveProperties()
|
||||
MineOSInterface.mainContainer.menu.colors.transparency = MineOSCore.properties.transparencyEnabled and menuTransparency
|
||||
container.panel.colors.background = switch.state and GUI.BACKGROUND_CONTAINER_PANEL_COLOR or (MineOSCore.properties.backgroundColor)
|
||||
container.panel.colors.transparency = switch.state and GUI.BACKGROUND_CONTAINER_PANEL_TRANSPARENCY
|
||||
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
end
|
||||
container.layout:addChild(GUI.textBox(1, 1, 36, 1, nil, 0x5A5A5A, {MineOSCore.localization.transparencySwitchInfo}, 1, 0, 0, true, true))
|
||||
|
||||
backgroundColorSelector.onColorSelected = function()
|
||||
MineOSCore.properties.backgroundColor = backgroundColorSelector.color
|
||||
MineOSCore.properties.menuColor = menuColorSelector.color
|
||||
MineOSCore.properties.dockColor = dockColorSelector.color
|
||||
MineOSInterface.mainContainer.menu.colors.default.background = MineOSCore.properties.menuColor
|
||||
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
end
|
||||
menuColorSelector.onColorSelected = backgroundColorSelector.onColorSelected
|
||||
dockColorSelector.onColorSelected = backgroundColorSelector.onColorSelected
|
||||
|
||||
container.panel.eventHandler = function(mainContainer, object, e1)
|
||||
if e1 == "touch" then
|
||||
container:remove()
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
|
||||
MineOSCore.saveProperties()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
settingsContextMenu:addItem(MineOSCore.localization.iconProperties).onTouch = function()
|
||||
local container = MineOSInterface.addBackgroundContainer(MineOSInterface.mainContainer, MineOSCore.localization.iconProperties)
|
||||
|
||||
local showExtensionSwitch = container.layout:addChild(GUI.switchAndLabel(1, 1, 36, 8, 0x66DB80, 0x2D2D2D, 0xE1E1E1, 0x878787, MineOSCore.localization.showExtension .. ":", MineOSCore.properties.showExtension)).switch
|
||||
local showHiddenFilesSwitch = container.layout:addChild(GUI.switchAndLabel(1, 1, 36, 8, 0x66DB80, 0x2D2D2D, 0xE1E1E1, 0x878787, MineOSCore.localization.showHiddenFiles .. ":", MineOSCore.properties.showHiddenFiles)).switch
|
||||
local showApplicationIconsSwitch = container.layout:addChild(GUI.switchAndLabel(1, 1, 36, 8, 0x66DB80, 0x2D2D2D, 0xE1E1E1, 0x878787, MineOSCore.localization.showApplicationIcons .. ":", MineOSCore.properties.showApplicationIcons)).switch
|
||||
|
||||
container.layout:addChild(GUI.label(1, 1, container.width, 1, 0xE1E1E1, MineOSCore.localization.sizeOfIcons):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP))
|
||||
|
||||
local iconWidthSlider = container.layout:addChild(GUI.slider(1, 1, 36, 0x66DB80, 0x2D2D2D, 0xE1E1E1, 0x878787, 8, 16, MineOSCore.properties.iconWidth, false, MineOSCore.localization.byHorizontal .. ": ", ""))
|
||||
local iconHeightSlider = container.layout:addChild(GUI.slider(1, 1, 36, 0x66DB80, 0x2D2D2D, 0xE1E1E1, 0x878787, 6, 16, MineOSCore.properties.iconHeight, false, MineOSCore.localization.byVertical .. ": ", ""))
|
||||
|
||||
container.layout:addChild(GUI.object(1, 1, 1, 0))
|
||||
container.layout:addChild(GUI.label(1, 1, container.width, 1, 0xE1E1E1, MineOSCore.localization.spaceBetweenIcons):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP))
|
||||
|
||||
local iconHorizontalSpaceBetweenSlider = container.layout:addChild(GUI.slider(1, 1, 36, 0x66DB80, 0x2D2D2D, 0xE1E1E1, 0x878787, 0, 5, MineOSCore.properties.iconHorizontalSpaceBetween, false, MineOSCore.localization.byHorizontal .. ": ", ""))
|
||||
local iconVerticalSpaceBetweenSlider = container.layout:addChild(GUI.slider(1, 1, 36, 0x66DB80, 0x2D2D2D, 0xE1E1E1, 0x878787, 0, 5, MineOSCore.properties.iconVerticalSpaceBetween, false, MineOSCore.localization.byVertical .. ": ", ""))
|
||||
|
||||
iconHorizontalSpaceBetweenSlider.roundValues, iconVerticalSpaceBetweenSlider.roundValues = true, true
|
||||
iconWidthSlider.roundValues, iconHeightSlider.roundValues = true, true
|
||||
|
||||
iconWidthSlider.onValueChanged = function()
|
||||
MineOSInterface.setIconProperties(math.floor(iconWidthSlider.value), math.floor(iconHeightSlider.value), MineOSCore.properties.iconHorizontalSpaceBetween, MineOSCore.properties.iconVerticalSpaceBetween)
|
||||
end
|
||||
iconHeightSlider.onValueChanged = iconWidthSlider.onValueChanged
|
||||
|
||||
iconHorizontalSpaceBetweenSlider.onValueChanged = function()
|
||||
MineOSInterface.setIconProperties(MineOSCore.properties.iconWidth, MineOSCore.properties.iconHeight, math.floor(iconHorizontalSpaceBetweenSlider.value), math.floor(iconVerticalSpaceBetweenSlider.value))
|
||||
end
|
||||
iconVerticalSpaceBetweenSlider.onValueChanged = iconHorizontalSpaceBetweenSlider.onValueChanged
|
||||
|
||||
showExtensionSwitch.onStateChanged = function()
|
||||
MineOSCore.properties.showExtension = showExtensionSwitch.state
|
||||
MineOSCore.properties.showHiddenFiles = showHiddenFilesSwitch.state
|
||||
MineOSCore.properties.showApplicationIcons = showApplicationIconsSwitch.state
|
||||
MineOSCore.saveProperties()
|
||||
|
||||
computer.pushSignal("MineOSCore", "updateFileList")
|
||||
end
|
||||
showHiddenFilesSwitch.onStateChanged, showApplicationIconsSwitch.onStateChanged = showExtensionSwitch.onStateChanged, showExtensionSwitch.onStateChanged
|
||||
end
|
||||
|
||||
settingsContextMenu:addItem(MineOSCore.localization.dateAndTime).onTouch = function()
|
||||
local container = MineOSInterface.addBackgroundContainer(MineOSInterface.mainContainer, MineOSCore.localization.timezone)
|
||||
|
||||
local comboBox = container.layout:addChild(GUI.comboBox(1, 1, 36, 3, 0xE1E1E1, 0x2D2D2D, 0x4B4B4B, 0x969696))
|
||||
comboBox.dropDownMenu.itemHeight = 1
|
||||
|
||||
local label = container.layout:addChild(GUI.label(1, 1, container.width, 1, 0xE1E1E1, MineOSCore.localization.dateFormat):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP))
|
||||
|
||||
local input = container.layout:addChild(GUI.input(1, 1, 36, 3, 0xE1E1E1, 0x696969, 0x878787, 0xE1E1E1, 0x2D2D2D, MineOSCore.properties.dateFormat or ""))
|
||||
input.onInputFinished = function()
|
||||
MineOSCore.properties.dateFormat = input.text
|
||||
MineOSCore.OSUpdateDate()
|
||||
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
MineOSCore.saveProperties()
|
||||
end
|
||||
|
||||
for i = -12, 12 do
|
||||
comboBox:addItem("GMT" .. (i >= 0 and "+" or "") .. i).onTouch = function()
|
||||
MineOSCore.properties.timezone = i
|
||||
MineOSCore.OSUpdateTimezone(i)
|
||||
MineOSCore.OSUpdateDate()
|
||||
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
MineOSCore.saveProperties()
|
||||
end
|
||||
end
|
||||
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
end
|
||||
|
||||
settingsContextMenu:addSeparator()
|
||||
|
||||
settingsContextMenu:addItem(MineOSCore.localization.setProtectionMethod).onTouch = function()
|
||||
setProtectionMethod()
|
||||
end
|
||||
|
||||
MineOSInterface.mainContainer.menuLayout = MineOSInterface.mainContainer:addChild(GUI.layout(1, 1, 1, 1, 1, 1))
|
||||
MineOSInterface.mainContainer.menuLayout:setDirection(1, 1, GUI.DIRECTION_HORIZONTAL)
|
||||
MineOSInterface.mainContainer.menuLayout:setAlignment(1, 1, GUI.ALIGNMENT_HORIZONTAL_RIGHT, GUI.ALIGNMENT_VERTICAL_TOP)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user