diff options
Diffstat (limited to 'tex')
-rw-r--r-- | tex/context/base/back-pdf.lua | 22 | ||||
-rw-r--r-- | tex/context/base/cont-new.mkii | 2 | ||||
-rw-r--r-- | tex/context/base/cont-new.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/context.mkii | 2 | ||||
-rw-r--r-- | tex/context/base/context.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/grph-inc.lua | 9 | ||||
-rw-r--r-- | tex/context/base/grph-swf.lua | 4 | ||||
-rw-r--r-- | tex/context/base/l-pdfview.lua | 4 | ||||
-rw-r--r-- | tex/context/base/lpdf-swf.lua | 188 | ||||
-rw-r--r-- | tex/context/base/status-files.pdf | bin | 23557 -> 23551 bytes | |||
-rw-r--r-- | tex/context/base/status-lua.pdf | bin | 154280 -> 154316 bytes | |||
-rw-r--r-- | tex/generic/context/luatex-fonts-merged.lua | 2 |
12 files changed, 173 insertions, 64 deletions
diff --git a/tex/context/base/back-pdf.lua b/tex/context/base/back-pdf.lua index 7c736ebaf..294a7b05c 100644 --- a/tex/context/base/back-pdf.lua +++ b/tex/context/base/back-pdf.lua @@ -8,6 +8,8 @@ if not modules then modules = { } end modules ['back-pdf'] = { -- we will move code to lpdf-* files (second cleanup stage) +-- the push/pop is a mess (only needed for calculate ...) .. will be done differently + --[[ldx-- <p>This module implements a couple of cleanup methods. We need these in order to meet the <l n='pdf'/> specification. Watch the double @@ -480,6 +482,26 @@ function codeinjections.setfigurealternative(data,figure) end end +function codeinjections.getdisplayfigure(request) + local figure = figures.initialize(request) + if not figure then + return + end + figure = figures.identify(figure) + if not figure then + return + end + figure = figures.check(figure) + if not figure then + return + end + local image = figure.status.private + if image then + img.immediatewrite(image) + end + return figure +end + function codeinjections.setfiguremask(data,figure) -- mark local request = data.request local mask = request.mask diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index 59035550a..1722e31d7 100644 --- a/tex/context/base/cont-new.mkii +++ b/tex/context/base/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2011.05.09 21:19} +\newcontextversion{2011.05.10 18:34} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 246f6f718..8ace480f0 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2011.05.09 21:19} +\newcontextversion{2011.05.10 18:34} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii index 0a88479a9..393b1f555 100644 --- a/tex/context/base/context.mkii +++ b/tex/context/base/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2011.05.09 21:19} +\edef\contextversion{2011.05.10 18:34} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 6ba32def2..b45400857 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2011.05.09 21:19} +\edef\contextversion{2011.05.10 18:34} %D For those who want to use this: diff --git a/tex/context/base/grph-inc.lua b/tex/context/base/grph-inc.lua index 87fbd549e..7dee63eaf 100644 --- a/tex/context/base/grph-inc.lua +++ b/tex/context/base/grph-inc.lua @@ -306,8 +306,7 @@ end local lastfiguredata = nil -- will be topofstack or last so no { } (else problems with getfiguredimensions) local callstack = { } -function figures.push(request) - statistics.starttiming(figures) +function figures.initialize(request) local figuredata = new() if request then -- request.width/height are strings and are only used when no natural dimensions @@ -325,6 +324,12 @@ function figures.push(request) -- request.height = (h and h > 0) or false table.merge(figuredata.request,request) end + return figuredata +end + +function figures.push(request) + statistics.starttiming(figures) + local figuredata = figures.initialize(request) insert(callstack,figuredata) lastfiguredata = figuredata return figuredata diff --git a/tex/context/base/grph-swf.lua b/tex/context/base/grph-swf.lua index ed1c20eeb..88eed021a 100644 --- a/tex/context/base/grph-swf.lua +++ b/tex/context/base/grph-swf.lua @@ -79,8 +79,8 @@ function figures.checkers.swf(data) width = width, height = height, -- factor = number.dimenfactors.bp, - -- display = dr.display, - -- controls = dr.controls, + display = dr.display, + controls = dr.controls, -- label = dr.label, resources = dr.resources, } diff --git a/tex/context/base/l-pdfview.lua b/tex/context/base/l-pdfview.lua index 9bf525775..6fd3ac246 100644 --- a/tex/context/base/l-pdfview.lua +++ b/tex/context/base/l-pdfview.lua @@ -6,6 +6,10 @@ if not modules then modules = { } end modules ['l-pdfview'] = { license = "see context related readme files" } +-- Todo: figure out pdfopen/pdfclose on linux. Calling e.g. okular directly +-- doesn't work in linux when issued from scite as it blocks the editor (no +-- & possible or so). + local format, concat = string.format, table.concat pdfview = pdfview or { } diff --git a/tex/context/base/lpdf-swf.lua b/tex/context/base/lpdf-swf.lua index 2fec5df07..ef1855526 100644 --- a/tex/context/base/lpdf-swf.lua +++ b/tex/context/base/lpdf-swf.lua @@ -23,39 +23,98 @@ local pdfnull = lpdf.null local pdfreference = lpdf.reference local pdfimmediateobject = lpdf.immediateobject +local variables = interfaces.variables + local codeinjections = backends.pdf.codeinjections local nodeinjections = backends.pdf.nodeinjections local pdfannotation_node = nodes.pool.pdfannotation +local activations = { + click = "XA", + page = "PO", + focus = "PV", +} + +local deactivations = { + click = "XD", + page = "PI", + focus = "PC", +} + +table.setmetatableindex(activations, function() return activations .click end) +table.setmetatableindex(deactivations,function() return deactivations.focus end) + +local factor = number.dimenfactors.bp + +function img.package(image) + local boundingbox = image.bbox + local imagetag = "Im" .. image.index + local resources = pdfdictionary { + ProcSet = pdfarray { + pdfconstant("PDF"), + pdfconstant("ImageC") + }, + Resources = pdfdictionary { + XObject = pdfdictionary { + [imagetag] = pdfreference(image.objnum) + } + } + } + local width = boundingbox[3] + local height = boundingbox[4] + local xform = img.scan { + attr = resources(), + stream = format("%s 0 0 %s 0 0 cm /%s Do",width,height,imagetag), + bbox = { 0, 0, width/factor, height/factor }, + } + img.immediatewrite(xform) + return xform +end + + local function insertswf(spec) - local width, height, filename, resources = spec.width, spec.height, spec.foundname, spec.resources + local width = spec.width + local height = spec.height + local filename = spec.foundname + local resources = spec.resources + local display = spec.display + local controls = spec.controls local resources = resources and parametersets[resources] - local eref = codeinjections.embedfile { file = filename } + if display == nil or display == "" then + display = resources.display + end + if controls == nil or controls == "" then + controls = resources.controls + end + + controls = toboolean(variables[controls] or controls,true) + + local embeddedreference = codeinjections.embedfile { file = filename } local flash = pdfdictionary { Subtype = pdfconstant("Flash"), Instances = pdfarray { pdfdictionary { - Asset = eref, + Asset = embeddedreference, Params = pdfdictionary { - Binding = pdfconstant("Foreground") + Binding = pdfconstant("Background") -- Foreground makes swf behave erratic } }, }, } - local fref = pdfreference(pdfimmediateobject(tostring(flash))) + local flashreference = pdfreference(pdfimmediateobject(tostring(flash))) local configuration = pdfdictionary { - Configurations = pdfarray { fref }, + Configurations = pdfarray { flashreference }, Assets = pdfdictionary { Names = pdfarray { pdfstring(filename), - eref, + embeddedreference, } }, } @@ -64,9 +123,9 @@ local function insertswf(spec) local names = configuration.Assets.Names local function add(filename) local filename = gsub(filename,"%./","") - local eref = codeinjections.embedfile { file = filename, keepdir = true } + local embeddedreference = codeinjections.embedfile { file = filename, keepdir = true } names[#names+1] = pdfstring(filename) - names[#names+1] = eref + names[#names+1] = embeddedreference end local paths = resources.paths if paths then @@ -85,58 +144,77 @@ local function insertswf(spec) end end - local cref = pdfreference(pdfimmediateobject(tostring(configuration))) + local configurationreference = pdfreference(pdfimmediateobject(tostring(configuration))) local activation = pdfdictionary { - Activation = pdfdictionary { - Type = pdfconstant("RichMediaActivation"), - Condition = pdfconstant("PO"), - Configuration = fref, - Animation = pdfdictionary { - Subtype = pdfconstant("Linear"), - Speed = 1, - Playcount = 1, - }, - Deactivation = pdfdictionary { - Type = pdfconstant("RichMediaDeactivation"), - Condition = pdfconstant("XD"), - }, - Presentation = pdfdictionary { - PassContextClick = false, - Style = pdfconstant("Embedded"), - Toolbar = false, - NavigationPane = false, - Transparent = true, - Window = pdfdictionary { - Type = pdfconstant("RichMediaWindow"), - Width = pdfdictionary { - Default = 100, - Min = 100, - Max = 100, - }, - Height = pdfdictionary { - Default = 100, - Min = 100, - Max = 100, - }, - Position = pdfdictionary { - Type = pdfconstant("RichMediaPosition"), - HAlign = pdfconstant("Near"), - VAlign = pdfconstant("Near"), - HOffset = 0, - VOffset = 0, - } + Type = pdfconstant("RichMediaActivation"), + Condition = pdfconstant(activations[resources.open]), + Configuration = flashreference, + Animation = pdfdictionary { + Subtype = pdfconstant("Linear"), + Speed = 1, + Playcount = 1, + }, + Presentation = pdfdictionary { + PassContextClick = false, + Style = pdfconstant("Embedded"), + Toolbar = controls or false, + NavigationPane = false, + Transparent = true, + Window = pdfdictionary { + Type = pdfconstant("RichMediaWindow"), + Width = pdfdictionary { + Default = 100, + Min = 100, + Max = 100, + }, + Height = pdfdictionary { + Default = 100, + Min = 100, + Max = 100, + }, + Position = pdfdictionary { + Type = pdfconstant("RichMediaPosition"), + HAlign = pdfconstant("Near"), + VAlign = pdfconstant("Near"), + HOffset = 0, + VOffset = 0, } } - } + }, + -- View + -- Scripts } - local aref = pdfreference(pdfimmediateobject(tostring(activation))) + local deactivation = pdfdictionary { + Type = pdfconstant("RichMediaDeactivation"), + Condition = pdfconstant(deactivations[resources.close]), + } + + local richmediasettings = pdfdictionary { + Type = pdfconstant("RichMediaSettings"), + Activation = activation, + Deactivation = deactivation, + } + + local settingsreference = pdfreference(pdfimmediateobject(tostring(richmediasettings))) + + local appearance + + if display and display ~= "" then + local figure = codeinjections.getdisplayfigure { name = display, width = width, height = height } + if figure then + local image = img.package(figure.status.private) + local reference = image.objnum + appearance = reference and pdfdictionary { N = pdfreference(reference) } or nil + end + end local annotation = pdfdictionary { - Subtype = pdfconstant("RichMedia"), - RichMediaContent = cref, - RichMediaSettings = aref, + Subtype = pdfconstant("RichMedia"), + RichMediaContent = configurationreference, + RichMediaSettings = settingsreference, + AP = appearance, } return annotation, nil, nil @@ -149,8 +227,8 @@ function backends.pdf.nodeinjections.insertswf(spec) width = spec.width, height = spec.height, -- factor = spec.factor, - -- display = spec.display, - -- controls = spec.controls, + display = spec.display, + controls = spec.controls, -- label = spec.label, resources = spec.resources, } diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex 5a136355c..575e68449 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf Binary files differindex 79df508e0..236ec43d3 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua index 18723ff07..22a56ec40 100644 --- a/tex/generic/context/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 05/09/11 21:19:11 +-- merge date : 05/10/11 18:34:20 do -- begin closure to overcome local limits and interference |