From 45342e7d8f4c4e384d540cead06902a6f7c0026e Mon Sep 17 00:00:00 2001 From: Igor Timofeev Date: Sun, 15 Jan 2017 02:43:42 +0300 Subject: [PATCH] aefae --- .DS_Store | Bin 18436 -> 18436 bytes Applications.txt | 8 ++-- Applications/MineCodeIDE/MineCodeIDE.lua | 46 ++++++++++++++++++++++- lib/ECSAPI.lua | 2 +- lib/GUI.lua | 2 +- lib/MineOSCore.lua | 8 +++- 6 files changed, 57 insertions(+), 9 deletions(-) diff --git a/.DS_Store b/.DS_Store index 5c29f80a4e716c7dada2b59cce9dba2b24a6954a..69bd8064c181cac9a09a5dcd76afb47da0151074 100644 GIT binary patch delta 458 zcmXZY&r4KM7{>AYjf8XX)SOY1nVXxYaZ<7{0xMC-7HXNfnY6N^tM@9`=0|m>Q7fXw z^b-Q%L=hB4QUoo^Cb3#se?f~`wQ3P9+85NOZZmD)_kH-hJf#In3%u&lG@D*sUaOi^ zv-z|wX6j?>Qx%!cIa#j~(a{DKw>L_?ERMTQ!5hxI{*>>z)s0zdZJe&2Bzepo-PU)FEy4+2R&iZ}^2lcbY9 zbkjpG`xxRNhZrHv2~KhfhiT4mmVg46xXLwdatp%)9`cCCyyPwKcyF#WjMlXb?jMYV zRV|v!jWed$mWsr}W>i8YWt584mU+=OQP(ep#*~@{#yja^FZ~Q~AasWrWsGBthw@aY z`pl5wJVoZ1=OU$0zs`-Seuul<<33MV|3YQbmJdTm#zeNF5L(|?o4tQ7tTHR_c&j5nd&lcc1hap-Lht9 zx}r;~9?xp4^tN^S3^8qHD%M2F%;)l!DOdEmv)N}DX~)^SV5!^Gb+;f8G(@VLU$kVV z@i7z@A~l;YnzGzz+8q(b;X>wwRgk8qUKZ;W#*s7DLOEY5$}!Jq{dIf4Fs8DlxjCy? zDSL@DKF0?PMP6iobm_3YffP)+&#WAv2-C%xXulg@-Fwd&jTLwgr_{?Id7@4!aLsc Z(aBv4bu@Lg#QGvzdi(ooJ@K#W{{!o>jPU>f 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