summaryrefslogtreecommitdiff
path: root/tex/context/base/mkxl/node-bck.lmt
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/mkxl/node-bck.lmt')
-rw-r--r--tex/context/base/mkxl/node-bck.lmt88
1 files changed, 43 insertions, 45 deletions
diff --git a/tex/context/base/mkxl/node-bck.lmt b/tex/context/base/mkxl/node-bck.lmt
index ad8f8d59e..5d4694600 100644
--- a/tex/context/base/mkxl/node-bck.lmt
+++ b/tex/context/base/mkxl/node-bck.lmt
@@ -60,6 +60,9 @@ local new_hlist = nodepool.hlist
local privateattributes = attributes.private
local unsetvalue = attributes.unsetvalue
+local getvalue = attributes.getvalue
+local hasvalues = attributes.hasvalues
+
local linefillers = nodes.linefillers
local a_background = privateattributes("background")
@@ -83,7 +86,7 @@ trackers.register("backgrounds.alignments",function(v) trace_alignment = v end)
local overshoot = math.floor(65781/5) -- could be an option per table (just also store it)
-local function colored_a(current,list,template,id,data)
+local function colored_a(current,list,template,id)
local width, height, depth = getwhd(current)
local total = height + depth
if width > 0 and total > 0 then
@@ -91,7 +94,7 @@ local function colored_a(current,list,template,id,data)
--
local a = getattr(template,a_linefiller)
if a then
- local d = data[a]
+ local d = getvalue(a_linefiller,a)
if d then
rule = linefillers.filler(template,d,width,height,depth)
end
@@ -106,7 +109,7 @@ local function colored_a(current,list,template,id,data)
end
end
-local function colored_b(current,list,template,id,indent,data)
+local function colored_b(current,list,template,id,indent)
local width, height, depth = getwhd(current)
local total = height + depth
if width > 0 and total > 0 then
@@ -115,7 +118,7 @@ local function colored_b(current,list,template,id,indent,data)
--
local a = getattr(template,a_linefiller)
if a then
- local d = data[a]
+ local d = getvalue(a_linefiller,a)
if d then
rule = linefillers.filler(template,d,width-indent,height,depth)
end
@@ -140,43 +143,47 @@ local currentrow = 0
local enabled = false
local alignments = false
-local function add_alignbackgrounds(head,list,data)
+-- todo: more control over cell attributes
+
+local function add_alignbackgrounds(head,list)
for current, id, subtype, list in nextlist, list do
if list and id == hlist_code and subtype == celllist_code then
for template in nexthlist, list do
local background = getattr(template,a_alignbackground)
if background then
- local list = colored_a(current,list,template,id,data)
+ local list = colored_a(current,list,template,id)
if list then
setlist(current,list)
end
- setattr(template,a_alignbackground,unsetvalue) -- or property
+ -- not that efficient:
+ setattr(template,a_alignbackground,unsetvalue)
end
break
end
end
end
+ -- we can store this differently now
local template = getprop(head,"alignmentchecked")
if template then
- list = colored_b(head,list,template[1],hlist_code,template[2],data)
+ list = colored_b(head,list,template[1],hlist_code,template[2])
flushnodelist(template)
templates[currentrow] = false
return list
end
end
-local function add_backgrounds(head,id,list,data)
+local function add_backgrounds(head,id,list)
if list then
for current, id, subtype, list in nextlist, list do
if list then
- if data and alignments and subtype == alignmentlist_code then
- local l = add_alignbackgrounds(current,list,data)
+ if alignments and subtype == alignmentlist_code then
+ local l = add_alignbackgrounds(current,list)
if l then
list = l
setlist(current,list)
end
end
- local l = add_backgrounds(current,id,list,data)
+ local l = add_backgrounds(current,id,list)
if l then
list = l
setlist(current,l)
@@ -187,36 +194,30 @@ local function add_backgrounds(head,id,list,data)
if id == hlist_code or id == vlist_code then
local background = getattr(head,a_background)
if background then
- list = colored_a(head,list,head,id,data)
+ list = colored_a(head,list,head,id)
-- not needed
- setattr(head,a_background,unsetvalue) -- or property -- todo
+ setattr(head,a_background,unsetvalue) -- or property
return list
end
end
end
function nodes.handlers.backgrounds(head)
- local data = attributes.values[a_linefiller]
--- if data then
- add_backgrounds(head,getid(head),getlist(head),data)
--- end
+ add_backgrounds(head,getid(head),getlist(head))
return head
end
function nodes.handlers.backgroundspage(head,where)
- local data = attributes.values[a_linefiller]
- if data then
- if head and where == "alignment" then
- for n in nexthlist, head do
- local p = getprop(n,"alignmentchecked")
- if not p and getsubtype(n) == alignmentlist_code then
- currentrow = currentrow + 1
- local template = templates[currentrow]
- if trace_alignment then
- report_alignment("%03i %s %s",currentrow,"page",template and "+" or "-")
- end
- setprop(n,"alignmentchecked",template)
+ if head and where == "alignment" then
+ for n in nexthlist, head do
+ local p = getprop(n,"alignmentchecked")
+ if not p and getsubtype(n) == alignmentlist_code then
+ currentrow = currentrow + 1
+ local template = templates[currentrow]
+ if trace_alignment then
+ report_alignment("%03i %s %s",currentrow,"page",template and "+" or "-")
end
+ setprop(n,"alignmentchecked",template)
end
end
end
@@ -224,21 +225,18 @@ function nodes.handlers.backgroundspage(head,where)
end
function nodes.handlers.backgroundsvbox(head,where)
- local data = attributes.values[a_linefiller]
- if data then
- if head and where == "vbox" then
- local list = getlist(head)
- if list then
- for n in nexthlist, list do
- local p = getprop(n,"alignmentchecked")
- if not p and getsubtype(n) == alignmentlist_code then
- currentrow = currentrow + 1
- local template = templates[currentrow]
- if trace_alignment then
- report_alignment("%03i %s %s",currentrow,"vbox",template and "+" or "-")
- end
- setprop(n,"alignmentchecked",template)
+ if head and where == "vbox" then
+ local list = getlist(head)
+ if list then
+ for n in nexthlist, list do
+ local p = getprop(n,"alignmentchecked")
+ if not p and getsubtype(n) == alignmentlist_code then
+ currentrow = currentrow + 1
+ local template = templates[currentrow]
+ if trace_alignment then
+ report_alignment("%03i %s %s",currentrow,"vbox",template and "+" or "-")
end
+ setprop(n,"alignmentchecked",template)
end
end
end
@@ -265,7 +263,7 @@ interfaces.implement {
}
interfaces.implement {
- name = "enablebackgroundalign",
+ name = "enablebackgroundalign", --- move into next one
onlyonce = true,
actions = function()
enable(true)