diff options
Diffstat (limited to 'tex/context/base/mkxl/node-bck.lmt')
-rw-r--r-- | tex/context/base/mkxl/node-bck.lmt | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/tex/context/base/mkxl/node-bck.lmt b/tex/context/base/mkxl/node-bck.lmt index ba0e508b6..ff48ff8b5 100644 --- a/tex/context/base/mkxl/node-bck.lmt +++ b/tex/context/base/mkxl/node-bck.lmt @@ -83,7 +83,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) +local function colored_a(current,list,template,id,data) local width, height, depth = getwhd(current) local total = height + depth if width > 0 and total > 0 then @@ -91,7 +91,7 @@ local function colored_a(current,list,template,id) -- local a = getattr(template,a_linefiller) if a then - local d = linefillers.data[a%1000] + local d = data[a] if d then rule = linefillers.filler(template,d,width,height,depth) end @@ -106,7 +106,7 @@ local function colored_a(current,list,template,id) end end -local function colored_b(current,list,template,id,indent) +local function colored_b(current,list,template,id,indent,data) local width, height, depth = getwhd(current) local total = height + depth if width > 0 and total > 0 then @@ -115,7 +115,7 @@ local function colored_b(current,list,template,id,indent) -- local a = getattr(template,a_linefiller) if a then - local d = linefillers.data[a%1000] + local d = data[a] if d then rule = linefillers.filler(template,d,width-indent,height,depth) end @@ -140,13 +140,13 @@ local currentrow = 0 local enabled = false local alignments = false -local function add_alignbackgrounds(head,list) +local function add_alignbackgrounds(head,list,data) 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) + local list = colored_a(current,list,template,data) if list then setlist(current,list) end @@ -158,25 +158,25 @@ local function add_alignbackgrounds(head,list) end local template = getprop(head,"alignmentchecked") if template then - list = colored_b(head,list,template[1],hlist_code,template[2]) + list = colored_b(head,list,template[1],hlist_code,template[2],data) flushnodelist(template) templates[currentrow] = false return list end end -local function add_backgrounds(head,id,list) +local function add_backgrounds(head,id,list,data) if list then for current, id, subtype, list in nextlist, list do if list then if alignments and subtype == alignmentlist_code then - local l = add_alignbackgrounds(current,list) + local l = add_alignbackgrounds(current,list,data) if l then list = l setlist(current,list) end end - local l = add_backgrounds(current,id,list) + local l = add_backgrounds(current,id,list,data) if l then list = l setlist(current,l) @@ -187,7 +187,7 @@ local function add_backgrounds(head,id,list) 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) + list = colored_a(head,list,head,id,data) -- not needed setattr(head,a_background,unsetvalue) -- or property -- todo return list @@ -196,21 +196,27 @@ local function add_backgrounds(head,id,list) end function nodes.handlers.backgrounds(head) - add_backgrounds(head,getid(head),getlist(head)) + local data = attributes.values[a_linefiller] + if data then + add_backgrounds(head,getid(head),getlist(head),data) + end return head end function nodes.handlers.backgroundspage(head,where) - 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 "-") + 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) end - setprop(n,"alignmentchecked",template) end end end @@ -218,18 +224,21 @@ function nodes.handlers.backgroundspage(head,where) end function nodes.handlers.backgroundsvbox(head,where) - 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 "-") + 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) end - setprop(n,"alignmentchecked",template) end end end @@ -237,15 +246,6 @@ function nodes.handlers.backgroundsvbox(head,where) return head end --- interfaces.implement { --- name = "enablebackgroundboxes", --- onlyonce = true, --- actions = enableaction, --- arguments = { "'shipouts'", "'nodes.handlers.backgrounds'" } --- } --- --- doing it in the shipout works as well but this is nicer - local function enable(alignmentstoo) if not enabled then enabled = true @@ -274,7 +274,7 @@ interfaces.implement { interfaces.implement { name = "setbackgroundrowdata", - arguments = { "integer", "integer", "dimension" }, + arguments = { "integer", "integer", "dimension" }, -- todo: "box" actions = function(row,box,indent) row = row -1 -- better here than in tex if box == 0 then |