%D \module
%D   [      file=simpleslides-s-Boxed,
%D        version=2009.03.30
%D          title=\CONTEXT\ Style File,
%D       subtitle=Presentation Module --- Boxed Style,
%D         author=Aditya Mahajan and Thomas A. Schmitz,
%D           date=\currentdate,
%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{Boxed} style for the presentation
%D module. It is loaded at runtime. The look of this style was inspired by the
%D screen version of the Metafun manual. 

\writestatus{simpleslides}{loading style Boxed}

\startmodule[simpleslides-s-Boxed]

\unprotect

%D The page layout:

\setuplayout [width=fit,
              margin=2cm,
              height=fit,
	      leftmargindistance=1cm,
	      rightmargindistance=0cm,
              header=2.8cm, 
              footer=1cm, 
              topspace=.7cm, 
              backspace=2cm,
              location=singlesided]

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

%D We also specify the position of the slidetitle.

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

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

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

%D We define our colorscheme:

\definecolor [simpleslides:backgroundcolor]     [s=.75]
\definecolor [simpleslides:altbackgroundcolor]  [s=.2]
\definecolor [simpleslides:contrastcolor]       [r=.55, g=0, b=.04]
\definecolor [simpleslides:variantcolor]	    [yellow]
\definecolor [simpleslides:itemize:color]       [simpleslides:contrastcolor]

%D We let Metapost calculate the background:

\startuniqueMPgraphic{simpleslides:MP:horizontal} 
StartPage ;

save p; path p[] ;

save a ; numeric a ;
a := 1.5cm ;

fill Page withcolor \MPcolor{simpleslides:backgroundcolor} ;

z1 = ulcorner Page shifted (a,0) ; z2 = urcorner Page shifted (-a,0) ;
z3 = urcorner Page shifted (0,-a); z4 = lrcorner Page shifted (0,a)  ;
z5 = (x2,0) ;   z6 = (x1,0) ;
z7 = (0,y4) ;   z8 = (0,y3) ;
z9 = (x1,y3) ;  z10 = (x2,y3) ;
z11 = (x2,y4) ; z12 = (x1,y4) ;

p[1] = z9  -- z12 -- z7 -- z8  -- cycle ;
p[2] = z10 -- z3  -- z4 -- z11 -- cycle ;
p[3] = z12 -- z11 -- z5 -- z6  -- cycle ;
p[4] = z9  -- z10 -- z2 -- z1  -- cycle ;

fill p[1] withcolor \MPcolor{simpleslides:altbackgroundcolor} ;
fill p[2] withcolor \MPcolor{simpleslides:altbackgroundcolor} ;
fill p[3] withcolor \MPcolor{simpleslides:altbackgroundcolor} ;
fill p[4] withcolor \MPcolor{simpleslides:altbackgroundcolor} ;

pickup pencircle scaled 8 pt ;

draw z1 -- z6 withcolor \MPcolor{simpleslides:contrastcolor} ;
draw z2 -- z5 withcolor \MPcolor{simpleslides:contrastcolor} ;
draw z7 -- z4 withcolor \MPcolor{simpleslides:contrastcolor} ;
draw z8 -- z3 withcolor \MPcolor{simpleslides:contrastcolor} ;

StopPage ;
\stopuniqueMPgraphic 

\startuseMPgraphic{simpleslides:MP:ornament}
StartPage

save a; numeric a;
a := 1.5cm ;   

save factor, allpages, shift ;
numeric factor, allpages, shift ;

factor :=(NOfPages div 18) + 1 ;
allpages := if NOfPages <= 18 : NOfPages elseif odd NOfPages : NOfPages + 1
            else : NOfPages fi ;

shift := factor * (PaperWidth -2a)/allpages ;

save p ;path p ;
p := fullcircle scaled 4mm shifted (a + shift/2, a/2) ;

for i = 1 upto allpages/factor :
  fill p shifted ( (i-1)*shift, 0) 
    if i - 1 = floor ((PageNumber - 1)/factor) :
      withcolor \MPcolor{simpleslides:variantcolor} ;
    else :
      withcolor \MPcolor{simpleslides:backgroundcolor} ;
    fi ;
endfor ;


StopPage
\stopuseMPgraphic

%D We define these backgrounds as overlays:

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

\defineoverlay 
  [simpleslides:background:vertical] 
  [\useMPgraphic{simpleslides:MP:horizontal}] 

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

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

%D The title page:

\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=2.3cm,
   \c!after=]

%D The symbol for the first level of itemizations. 

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

\protect
\stopmodule

\endinput

