From 7832b06ba33eda44398cdee2994aa20f31d20028 Mon Sep 17 00:00:00 2001 From: Igor Timofeev Date: Sun, 15 Jan 2017 01:37:48 +0300 Subject: [PATCH] aefaf --- .DS_Store | Bin 18436 -> 18436 bytes Applications.txt | 6 ++--- Applications/.DS_Store | Bin 79876 -> 79876 bytes Applications/MineCodeIDE/MineCodeIDE.lua | 30 ++++++++++++----------- lib/ECSAPI.lua | 2 -- lib/GUI.lua | 28 ++++++++++++++------- 6 files changed, 38 insertions(+), 28 deletions(-) diff --git a/.DS_Store b/.DS_Store index 82743031270711f8c8844e55098481b8f5a77f5a..ed27f62c0f54d7d2c0db1dde9f214ae9f067a199 100644 GIT binary patch delta 596 zcmXYt%WD%+9EImos}s1=o7UQ9L_#7ai-xokADC*>YLS$-STxp3st_|1O`9gAiLWZw zMHCg3>L4n(QA7pNDxvC9)P;XQUAhw7xpbrWxHHLJTsZgK-{XAM1*!|Y+9heVcgvcc z*⋘_IQ??rMIQSXNU`|nl0x`MLFadtiNvCE{ySPX?of! zR?1!?jnDBO!#L)Q9?q02`)918TI+LTenPEv#PRw~(^<;??%k37s(sUbXg{@I+8^z& z_79yl+UdYYkSJYrvy)!>=w}Z@jB&&vly@w@}YgPbNv0@piZh&ZQ&zdcRjzSerM$yk?s1<-Jmv{cdB$sMEb)f7 cymxZfLT#S}F?(@+vK9;eZYNgjiho)AAJ6fSYybcN delta 467 zcmXYt%S%*Y7{<>J63&NT%{OY(%*oX>O-3e$U?mFK!b@gtCbhKa=sC)9kZDxG$ z!vE41xm74%WKMYbTG(opZKiU>p{zaWX2ZUs1j7=4C zIX7SQYpiYQW@RO;Uei4M?~z`|aUH!J-8uEm_-_0#R*av$- L8$xlm>-O5e-M4s` diff --git a/Applications.txt b/Applications.txt index 98302a3a..0edb41b4 100644 --- a/Applications.txt +++ b/Applications.txt @@ -274,7 +274,7 @@ url="IgorTimofeev/OpenComputers/master/lib/ECSAPI.lua", type="Library", preLoadFile=true, - version=1.11, + version=1.12, }, { name="lib/colorlib.lua", @@ -300,7 +300,7 @@ name="lib/GUI.lua", url="IgorTimofeev/OpenComputers/master/lib/GUI.lua", type="Library", - version=1.30, + version=1.31, }, { name="lib/windows.lua", @@ -886,7 +886,7 @@ icon="IgorTimofeev/OpenComputers/master/Applications/MineCodeIDE/Icon.pic", createShortcut="dock", forceDownload=true, - version=1.14, + version=1.15, }, { name="MineOS/Applications/Battleship", diff --git a/Applications/.DS_Store b/Applications/.DS_Store index f9f576ebdde9326432576e1ead153b1ed8c7d7a2..4bb0935629d59f3cdc30a2c39efcdaca50686c8c 100644 GIT binary patch delta 20 ccmZqqz|!)8Wy9+2jK-56I(TgUvR$A70Bau#ApigX delta 20 ccmZqqz|!)8Wy9+2j7F0mI(TgUvR$A70BaQrAOHXW diff --git a/Applications/MineCodeIDE/MineCodeIDE.lua b/Applications/MineCodeIDE/MineCodeIDE.lua index 5d262372..80c96129 100755 --- a/Applications/MineCodeIDE/MineCodeIDE.lua +++ b/Applications/MineCodeIDE/MineCodeIDE.lua @@ -1,8 +1,7 @@ ---------------------------------------------------- Libraries ---------------------------------------------------- --- "/MineOS/Desktop/MineCode IDE.app/MineCode IDE.lua" --- "/MineOS/Applications/MineCode IDE.app/MineCode IDE.lua" +-- "/MineOS/Applications/MineCode IDE.app/MineCode IDE.lua" open Govno.lua -- package.loaded.syntax = nil -- package.loaded.GUI = nil @@ -218,6 +217,7 @@ local function loadFile(path) end file:close() workPath = path + if #mainWindow.codeView.lines == 0 then table.insert(mainWindow.codeView.lines, "") end setCursorPositionAndClearSelection(1, 1) end @@ -231,13 +231,7 @@ local function saveFile(path) end local function newFile() - mainWindow.codeView.lines = { - "", - "for i = 1, 10 do", - " print(\"Hello world!\")", - "end", - "" - } + mainWindow.codeView.lines = {""} workPath = nil setCursorPositionAndClearSelection(1, 1) end @@ -759,10 +753,14 @@ local function createWindow() end elseif eventData[1] == "clipboard" then local lines = {} - for line in eventData[3]:gmatch("(.+)\n") do table.insert(lines, removeTabs(line)) end + for line in eventData[3]:gmatch("([^\r\n]+)\r?\n?") do + line = removeTabs(line) + table.insert(lines, line) + end + table.insert(lines, "") paste(lines) elseif eventData[1] == "scroll" then - if mainWindow.codeView:isClicked(eventData[3], eventData[4]) then + if isClickedOnCodeArea(eventData[3], eventData[4]) then scroll(eventData[5], config.scrollSpeed) end elseif not eventData[1] then @@ -792,11 +790,15 @@ buffer.start() createWindow() calculateSizes() -mainWindow.drawShadow = false mainWindow:draw() -if args[1] == "open" and fs.exists(args[2]) then - loadFile(args[2]) +if args[1] == "open" then + if fs.exists(args[2]) then + loadFile(args[2]) + else + newFile() + workPath = args[2] + end else newFile() end diff --git a/lib/ECSAPI.lua b/lib/ECSAPI.lua index d8690332..3823aaa4 100755 --- a/lib/ECSAPI.lua +++ b/lib/ECSAPI.lua @@ -1178,8 +1178,6 @@ function ecs.newFile(path) local inputs = ecs.universalWindow("auto", "auto", 30, ecs.windowColors.background, true, {"EmptyLine"}, {"CenterText", 0x262626, "Новый файл"}, {"EmptyLine"}, {"Input", 0x262626, 0x880000, ""}, {"EmptyLine"}, {"Button", {0xbbbbbb, 0xffffff, "OK"}}) if ecs.checkName(inputs[1], path) then - fs.makeDirectory(path) - local file = io.open(path .. inputs[1], "w"); file:write(""); file:close() local MineOSCore = require("MineOSCore") MineOSCore.safeLaunch(MineOSCore.paths.applications .. "/MineCode IDE.app/MineCode IDE.lua", "open", path .. inputs[1]) end diff --git a/lib/GUI.lua b/lib/GUI.lua index c4f5e7fe..977b7bc1 100755 --- a/lib/GUI.lua +++ b/lib/GUI.lua @@ -1595,16 +1595,26 @@ local function codeViewDraw(codeView) end buffer.setDrawLimit(oldDrawLimit) - codeView.scrollBars.vertical.colors.background, codeView.scrollBars.vertical.colors.foreground = syntax.colorScheme.scrollBarBackground, syntax.colorScheme.scrollBarForeground - codeView.scrollBars.vertical.minimumValue, codeView.scrollBars.vertical.maximumValue, codeView.scrollBars.vertical.value, codeView.scrollBars.vertical.shownValueCount = 1, #codeView.lines, codeView.fromLine, codeView.height - codeView.scrollBars.vertical.localPosition.x = codeView.width - codeView.scrollBars.vertical.localPosition.y = 1 - codeView.scrollBars.vertical.height = codeView.height + if #codeView.lines > codeView.height then + codeView.scrollBars.vertical.isHidden = false + codeView.scrollBars.vertical.colors.background, codeView.scrollBars.vertical.colors.foreground = syntax.colorScheme.scrollBarBackground, syntax.colorScheme.scrollBarForeground + codeView.scrollBars.vertical.minimumValue, codeView.scrollBars.vertical.maximumValue, codeView.scrollBars.vertical.value, codeView.scrollBars.vertical.shownValueCount = 1, #codeView.lines, codeView.fromLine, codeView.height + codeView.scrollBars.vertical.localPosition.x = codeView.width + codeView.scrollBars.vertical.localPosition.y = 1 + codeView.scrollBars.vertical.height = codeView.height + else + codeView.scrollBars.vertical.isHidden = true + end - 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 - 1 - codeView.scrollBars.horizontal.localPosition.y = codeView.height + if codeView.maximumLineLength > codeView.codeAreaWidth - 2 then + 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.y = codeView.height + else + codeView.scrollBars.horizontal.isHidden = true + end codeView:reimplementedDraw() end