summaryrefslogtreecommitdiff
path: root/doc/context/sources/general/manuals/metafun/mfun-774.tex
blob: 725d1199b4f8cf9d8a201239dc87ee3193ee2e8c (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
% language=uk
%
% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa

\usemodule[present-organic]

\setupMPvariables[page][alternative=1]

\startuseMPgraphic{page}

  \includeMPgraphic{rightsuperbutton}

  StartPage ;

    path p, q ;

    p := Field[Text][Text] enlarged 36pt superellipsed .90 ;

    fill Page
      withcolor \MPcolor{yellow} ;
    fill p
      withcolor \MPcolor{white} ;
    draw p
      dashed dashpattern (on 9pt off 9pt)
      withpen pencircle scaled 3pt
      withcolor \MPcolor{red} ;

    p := Field[Text][Text] enlarged 48pt superellipsed .90 ;

    draw p
      dashed dashpattern (on 9pt off 9pt)
      withpen pencircle scaled 1.5pt ;

    def right_menu_button (expr nn, rr, pp, xx, yy, ww, hh, dd) =
      if (pp>0) and (rr>0) :
        q := rightsuperbutton(p,xx,yy,RightEdgeWidth,hh) ;
        fill q
          withcolor \MPcolor{white} ;
        draw ptop
          withpen pencircle scaled 1.5pt ;
        draw pbot
          withpen pencircle scaled 1.5pt ;
        draw q
          dashed dashpattern (on 9pt off 9pt)
          withpen pencircle scaled 3pt
          withcolor if rr=2 : \MPcolor{gray} else : \MPcolor{red} fi ;
      fi ;
    enddef ;

    \MPmenubuttons{right}

  StopPage ;
\stopuseMPgraphic

\startuseMPgraphic{rightsuperbutton}

vardef rightsuperbutton (expr pat, xpos, ypos, wid, hei) =

  save p, t, b, edge, shift, width, height ;
  path p, ptop, pbot ; pair t, b ; numeric edge, shift, width, height ;

  edge  := xpos + wid ; shift := ypos + hei ;

  p := rightpath pat ;

draw p withpen pencircle scaled 1.5pt ;

  ptop := ((-infinity,shift)--(edge,shift)) ;
  pbot := ((-infinity,shift-hei)--(edge,shift-hei)) ;

  t := p intersectionpoint ptop ;
  b := p intersectionpoint pbot ;

  label.llft("t",t) ;
  label.ulft("b",b) ;

  p := subpath(0,xpart (p intersectiontimes ptop)) of p ;
  p := subpath(xpart (p intersectiontimes pbot),length(p)) of p ;

  (p --               t -- point 1 of ptop &
        point 1 of ptop -- point 1 of pbot &
        point 1 of pbot -- b
     -- cycle)

enddef ;

\stopuseMPgraphic



\starttext

\TitlePage
  {A Few Nice Quotes\\
   A Simple Style Demo\\
   Hans Hagen, August 2000}

\Topic {Douglas R. Hofstadter} \input douglas \page
\Topic {Donald E. Knuth}       \input knuth   \page
\Topic {Edward R. Tufte}       \input tufte   \page
\Topic {Hermann Zapf}          \input zapf    \page

\stoptext