%D \module
%D   [      file=s-pre-66,
%D        version=2009.02.24,
%D          title=\CONTEXT\ Style File,
%D       subtitle=Presentation Environment 66,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright=Hans Hagen]
%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 Cambria (made in the aftermath of testing \OPENTYPE\ math).

% \enablemode[paper]

\usemodule[pre-60]
\usemodule[abr-01]

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

\setuppapersize
  [wide]
  [wide]

\setuplayout
  [topspace=20pt,
   bottomspace=20pt,
   header=0pt,
   footer=0pt,
   backspace=20pt,
   height=middle,
   rightmargin=0pt,
   rightedge=\dimexpr220pt-40pt\relax,
   rightedgedistance=40pt,
   leftedge=0pt,
   leftmargin=0pt,
   cutspace=220pt,
   width=\dimexpr960pt-40pt-220pt\relax]

\definebodyfontenvironment
  [20pt]

\definefontfeature[default][default][mode=node,script=latn]

\usetypescript
  [cambria]

\setupbodyfont
  [cambria,20pt] \bf

\setupwhitespace
  [big]

\setupcolors
  [state=start]

\definecolor[pagecolor][s=.25]
\definecolor[edgecolor][b=.50,g=.75,r=.75]

\setupinteraction
  [state=start,
   click=no,
   color=,
   contrastcolor=]

\defineoverlay[pagegraphic][\reuseMPgraphic{pagegraphic}]

\startuseMPgraphic{pagegraphic}
    StartPage ;
        fill Page enlarged 10pt withcolor \MPcolor{pagecolor} ;
        fill Page enlarged 10pt leftenlarged (CutSpace - bbwidth(Page) - 10pt) withcolor \MPcolor{edgecolor} ;
    %   fill Field[Text][RightEdge] withcolor green ;
    %   fill Field[Text][Text] withcolor yellow ;
    StopPage ;
\stopuseMPgraphic

\setupbackgrounds
  [page]
  [background=pagegraphic]

\setupbackgrounds
  [text]
  [rightedge]
  [background=edge]

\definelayer
  [edge]
  [width=\rightedgewidth,
   state=repeat]

\setuphead
  [chapter]
  [style=\bfc,
   color=edgecolor]

\setupcolors
  [textcolor=edgecolor]

\newcounter\MyCounter

\def\StartRemark#1%
  {\doglobal\increment\MyCounter % hm, we could use the autoref (todo in cont-xp)
   \title[topic:\MyCounter]{#1}
   \setlayer[edge][preset=middletop,y=\thelayerheight{edge}]{\strut\color[pagecolor]{\bf\goto{#1}[topic:\MyCounter]}}
   \StartSteps}

\def\StopRemark
  {\StopSteps
   \page}

\def\StartRemark#1%
  {\doglobal\increment\MyCounter % hm, we could use the autoref (todo in cont-xp)
   \title[topic:\MyCounter]{#1}
   \StartSteps
   \def\StopRemark
     {\StopSteps
      \page
      \setlayer[edge][preset=middletop,y=\thelayerheight{edge}]{\strut\color[pagecolor]{\bf\goto{#1}[topic:\MyCounter]}}}}

\def\StartTitlePage
  {\startstandardmakeup[top=\vss,bottom=\vss\vss]
   \definedfont[Bold sa 4]
   \raggedcenter
   \setupinterlinespace
   \baselineskip=1\baselineskip plus 1fil minus 1fil\relax}

\def\StopTitlePage
  {\stopstandardmakeup}

\doifnotmode{demo} {\endinput}

\starttext

\StartTitlePage x\\y\\z \StopTitlePage

\StartRemark{a}
    a \FlushStep
    a \FlushStep
\StopRemark

\StartRemark{b}
    b \FlushStep
    b \FlushStep
    b \FlushStep
\StopRemark

\StartRemark{c}
    c \FlushStep
    c \FlushStep
    c \FlushStep
    c \FlushStep
\StopRemark

\stoptext


