%D \module
%D   [      file=s-present-simple, % was: s-pre-68,
%D        version=2009.08.28,
%D          title=\CONTEXT\ Style File,
%D       subtitle=Presentation Environment Simple,
%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.

\usemodule[present-stepwise]

\startmodule[present-simple]

% style

\setuppapersize
  [S66][S66]

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

\setupinteraction
  [state=start,
   click=no]

\definecolor[maincolor][r=.4]

\startreusableMPgraphic{page}
    StartPage ;
        fill Page enlarged 5mm withcolor "maincolor" ;
    StopPage ;
\stopreusableMPgraphic

\startreusableMPgraphic{next}
    fill ultriangle scaled .15PaperWidth withcolor white ;
\stopreusableMPgraphic

\startreusableMPgraphic{last}
    fill boundingbox(ultriangle scaled .15PaperWidth) withcolor white ;
\stopreusableMPgraphic

\startuniqueMPgraphic{bullit}
    fill ultriangle scaled 2ExHeight withcolor white ;
\stopuniqueMPgraphic

\definelayer
  [extra]
  [width=\paperwidth,
   height=\paperheight]

\defineoverlay
  [page]
  [\reuseMPgraphic{page}]

\setupbackgrounds
  [page]
  [background={page,extra}]

\setupcolors
  [state=start,
   textcolor=white]

\setuphead
  [chapter]
  [style=\bfc]

\definehead
  [Title]
  [title]

\definesymbol
  [MyBullet]
  [\uniqueMPgraphic{bullit}]

\setupitemgroup
  [itemize]
  [each]
  [symbol=MyBullet]

\doifelsemode {asintended,atpragma} {
    \setupbodyfont[cambria,14.4pt]
} {
    \setupbodyfont[pagella,14.4pt]
}

% interface

\unexpanded\def\StartItems
  {\begingroup
   \StartSteps
   \startitemize
   \unexpanded\def\StartItems{\startitemize\unexpanded\def\StopItems{\stopitemize}}}

\unexpanded\def\StopItems
  {\FlushStep
   \stopitemize
   \NextPageSymbol
   \StopSteps
   \endgroup}

\unexpanded\def\Item
  {\unexpanded\def\Item{\FlushStep\item}
   \item}

\unexpanded\def\NextPageSymbol
  {\setlayer
     [extra]
     [preset=rightbottom,offset=2mm]
     {\ifnum\realpageno=\lastpage\relax
       \reuseMPgraphic{last}%
      \else\ifnum\realpageno>\plusone
       \reuseMPgraphic{next}%
      \fi\fi
      \FlushStep}}

\unexpanded\def\TitlePage#1#2%
  {\startstandardmakeup[bottom=,top=]
   \scale[width=\textwidth]{\framed[align=flushleft,foregroundstyle=\bf,frame=off]{#1}}
   \vfilll
   \hfill\scale[width=.5\textwidth]{\framed[align=flushright,foregroundstyle=\bf,frame=off]{#2}}
   \stopstandardmakeup}

\unexpanded\def\StartTopic#1%
  {\Title{#1}}

\unexpanded\def\StopTopic
  {\page}

\startsetups document:start
    \TitlePage
      {\documentvariable{title}}
      {\documentvariable{author}\\
       \documentvariable{location}}
\stopsetups

\stopmodule

\continueifinputfile{s-present-simple.mkiv}

\usemodule[present-common]

\inputpresentationfile{examples/present-simple-001.tex}
