% engine=luatex

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

%D I might improve this module so consider it experimental.

% \enablemode[numbers]
% \enablemode[paper]

\usemodule[pre-60,abr-02]

\registerctxluafile{s-pre-71}{}

\setupinteraction[state=start,click=off]

\definepapersize[wide][width=900pt,height=600pt]

\setuppapersize[wide][wide]

\setuplayout[page]

% \setupbodyfont[15pt]

\usetypescriptfile[type-hgz]
\usetypescript[palatino-informal]
\setupbodyfont[palatino-informal,15pt]

\setupsorting[logo][style=]

\startnotmode[paper]
    \setupbackgrounds[page][background=color,backgroundcolor=black]
\stopnotmode

\TransparencyHack

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

\definecolor[TopicColor-1][r=.3,g=.4,b=.5]
\definecolor[TopicColor-2][r=.3,g=.5,b=.4]
\definecolor[TopicColor-3][r=.4,g=.3,b=.5]
\definecolor[TopicColor-4][r=.4,g=.5,b=.3]
\definecolor[TopicColor-5][r=.5,g=.3,b=.4]
\definecolor[TopicColor-6][r=.5,g=.4,b=.3]
\definecolor[TopicColor-7][r=.35,g=.35,b=.6]
\definecolor[TopicColor-8][r=.6,g=.35,b=.35]
\definecolor[TopicColor-9][r=.35,g=.6,b=.35]

\definecolor[TopicColor-0][t=.5,a=1,s=.5]
\definecolor[TopicColor]  [s=1]

\setupcolors[state=start]
\setupcolors[textcolor=TopicColor]

\def\StartTopics
  {\startstandardmakeup
   \ctxlua{moduledata.steps.reset_locations()}
   \doifnotmode{paper}{\StartLocalSteps}}

\def\StopTopics
  {\doifnotmode{paper}{\StopLocalSteps}
   \flushlayer[page]
   \stopstandardmakeup}

\def\StartTopic
  {\dosingleempty\doStartTopic}

\def\doStartTopic[#1]%
  {\doifnotmode{paper}{\NextStep}
   \ctxlua{moduledata.steps.next_location("#1")}
   \startnotmode[paper]
     \doifnothing{#1}
       {\ifcase\ctxlua{moduledata.steps.previous_n()}\else
          \setlayer
            [page]
            [preset=\ctxlua{moduledata.steps.previous_location()}]
             \bgroup
               \doifnotmode{paper}{\startviewerlayer[\StepLayer]}%
               \framed
                 [offset=20pt,
                  strut=no,
                  align=normal,
                  frame=off,
                  height=\dimexpr\paperheight/3\relax,
                  width=\dimexpr\paperwidth/3\relax,
                  background=color,
                  backgroundcolor=TopicColor-0]
                 {}%
               \doifnotmode{paper}{\stopviewerlayer}%
             \egroup
         \fi}
   \stopnotmode
   \setlayer
     [page]
     [preset=\ctxlua{moduledata.steps.current_location()}]
     \bgroup
       \doifnotmode{paper}{\startviewerlayer[\StepLayer]}%
       \framed
         [offset=20pt,
          strut=no,
          align=\expdoifelse{#1}{}{normal}{middle,lohi},
          align=\expdoifelse{#1}{}{flushleft,verytolerant}{middle,lohi},
          frame=off,
          height=\dimexpr\paperheight/3\relax,
          width=\dimexpr\paperwidth/3\relax,
          background=color,
          backgroundcolor=TopicColor-\ctxlua{moduledata.steps.current_n()}]
         \bgroup
         \ignorespaces}

\def\StopTopic
  {\removeunwantedspaces
   \egroup
   \doifnotmode{paper}{\stopviewerlayer}%
   \egroup
   \startmode[numbers]
   \setlayerframed
     [page]
     [preset=\ctxlua{moduledata.steps.current_location()}]
     [height=\dimexpr\paperheight/3\relax,
      width=\dimexpr\paperwidth/3\relax,
      frame=off,
      foregroundstyle=\bfa,
      align={flushright,low}]
     {\doifnotmode{paper}{\startviewerlayer[\StepLayer]}%
      \ctxlua{moduledata.steps.step()}\kern\strutdepth
      \doifnotmode{paper}{\stopviewerlayer}}
   \stopmode}

\logo [METAPOST] {MetaPost}

\definefont[TitleFont][SansBold at 60pt]
\definefont[TempFont] [SansBold at 12pt]

\let\StartText\starttext
\let\StopText \stoptext

\continueifinputfile{s-pre-71.mkiv}

\starttext

\StartTopics
    \StartTopic[1] A \StopTopic
    \StartTopic[5] B \StopTopic
    \StartTopic[9] C \StopTopic
\StopTopics

\StartTopics
    \StartTopic A \StopTopic
    \StartTopic B \StopTopic
    \StartTopic C \StopTopic
    \StartTopic D \StopTopic
    \StartTopic E \StopTopic
    \StartTopic F \StopTopic
    \StartTopic G \StopTopic
    \StartTopic H \StopTopic
    \StartTopic I \StopTopic
\StopTopics

\stoptext
