summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/modules/mkiv/m-nodechart.mkvi
blob: ab117efe04512d62838bc3a88ba0ca671e619d59 (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
%D \module
%D   [       file=m-nodechart,
%D        version=2011.11.11, % nos sure when it started, needed for fonts-mkiv
%D          title=\CONTEXT\ Modules,
%D       subtitle=Node Visualization,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]

%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

\registerctxluafile{m-nodechart}{}

\usemodule[chart]

\unprotect

\def\enspaceminus{\hskip.5em minus .25em\relax}

\starttexdefinition unexpanded doFLOWglyphnode #comment #subtype #font #char #unicode
   \dontleavehmode\hbox{\bf\setstrut\strut \doifsomething{#comment}{#comment\enspaceminus:\enspaceminus}glyph #subtype}
   \vss
   \dontleavehmode\hbox{\tx\setstrut\strut font\enspaceminus#font:\enspace#unicode:\enspaceminus\setfontofid{#font}\char#char}
\stoptexdefinition

\starttexdefinition unexpanded doFLOWdiscnode #comment #subtype
   \dontleavehmode\hbox{\bf\setstrut\strut disc}
   \vss
   \dontleavehmode\hbox{\tx\setstrut\strut}
\stoptexdefinition

\starttexdefinition unexpanded doFLOWkernnode #comment #subtype #kern
   \dontleavehmode\hbox{\bf\setstrut\strut#subtype}
   \vss
   \dontleavehmode\hbox{\tx\setstrut\strut#kern}
\stoptexdefinition

\starttexdefinition unexpanded doFLOWpenaltynode #comment #subtype #penalty
   \dontleavehmode\hbox{\bf\setstrut\strut#subtype}
   \vss
   \dontleavehmode\hbox{\tx\setstrut\strut#penalty}
\stoptexdefinition

\starttexdefinition unexpanded doFLOWgluenode #comment #subtype #width #shrink #stretch
   \dontleavehmode\hbox{\bf\setstrut\strut#subtype}
   \vss
   \dontleavehmode\hbox{\tx\setstrut\strut#width\enspaceminus-\enspaceminus#shrink\enspaceminus+\enspaceminus#stretch}
\stoptexdefinition

\starttexdefinition unexpanded doFLOWdirnode #comment #subtype #direction
   \dontleavehmode\hbox{\bf\setstrut\strut#subtype}
   \vss
   \dontleavehmode\hbox{\tx\setstrut\strut#direction}
\stoptexdefinition

\defineframed
  [flowcell:node]
  [flowcell:base]
  [\c!top=\vss,
   \c!bottom=\vss,
   \c!align=\v!middle,
   \c!foregroundstyle=\tt]

% this is a temporary interface ... we will have instances and optional settings

\unexpanded\def\boxtoFLOWchart[#name]#box%
  {\ctxlua{moduledata.charts.nodes.chart {
       name = "#name",
       box  = \number#box,
   }}}

\unexpanded\def\nextboxtoFLOWchart[#name]%
  {\dowithnextbox{\boxtoFLOWchart[#name]\nextbox}}

\unexpanded\def\hboxtoFLOWchart[#name]%
  {\nextboxtoFLOWchart[#name]\hbox}

\unexpanded\def\vboxtoFLOWchart[#name]%
  {\nextboxtoFLOWchart[#name]\vbox}

\protect

\continueifinputfile{m-nodechart.mkvi}

\definecolor[nodechart:glyph][darkred]

\setupbodyfont[dejavu,10pt]

\starttext

\startTEXpage[offset=10pt]

    \hboxtoFLOWchart[dummy]{an affil\discretionary{-}{-}{!}iation}

    \FLOWchart[dummy][width=14em,height=3em,dx=1em,dy=.75em,hcompact=yes]

\stopTEXpage

\startTEXpage[offset=10pt]

    \hboxtoFLOWchart[dummy]{an affiliation}

    \FLOWchart[dummy][width=14em,height=3em,dx=.5em,dy=.75em,hcompact=yes]

\stopTEXpage

\startTEXpage[offset=10pt]

    \hboxtoFLOWchart[dummy]{\nl effe fijn fietsen}

    \FLOWchart[dummy][width=14em,height=3em,dx=.5em,dy=.75em,hcompact=yes]

\stopTEXpage

\startTEXpage[offset=10pt]

    \hboxtoFLOWchart[dummy]{\righttoleft t\kern 1pt est}

    \FLOWchart[dummy][width=14em,height=3em,dx=.5em,dy=.75em,hcompact=yes]

\stopTEXpage

\stoptext