[tekui-devel] tekui: List: now uses regular setValue() mechanism for Canvas le...

Timm S. Mueller tmueller at neoscientists.org
Fri Apr 25 00:10:44 CEST 2008


details:   http://hg.teklib.org/tekui/rev/9dcd46da41f4
changeset: 446:9dcd46da41f4
user:      Timm S. Mueller <tmueller at neoscientists.org>
date:      Wed Apr 23 23:30:04 2008 +0200
description:
List: now uses regular setValue() mechanism for Canvas left/top;
Object:addNotify(): added optional positional argument; ScrollGroup, Slider:
simplified XPosition/YPosition management; ScrollGroup: rectified cyclic
Position notification

diffs (truncated from 236 to 100 lines):

diff -r a87ef8db8896 -r 9dcd46da41f4 tek/class/ui/list.lua
--- a/tek/class/ui/list.lua	Wed Apr 23 22:42:32 2008 +0200
+++ b/tek/class/ui/list.lua	Wed Apr 23 23:30:04 2008 +0200
@@ -20,7 +20,7 @@ local type = type
 local type = type
 
 module("tek.class.ui.list", tek.class.ui.scrollgroup)
-_VERSION = "List 0.19"
+_VERSION = "List 0.20"
 local List = _M
 
 -------------------------------------------------------------------------------
@@ -225,13 +225,13 @@ function ListGadget:moveCursor(lnr)
 			local y0, y1 = line[2], line[4]
 			if y1 < ca.Top then
 				y = y0
-				self.Parent:setTop(y)
+				self.Parent:setValue("Top", y)
 			else
 				local r = ca.Rect
 				local vh = r[4] - r[2] + 1 - (line[4] - line[2] + 1)
 				if y0 > ca.Top + vh then
 					y = y0 - vh
-					self.Parent:setTop(y)
+					self.Parent:setValue("Top", y)
 				end
 			end
 		end
diff -r a87ef8db8896 -r 9dcd46da41f4 tek/class/ui/object.lua
--- a/tek/class/ui/object.lua	Wed Apr 23 22:42:32 2008 +0200
+++ b/tek/class/ui/object.lua	Wed Apr 23 23:30:04 2008 +0200
@@ -32,7 +32,7 @@ local unpack = unpack
 local unpack = unpack
 
 module("tek.class.ui.object", tek.class)
-_VERSION = "Object 5.1"
+_VERSION = "Object 5.2"
 local Object = _M
 
 -------------------------------------------------------------------------------
@@ -162,7 +162,7 @@ end
 end
 
 -------------------------------------------------------------------------------
---	Object:addNotify(key, val, dest):
+--	Object:addNotify(key, val, dest[, pos]):
 --	Adds a notification to an object. {{key}} is the name of an attribute to
 --	react for changes. {{val}} indicates the value that should trigger the
 --	notification; it may be {{ui.NOTIFY_ALWAYS}}, which is a placeholder
@@ -191,12 +191,16 @@ end
 --	no longer needed, to reduce overhead and memory use.
 ------------------------------------------------------------------------------
 
-function Object:addNotify(attr, val, dest)
+function Object:addNotify(attr, val, dest, pos)
 	if dest then
 		local n = self.Notifications
 		n[attr] = n[attr] or { }
 		n[attr][val] = n[attr][val] or { }
-		insert(n[attr][val], dest)
+		if pos then
+			insert(n[attr][val], pos, dest)
+		else
+			insert(n[attr][val], dest)
+		end
 	else
 		error("No notify destination given")
 	end
diff -r a87ef8db8896 -r 9dcd46da41f4 tek/class/ui/scrollgroup.lua
--- a/tek/class/ui/scrollgroup.lua	Wed Apr 23 22:42:32 2008 +0200
+++ b/tek/class/ui/scrollgroup.lua	Wed Apr 23 23:30:04 2008 +0200
@@ -27,7 +27,7 @@ local unpack = unpack
 local unpack = unpack
 
 module("tek.class.ui.scrollgroup", tek.class.ui.group)
-_VERSION = "ScrollGroup 1.16"
+_VERSION = "ScrollGroup 1.17"
 
 -------------------------------------------------------------------------------
 --	ArrowButton
@@ -383,11 +383,7 @@ function ScrollGroup:setLeft(x)
 	x = floor(x)
 	local dx = x - ca.Left
 	ca.Left = x
-	local changed
-	x, _, changed = self.HSlider:checkXPosition(x * 0x10000 / ca.Width)
-	if changed then
-		self.HSlider:setValue("XPosition", x)
-	end
+	self.HSlider:setValue("XPosition", x * 0x10000 / ca.Width, false)
 	if dx > 0 then
 		insert(self.CopyAreaList, { -dx, 0 })
 	elseif dx < 0 then
@@ -404,11 +400,7 @@ function ScrollGroup:setTop(y)
 	y = floor(y)
 	local dy = y - ca.Top
 	ca.Top = y
-	local changed
-	y, _, changed = self.VSlider:checkYPosition(y * 0x10000 / ca.Height)
-	if changed then


More information about the tekui-devel mailing list