[tekui-devel] tekui: Canvas: FreeWidth/FreeHeight renamed to AutoWidth/AutoHei...
Timm S. Mueller
tmueller at neoscientists.org
Sun Mar 23 18:35:34 CET 2008
details: http://hg.teklib.org/tekui/rev/346b72a03579
changeset: 377:346b72a03579
user: Timm S. Mueller <tmueller at neoscientists.org>
date: Fri Mar 21 20:57:29 2008 +0100
description:
Canvas: FreeWidth/FreeHeight renamed to AutoWidth/AutoHeight, added repeat
logic to layout(), HMax/VMax now considered in askMinMax()
diffs (95 lines):
diff -r a2d5321715bb -r 346b72a03579 tek/app/ui/demo.lua
--- a/tek/app/ui/demo.lua Fri Mar 21 15:34:40 2008 +0100
+++ b/tek/app/ui/demo.lua Fri Mar 21 20:57:29 2008 +0100
@@ -261,7 +261,7 @@ ui.Application:new
{
Legend = "Available Demos",
HMax = true,
- FreeWidth = true,
+ AutoWidth = true,
KeepMinWidth = true,
HideHSlider = true,
Children =
diff -r a2d5321715bb -r 346b72a03579 tek/class/ui/canvas.lua
--- a/tek/class/ui/canvas.lua Fri Mar 21 15:34:40 2008 +0100
+++ b/tek/class/ui/canvas.lua Fri Mar 21 20:57:29 2008 +0100
@@ -107,8 +107,8 @@ function Canvas:askMinMax()
local s = self.ScrollGroup
local m1 = s.KeepMinWidth and m[1] or 0
local m2 = s.KeepMinHeight and m[2] or 0
- local m3 = s.FreeWidth and ui.HUGE or self.Width
- local m4 = s.FreeHeight and ui.HUGE or self.Height
+ local m3 = s.HMax and ui.HUGE or self.Width
+ local m4 = s.VMax and ui.HUGE or self.Height
return m1, m2, m3, m4
end
@@ -120,23 +120,29 @@ function Canvas:layout(r1, r2, r3, r4, m
function Canvas:layout(r1, r2, r3, r4, markdamage)
local sizechanged = false
+
local m = self.MarginAndBorder
- if self.ScrollGroup.FreeWidth then
+ if self.ScrollGroup.AutoWidth then
local w = r3 - r1 + 1 - m[1] - m[3]
sizechanged = w ~= self.Width
self.ScrollGroup:setWidth(w)
end
- if self.ScrollGroup.FreeHeight then
+ if self.ScrollGroup.AutoHeight then
local h = r4 - r2 + 1 - m[2] - m[4]
sizechanged = sizechanged or (h ~= self.Height)
- -- self.ScrollGroup:setHeight(h) -- !!!
+ self.ScrollGroup:setHeight(h)
end
Frame.layout(self, r1, r2, r3, r4, markdamage)
- self.Object:layout(0, 0, self.Width - 1, self.Height - 1, sizechanged)
+ local iw, ih
+ repeat
+ iw, ih = self.Width, self.Height
+ self.Object:layout(0, 0, self.Width - 1, self.Height - 1, sizechanged)
+ sizechanged = true
+ until self.Width == iw and self.Height == ih
-- propagate intra-area damages calculated in Frame.layout to child object:
local dr = self.DamageRegion
diff -r a2d5321715bb -r 346b72a03579 tek/class/ui/floattext.lua
--- a/tek/class/ui/floattext.lua Fri Mar 21 15:34:40 2008 +0100
+++ b/tek/class/ui/floattext.lua Fri Mar 21 20:57:29 2008 +0100
@@ -33,17 +33,15 @@ local TextCanvas = Canvas:newClass()
local TextCanvas = Canvas:newClass()
function TextCanvas:layout(r1, r2, r3, r4, markdamage)
+
local res = Canvas.layout(self, r1, r2, r3, r4, markdamage)
-- determine free/unused region:
-
local m = self.MarginAndBorder
self.MyRegion = ui.Region.new(r1 + m[1], r2 + m[2], r3 - m[3], r4 - m[4])
local o = self.Object.Rect
local r = self.Rect
self.MyRegion:subRect(o[1] + r[1], o[2] + r[2], o[3] + r[1], o[4] + r[2])
-
--- self.Redraw = true
return res
end
@@ -216,10 +214,10 @@ function FloatText.new(class, self)
self.HideHSlider = true
-- self.HideVSlider = true
self.KeepMinWidth = true
- self.FreeWidth = true
- self.FreeHeight = true
+ self.AutoWidth = true
self.Canvas = TextCanvas:new {
+ HMax = true,
Object = TextArea:new {
BackPen = ui.PEN_LISTVIEWBACK,
Parent = self,
More information about the tekui-devel
mailing list