%D \module
%D   [      file=s-pre-03,
%D        version=1998.09.06,
%D          title=\CONTEXT\ Style File,
%D       subtitle=Presentation Environment 3,
%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.

%D This is the third environment for typesetting interactive
%D presentations. I used this style for a talk on \TEX\ and
%D \JAVASCRIPT\ at \TUG98, mainly because I didn't want to
%D use the same style three times. Therefore this is a rather
%D simple, silly style.

\usemodule[pre-general] % mode=step 

%D \macros
%D  {setupbodyfont}
%D
%D We use a large bodyfont. Combined with the fancy
%D background, this does not leave that much room for text, but
%D presentations should use much text anyway.

\setupbodyfont
  [lbr,14.4pt]

%D \macros
%D   {setuppapersize,setuplayout,setupinteractionscreen}
%D
%D The page dimensions are set to size \type {S6}, being 
%D 600pt by 450pt. We use wide margins and discard headers 
%D and footers. We also launch the document full screen.

\setuppapersize
  [S6][S6]

\setuplayout
  [width=middle,
   height=middle,
   topspace=75pt,
   backspace=100pt,
   header=0pt,
   footer=0pt]

\setupinteractionscreen
  [option=max]

%D \macros 
%D   {setupcolors,definecolor}
%D
%D Next, color support is turned on and a dark red color is 
%D defined. Other red shades will be derived from this one 
%D color. 

\setupcolors
  [state=start]

\definecolor
  [DarkRed][r=.5]

%D \macros 
%D   {setupinteraction}
%D
%D We turn on interaction mode and use the same color for 
%D hyperlinks and redundant hyperlinks (the ones that point 
%D to the current page). 

\setupinteraction
  [state=start,
   contrastcolor=DarkRed,
   color=DarkRed]

%D \macros 
%D   {defineoverlay, setupbackgrounds}
%D
%D The joke in this presentation is the elliptical shape of 
%D which the bottom part includes a page indication. 

\defineoverlay
  [PageShape][\useMPgraphic{PageShape}]

\startuseMPgraphic{PageShape}
  input mp-tool ; 
  color fillcolor ; fillcolor := .85white ; 
  color drawcolor ; drawcolor := .75red   ; 
  color backcolor ; backcolor :=    black ; 
  color pagecolor ; pagecolor := .50red   ; 
  lin := 20pt ; off := .75lin ;
  wid := \overlaywidth ; hei := \overlayheight ;
  pos := \currentpage ; tot := \lastpage ;
  path bb; bb := unitsquare xscaled wid yscaled hei ;  
  filldraw bb withcolor backcolor ;
  pickup pencircle xscaled .5lin yscaled lin rotated 45 ;
  pair r, t, l, b ; 
  r := (wid-off,.5hei) ; t := (.5wid,hei-off) ; 
  l := (off,.5hei) ; b := (.5wid,off) ;
  path p; p := superellipse(r,t,l,b,.8) ;
  fill p withcolor fillcolor ;
  draw p withcolor drawcolor ;
  if (pos>0) and (tot>0): 
    pair pa ; pa := point 5 of p ;
    pair pb ; pb := point 7 of p ;
    draw pa withcolor pagecolor ;
    draw pb withcolor pagecolor ;
    len := 2/tot ;
    pair pa ; pa := point (5+len*pos) of p ;
    pair pb ; pb := point (5+len*(pos-1)) of p ;
    p := p cutafter pa ;
    p := p cutbefore pb ; 
    draw p withcolor pagecolor; 
  fi ; 
  setbounds currentpicture to bb ;
\stopuseMPgraphic

%D We use the viewer provided feature to go to the previous or 
%D next page. 

\defineoverlay[PrevButton][\overlaybutton{PreviousPage}]
\defineoverlay[NextButton][\overlaybutton{NextPage}]

\setupbackgrounds
  [page][background={PageShape,PrevButton}]

\setupbackgrounds
  [text][text][background=NextButton]

% \setupbackgrounds
%   [state=repeat]

%D \macros 
%D   {definehead, setuphead}
%D 
%D Like the other presentation styles, we use \type {\Topic} 
%D instead of \type {\chapters}. This time we don't provide 
%D an additional sectioning. So we have: 
%D 
%D \starttypen 
%D \TitlePage{How nice}
%D 
%D \Topics{This is about ...}
%D 
%D \Topic{The first one}
%D 
%D \Topic{Another one}
%D \stoptypen

\definehead [Topic] [chapter]
\definehead [Nopic] [title]

\setuphead
  [Topic,Nopic]
  [after={\blank[3*medium]},
   number=no,
   style=\tfb,
   page=yes,
   alternative=middle]

\setuplist
  [Topic]
  [alternative=g,
   interaction=all,
   before=,
   after=]

%D The tables of contents is associated with \type 
%D {\Topics}. 

\def\Topics#1%
  {\Nopic[Topics]{#1}
   \placelist[Topic][criterium=all]}

%D Instead of \type {\TitlePage}, one can use the pair 
%D \type {\StartTitlePage} -- \type {\StopTitlePage}:
%D
%D \starttypen 
%D \StartTitlePage
%D A Self Made Title 
%D \StopTitlePage
%D \stoptypen

\def\StartTitlePage%
  {\startstandardmakeup
   \bfd\setupinterlinespace
   \setupalign[middle]
   \vfil
   \def\\{\vfil\bfb\setupinterlinespace}}

\def\StopTitlePage%
  {\vfil\vfil\vfil
   \stopstandardmakeup}

\def\TitlePage#1%
  {\StartTitlePage#1\StopTitlePage}

\endinput
