diff --git a/.DS_Store b/.DS_Store index 5c29f80a..69bd8064 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/Applications.txt b/Applications.txt index 973daa4d..52338eee 100644 --- a/Applications.txt +++ b/Applications.txt @@ -253,7 +253,7 @@ name="lib/MineOSCore.lua", url="IgorTimofeev/OpenComputers/master/lib/MineOSCore.lua", type="Library", - version=1.44, + version=1.45, }, { name="lib/advancedLua.lua", @@ -274,7 +274,7 @@ url="IgorTimofeev/OpenComputers/master/lib/ECSAPI.lua", type="Library", preLoadFile=true, - version=1.12, + version=1.13, }, { name="lib/colorlib.lua", @@ -300,7 +300,7 @@ name="lib/GUI.lua", url="IgorTimofeev/OpenComputers/master/lib/GUI.lua", type="Library", - version=1.31, + version=1.32, }, { name="lib/windows.lua", @@ -886,7 +886,7 @@ icon="IgorTimofeev/OpenComputers/master/Applications/MineCodeIDE/Icon.pic", createShortcut="dock", forceDownload=true, - version=1.16, + version=1.17, }, { name="MineOS/Applications/Battleship", diff --git a/Applications/MineCodeIDE/MineCodeIDE.lua b/Applications/MineCodeIDE/MineCodeIDE.lua index c490948a..e20bc2ee 100755 --- a/Applications/MineCodeIDE/MineCodeIDE.lua +++ b/Applications/MineCodeIDE/MineCodeIDE.lua @@ -1,7 +1,7 @@ ---------------------------------------------------- Libraries ---------------------------------------------------- --- "/MineOS/Applications/MineCode IDE.app/MineCode IDE.lua" open Govno.lua +-- "/MineOS/Applications/MineCode IDE.app/MineCode IDE.lua" open OS.lua -- package.loaded.syntax = nil -- package.loaded.GUI = nil @@ -48,6 +48,24 @@ local config = { } } }, + syntaxColorScheme = { + background = 0x1E1E1E, + text = 0xffffff, + strings = 0x99FF80, + loops = 0xffff98, + comments = 0x888888, + boolean = 0xffcc66, + logic = 0xffcc66, + numbers = 0x66DBFF, + functions = 0xffcc66, + compares = 0xffff98, + lineNumbers = 0x2D2D2D, + lineNumbersText = 0xCCCCCC, + scrollBarBackground = 0x444444, + scrollBarForeground = 0x33B6FF, + selection = 0x555555, + indentation = 0x2D2D2D, + }, scrollSpeed = 8, } @@ -69,6 +87,10 @@ local mainWindow = {} ---------------------------------------------------- Safe launch ---------------------------------------------------- +local function updateColorScheme() + syntax.colorScheme = config.syntaxColorScheme +end + local function showErrorMessage(text) mainWindow.errorMessage.errorTextBox.lines = string.wrap({text}, mainWindow.errorMessage.errorTextBox.width) mainWindow.errorMessage.height = 2 + #mainWindow.errorMessage.errorTextBox.lines @@ -602,6 +624,27 @@ local function createWindow() local item3 = mainWindow.topMenu:addItem("View") item3.onTouch = function() local menu = GUI.contextMenu(item3.x, item3.y + 1) + menu:addItem("Color scheme").onTouch = function() + local variants = {} + for key in pairs(config.syntaxColorScheme) do + table.insert(variants, key) + end + + local data = ecs.universalWindow("auto", "auto", 30, ecs.windowColors.background, true, + {"EmptyLine"}, + {"CenterText", 0x000000, "Color scheme"}, + {"EmptyLine"}, + {"Selector", 0x262626, 0x880000, table.unpack(variants)}, + {"Color", "Color", 0x000000}, + {"EmptyLine"}, + {"Button", {0xAAAAAA, 0xffffff, "OK"}, {0x888888, 0xffffff, MineOSCore.localization.cancel}} + ) + + if data[#data] == "OK" then + config.syntaxColorScheme[data[1]] = data[2] + end + updateColorScheme() + end menu:addItem("Toggle top toolbar").onTouch = function() mainWindow.topToolBar.isHidden = not mainWindow.topToolBar.isHidden calculateSizes() @@ -788,6 +831,7 @@ end buffer.start() +updateColorScheme() createWindow() calculateSizes() mainWindow:draw() diff --git a/lib/ECSAPI.lua b/lib/ECSAPI.lua index 3823aaa4..f8524983 100755 --- a/lib/ECSAPI.lua +++ b/lib/ECSAPI.lua @@ -2039,7 +2039,7 @@ function ecs.universalWindow(x, y, width, background, closeWindowAfter, ...) local screenWidth, screenHeight = component.gpu.getResolution() local paletteX, paletteY = math.floor(screenWidth / 2 - paletteWidth / 2), math.floor(screenHeight / 2 - paletteHeight / 2) local oldPixels = ecs.rememberOldPixels(paletteX, paletteY, paletteX + paletteWidth - 1, paletteY + paletteHeight - 1) - local color = loadfile("lib/palette.lua")().draw("auto", "auto", objects[key][3]) + local color = require("palette").draw("auto", "auto", objects[key][3]) ecs.drawOldPixels(oldPixels) objects[key][3] = color or oldColor diff --git a/lib/GUI.lua b/lib/GUI.lua index 977b7bc1..41a36ccd 100755 --- a/lib/GUI.lua +++ b/lib/GUI.lua @@ -1610,7 +1610,7 @@ local function codeViewDraw(codeView) codeView.scrollBars.horizontal.isHidden = false codeView.scrollBars.horizontal.colors.background, codeView.scrollBars.horizontal.colors.foreground = syntax.colorScheme.scrollBarBackground, syntax.colorScheme.scrollBarForeground codeView.scrollBars.horizontal.minimumValue, codeView.scrollBars.horizontal.maximumValue, codeView.scrollBars.horizontal.value, codeView.scrollBars.horizontal.shownValueCount = 1, codeView.maximumLineLength, codeView.fromSymbol, codeView.codeAreaWidth - 2 - codeView.scrollBars.horizontal.localPosition.x, codeView.scrollBars.horizontal.width = codeView.lineNumbersWidth + 1, codeView.codeAreaWidth - codeView.lineNumbersWidth + codeView.scrollBars.horizontal.localPosition.x, codeView.scrollBars.horizontal.width = codeView.lineNumbersWidth + 1, codeView.codeAreaWidth - 2 codeView.scrollBars.horizontal.localPosition.y = codeView.height else codeView.scrollBars.horizontal.isHidden = true diff --git a/lib/MineOSCore.lua b/lib/MineOSCore.lua index f9da4836..92adca3b 100755 --- a/lib/MineOSCore.lua +++ b/lib/MineOSCore.lua @@ -587,8 +587,12 @@ function MineOSCore.safeLaunch(path, ...) end local runSuccess, runReason = xpcall(launchMethod, tracebackMethod) - if not runSuccess and not string.match(runReason.traceback, "^table") and not string.find(runReason.traceback, "interrupted", 1, 15) then - finalSuccess, finalPath, finalLine, finalTraceback = false, runReason.path, runReason.line, runReason.traceback + if type(runReason) == "string" then + GUI.error(runReason, {title = {color = 0xFFDB40, text = "Warning"}}) + else + if not runSuccess and not string.match(runReason.traceback, "^table") and not string.find(runReason.traceback, "interrupted", 1, 15) then + finalSuccess, finalPath, finalLine, finalTraceback = false, runReason.path, runReason.line, runReason.traceback + end end else finalSuccess, finalPath, finalTraceback = false, path, loadReason