%D \module
%D   [      file=s-pre-18,
%D        version=1999.08.20,
%D          title=\CONTEXT\ Style File,
%D       subtitle=Presentation Environment 18,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

% todo: met pos en dan iedere titel

\setuppapersize
  [S6][S6]

\setupbodyfont
  [loc,ppl]

\setupcolors
  [state=start]

\definecolor [shade-1] [s=.7]
\definecolor [shade-2] [s=.1]

\definecolor [shade-3] [s=.8]
\definecolor [shade-4] [b=.8]

\definecolor [shade-5] [g=.6]

\setuplayout
  [topspace=1cm,
   height=fit,
   backspace=1cm,
   width=middle,
   header=0pt,
   footer=0pt,
   bottomdistance=1cm]

\setupbackgrounds
  [state=repeat]

\setupbackgrounds [page] [background=page]

\defineoverlay [page] [\useMPgraphic{page}]
\defineoverlay [text] [\useMPgraphic{text}]

\startuseMPgraphic{page}
  StartPage ;
    path p ; numeric s ; pair cp ; cp := center Page ;
    s := define_circular_shade(cp,cp,0,TextWidth,
      \MPcolor{shade-1},\MPcolor{shade-2}) ;
    fill Page withshade s ;
    p := fullcircle xyscaled (TextWidth+1cm, TextHeight+1cm) shifted cp ;
    s := define_circular_shade(cp,cp,0,TextWidth,\MPcolor{shade-3},
      \MPcolor{shade-4}) ;
    fill p withshade s ;
  StopPage
\stopuseMPgraphic

\startuseMPgraphic{text}
  StartPage ;
    path p ; numeric s, t ; pair cp ; cp := center Page ;
    s := define_circular_shade(cp,cp,0,TextWidth,
      \MPcolor{shade-1},\MPcolor{shade-2}) ;
    fill Page withshade s ;
    p := llcorner Field[Text][Bottom] --
         lrcorner Field[Text][Bottom] --
         urcorner Field[Text][Text]   --
         ulcorner Field[Text][Text]   -- cycle ;
    p := p enlarged .5cm randomized .5cm ;
    t := define_circular_shade(cp,cp,0,TextWidth,\MPcolor{shade-3},
      \MPcolor{shade-4}) ;
    fill p withshade t ;

    def bottom_menu_button (expr nn, rr, pp, xx, yy, ww, hh, dd) =
      if (pp>0) and (rr>0) :
        if     nn = 1 :
          p := (0,0)--(ww,hh/2)--(0,hh)--cycle ;
        elseif nn = 2 :
          p := (0,hh/2)--(ww,hh)--(ww,0)--cycle ;
        else :
          p := origin--cycle ;
        fi ;
        fill p randomized 2.5mm shifted (xx,yy) withshade s ;
      fi ;
    enddef ;

    \MPmenubuttons{bottom}

    if length \MPstring{topic} > 0 :
      graphictext
        \MPstring{topic}
        scaled 3
        shifted ulcorner Field[Text][Text]
        shifted (0,-1.5cm)
        withshade s ;
    fi ;

  StopPage ;
\stopuseMPgraphic

\setupinteractionmenu
  [bottom]
  [state=start,
   frame=off,
   left=\hfill,
   middle=\hskip.5cm,
   width=2\bottomheight,
   position=yes]

\startinteractionmenu[bottom]
  \but [previouspage] \\
  \but [nextpage]     \\
\stopinteractionmenu

\setupinteraction
  [state=start,
   click=no,
   color=shade-5,
   contrastcolor=shade-5,
   menu=on]

\setupwhitespace
  [big]

\def\Topic#1%
  {\page
   \setMPtext{topic}{#1}
   \vbox to 2cm{}}

\setMPtext{topic}{}

\def\StartTitlePage%
  {\startstandardmakeup[bottomstate=none]
   \setupalign[middle]
   \vfill}

\def\StopTitlePage%
  {\stopstandardmakeup
   \setuplayout[bottom=1.5cm]
   \setupbackgrounds[page][background=text]}

\def\TitleString#1#2%
  {\indent
   \startMPcode
     graphictext
       "#2"
       scaled #1
       withdrawcolor .4white
       withfillcolor .7white
       withpen pencircle scaled 2pt ;
   \stopMPcode
   \vfill}

\doifnotmode{demo}{\endinput}

\starttext

\StartTitlePage
  \TitleString{8}{Welcome}
  \TitleString{4}{to my favourite}
  \TitleString{8}{Quotes}
\StopTitlePage

\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
