[tekui-devel] tekui: Area: MinMax, Rect and MarginAndBorder are now created on...

Timm S. Mueller tmueller at neoscientists.org
Wed Apr 9 22:00:20 CEST 2008


details:   http://hg.teklib.org/tekui/rev/bcfe4b15deab
changeset: 415:bcfe4b15deab
user:      Timm S. Mueller <tmueller at neoscientists.org>
date:      Wed Apr 09 21:59:17 2008 +0200
description:
Area: MinMax, Rect and MarginAndBorder are now created only once in new();
Frame: PaddingAndBorder created only once int new(); Group:askMinMax() bug
fixed in tab mode - now TabElement.MinMax is also placed in group itself,
minor cleanup; TextInput: added temporary protection against nonexistant
LMBDownMsg, Escape key now deactives/unfocuses element

diffs (truncated from 187 to 100 lines):

diff -r 66913c7a8005 -r bcfe4b15deab tek/class/ui/area.lua
--- a/tek/class/ui/area.lua	Wed Apr 09 19:00:07 2008 +0200
+++ b/tek/class/ui/area.lua	Wed Apr 09 21:59:17 2008 +0200
@@ -36,7 +36,7 @@ local floor = math.floor
 local floor = math.floor
 
 module("tek.class.ui.area", tek.class.ui.element)
-_VERSION = "Area 5.11"
+_VERSION = "Area 5.12"
 local Area = _M
 
 -------------------------------------------------------------------------------
@@ -53,11 +53,11 @@ function Area.new(class, self)
 function Area.new(class, self)
 	self = self or { }
 	-- Combined margin and border offsets of the element:
-	self.MarginAndBorder = { }
+	self.MarginAndBorder = { 0, 0, 0, 0 }
 	-- Calculated minimum/maximum sizes of the element:
-	self.MinMax = { }
+	self.MinMax = { 0, 0, 0, 0 }
 	-- The layouted rectangle of the element on the display:
-	self.Rect = { }
+	self.Rect = { 0, 0, 0, 0 }
 	return Element.new(class, self)
 end
 
@@ -80,8 +80,6 @@ function Area.init(self)
 	self.Hilite = false
 	-- Margin offsets of the element:
 	self.Margin = self.Margin or false
-	-- Combined margin and border offsets of the element:
-	self.MarginAndBorder = { } -- TODO
 	-- Maximum height of the element:
 	self.MaxHeight = self.MaxHeight or false
 	-- Maximum width of the element:
@@ -90,10 +88,6 @@ function Area.init(self)
 	self.MinHeight = self.MinHeight or 0
 	-- Minimum width of the element:
 	self.MinWidth = self.MinWidth or 0
-	-- Calculated minimum/maximum sizes of the element:
-	self.MinMax = { } -- TODO
-	-- The layouted rectangle of the element on the display:
-	self.Rect = { } -- TODO
 	-- Indicates whether the element needs to be redrawn:
 	self.Redraw = false
 	-- Selected state of the element (defined, but not handled by Area):
@@ -137,7 +131,6 @@ function Area:setupDisplay(display, draw
 	self.Margin = self.Margin or display.Theme.AreaMargin or DEF_MARGIN
 	self.Display = display
 	self.Drawable = drawable
-	self.DamageRegion = false
 	self:calcOffsets()
 	self:setState()
 	return true
diff -r 66913c7a8005 -r bcfe4b15deab tek/class/ui/frame.lua
--- a/tek/class/ui/frame.lua	Wed Apr 09 19:00:07 2008 +0200
+++ b/tek/class/ui/frame.lua	Wed Apr 09 21:59:17 2008 +0200
@@ -22,7 +22,7 @@ local unpack = unpack
 local unpack = unpack
 
 module("tek.class.ui.frame", tek.class.ui.area)
-_VERSION = "Frame 1.22"
+_VERSION = "Frame 1.23"
 
 local Frame = _M
 
@@ -182,7 +182,8 @@ end
 -------------------------------------------------------------------------------
 
 function Frame:layout(r1, r2, r3, r4, markdamage)
-	if Area.layout(self, r1, r2, r3, r4, markdamage) then
+	if Area.layout(self, r1, r2, r3, r4, markdamage) or
+		not self.BorderRegion then
 		self.BorderRegion = self.BorderClass:getRegion(self,
 			self.Border, self.Rect)
 		self.RedrawBorder = markdamage ~= false
@@ -240,7 +241,7 @@ function Frame:getElementByXY(x, y)
 function Frame:getElementByXY(x, y)
 	local b1, b2, b3, b4 = self:getBorder()
 	local r = self.Rect
-	return b1 and r[1] and -- TODO
+	return b1 and
 		x >= r[1] - b1 and x <= r[3] + b3 and
 		y >= r[2] - b2 and y <= r[4] + b4 and self
 end
diff -r 66913c7a8005 -r bcfe4b15deab tek/class/ui/group.lua
--- a/tek/class/ui/group.lua	Wed Apr 09 19:00:07 2008 +0200
+++ b/tek/class/ui/group.lua	Wed Apr 09 21:59:17 2008 +0200
@@ -20,7 +20,7 @@ local unpack = unpack
 local unpack = unpack
 
 module("tek.class.ui.group", tek.class.ui.gadget)
-_VERSION = "Group 4.3"
+_VERSION = "Group 4.4"
 local Group = _M
 
 -------------------------------------------------------------------------------
@@ -129,14 +129,12 @@ function Group.newTabGroup(class, self)
 								children[self.TabNumber]:setValue("Selected", false)


More information about the tekui-devel mailing list