mfun-774.tex /size: 2382 b    last modification: 2023-12-21 09:43
1% language=us runpath=texruns:manuals/metafun
2
3\usemodule[present-organic]
4
5\setupMPvariables[page][alternative=1]
6
7\startuseMPgraphic{page}
8
9  \includeMPgraphic{rightsuperbutton}
10
11  StartPage ;
12
13    path p, q ;
14
15    p := Field[Text][Text] enlarged 36pt superellipsed .90 ;
16
17    fill Page
18      withcolor \MPcolor{yellow} ;
19    fill p
20      withcolor \MPcolor{white} ;
21    draw p
22      dashed dashpattern (on 9pt off 9pt)
23      withpen pencircle scaled 3pt
24      withcolor \MPcolor{red} ;
25
26    p := Field[Text][Text] enlarged 48pt superellipsed .90 ;
27
28    draw p
29      dashed dashpattern (on 9pt off 9pt)
30      withpen pencircle scaled 1.5pt ;
31
32    def right_menu_button (expr nn, rr, pp, xx, yy, ww, hh, dd) =
33      if (pp>0) and (rr>0) :
34        q := rightsuperbutton(p,xx,yy,RightEdgeWidth,hh) ;
35        fill q
36          withcolor \MPcolor{white} ;
37        draw ptop
38          withpen pencircle scaled 1.5pt ;
39        draw pbot
40          withpen pencircle scaled 1.5pt ;
41        draw q
42          dashed dashpattern (on 9pt off 9pt)
43          withpen pencircle scaled 3pt
44          withcolor if rr=2 : \MPcolor{gray} else : \MPcolor{red} fi ;
45      fi ;
46    enddef ;
47
48    \MPmenubuttons{right}
49
50  StopPage ;
51\stopuseMPgraphic
52
53\startuseMPgraphic{rightsuperbutton}
54
55vardef rightsuperbutton (expr pat, xpos, ypos, wid, hei) =
56
57  save p, t, b, edge, shift, width, height ;
58  path p, ptop, pbot ; pair t, b ; numeric edge, shift, width, height ;
59
60  edge  := xpos + wid ; shift := ypos + hei ;
61
62  p := rightpath pat ;
63
64draw p withpen pencircle scaled 1.5pt ;
65
66  ptop := ((-infinity,shift)--(edge,shift)) ;
67  pbot := ((-infinity,shift-hei)--(edge,shift-hei)) ;
68
69  t := p intersectionpoint ptop ;
70  b := p intersectionpoint pbot ;
71
72  label.llft("t",t) ;
73  label.ulft("b",b) ;
74
75  p := subpath(0,xpart (p intersectiontimes ptop)) of p ;
76  p := subpath(xpart (p intersectiontimes pbot),length(p)) of p ;
77
78  (p --               t -- point 1 of ptop &
79        point 1 of ptop -- point 1 of pbot &
80        point 1 of pbot -- b
81     -- cycle)
82
83enddef ;
84
85\stopuseMPgraphic
86
87
88
89\starttext
90
91\TitlePage
92  {A Few Nice Quotes\\
93   A Simple Style Demo\\
94   Hans Hagen, August 2000}
95
96\Topic {Douglas R. Hofstadter} \input douglas \page
97\Topic {Donald E. Knuth}       \input knuth   \page
98\Topic {Edward R. Tufte}       \input tufte   \page
99\Topic {Hermann Zapf}          \input zapf    \page
100
101\stoptext
102