summaryrefslogtreecommitdiff
path: root/tex/context/base/grph-epd.mkiv
blob: b23631b790563f0c89621acbef7ee03f4dc784b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
%D \module
%D   [       file=grph-epd,
%D        version=2010.07.29,
%D          title=\CONTEXT\ Graphic Macros,
%D       subtitle=Merging Goodies,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA / Hans Hagen \& Ton Otten}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

\writestatus{loading}{ConTeXt Graphic Macros / Merging Coodies}

\unprotect

\registerctxluafile{lpdf-epd}{1.001}
\registerctxluafile{lpdf-epa}{1.001}
\registerctxluafile{grph-epd}{1.001}

\def\figurereference {\ctxlua{figures.tprint("status","reference")}}

\defineoverlay[epdf-overlay][\directsetup{epdf-overlay}]

\startsetups epdf-overlay
    \ctxlua{figures.mergegoodies("\@@efinteraction")}%
    \reference[\figurereference]{}% todo: dest area
\stopsetups

\def\doaddpdffiguregoodies
  {\global\setbox\foundexternalfigure\vbox\bgroup
        \framed[\c!offset=\v!overlay,\c!background={\v!foreground,epdf-overlay}]{\box\foundexternalfigure}%
   \egroup}

\appendtoks
    \iflocation\doif\figurefiletype{pdf}{\doifnot\@@efinteraction\v!none\doaddpdffiguregoodies}\fi
\to \externalfigurepostprocessors

\protect \endinput

% /Properties << /xxxx 22 0 R >>
% 21 0 obj << /Type /OCG /Name (xxxx) >> endobj
% 22 0 obj << /OCGs [ 21 0 R ] /Type /OCMD >> endobj

% \def\setepdflayer#1#2#3#4#5#6% x y w h (in bp) 0/1 destination
%   {\setlayer
%     [epdflinks]
%     [\c!x=#1bp,\c!y=#1\s!bp,\c!preset=\v!leftbottom]
%     {\button
%        [\c!width=#3\s!bp,\c!height=#4\s!bp,\c!offset=\v!overlay,\c!frame=\ifnum#5=1 on\else\v!off]%
%        {}[#6]}}

% \def\setepdflayer#1#2#3#4#5#6% x y w h (in bp) 0/1 destination
%   {\setlayer
%     [epdflinks]
%     [\c!x=#1bp,\c!y=#1\s!bp,\c!preset=\v!leftbottom]
%     {\gotowdhtbox{#3\s!bp}{#4\s!bp}[#6]}}