%D \module
%D   [      file=s-present-original, % was s-pre-01
%D        version=1997.07.22,
%D          title=\CONTEXT\ Style File,
%D       subtitle=Presentation Environment Original,
%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 This environment can be used to typeset interactive presentations. This module
%D was first used at the 1997 \TUG\ meeting. The \MKIV\ variant is mostly the same
%D but we adapted the colors a bit.

\usemodule[present-general]

\startmodule[present-original]

%D \macros
%D   {language}
%D
%D Because this module is defined in english, we default to the english hyphenation
%D patterns and labels too. This is default anyway.

\mainlanguage
  [en]

%D \macros
%D   {setupbodyfont,setuplayout}
%D
%D For screen reading, a Lucida Bright font looks nice. We use a 14.4 point bodyfont
%D for the main text, but switch back to 12 points for ornaments.

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

\setuplayout
  [style=smallbodyfont]

\setupalign
  [tolerant,stretch]

%D \macros
%D   {definecolor}
%D
%D Screen presentations without color just look dull, so we enable color support. We
%D define ourselves a yellowish backgroundcolor and a not too dark blue
%D interactioncolor.

% \definecolor [BackgroundColor]  [r=1,  g=1,  b=.7]
% \definecolor [InteractionColor] [r=.1, g=.5, b=.8]
% \definecolor [ContrastColor]    [r=.9, g=.5, b=.2]

\definecolor [BackgroundColor]  [r=.7,  g=.7,  b=.3]
\definecolor [InteractionColor] [r=.1, g=.5, b=.8]
\definecolor [ContrastColor]    [r=.9, g=.5, b=.2]

%D \macros
%D   {setuppapersize,setuplayout,setupinteractionscreen}
%D
%D We use a nice large screen, and dedicate the right edge and bottom part to
%D navigational tools. We automatically set the width and height of the page and
%D start up full screen.

\setuppapersize
  [S6][S6]

\setuplayout
  [topspace=12pt,
   header=0pt,
   footer=0pt,
   height=402pt, % 450 - 12 - 15 - 12 - 12 + 3
   bottomdistance=15pt,
   bottom=12pt,
   backspace=12pt,
   margin=0pt,
   width=fit,
   edgedistance=12pt,
   rightedge=96pt]

\setupinteractionscreen
  [option=max]

%D \macros
%D   {setupbackgrounds}
%D
%D We set the pagecolor to yellow except the part of the screen that is used to
%D display the running text. By seting the offset to 3pt the text will not touch the
%D yellow parts. We do not set the depth.

\setupbackgrounds
  [page]
  [background=color,
   backgroundcolor=BackgroundColor]

\setupbackgrounds
  [text][text]
  [background=color,
   backgroundcolor=white,
   backgroundoffset=3pt]

%D I considered the next setup too, but finaly decided to
%D comment it out.
%D
%D \starttyping
%D \setupbackgrounds
%D   [bottom][text]
%D   [frame=on,
%D    framecolor=white]
%D \stoptyping

%D \macros
%D   {setupinteraction}
%D
%D We did not enable interactive text support yet, so let's do that now. We force
%D page reference to circumvent problems with named destinations in buggy viewers.

\setupinteraction
  [page=yes,
   color=InteractionColor,
   contrastcolor=ContrastColor,
   menu=on,
   state=start]

%D \macros
%D   {setupinteractionmenu,startinteractionmenu}
%D
%D At the bottom of the screen we show two navigational bars. At the left we show
%D the subpage bar, at the right we use a non default backward|/|forward bar.

\setupinteractionmenu
  [bottom]
  [leftoffset=3pt,
   rightoffset=3pt]

\startinteractionmenu[bottom]
    \startcom \InteractionBar     \stopcom
    \hfill
    \startcom \InteractionButtons \stopcom
\stopinteractionmenu

%D \macros
%D   {interactionbar}
%D
%D The left bar gets a white border (on the yellow background). Because we don't
%D want to typeset an empty frame when no subpage bar is shown, we check for the
%D number of subpages.

\unexpanded\def\InteractionBar
  {\ifnum\nofsubpages>\plusone
     \framed
       [framecolor=white,
        rulethickness=1pt,
        height=\bottomheight,
        strut=no]
       {\interactionbar[alternative=f,width=.5\makeupwidth,height=1ex]}
   \fi}

%D \macros
%D   {setupinteractionbar, interactionbuttons}
%D
%D The right hand buttons enable us to jump backward and forward, as well as to the
%D previous and next jump. We also enable to close the presentation.

\setupinteractionbar
  [framecolor=white,
   rulethickness=1pt,
   height=\bottomheight,
   strut=no]

\unexpanded\def\InteractionButtons
  {\interactionbuttons
     [width=15em,
      framecolor=white,
      rulethickness=1pt,
      height=\bottomheight,
      strut=no,
      distance=.5em]
     [PreviousJump,NextJump,
      firstpage,
      firstsubpage,previouspage,nextpage,lastsubpage,
      lastpage,
      CloseDocument]}

%D \macros
%D  {StartTitlePage, TitlePage}
%D
%D The titlepage is rather simple and can be typeset in two ways:
%D
%D \starttyping
%D \StartTitlePage
%D text \\ text \\ text
%D \StopTitlepage
%D \stoptyping
%D
%D or more straightforward:
%D
%D \starttyping
%D \TitlePage{text\\text\\text}
%D \stoptyping
%D
%D The first alternative can be used for more complicated title pages.

\unexpanded\def\StartTitlePage
  {\startstandardmakeup
   \bfd
   \setupinterlinespace
   \setupalign[middle]
   \vfil
   \let\\=\vfil}

\unexpanded\def\StopTitlePage
  {\vfil\vfil\vfil
   \stopstandardmakeup}

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

%D \macros
%D   {TitlePage, Topics, Topic, Subject}
%D
%D A presentation after loading this module looks like:
%D
%D \starttyping
%D \TitlePage {About Whatever\\Topics}
%D
%D \Topics {Todays Talk}
%D
%D \Topic {Some topic}
%D
%D \Subject {Alfa}
%D
%D .....
%D
%D \Subject {Beta}
%D
%D .....
%D \stoptyping

%D \macros
%D   {definehead}
%D
%D The commands \type{\Topic} and \type{\Subject} are defined as copies of head. We
%D use \type{\Nopic} for internal purposes.

\definehead [Topic]   [chapter]
\definehead [Subject] [section]

\definehead [Nopic]   [title]

%D \macros
%D   {setuphead}
%D
%D Because chapters and sections do not make sense in presentations, we use our own
%D command for typesetting the titles. Sectionnumbers are of course hidden from
%D viewing. Each topic is followed by a list of subjects that belong to the topic.

\setuphead
  [Topic,Nopic,Subject]
  [command=\HeadLine,
   page=yes,
   style=\bfb,
   after=\blank,
   sectionnumber=no]

\setuphead
  [Topic]
  [after=\PlaceSubjectList]

\setuphead
  [Subject]
  [continue=no]

%D \macros
%D   {framed, midalined}
%D
%D The command used to typeset the head lines is rather simple. We just center the
%D framed title. The frame macro optimizes the alignment and at the same time
%D enables us to typeset a nice colored rule.

\unexpanded\def\HeadLine#1#2%
  {\midaligned
     {\framed
        [framecolor=BackgroundColor,
         rulethickness=1pt,
         width=.8\hsize,
         align=middle,
         strut=no]
        {#2}}}

%D \macros
%D   {setuplist}
%D
%D The subject list is automatically placed. We center each subject line by using
%D one of the default alternatives (g). We could have said:
%D
%D \starttyping
%D \setuplist
%D   [Subject]
%D   [alternative=none,
%D    command=\SubjectListLine,
%D    interaction=all]
%D
%D \def\SubjectListLine#1#2#3%
%D   {\midaligned{#2}}
%D \stoptyping
%D
%D But why should we complicate things when we can use alternative~\type{g}. The
%D test is only needed if one does not automatically goes a new page with each
%D subject.

\unexpanded\def\PlaceSubjectList
  {\blank
   \determinelistcharacteristics[Subject]
   \doifmode{*list}{\placelist[Subject]}}

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

% %D \macros
% %D   {setuptexttexts}
% %D
% %D The topics will be listed in the right edge, using:
%
% \setuptexttexts
%   [edge]
%   [][\TopicList]

%D \macros
%D   {setuplist, placelist,startinteractionmenu}
%D
%D The actual topic list is typeset using a \type{\vbox}. We have to specify
%D \type{criteriumcriterium=all} because otherwise no list will be typeset. (By
%D default lists are typeset locally.)

\startinteractionmenu[right]
  \placelist
    [Topic]
    [alternative=f, % command, % none,
     maxwidth=\hsize,
     width=\hsize,
     offset=0pt,
     criterium=all,
     align=left,
     style=\smallbodyfont\bfx]
\stopinteractionmenu

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

\unexpanded\def\Subjects
  {}

%D \macros
%D   {setupbackgrounds, overlaybutton}
%D
%D During a presentation, we want to use the cursor to point to parts of the text.
%D Furthermore we want to be able to jump to the next page, without the need to move
%D the cursor on buttons. Therefore we make the text part of the screen into an
%D invisible button.
%D
%D In \MKII\ we put a button in he texttextsm here we just use an extra background.

\defineoverlay[nextpage][\overlaybutton{nextpage}]

\setupbackgrounds
  [text][text]
  [background={color,nextpage}]

%D \macros
%D   {setupsubpagenumber}
%D
%D The left bottom navigation bar shows the subpages, which will be counted by text.
%D One can change this in the preentation itself by saying \type {[way=byTopic]}.

\setupsubpagenumber
  [way=bytext, % byTopic,
   state=start]

\stopmodule

\continueifinputfile{s-present-original.mkiv}

\usemodule[present-common]

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