diff --git a/MineOS/OS.lua b/MineOS/OS.lua index 25e7b059..e340d960 100755 --- a/MineOS/OS.lua +++ b/MineOS/OS.lua @@ -288,21 +288,21 @@ local function updateDesktopCounters() workspace.desktopCounters:addButton(x, 1, 1, 1, nil, 0xEEEEEE, nil, 0x888888, "<").onTouch = function() table.remove(workpathHistory, #workpathHistory) changeWorkpath(#workpathHistory) - workspace.updateFileList() + workspace.updateAndDraw() end; x = x + 3 end if workpathHistory[currentWorkpathHistoryIndex] ~= "/" then workspace.desktopCounters:addButton(x, 1, 4, 1, nil, 0xEEEEEE, nil, 0x888888, "Root").onTouch = function() table.insert(workpathHistory, "/") changeWorkpath(#workpathHistory) - workspace.updateFileList() + workspace.updateAndDraw() end; x = x + 6 end if workpathHistory[currentWorkpathHistoryIndex] ~= MineOSCore.paths.desktop then workspace.desktopCounters:addButton(x, 1, 7, 1, nil, 0xEEEEEE, nil, 0x888888, "Desktop").onTouch = function() table.insert(workpathHistory, MineOSCore.paths.desktop) changeWorkpath(#workpathHistory) - workspace.updateFileList() + workspace.updateAndDraw() end; x = x + 9 end if countOfDesktops > 1 then @@ -310,7 +310,7 @@ local function updateDesktopCounters() workspace.desktopCounters:addButton(x, 1, 1, 1, nil, i == currentDesktop and 0xEEEEEE or 0xBBBBBB, nil, 0x888888, "●").onTouch = function() if currentDesktop ~= i then currentDesktop = i - workspace.updateFileList() + workspace.updateAndDraw() end end; x = x + 3 end @@ -337,14 +337,14 @@ local function updateDock() local xPos = 1 for iconIndex = 1, #_G.OSSettings.dockShortcuts do - local iconObject = MineOSCore.createIcon(xPos, 1, _G.OSSettings.dockShortcuts[iconIndex].path, 0x262626, _G.OSSettings.showExtension) + local icon = MineOSCore.createIcon(xPos, 1, _G.OSSettings.dockShortcuts[iconIndex].path, 0x262626, _G.OSSettings.showExtension) - iconObject.onRightClick = function(iconObject, eventData) + icon.onRightClick = function(icon, eventData) local menu = GUI.contextMenu(eventData[3], eventData[4]) menu:addItem(MineOSCore.localization.contextMenuShowContainingFolder).onTouch = function() - table.insert(workpathHistory, fs.path(iconObject.path)) + table.insert(workpathHistory, fs.path(icon.path)) changeWorkpath(#workpathHistory) - workspace.updateFileList() + workspace.updateAndDraw() end menu:addSeparator() menu:addItem(MineOSCore.localization.contextMenuMoveRight, iconIndex >= #_G.OSSettings.dockShortcuts).onTouch = function() @@ -364,33 +364,38 @@ local function updateDock() menu:show() end - workspace.dockContainer:addChild(iconObject, GUI.objectTypes.container) + workspace.dockContainer:addChild(icon, GUI.objectTypes.container) xPos = xPos + MineOSCore.iconWidth + sizes.xSpaceBetweenIcons end - local iconObject = MineOSCore.createIcon(xPos, 1, MineOSCore.paths.trash, 0x262626, _G.OSSettings.showExtension) - iconObject.iconImage.image = MineOSCore.icons.trash - iconObject.onRightClick = function(iconObject, eventData) + local icon = MineOSCore.createIcon(xPos, 1, MineOSCore.paths.trash, 0x262626, _G.OSSettings.showExtension) + icon.iconImage.image = MineOSCore.icons.trash + icon.onRightClick = function(icon, eventData) local menu = GUI.contextMenu(eventData[3], eventData[4]) menu:addItem(MineOSCore.localization.emptyTrash).onTouch = function() - local data = ecs.universalWindow("auto", "auto", 36, 0xeeeeee, true, - {"EmptyLine"}, - {"CenterText", 0x000000, MineOSCore.localization.areYouSure}, - {"EmptyLine"}, - {"Button", {0xAAAAAA, 0xffffff, "OK"}, {0x888888, 0xffffff, MineOSCore.localization.cancel}} - ) - - if data[1] == "OK" then + local container = GUI.addUniversalContainer(workspace, MineOSCore.localization.areYouSure) + + container.layout:addButton(1, 1, 30, 3, 0xEEEEEE, 0x262626, 0xA, 0x262626, "OK").onTouch = function() for file in fs.list(MineOSCore.paths.trash) do fs.remove(MineOSCore.paths.trash .. file) end - workspace.updateFileList() + container:delete() + workspace.updateAndDraw() end + + container.panel.onTouch = function() + container:delete() + workspace:draw() + buffer.draw() + end + + workspace:draw() + buffer.draw() end menu:show() end - workspace.dockContainer:addChild(iconObject, GUI.objectTypes.container) + workspace.dockContainer:addChild(icon, GUI.objectTypes.container) end -- Отрисовка дока @@ -426,8 +431,6 @@ local function changeResolution() workspace.menu.width = workspace.width workspace.background.width, workspace.background.height = workspace.width, workspace.height - - workspace.updateFileList(true) end local function createWorkspace() @@ -495,36 +498,36 @@ local function createWorkspace() workspace.iconField.showExtension = not workspace.iconField.showExtension _G.OSSettings.showExtension = workspace.iconField.showExtension MineOSCore.saveOSSettings() - workspace.updateFileList() + workspace.updateAndDraw() end menu:addItem(workspace.iconField.showHiddenFiles and MineOSCore.localization.hideHiddenFiles or MineOSCore.localization.showHiddenFiles).onTouch = function() workspace.iconField.showHiddenFiles = not workspace.iconField.showHiddenFiles _G.OSSettings.showHiddenFiles = workspace.iconField.showHiddenFiles MineOSCore.saveOSSettings() - workspace.updateFileList() + workspace.updateAndDraw() end menu:addItem(MineOSCore.showApplicationIcons and MineOSCore.localization.hideApplicationIcons or MineOSCore.localization.showApplicationIcons).onTouch = function() MineOSCore.showApplicationIcons = not MineOSCore.showApplicationIcons - workspace.updateFileList() + workspace.updateAndDraw() end menu:addSeparator() menu:addItem(MineOSCore.localization.sortByName).onTouch = function() _G.OSSettings.sortingMethod = "name" MineOSCore.saveOSSettings() workspace.iconField.sortingMethod = _G.OSSettings.sortingMethod - workspace.updateFileList() + workspace.updateAndDraw() end menu:addItem(MineOSCore.localization.sortByDate).onTouch = function() _G.OSSettings.sortingMethod = "date" MineOSCore.saveOSSettings() workspace.iconField.sortingMethod = _G.OSSettings.sortingMethod - workspace.updateFileList() + workspace.updateAndDraw() end menu:addItem(MineOSCore.localization.sortByType).onTouch = function() _G.OSSettings.sortingMethod = "type" MineOSCore.saveOSSettings() workspace.iconField.sortingMethod = _G.OSSettings.sortingMethod - workspace.updateFileList() + workspace.updateAndDraw() end menu:addSeparator() menu:addItem(MineOSCore.localization.screensaver).onTouch = function() @@ -609,6 +612,7 @@ local function createWorkspace() _G.OSSettings.resolution = {tonumber(widthTextBox.text), tonumber(heightTextBox.text)} MineOSCore.saveOSSettings() changeResolution() + workspace.updateAndDraw() end end menu:addSeparator() @@ -618,11 +622,15 @@ local function createWorkspace() menu:show() end - workspace.updateFileList = function(forceRedraw) + workspace.update = function() workspace.iconField.fromFile = (currentDesktop - 1) * workspace.iconField.iconCount.total + 1 workspace.iconField:updateFileList() updateDock() updateDesktopCounters() + end + + workspace.updateAndDraw = function(forceRedraw) + workspace.update() workspace:draw() buffer.draw(forceRedraw) end @@ -632,19 +640,19 @@ local function createWorkspace() if eventData[5] == 1 then if currentDesktop < countOfDesktops then currentDesktop = currentDesktop + 1 - workspace.updateFileList() + workspace.updateAndDraw() end else if currentDesktop > 1 then currentDesktop = currentDesktop - 1 - workspace.updateFileList() + workspace.updateAndDraw() end end elseif eventData[1] == "MineOSCore" then if eventData[2] == "updateFileList" then - workspace.updateFileList() + workspace.updateAndDraw() elseif eventData[2] == "updateFileListAndBufferTrueRedraw" then - workspace.updateFileList(true) + workspace.updateAndDraw(true) elseif eventData[2] == "changeWorkpath" then table.insert(workpathHistory, eventData[3]) changeWorkpath(#workpathHistory) @@ -680,9 +688,10 @@ end ---------------------------------------------- Сама ОС ------------------------------------------------------------------------ createWorkspace() +changeResolution() changeWorkpath(1) changeWallpaper() -changeResolution() +workspace.update() login() windows10() workspace:handleEvents(0.5) diff --git a/lib/doubleBuffering.lua b/lib/doubleBuffering.lua index 32c62017..7f4fa23c 100755 --- a/lib/doubleBuffering.lua +++ b/lib/doubleBuffering.lua @@ -645,6 +645,12 @@ end buffer.start() +------------------------------------------------------------------------------------------------------ + +-- buffer.clear(0x0) +-- buffer.image(1, 1, image.load("/Untitled.pic")) +-- buffer.draw(true) + -- buffer.clear(0x0) -- buffer.semiPixelCircle(80, 50, 20, 0xFFDB40, true) -- buffer.draw() diff --git a/lib/image.lua b/lib/image.lua index 6f3856b2..6df4c006 100755 --- a/lib/image.lua +++ b/lib/image.lua @@ -13,7 +13,7 @@ image.formatModules = {} -------------------------------------------------- Low-level methods -------------------------------------------------- -local function compressionYield(iteration) +function image.iterationYield(iteration) if iteration % 603 == 0 then os.sleep(0) end end @@ -34,7 +34,7 @@ function image.group(picture, compressColors) if compressColors then background, foreground = color.to8Bit(picture[i]), color.to8Bit(picture[i + 1]) - compressionYield(i) + image.iterationYield(i) else background, foreground = picture[i], picture[i + 1] end @@ -199,7 +199,7 @@ function image.toString(picture) table.insert(charArray, string.format("%02X", picture[i + 2])) table.insert(charArray, picture[i + 3]) - compressionYield(i) + image.iterationYield(i) end return table.concat(charArray) @@ -381,6 +381,8 @@ image.loadFormatModule("/lib/ImageFormatModules/OCIF.lua", ".pic") -- image.draw(1, 1, picture) -- end +-- clearAndDraw(image.load("/braille.pic")) + -- clearAndDraw(image.fromString([[4510AA0000 AA0000MAA0000iAA0000nAA0000eAA0000OAA0000SAA0000 AA0000 AA0000 AA0000 AA0000 AA0000 AA0000 AA0000 AA0000 AAAB00▄AB0000 AB0000 ABAA00▄AA0000 ABAA00▄ABAA00▄AB0000 AB0000 AB0000 AC0000 ABAC00▄AB0000 AB0000 AB0000 AB0000 AB0000 AB0000 AB0000 AB0000 ABAA00▄AA0000 AA0000 AA0000 AA0000 AA0000 AA0000 AA0000 AA0000 AA0000 AA0000 AA0000 AA0000 AA0000 ABAA00▄AA0000 AA0000 AA0000 AA0000 AA0000 AA0000 AA0000 AA0000 AA0000 AA0000 AA0000 AA0000 AA0000 AA0000 AA0000 AA0000 AA0000 AA0000 280000 290000 280000 2A0000 2A0000 2A0000 292800▄290000 290000 FFD500▀FFD500▀FFD500▀290000 2A5300▄530000 290000 290000 290000 536100▄610000 616600▄2A5300▀555300▀2A5300▀540000 540000 7E0000 D70000 D70000 D70000 545500▄545300▄535400▄002200▀000000 002200▀530000 2A0000 292A00▄292A00▄290000 290000 290000 292800▄290000 FF2900▗290000 FF0000 280000 280000 290000 B10000 FB0000 000000 290000 290000 290000 D50000 D55500▄D50000 280000 290000 280000 28D500▃D50000 D50000 280000 280000 280000 280000 280000 282900▄2A0000 2A0000 2A0000 290000 290000 2A0000 2AFF00▒29FF00▒29FF00▒2A5300▄540000 2A5300▄290000 290000 290000 920000 920000 920000 532A00▄530000 532A00▄537E00▄532A00▄542A00▄48D700▀48D700▀48D700▀819800▄7F7E00▄535400▄000000 00E300▀000000 530000 545300▄2A0000 D50000 D50000 D5FF00▀290000 290000 290000 FF2900▀290000 290000 280000 282900▄280000 B10000 FB0000 000000 290000 290000 290000 AA5500▝360000 553600▛290000 290000 290000 D70000 D70000 D70000 282900▄290000 290000 280000 282900▄290000 280000 290000 290000 290000 2A0000 2A0000 2A0000 292A00▄530000 555400▄292A00▄557E00▄7F7E00▄610000 669200▄920000 929300▄939800▄929800▄979800▄980000 929800▄555400▄530000 540000 555400▄AA9800▄80AB00▄550000 555400▄7E5500▄540000 545500▄2A0000 2A2900▄532A00▄2A0000 290000 290000 290000 290000 290000 290000 290000 290000 290000 290000 280000 282900▄290000 290000 290000 290000 290000 282900▄290000 290000 290000 290000 290000 290000 290000 290000 290000 290000 290000 280000 290000 280000 280000 290000 290000 290000 2A0000 532A00▄FFD800┌FF0000─FFD800┐290000 550000 7E0000 610000 920000 920000 930000 980000 C30000 AC7F00▀AC7F00▀AC7F00▀C3C800▄C3C800▄980000 55FD00▄FD0000 7FFD00▄7E0000 7F0000 AA0000 530000 290000 290000 535400▄545300▄2A0000 060000 060000 060000 292A00▄290000 290000 290000 290000 290000 290000 290000 290000 CFD500▄787200▄484200▄290000 290000 290000 2A0000 FF0000 FF2A00▄290000 290000 290000 295400▄2A5400▀2A5400▀292A00▄290000 290000 280000 290000 290000 29A400\2A0000 29A400/292A00▄530000 2A0000 FF0000│D80000 FF0000│292A00▄7E0000 615400▄61D700▄55D700▄55D700▄939200▄C30000 C30000 818000▄818000▄815300▄AB0000 AB0000 C80000 F70000 D5D600▀D5D600▀7F7E00▄7F8000▄7F9800▄530000 29A700▀290000 545300▄532A00▄545300▄063D00C063D00i063D00t2A0000 2A0000 2A0000 585300▄2C5300▄2A0000 290000 290000 290000 675500▄3C3600▄0C0B00▄290000 290000 290000 F60000 EE2A00▀EE2A00▀290000 2A0000 290000 2A0000 A44300▄433D00▄2A2900▄292A00▄290000 280000 290000 290000 290000 290000 292A00▄2A2900▄533600▄2A0000 2A0000 550000 290000 2A0000 545300▄532900▄552A00▄7E5300▄926100▄920000 980000 C39800▄C30000 C80000 C8AA00▄C80000 ABAA00▄C8C300▄C39800▄985400▄290000 2A5400▄555300▄7F5500▄540000 988000▄7F8000▄2A5400▄2A2900▄532A00▄2A0000 295300▄545300▄555400▄530000 2A0000 2A0000 530000 2A0000 290000 292A00▄290000 290000 290000 290000 290000 290000 292A00▄290000 290000 290000 290000 290000 292A00▄290000 2A0000 2A0000 292A00▄290000 2A0000 280000 2A0000 2A0000 00D600▀00D600▀00D600▀2A2900▄540000 533600▄530000 810000 810000 290000 290000 280000 290000 291F00▙296100▄292A00▄2A0000 2A0000 00FF00▀00FF00▄00FF00▄980000 989300▄2A5300▄2A3C00▄3C0C00▄2A2800▄615300▄2A0000 292A00▄D60000 D60000 D60000 81AA00▄7E5500▄292A00▄A40000 A40000 A40000 2A0000 542A00▄557E00▄ADFF00uADFF00eAD0000 530000 540000 2A0000 2A2900▄294800╵290000 290000 290000 290000 29A400▄A40000 A40000 290000 290000 290000 2A2900▄290000 290000 2A2900▄292A00▄290000 290000 2A0000 2A0000 000000 00F200р00F200к290000 540000 540000 FF0000 FF0000 AC0000 290000 290000 2A0000 291500▟150000 281500▙292A00▄532800▄2A6600▄FF0000▄00FF00▄00FF00▄AA0000 980000 619200▄0C0000 370700▄060000 280000 362A00▄292A00▄53FF00.FF0000 FF7300▄542A00▄98AA00▄7E0000 800000 D75400▀800000 545500▄2A5300▄530000 FF0000 FF0000 FF0000 2A5400▄2A5300▄532A00▄2A5300▄2A0000 294800╹290000 2A2900▄290000 430000 43FF00d43FF00i290000 290000 2A0000 290000 29D700d29D700t290000 290000 2A2900▄290000 2A0000 290000 2A0000 2A0000 290000 290000 530000 540000 290000 7F0000 540000 292A00▄280000 280000 292800▄2A0000 295300▄616600▄C30000 C30000 989300▄980000 C80000 C80000 980000 979300▄C39200▄920000 610000 2A5C00▄292A00▄282900▄290000 282900▄545500▄532A00▄555300▄2A5400▄7F5500▄2A5500▄2A0000 290000 550000 535400▄2A0000 545300▄540000 555400▄545500▄545300▄290000 2A2900▄2A0000 292A00▄290000 290000 290000 292A00▄290000 290000 290000 290000 290000 290000 2A2900▄2A2900▄2A2900▄290000 282900▄2A0000 290000 2A0000 2A0000 290000 290000 290000 540000 292A00▄7F0000 550000 545500▄530000 669200▄7E7F00▄7F0000 980000 980000 980000 980000 930000 980000 AB0000 AB0000 980000 920000 920000 920000 920000 920000 619200▄5C0000 875B00▄5B0000 290000 2A2900▄2A0000 555300▄980000 290000 535400▄292A00▄2A2900▄2A2900▄545300▄540000 530000 545300▄2A0000 530000 545300▄530000 2A0000 290000 2A2900▄2A0000 290000 290000 290000 290000 290000 290000 290000 290000 290000 290000 290000 290000 280000 290000 290000 290000 2A2900▄292800▄290000 290000 545500▄2A0000 550000 555400▄7E0000 2A0000 666100▄920000 920000 920000 939200▄930000 930000 920000 939200▄AB0000 AC0000 AA0000 928D00▄920000 920000 920000 928D00▄8D6100▄8D5B00▄565B00▄5B5C00▄293000▄282900▄292800▄530000 545300▄980000 7F5500▄535400▄2A0000 2A0000 290000 540000 545500▄532A00▄2A5300▄2A0000 532A00▄530000 2A5300▄292A00▄290000 290000 2A0000 290000 290000 290000 2A2900▄2A2900▄2A2900▄280000 290000 290000 292800▄290000 280000 290000 290000 290000 2A0000 280000 290000 290000 550000 2A0000 530000 550000 550000 556100▄530000 610000 610000 928D00▄928D00▄920000 926600▄920000 615C00▄986100▄989200▄928D00▄615C00▄610000 8D0000 8D0000 8D0000 610000 5C5B00▄5B0000 5B5600▄300000 290000 282900▄290000 557E00▄540000 557E00▄7F7E00▄545300▄2A2900▄530000 292A00▄532900▄545500▄2A5300▄545300▄2A0000 2A0000 532A00▄2A5300▄290000 290000 292800▄290000 290000 280000 280000 292800▄290000 2A2900▄290000 290000 290000 290000 280000 282900▄292800▄290000 290000 290000 280000 2A0000 540000 540000 530000 7F7E00▄7E0000 530000 612A00▄2A5300▄610000 610000 928D00▄920000 920000 669200▄2A5300▄292A00▄2A0000 295300▄5C8D00▄8D0000 8D0000 8D0000 610000 5C6100▄2A0000 300000 300000 290000 290000 282900▄290000 290000 7E5500▄7F7E00▄540000 532A00▄545500▄535400▄290000 2A5300▄290000 532A00▄530000 540000 530000 530000 2A0000 532A00▄2A5300▄290000 290000 282900▄290000 280000 280000 280000 280000 292800▄292A00▄290000 282900▄280000 280000 282900▄280000 290000 290000 282900▄2A0000 545300▄545300▄530000 530000 555400▄535400▄290000 532A00▄530000 615C00▄610000 928D00▄930000 930000 7F6600▄7E9300▄53D600╬61D600╬8DD600╬8D9200▄8D0000 610000 29F800h29F800l29FE00a302900▄300000 280000 FF0000 FF0000 FF0000 290000 532A00▄530000 54D500▒2AD500▒55D500▒7E7F00▄547E00▄290000 535400▄290000 290000 2A5300▄540000 547E00▄530000 2A5300▄290000 2A0000 290000 290000 292800▄290000 292800▄290000 290000 280000 292800▄290000 290000 280000 290000 290000 280000 290000 290000 290000 2A2900▄530000 530000 540000 540000 2A5300▄7E5500▄615300▄292A00▄536100▄530000 5C0000 2A2900▄2A2900▄290000 297E00▟615500▄935500▄935500▄7E0000 7E0000 7E5500▄7E0000 29F800n290000 290000 7E0000 7E0000 557E00▄29FF00▀29FF00▀29FF00▀7E0000 7E0000 800000 7F0000 AB5300▄7E0000 7F7E00▄7F8100▙557F00▄2A2900▄540000 292A00▄290000 2A0000 530000 540000 535400▄2A0000 292A00▄290000 290000 290000 280000 290000 290000 290000 282900▄290000 290000 290000 ]])) -- local w, h = 2, 2 -- local picture = image.create(w, h, 0xFF0000, 0xFFFFFF, 0x0, "Q")