mirror of
https://github.com/IgorTimofeev/MineOS.git
synced 2026-01-06 19:22:40 +01:00
)))))
This commit is contained in:
parent
57028ebf8f
commit
8b2f2ff7f0
@ -77,7 +77,7 @@ end
|
||||
local drawingArea = window:addChild(GUI.container(1, 4, 1, 1))
|
||||
local overrideDraw = drawingArea.draw
|
||||
drawingArea.draw = function(...)
|
||||
GUI.drawShadow(drawingArea.x, drawingArea.y, drawingArea.width, drawingArea.height, GUI.colors.contextMenu.transparency.shadow, true)
|
||||
GUI.drawShadow(drawingArea.x, drawingArea.y, drawingArea.width, drawingArea.height, GUI.CONTEXT_MENU_SHADOW_TRANSPARENCY, true)
|
||||
overrideDraw(...)
|
||||
end
|
||||
|
||||
@ -171,7 +171,7 @@ saveButton.onTouch = function()
|
||||
|
||||
filesystemDialog.onSubmit = function(path)
|
||||
if fs.extension(path) == ".pic" then
|
||||
local picture = {drawingArea.width / 4, drawingArea.height / 4}
|
||||
local picture = {drawingArea.width / 4, drawingArea.height / 4, {}, {}, {}, {}}
|
||||
|
||||
local x, y = 1, 1
|
||||
for childIndex = 1, #drawingArea.children do
|
||||
|
||||
@ -425,6 +425,7 @@ end
|
||||
|
||||
local overrideUpdateFileList = iconField.updateFileList
|
||||
iconField.updateFileList = function(...)
|
||||
mainContainer:drawOnScreen()
|
||||
overrideUpdateFileList(...)
|
||||
updateScrollBar()
|
||||
end
|
||||
|
||||
@ -186,26 +186,24 @@ mainContainer.image.draw = function(object)
|
||||
end
|
||||
|
||||
local x, y, step, notStep, background, foreground, symbol = object.x, object.y, false, mainContainer.image.width % 2
|
||||
for i = 3, #mainContainer.image.data, 4 do
|
||||
|
||||
if mainContainer.image.data[i + 2] == 0 then
|
||||
background = mainContainer.image.data[i]
|
||||
foreground = mainContainer.image.data[i + 1]
|
||||
symbol = mainContainer.image.data[i + 3]
|
||||
elseif mainContainer.image.data[i + 2] < 1 then
|
||||
background = color.blend(config.transparencyBackground, mainContainer.image.data[i], mainContainer.image.data[i + 2])
|
||||
foreground = mainContainer.image.data[i + 1]
|
||||
symbol = mainContainer.image.data[i + 3]
|
||||
for i = 1, mainContainer.image.width * mainContainer.image.height do
|
||||
if mainContainer.image.data[5][i] == 0 then
|
||||
background = mainContainer.image.data[3][i]
|
||||
foreground = mainContainer.image.data[4][i]
|
||||
symbol = mainContainer.image.data[6][i]
|
||||
elseif mainContainer.image.data[5][i] < 1 then
|
||||
background = color.blend(config.transparencyBackground, mainContainer.image.data[3][i], mainContainer.image.data[5][i])
|
||||
foreground = mainContainer.image.data[4][i]
|
||||
symbol = mainContainer.image.data[6][i]
|
||||
else
|
||||
if mainContainer.image.data[i + 3] == " " then
|
||||
if mainContainer.image.data[6][i] == " " then
|
||||
background = config.transparencyBackground
|
||||
foreground = config.transparencyForeground
|
||||
symbol = step and "▒" or "░"
|
||||
else
|
||||
background = config.transparencyBackground
|
||||
foreground = mainContainer.image.data[i + 1]
|
||||
symbol = mainContainer.image.data[i + 3]
|
||||
|
||||
foreground = mainContainer.image.data[4][i]
|
||||
symbol = mainContainer.image.data[6][i]
|
||||
end
|
||||
end
|
||||
|
||||
@ -284,14 +282,14 @@ end
|
||||
|
||||
local function newNoGUI(width, height)
|
||||
savePath = nil
|
||||
mainContainer.image.data = {width, height}
|
||||
mainContainer.image.data = {width, height, {}, {}, {}, {}}
|
||||
mainContainer.image.reposition()
|
||||
|
||||
for i = 1, width * height do
|
||||
table.insert(mainContainer.image.data, 0x0)
|
||||
table.insert(mainContainer.image.data, 0x0)
|
||||
table.insert(mainContainer.image.data, 1)
|
||||
table.insert(mainContainer.image.data, " ")
|
||||
table.insert(mainContainer.image.data[3], 0x0)
|
||||
table.insert(mainContainer.image.data[4], 0x0)
|
||||
table.insert(mainContainer.image.data[5], 1)
|
||||
table.insert(mainContainer.image.data[6], " ")
|
||||
end
|
||||
end
|
||||
|
||||
@ -478,7 +476,6 @@ mainContainer.image:moveToBack()
|
||||
mainContainer.backgroundPanel:moveToBack()
|
||||
|
||||
updateRecentColorsButtons()
|
||||
onToolTouch(5)
|
||||
|
||||
if options.o or options.open and args[1] and fs.exists(args[1]) then
|
||||
loadImage(args[1])
|
||||
@ -486,5 +483,5 @@ else
|
||||
newNoGUI(51, 19)
|
||||
end
|
||||
|
||||
mainContainer:drawOnScreen(true)
|
||||
onToolTouch(5)
|
||||
mainContainer:startEventHandling()
|
||||
24
OS.lua
24
OS.lua
@ -228,13 +228,21 @@ local function changeWallpaper()
|
||||
MineOSInterface.mainContainer.background.wallpaperPosition.y = math.floor(1 + MineOSInterface.mainContainer.height / 2 - image.getHeight(MineOSInterface.mainContainer.background.wallpaper) / 2)
|
||||
end
|
||||
|
||||
local r, g, b
|
||||
for i = 3, #MineOSInterface.mainContainer.background.wallpaper, 4 do
|
||||
r, g, b = color.integerToRGB(MineOSInterface.mainContainer.background.wallpaper[i])
|
||||
MineOSInterface.mainContainer.background.wallpaper[i] = color.RGBToInteger(math.floor(r * MineOSCore.properties.wallpaperBrightness), math.floor(g * MineOSCore.properties.wallpaperBrightness), math.floor(b * MineOSCore.properties.wallpaperBrightness))
|
||||
|
||||
r, g, b = color.integerToRGB(MineOSInterface.mainContainer.background.wallpaper[i + 1])
|
||||
MineOSInterface.mainContainer.background.wallpaper[i + 1] = color.RGBToInteger(math.floor(r * MineOSCore.properties.wallpaperBrightness), math.floor(g * MineOSCore.properties.wallpaperBrightness), math.floor(b * MineOSCore.properties.wallpaperBrightness))
|
||||
local backgrounds, foregrounds, r, g, b = MineOSInterface.mainContainer.background.wallpaper[3], MineOSInterface.mainContainer.background.wallpaper[4]
|
||||
for i = 1, #backgrounds do
|
||||
r, g, b = color.integerToRGB(backgrounds[i])
|
||||
backgrounds[i] = color.RGBToInteger(
|
||||
math.floor(r * MineOSCore.properties.wallpaperBrightness),
|
||||
math.floor(g * MineOSCore.properties.wallpaperBrightness),
|
||||
math.floor(b * MineOSCore.properties.wallpaperBrightness)
|
||||
)
|
||||
|
||||
r, g, b = color.integerToRGB(foregrounds[i])
|
||||
foregrounds[i] = color.RGBToInteger(
|
||||
math.floor(r * MineOSCore.properties.wallpaperBrightness),
|
||||
math.floor(g * MineOSCore.properties.wallpaperBrightness),
|
||||
math.floor(b * MineOSCore.properties.wallpaperBrightness)
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -358,6 +366,8 @@ local function createOSWidgets()
|
||||
window.hidden = false
|
||||
window:moveToFront()
|
||||
end
|
||||
|
||||
icon.selected = false
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
else
|
||||
MineOSInterface.iconDoubleClick(icon, ...)
|
||||
|
||||
@ -61,11 +61,14 @@ function MineOSCore.createShortcut(where, forWhat)
|
||||
end
|
||||
|
||||
function MineOSCore.readShortcut(path)
|
||||
local file = io.open(path, "r")
|
||||
local data = file:read("*a")
|
||||
file:close()
|
||||
|
||||
return data
|
||||
local file, reason = io.open(path, "r")
|
||||
if file then
|
||||
local data = file:read("*a")
|
||||
file:close()
|
||||
return data
|
||||
else
|
||||
error("Failed to read shortcut \"" .. tostring(path) .. "\": " .. tostring(reason))
|
||||
end
|
||||
end
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@ -694,10 +694,9 @@ function MineOSInterface.iconLeftClick(icon)
|
||||
end
|
||||
|
||||
function MineOSInterface.iconDoubleClick(icon)
|
||||
icon.selected = false
|
||||
icon:launch()
|
||||
icon.selected = false
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
-- computer.pushSignal("MineOSCore", "updateFileList")
|
||||
end
|
||||
|
||||
function MineOSInterface.iconRightClick(icon, e1, e2, e3, e4)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user