diff --git a/Applications/App Market.app/Main.lua b/Applications/App Market.app/Main.lua index 1660b45b..62b0236e 100644 --- a/Applications/App Market.app/Main.lua +++ b/Applications/App Market.app/Main.lua @@ -112,8 +112,6 @@ local leftList = window:addChild(GUI.list(1, 4, leftListPanel.width, 1, 3, 0, ni local contentContainer = window:addChild(GUI.container(1, 1, 1, 1)) -local sponsoredLabel = window:addChild(GUI.text(3, 1, 0x3C3C3C, "Meow <3")) - local progressIndicator = window:addChild(GUI.progressIndicator(math.floor(leftListPanel.width / 2 - 1), 1, 0x3C3C3C, 0x00B640, 0x99FF80)) window.actionButtons.localX = 3 @@ -764,6 +762,7 @@ local function overview() contentContainer:removeChildren() local iconsContainer = contentContainer:addChild(GUI.container(1, 1, contentContainer.width, contentContainer.height)) + iconsContainer.blockScreenEvents = true local width = appWidth + 4 local container = contentContainer:addChild(GUI.container(math.floor(contentContainer.width / 2 - width / 2), 1, width, contentContainer.height)) @@ -1213,6 +1212,8 @@ local function dialogs() end local dialogContainer = dialogsContainer:addChild(GUI.container(3, y, dialogsContainer.width - 4, 4)) + dialogContainer.blockScreenEvents = true + addPanel(dialogContainer,backgroundColor) dialogContainer:addChild(GUI.keyAndValue(3, 2, nicknameColor, timestampColor, dialogs[i].dialog_user_name, os.date(" (%d.%m.%Y, %H:%M)", dialogs[i].timestamp + system.getUserSettings().timeTimezone))) @@ -2004,7 +2005,7 @@ local function leftListItemDraw(pressable) -- Рисуем синюю писечку, просящую прочитать сообщения if pressable.showIndicator then - local x = math.floor(pressable.x + 2) + local x = math.floor(pressable.x + 1) local y = math.floor(pressable.y + pressable.height / 2) local backgroundColor, _, _ = screen.get(x, y) @@ -2056,7 +2057,6 @@ window.onResize = function(width, height) contentContainer.height = window.backgroundPanel.height progressIndicator.localY = height - progressIndicator.height - sponsoredLabel.localY = height end window.onResizeFinished = function() diff --git a/Applications/Finder.app/Main.lua b/Applications/Finder.app/Main.lua index 50897b42..e9e16dea 100644 --- a/Applications/Finder.app/Main.lua +++ b/Applications/Finder.app/Main.lua @@ -490,8 +490,8 @@ local function updateIconField() ) ) - iconField.passScreenEvents = false - + iconField.blockScreenEvents = true + iconField.launchers.directory = function(icon) addPath(icon.path) updateFileListAndDraw() diff --git a/Applications/IRC.app/Main.lua b/Applications/IRC.app/Main.lua index e7c92c4f..97fd5c53 100644 --- a/Applications/IRC.app/Main.lua +++ b/Applications/IRC.app/Main.lua @@ -111,7 +111,7 @@ rightLayout:setMargin(1, 1, 0, 0) rightLayout:setSpacing(1, 1, 0) local chat = window:addChild(GUI.object(1, 1, 1, 1)) -chat.passScreenEvents = true +chat.blockScreenEvents = false local scrollBar = window:addChild(GUI.scrollBar(1, 1, 1, 1, 0xD2D2D2, 0x878787, 1, 1, 1, 1, 1, true)) diff --git a/Applications/Lua.app/Main.lua b/Applications/Lua.app/Main.lua index a06cbc78..ea708471 100644 --- a/Applications/Lua.app/Main.lua +++ b/Applications/Lua.app/Main.lua @@ -21,7 +21,7 @@ local treePanel = window:addChild(GUI.panel(1, 1, 22, 3, 0x2D2D2D)) local tree = window:addChild(GUI.tree(1, 4, treePanel.width, 1, 0x2D2D2D, 0xD2D2D2, 0x878787, 0x696969, 0xE1E1E1, 0x2D2D2D, 0x696969, 0x696969, 0x4B4B4B, 0x696969, GUI.IO_MODE_BOTH, GUI.IO_MODE_BOTH)) local textBox = window:addChild(GUI.textBox(1, 2, 1, 1, nil, 0x3C3C3C, lines, 1, 0, 0, true)) -textBox.passScreenEvents = true +textBox.blockScreenEvents = false local input = window:addChild(GUI.input(1, 1, 1, 3, 0xD2D2D2, 0x3C3C3C, 0x969696, 0xD2D2D2, 0x3C3C3C, "", "Type statement here")) local lastInput = input.text diff --git a/Applications/MineCode IDE.app/Main.lua b/Applications/MineCode IDE.app/Main.lua index 2b482f8f..76f02855 100755 --- a/Applications/MineCode IDE.app/Main.lua +++ b/Applications/MineCode IDE.app/Main.lua @@ -848,7 +848,7 @@ showTip = function(errorCode, matchCode, beep, force) local container = zalupa() local tip, tipLines = container:addChild(GUI.object(1, 1, 40)) - tip.passScreenEvents = true + tip.blockScreenEvents = false tip.draw = function() screen.drawText(math.floor(tip.x + tip.width / 2 - 1), tip.y, 0xE1E1E1, "◢◣") screen.drawRectangle(tip.x, tip.y + 1, tip.width, tip.height - 1, 0xE1E1E1, 0x2D2D2D, " ") diff --git a/Libraries/GUI.lua b/Libraries/GUI.lua index a0e9fd09..2259d7a4 100755 --- a/Libraries/GUI.lua +++ b/Libraries/GUI.lua @@ -181,6 +181,7 @@ function GUI.object(x, y, width, height) width = width, height = height, isPointInside = objectIsPointInside, + blockScreenEvents = true, draw = objectDraw } end @@ -354,6 +355,10 @@ local function containerDraw(container) screen.setDrawLimit(R1X1, R1Y1, R1X2, R1Y2) end + -- if container.workspace and container.workspace.capturedObject == container then + -- screen.drawRectangle(container.x, container.y, container.width, 1, 0xFF0000, 0x0, " ") + -- end + return container end @@ -361,7 +366,7 @@ function GUI.container(x, y, width, height) local container = GUI.object(x, y, width, height) container.children = {} - container.passScreenEvents = true + container.blockScreenEvents = false container.draw = containerDraw container.removeChildren = containerRemoveChildren @@ -391,7 +396,6 @@ local function workspaceStart(workspace, eventPullTimeout) if workspace.capturedObject then if workspace.capturedObject == object then - elseif object.ignoresCapturedObject then if not boundsX1 or not ( roundedX >= boundsX1 @@ -399,10 +403,10 @@ local function workspaceStart(workspace, eventPullTimeout) and roundedY >= boundsY1 and roundedY <= boundsY2 ) then - goto pizda + goto skipEventHandling end else - goto pizda + goto skipEventHandling end else if @@ -413,9 +417,9 @@ local function workspaceStart(workspace, eventPullTimeout) and roundedY <= boundsY2 ) then - goto pizda + goto skipEventHandling else - govno = not object.passScreenEvents + govno = object.blockScreenEvents end end @@ -436,7 +440,7 @@ local function workspaceStart(workspace, eventPullTimeout) -- Container - ::pizda:: + ::skipEventHandling:: if object.children and boundsX1 then local child, newBoundsX1, newBoundsY1, newBoundsX2, newBoundsY2 @@ -1199,7 +1203,7 @@ end function GUI.codeView(x, y, width, height, fromSymbol, fromLine, maximumLineLength, selections, highlights, syntaxPatterns, syntaxColorScheme, syntaxHighlight, lines) local codeView = GUI.container(x, y, width, height) - codeView.passScreenEvents = false + codeView.blockScreenEvents = true codeView.lines = lines codeView.fromSymbol = fromSymbol codeView.fromLine = fromLine @@ -3417,7 +3421,7 @@ function GUI.palette(x, y, startColor) paletteDrawBigCrestPixel(object.x + 2, object.y + 2, "│") end - bigCrest.passScreenEvents = true + bigCrest.blockScreenEvents = false local miniImage = palette:addChild(GUI.image(53, 1, image.create(3, 25))) @@ -3819,7 +3823,7 @@ function GUI.list(x, y, width, height, itemSize, spacing, backgroundColor, textC }, } - list.passScreenEvents = false + list.blockScreenEvents = true list.selectedItem = 1 list.offsetMode = offsetMode list.itemSize = itemSize @@ -4510,29 +4514,23 @@ local function windowDraw(window) return window end -local function windowScreenEventCheck(window, x, y) +local function windowCheckForBlockingScreenEvent(object, x, y) local child, result - for i = #window.children, 1, -1 do - child = window.children[i] + for i = #object.children, 1, -1 do + child = object.children[i] if - not child.hidden and - not child.disabled and - child:isPointInside(x, y) + not child.hidden + and not child.disabled + and child:isPointInside(x, y) then - if not child.passScreenEvents and child.eventHandler then + if child.blockScreenEvents and child.eventHandler then return true elseif child.children then - result = windowScreenEventCheck(child, x, y) - - -- Nil causes next child processing - if result == true then + if windowCheckForBlockingScreenEvent(child, x, y) then return true - - elseif result == false then - return false end end end @@ -4547,7 +4545,7 @@ local function windowEventHandler(workspace, window, e1, e2, e3, e4, ...) if e1 == "touch" then e3, e4 = math.ceil(e3), math.ceil(e4) - if not windowScreenEventCheck(window, e3, e4) then + if not windowCheckForBlockingScreenEvent(window, e3, e4) then workspace.capturedObject = window window.lastTouchX, window.lastTouchY = e3, e4 end @@ -4651,7 +4649,7 @@ end function GUI.window(x, y, width, height) local window = GUI.container(x, y, width, height) - window.passScreenEvents = false + window.blockScreenEvents = true window.movingEnabled = true window.drawShadow = true @@ -4717,7 +4715,19 @@ end local function menuDraw(menu) screen.drawRectangle(menu.x, menu.y, menu.width, 1, menu.colors.default.background, menu.colors.default.text, " ", menu.colors.transparency) - layoutDraw(menu) + + local x = 1 + + local child + for i = 1, #menu.children do + child = menu.children[i] + + child.localX = x + + x = x + child.width + end + + containerDraw(menu) end local function menuAddItem(menu, text, textColor) @@ -4761,7 +4771,7 @@ local function menuAddContextMenuItem(menu, ...) end function GUI.menu(x, y, width, backgroundColor, textColor, backgroundPressedColor, textPressedColor, backgroundTransparency) - local menu = GUI.layout(x, y, width, 1, 1, 1) + local menu = GUI.container(x, y, width, 1) menu.colors = { default = { @@ -4775,16 +4785,16 @@ function GUI.menu(x, y, width, backgroundColor, textColor, backgroundPressedColo transparency = backgroundTransparency } - menu.passScreenEvents = false + menu.blockScreenEvents = true menu.addContextMenuItem = menuAddContextMenuItem menu.addItem = menuAddItem menu.getItem = menuGetItem menu.draw = menuDraw - menu:setDirection(1, 1, GUI.DIRECTION_HORIZONTAL) - menu:setAlignment(1, 1, GUI.ALIGNMENT_HORIZONTAL_LEFT, GUI.ALIGNMENT_VERTICAL_TOP) - menu:setSpacing(1, 1, 0) - menu:setMargin(1, 1, 1, 0) + -- menu:setDirection(1, 1, GUI.DIRECTION_HORIZONTAL) + -- menu:setAlignment(1, 1, GUI.ALIGNMENT_HORIZONTAL_LEFT, GUI.ALIGNMENT_VERTICAL_TOP) + -- menu:setSpacing(1, 1, 0) + -- menu:setMargin(1, 1, 1, 0) return menu end diff --git a/Libraries/Screen.lua b/Libraries/Screen.lua index 23fa77ba..1f27be1b 100755 --- a/Libraries/Screen.lua +++ b/Libraries/Screen.lua @@ -682,11 +682,14 @@ local function drawFrame(x, y, width, height, color) local stringUp, stringDown, x2 = "┌" .. string.rep("─", width - 2) .. "┐", "└" .. string.rep("─", width - 2) .. "┘", x + width - 1 drawText(x, y, color, stringUp); y = y + 1 + for i = 1, height - 2 do drawText(x, y, color, "│") drawText(x2, y, color, "│") + y = y + 1 end + drawText(x, y, color, stringDown) end