%D \module
%D   [      file=simpleslides-s-BottomSquares,
%D        version=2009.03.30
%D          title=\CONTEXT\ Style File,
%D       subtitle=Presentation Module --- BottomSquares style,
%D         author=Aditya Mahajan and Thomas A. Schmitz,
%D           date=\PRESTITdate,
%D      copyright={Aditya Mahajan and Thomas A. Schmitz}]
%C
%C Copyright 2007 Aditya Mahajan and Thomas A. Schmitz
%C This file may be distributed under the GNU General Public License v. 2.0.

%D This file provides the \quotation{BottomSquares} style for the presentation
%D module. It is loaded at runtime. This minimalistic design is inspired by a
%D presentation Taco gave at EuroTeX 2006. 

\writestatus{simpleslides}{loading module BottomSquares}

\startmodule[simpleslides-s-BottomSquares]

\unprotect

%D The page layout:

\setuplayout [width=fit,
	      height=middle,
              margin=0cm,
              height=fit,
	      margindistance=0cm,
              header=0cm, 
              footer=0cm, 
              topspace=1cm,
	      bottomspace=2cm,
              backspace=1.5cm,
              location=singlesided]

\setuplayout [simpleslides:layout:horizontal][header=1.4cm]
\setuplayout [simpleslides:layout:vertical]  [header=0cm]
\setuplayout [simpleslides:layout:title]     [header=0cm]

%D We also specify the position of the slidetitle.

\setuplayer[simpleslides:layer:slidetitle]
            [x=15mm]

%D These macros are used for placing figures/pictures:

\define\NormalHeight        {\textheight}
\define\NormalWidth         {.5\textwidth}
\define\PictureFrameHeight  {\textheight}
\define\PictureFrameWidth   {.5\textwidth}

% %D We define a generic frame that is used by the slide title.
% 
% \defineframed[simpleslides:framed]
%              [frame=off,offset=0pt,
%               top=\vss,bottom=\vss]


%D We define our color scheme:

\definecolor [simpleslides:backgroundcolor]    [s=.95]
\definecolor [simpleslides:contrastcolor]      [r=.7,g=.1,b=.3]
\definecolor [simpleslides:variantcolor]       [s=.3]
\definecolor [simpleslides:itemize:color]      [simpleslides:contrastcolor]

%D We let \METAPOST\ calculate the background:

%AM: Why not implement this as an interaction bar?

\startuseMPgraphic{simpleslides:MP:ornament} 
StartPage ;

fill Page withcolor \MPcolor{simpleslides:backgroundcolor} ;

save diff ;numeric diff; 
diff = .3cm ;

save w; numeric w; 
w = xpart (lrcorner Field[Text][Text] - llcorner Field[Text][Text]) - diff ;

save factor; numeric factor; 
factor = w/(NOfPages - 1) ;

save p; path p ;
p = unitsquare xyscaled (diff,diff) 
               shifted (xpart llcorner Field[Text][Text],0.85cm) ;

for i = 1 upto NOfPages:
  if PageNumber = i:
    fill p xyscaled (0,2) shifted ( (i-1)*factor,-diff-0.85cm) 
         withcolor \MPcolor{simpleslides:contrastcolor} ;
  else :
    fill p shifted ( (i-1)*factor, 0) 
         withcolor \MPcolor{simpleslides:variantcolor} ;
  fi ;
endfor ;
StopPage ;
\stopuseMPgraphic 

%D We define these backgrounds as overlays:

\defineoverlay 
  [simpleslides:background:ornament] 
  [\useMPgraphic{simpleslides:MP:ornament}] 

\defineoverlay 
  [simpleslides:background:title] 
  [\useMPgraphic{simpleslides:MP:ornament}] 

%D We want the title information to be colored

\setupTitle
  [\c!headcolor={simpleslides:contrastcolor}]

%D The slide title is typeset in a layer

\setupSlideTitle
  [\c!color={simpleslides:contrastcolor},
   \c!alternative=layer,
   \c!align=\v!center,
   \c!width=\textwidth,
   \c!height=3cm,
   \c!after=]

%D The symbol for the first level of itemizations. 

\definesymbol[1][\useMPgraphic{simpleslides:itemize:square}]
\setupitemize[1][color={simpleslides:itemize:color}]

\protect
\stopmodule

\endinput

