From e2cac07ae390379101db6ee7f44ecea297d52c07 Mon Sep 17 00:00:00 2001 From: Igor Timofeev Date: Mon, 16 Jan 2017 06:50:08 +0300 Subject: [PATCH] aefaef --- .DS_Store | Bin 18436 -> 18436 bytes Applications.txt | 6 +-- Applications/.DS_Store | Bin 79876 -> 79876 bytes Applications/MineCodeIDE/MineCodeIDE.lua | 32 +++++++---- lib/GUI.lua | 65 ++++++++--------------- lib/windows.lua | 18 ++++--- 6 files changed, 58 insertions(+), 63 deletions(-) diff --git a/.DS_Store b/.DS_Store index 7133356ce001d26a1367998282f128007832047f..53af7b5eae1eaf07444c9c257ea7059efb742c5a 100644 GIT binary patch delta 458 zcmXZY%S%*Y7{~GRg@pITm*yR{Vdms&8Yd$QL$C`9*+MPTHlvo7c=R0Q*j%bJ4c&+q z({&}hQ3OSi6p0J7NxE#h`~?NGYSpSm`-0lkX{PP-JU>1Uzw#pGMV|L)Vy0JDHmDXA zGoNco07D#Rgd=1)!4%Ut%yWv<1QfZ%RjzT9TNv*1fQLL{mDjxCt+~=P*3de5a4-^9 zwPY?gFPKt$IuZ|?QAw4OQL0i~W~F_mp%8JUANW{FZ+fT9a%`m1mHgcH E7pxd`*Z=?k delta 594 zcmXYtOK1~89LD#jwr*gclh$gpA~BIBhlbc1AJ}TsYLS$-C>m=eRfyS*rcIO5#8(yT zA&Lr0brBW3D58RBEuqz$q8G11ubu>N9=!-YW;dC`z&GFgAK$MsPi3CBdn7IPURkx% z?a{dvk7uPxdYjvPh8Q=~Wox8p=CV1D z{}>7jk(|sGOj)Wo?T85DXg+<)%1hHzE9>kM#<6qOOet3^$RW>Q?RCdaVT@&pQ&U!< zT=EjBf9~!vjFZmj;dH5daM~)UwZ7En$JJWL9k1Usou%v_-d&k*+IQ`z_DlP%{n7qv z|Ile=18w*S5@jo$?53AK`q{@2hd9g;lAIueMV8Y{bAeedahYq};V$>EdCV(b^M(c9 z^NG*))#lN){={ISNetL=`NY1`GGPZALUW4X#z0UAsd;gzIyw~g`{gQyQg>xX#4qG( z7ntKJ7Jk{_qH&~xAmkbso+G<^l-sBn)oSB?s+I1>cie%nYK896w`jFv-(J_7in3kh zJ3vCE8)k%2#z--)5@tEW1e4@B%Xu!kDJxv(1~<8-Qr_nQ4|&8>p7ER)ykwCoODyw_ bk52AtsP%(rj72tYi*?xx>l4*j@N4^jqaKd{ diff --git a/Applications.txt b/Applications.txt index 42363a4b..e660bd90 100644 --- a/Applications.txt +++ b/Applications.txt @@ -300,13 +300,13 @@ name="lib/GUI.lua", url="IgorTimofeev/OpenComputers/master/lib/GUI.lua", type="Library", - version=1.34, + version=1.35, }, { name="lib/windows.lua", url="IgorTimofeev/OpenComputers/master/lib/windows.lua", type="Library", - version=1.14, + version=1.15, }, { name="lib/rayEngine.lua", @@ -886,7 +886,7 @@ icon="IgorTimofeev/OpenComputers/master/Applications/MineCodeIDE/Icon.pic", createShortcut="dock", forceDownload=true, - version=1.21, + version=1.22, resources={ { name="Localization/Russian.lang", diff --git a/Applications/.DS_Store b/Applications/.DS_Store index d837a5d552a47b173d5aa5dec9dea6bad33b86d8..7a06a26c04191bed09664cc8166239e8a4f89fe8 100644 GIT binary patch delta 25 hcmZqqz|!)8Wy7-VY(_c?MyBSIA3At!{<2-50RWHY3km=L delta 18 acmZqqz|!)8Wy7-VlVjidZT_-dpaB41m treeView.height + local textLimit = treeView.width - (showScrollBar and 2 or 1) if treeView.colors.default.background then buffer.square(treeView.x, treeView.y, treeView.width, treeView.height, treeView.colors.default.background, treeView.colors.default.text, " ") end - local drawLimit = buffer.getDrawLimit(); buffer.setDrawLimit(treeView.x, treeView.y, treeView.width - (showScrollBar and 1 or 0), treeView.height) - - for fileListIndex = treeView.fromFile, #treeView.fileList do + for fileIndex = treeView.fromFile, #treeView.fileList do local textColor = treeView.colors.default.text - if treeView.fileList[fileListIndex].path == treeView.currentFile then + if treeView.fileList[fileIndex].path == treeView.currentFile then textColor = treeView.colors.selected.text buffer.square(treeView.x, y, treeView.width, 1, treeView.colors.selected.background, textColor, " ") end - if treeView.fileList[fileListIndex].isDirectory then - if treeView.fileList[fileListIndex].showDirectoryContent then - buffer.text(treeView.x + treeView.fileList[fileListIndex].xOffset, y, treeView.colors.arrow, "▽") - buffer.text(treeView.x + treeView.fileList[fileListIndex].xOffset + 2, y, textColor, "■ " .. fs.name(treeView.fileList[fileListIndex].path)) + if treeView.fileList[fileIndex].isDirectory then + if treeView.fileList[fileIndex].showDirectoryContent then + buffer.text(treeView.x + treeView.fileList[fileIndex].xOffset, y, treeView.colors.arrow, "▽") + buffer.text(treeView.x + treeView.fileList[fileIndex].xOffset + 2, y, textColor, unicode.sub("■ " .. fs.name(treeView.fileList[fileIndex].path), 1, textLimit - treeView.fileList[fileIndex].xOffset - 2)) else - buffer.text(treeView.x + treeView.fileList[fileListIndex].xOffset, y, treeView.colors.arrow, "▷") - buffer.text(treeView.x + treeView.fileList[fileListIndex].xOffset + 2, y, textColor, "■ " .. fs.name(treeView.fileList[fileListIndex].path)) + buffer.text(treeView.x + treeView.fileList[fileIndex].xOffset, y, treeView.colors.arrow, "▷") + buffer.text(treeView.x + treeView.fileList[fileIndex].xOffset + 2, y, textColor, unicode.sub("■ " .. fs.name(treeView.fileList[fileIndex].path), 1, textLimit - treeView.fileList[fileIndex].xOffset - 2)) end else - buffer.text(treeView.x + treeView.fileList[fileListIndex].xOffset, y, textColor, " □ " .. fs.name(treeView.fileList[fileListIndex].path)) + buffer.text(treeView.x + treeView.fileList[fileIndex].xOffset, y, textColor, unicode.sub(" □ " .. fs.name(treeView.fileList[fileIndex].path), 1, textLimit - treeView.fileList[fileIndex].xOffset)) end y = y + 1 if y > treeView.y + treeView.height - 2 then break end end - buffer.setDrawLimit(drawLimit) - if showScrollBar then GUI.scrollBar( treeView.x + treeView.width - 1, @@ -1774,8 +1754,9 @@ function GUI.treeView(x, y, width, height, backgroundColor, textColor, selection }, arrow = arrowColor } + treeView.directoriesToShowContent = {} treeView.fileList = {} - treeView.path = workPath + treeView.workPath = workPath treeView.updateFileList = treeViewUpdateFileList treeView.draw = treeViewDraw diff --git a/lib/windows.lua b/lib/windows.lua index f398b7d7..ad27bc30 100755 --- a/lib/windows.lua +++ b/lib/windows.lua @@ -144,16 +144,20 @@ end local function treeViewHandler(window, object, objectIndex, eventData) if eventData[1] == "touch" then - local fileListIndex = eventData[4] - object.y + object.fromFile - 1 - if object.fileList[fileListIndex] then - if object.fileList[fileListIndex].isDirectory then - object.fileList[fileListIndex].showDirectoryContent = not object.fileList[fileListIndex].showDirectoryContent + local fileIndex = eventData[4] - object.y + object.fromFile - 1 + if object.fileList[fileIndex] then + if object.fileList[fileIndex].isDirectory then + if object.directoriesToShowContent[object.fileList[fileIndex].path] then + object.directoriesToShowContent[object.fileList[fileIndex].path] = nil + else + object.directoriesToShowContent[object.fileList[fileIndex].path] = true + end object:updateFileList() object:draw(); buffer.draw() else - object.currentFile = object.fileList[fileListIndex].path - executeObjectMethod(object.onFileSelected, object.currentFile) + object.currentFile = object.fileList[fileIndex].path object:draw(); buffer.draw() + executeObjectMethod(object.onFileSelected, object.currentFile) end end elseif eventData[1] == "scroll" then @@ -326,7 +330,7 @@ end -- buffer.clear(0xFF8888) -- buffer.draw(true) --- local myWindow = windows.empty(2, 2, 40, 30, 30, 40) +-- local myWindow = windows.empty(2, 2, 20, 40, 20, 40) -- myWindow:addTreeView(1, 1, myWindow.width, myWindow.height, 0xDDDDDD, 0x2D2D2D, 0x2D2D2D, 0xEEEEEE, 0x555555, 0x444444, 0x00DBFF, "/") -- myWindow:draw() -- buffer.draw()