small monitor/offsetbugfix update

-reworked monitor support (you are able to write on monitors through computer)
-fixed offset bugs
-couple of smaller bugfixes
This commit is contained in:
Robert Jelic
2022-06-20 21:07:09 +02:00
parent a899b1d247
commit 6b3a7cd73f
18 changed files with 446 additions and 337 deletions

View File

@@ -17,8 +17,8 @@ local function Checkbox(name)
return objectType
end;
mouseClickHandler = function(self, event, button, x, y)
if (base.mouseClickHandler(self, event, button, x, y)) then
mouseHandler = function(self, event, button, x, y)
if (base.mouseHandler(self, event, button, x, y)) then
if ((event == "mouse_click") and (button == 1)) or (event == "monitor_touch") then
if (self:getValue() ~= true) and (self:getValue() ~= false) then
self:setValue(false)

View File

@@ -94,7 +94,7 @@ local function Dropdown(name)
return self
end;
mouseClickHandler = function(self, event, button, x, y)
mouseHandler = function(self, event, button, x, y)
if (isOpened) then
local obx, oby = self:getAbsolutePosition(self:getAnchorPosition())
if ((event == "mouse_click") and (button == 1)) or (event == "monitor_touch") then
@@ -129,7 +129,7 @@ local function Dropdown(name)
end
self:setVisualChanged()
end
if (base.mouseClickHandler(self, event, button, x, y)) then
if (base.mouseHandler(self, event, button, x, y)) then
isOpened = true
else
isOpened = false

View File

@@ -187,8 +187,8 @@ local function Input(name)
end
end;
mouseClickHandler = function(self, event, button, x, y)
if (base.mouseClickHandler(self, event, button, x, y)) then
mouseHandler = function(self, event, button, x, y)
if (base.mouseHandler(self, event, button, x, y)) then
if (event == "mouse_click") and (button == 1) then
end

View File

@@ -92,7 +92,7 @@ local function List(name)
return self
end;
mouseClickHandler = function(self, event, button, x, y)
mouseHandler = function(self, event, button, x, y)
local obx, oby = self:getAbsolutePosition(self:getAnchorPosition())
if (obx <= x) and (obx + self.width > x) and (oby <= y) and (oby + self.height > y) and (self:isVisible()) then
if (((event == "mouse_click") or (event == "mouse_drag"))and(button==1))or(event=="monitor_touch") then

View File

@@ -126,8 +126,8 @@ local function Menubar(name)
return self
end;
mouseClickHandler = function(self, event, button, x, y)
if(base.mouseClickHandler(self, event, button, x, y))then
mouseHandler = function(self, event, button, x, y)
if(base.mouseHandler(self, event, button, x, y))then
local objX, objY = self:getAbsolutePosition(self:getAnchorPosition())
if (objX <= x) and (objX + self.width > x) and (objY <= y) and (objY + self.height > y) and (self:isVisible()) then
if (self.parent ~= nil) then

View File

@@ -534,15 +534,15 @@ local function Program(name)
return self
end;
mouseClickHandler = function(self, event, button, x, y)
if (base.mouseClickHandler(self, event, button, x, y)) then
mouseHandler = function(self, event, button, x, y)
if (base.mouseHandler(self, event, button, x, y)) then
if (curProcess == nil) then
return false
end
if not (curProcess:isDead()) then
if not (paused) then
local absX, absY = self:getAbsolutePosition(self:getAnchorPosition(nil, nil, true))
curProcess:resume(event, button, x - absX + 1, y - absY + 1)
curProcess:resume(event, button, x - (absX - 1), y - (absY - 1))
end
end
return true

View File

@@ -80,7 +80,7 @@ local function Radio(name)
return self
end;
mouseClickHandler = function(self, event, button, x, y)
mouseHandler = function(self, event, button, x, y)
local obx, oby = self:getAbsolutePosition(self:getAnchorPosition())
if ((event == "mouse_click")and(button==1))or(event=="monitor_touch") then
if (#list > 0) then

View File

@@ -61,8 +61,8 @@ local function Scrollbar(name)
return self
end;
mouseClickHandler = function(self, event, button, x, y)
if (base.mouseClickHandler(self, event, button, x, y)) then
mouseHandler = function(self, event, button, x, y)
if (base.mouseHandler(self, event, button, x, y)) then
local obx, oby = self:getAbsolutePosition(self:getAnchorPosition())
if (((event == "mouse_click") or (event == "mouse_drag")) and (button == 1))or(event=="monitor_touch") then
if (barType == "horizontal") then

View File

@@ -60,8 +60,8 @@ local function Slider(name)
return self
end;
mouseClickHandler = function(self, event, button, x, y)
if (base.mouseClickHandler(self, event, button, x, y)) then
mouseHandler = function(self, event, button, x, y)
if (base.mouseHandler(self, event, button, x, y)) then
local obx, oby = self:getAbsolutePosition(self:getAnchorPosition())
if (((event == "mouse_click") or (event == "mouse_drag")) and (button == 1))or(event=="monitor_touch") then
if (barType == "horizontal") then

View File

@@ -36,8 +36,8 @@ local function Switch(name)
return self
end;
mouseClickHandler = function(self, event, button, x, y)
if (base.mouseClickHandler(self, event, button, x, y)) then
mouseHandler = function(self, event, button, x, y)
if (base.mouseHandler(self, event, button, x, y)) then
local obx, oby = self:getAbsolutePosition(self:getAnchorPosition())
if ((event == "mouse_click") and (button == 1))or(event=="monitor_touch") then
self:setValue(not self:getValue())

View File

@@ -244,8 +244,8 @@ local function Textfield(name)
end
end;
mouseClickHandler = function(self, event, button, x, y)
if (base.mouseClickHandler(self, event, button, x, y)) then
mouseHandler = function(self, event, button, x, y)
if (base.mouseHandler(self, event, button, x, y)) then
local obx, oby = self:getAbsolutePosition(self:getAnchorPosition())
local anchx, anchy = self:getAnchorPosition()
if (event == "mouse_click")or(event=="monitor_touch") then
@@ -262,7 +262,7 @@ local function Textfield(name)
end
end
if (self.parent ~= nil) then
self.parent:setCursor(true, anchx + textX - wIndex, anchy + textY - hIndex)
self.parent:setCursor(true, anchx + textX - wIndex, anchy + textY - hIndex, self.fgColor)
end
end
end
@@ -280,7 +280,7 @@ local function Textfield(name)
end
end
if (self.parent ~= nil) then
self.parent:setCursor(true, anchx + textX - wIndex, anchy + textY - hIndex)
self.parent:setCursor(true, anchx + textX - wIndex, anchy + textY - hIndex, self.fgColor)
end
end
end
@@ -297,7 +297,7 @@ local function Textfield(name)
if (self.parent ~= nil) then
if (obx + textX - wIndex >= obx and obx + textX - wIndex <= obx + self.width) and (oby + textY - hIndex >= oby and oby + textY - hIndex <= oby + self.height) then
self.parent:setCursor(true, anchx + textX - wIndex, anchy + textY - hIndex)
self.parent:setCursor(true, anchx + textX - wIndex, anchy + textY - hIndex, self.fgColor)
else
self.parent:setCursor(false)
end