From e09ff425af5d216ebfa43d9ac03904ab1bddc6d7 Mon Sep 17 00:00:00 2001 From: Igor Timofeev Date: Mon, 4 Sep 2017 06:47:05 +0300 Subject: [PATCH] =?UTF-8?q?=D0=91=D0=BE=D0=BB=D0=B5=D0=B5=20=D0=B3=D1=80?= =?UTF-8?q?=D0=B0=D1=84=D0=BE=D0=BD=D0=B8=D1=81=D1=82=D0=BE=D0=B5=20=D0=B2?= =?UTF-8?q?=D1=8B=D0=B4=D0=B5=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Applications.cfg | 2 +- lib/MineOSCore.lua | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Applications.cfg b/Applications.cfg index 45e914d4..d8f109b3 100644 --- a/Applications.cfg +++ b/Applications.cfg @@ -223,7 +223,7 @@ path="/lib/MineOSCore.lua", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/lib/MineOSCore.lua", type="Library", - version=1.73, + version=1.74, }, { path="/lib/advancedLua.lua", diff --git a/lib/MineOSCore.lua b/lib/MineOSCore.lua index 2c8b6ca2..b0ba7a24 100755 --- a/lib/MineOSCore.lua +++ b/lib/MineOSCore.lua @@ -243,10 +243,20 @@ function MineOSCore.analyzeIconExtension(icon) end local function iconDraw(icon) + local text = string.limit(icon.showExtension and fs.name(icon.path) or fs.hideExtension(fs.name(icon.path)), icon.width, "center") + local textLength = unicode.len(text) + local textX, textY = math.floor(icon.x + icon.width / 2 - unicode.len(text) / 2), icon.y + icon.height - 1 if icon.selected then - buffer.square(icon.x, icon.y, icon.width, icon.height, icon.colors.selection, 0x000000, " ", 60) + local x, width = icon.x + 1, icon.width - 2 + buffer.text(x, icon.y - 1, icon.colors.selection, string.rep("▄", width), icon.colors.selectionTransparency) + buffer.square(x, icon.y, width, icon.height - 2, icon.colors.selection, 0x000000, " ", icon.colors.selectionTransparency) + buffer.text(x, icon.y + icon.height - 2, icon.colors.selection, string.rep("▀", width), icon.colors.selectionTransparency) + + buffer.square(textX, textY, textLength, 1, icon.colors.selection, 0x000000, " ", icon.colors.selectionTransparency) end + buffer.text(textX, textY, icon.colors.text, text) + if icon.cut then if not icon.semiTransparentImage then icon.semiTransparentImage = image.copy(icon.image) @@ -263,15 +273,6 @@ local function iconDraw(icon) buffer.image(icon.x + 2, icon.y, icon.image) end - local text - if icon.showExtension then - text = string.limit(fs.name(icon.path), icon.width, "center") - else - text = string.limit(fs.hideExtension(fs.name(icon.path)), icon.width, "center") - end - - buffer.text(math.floor(icon.x + icon.width / 2 - unicode.len(text) / 2), icon.y + icon.height - 1, icon.colors.text, text) - if icon.isShortcut then buffer.set(icon.x + 9, icon.y + 3, 0xFFFFFF, 0x000000, "<") end @@ -327,6 +328,7 @@ function MineOSCore.icon(x, y, path, textColor, selectionColor, showExtension) icon.colors = { text = textColor, selection = selectionColor, + selectionTransparency = 60 } icon.path = path icon.isDirectory = fs.isDirectory(icon.path) @@ -562,10 +564,8 @@ local function iconFieldForegroundObjectDraw(object) if y2 < y1 then y1, y2 = y2, y1 end - - local width, height = x2 - x1 + 1, y2 - y1 + 1 - buffer.square(x1, y1, width, height, 0xFFFFFF, 0x0, " ", 70) - buffer.frame(x1, y1, width, height, 0xFFFFFF) + + buffer.square(x1, y1, x2 - x1 + 1, y2 - y1 + 1, 0xFFFFFF, 0x0, " ", 60) local partialWidth, partialHeight = MineOSCore.iconWidth * MineOSCore.selectionIconPart, MineOSCore.iconHeight * MineOSCore.selectionIconPart for i = 1, #object.parent.iconsContainer.children do