%D \module
%D   [      file=t-horizontalblue,
%D        version=2007.07.17, 
%D          title=\CONTEXT\ Style File,
%D       subtitle=Presentation Module horizontalblue,
%D         author=Thomas A. Schmitz,
%D           date=\currentdate,
%D      copyright={Thomas A. Schmitz}]
%C
%C Copyright 2007 Thomas A. Schmitz.
%C This file may be distributed under the GNU General Public License v. 2.0.

%D This file provides the \quotation{horizontalblue} style for the presentation
%D module. It is loaded at runtime. The look of this style was inspired by the
%D \quotation{Copenhagen} theme of the \LaTeX\ {\tt beamer} package.

\writestatus{loading}{module horizontalblue}

\startmodule[horizontalblue]

\unprotect

%D The taspresentation module provides a skeleton into which different styles
%D can be hooked. It uses a number of variables and macros which have to be set
%D beforehand. Some parts are optional. We begin with the necessary definitions:

%D We start colors:

\setupcolors[state=start]

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

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

%D The page layout:

\setuplayout [width=fit,
              margin=0cm,
              height=14.7cm,
              header=1.75cm, 
              footer=1.2cm, 
              topspace=1cm, 
              backspace=1cm,
              location=singlesided]

%D The macro for typesetting the Slidetitle; this is adapted from a sample
%D document that Brooks Moses published on the wiki:

\definelayer[slidetitle]
    [width=\paperwidth,
    height=\paperheight,
    x=10mm]

\define[1]\Slidetitle{\page\setlayer[slidetitle]%
     {\framed[frame=off,width=\textwidth,height=2.2cm,offset=0pt,top=\vss,bottom=\vss]{\switchtobodyfont[\Titlesize]\color[c]{#1}}}}

%D The macro \tex{Maketitle} produces a default title page with the author, the
%D title of the presentation, and the date. Using it is not mandatory.

\define\Maketitle{%
\titback
\null
\vfill
\framed[frame=off,width=\textwidth,height=.75\textheight,top=\vss,bottom=\vss,align=middle]{\switchtobodyfont[\Titlesize]\color[c]{\bf \getvariable{taspresent}{title}}\switchtobodyfont[\Normalsize]\blank[line]\getvariable{taspresent}{author}\blank[2*line]\currentdate}
\vfill
\null}

%D The following parts are optional; if you don't use backgrounds and are
%D content with CONTEXT's default itemization, you don't have to set these
%D macros. 

%D We define our colors:

\definecolor [a]                [s=.95]
\definecolor [b] 	        [r=.58,g=.58,b=.82]
\definecolor [c]                [r=.2,g=.2,b=.73]
\definecolor [Item]             [r=.2,g=.2,b=.73]

%D We let Metapost calculate the background:

\startuniqueMPgraphic{vertical} 
StartPage ;
pair zd[] ;
path pb[] ;
fill Page withcolor \MPcolor{a} ;
z.d1 = ulcorner Page shifted (0,-5pt) ;
z.d2 = urcorner Page shifted (0,-5pt) ;
pb[1] = ulcorner Page -- z.d1 -- z.d2 -- urcorner Page -- cycle ;
z.d3 = llcorner Page shifted (0,5pt) ;
z.d4 = lrcorner Page shifted (0,5pt) ;
pb[3] = llcorner Page -- z.d3 -- z.d4 -- lrcorner Page -- cycle ;
pb[4] = pb[3] shifted (0,.75cm) ;
fill pb[1] withcolor \MPcolor{b} ;
fill pb[3] withcolor \MPcolor{b} ;
fill pb[4] withcolor \MPcolor{b} ;
StopPage ;
\stopuniqueMPgraphic 

\startuniqueMPgraphic{horizontal}
StartPage ;
pair zd[] ;
path pb[] ;
z.d1 = ulcorner Page shifted (0,-5pt) ;
z.d2 = urcorner Page shifted (0,-5pt) ;
pb[1] = ulcorner Page -- z.d1 -- z.d2 -- urcorner Page -- cycle ;
pb[2] = pb[1] shifted (0,-2cm) ;
fill pb[2] withcolor \MPcolor{b} ;
StopPage ;
\stopuniqueMPgraphic

%D We define these backgrounds as overlays:

\defineoverlay 
[lecbackground] 
[\useMPgraphic{horizontal}] 

\defineoverlay 
[picbackground] 
[\useMPgraphic{vertical}] 

%D We define the footer

\setupfooter[color=c,style={\switchtobodyfont[10pt]},strut=yes]
\setupfootertexts[{\framed[frame=off,height=.45cm,width=\textwidth]{\getvariable{taspresent}{title}\hfill \pagenumber \ of \lastpage}}]

%D These are shortcuts to switch backgrounds:

\define\lecback{\setuplayout[header=1.75cm]\setupfooter[state=start]\setupbackgrounds[page][background={picbackground,lecbackground,slidetitle}]}
\define\titback{\setuplayout[header=1.75cm]\setupfooter[state=stop]\setupbackgrounds[page][background={picbackground,lecbackground}]}
\define\picback{\setuplayout[header=0cm]\setupfooter[state=start]\setupbackgrounds[page][background={picbackground}]}
\define\noback{\setupbackgrounds[page][background=nobackground]}

%D We use combinations for placing vertical pictures and text side by side, and
%D we want a distance of 1.1 cm between both.

\setupcombinations[distance=1.1cm]

%D The symbol for the first level of itemizations. 

\definesymbol[1][\useMPgraphic{ItSquare}]
\setupitemize[1][color=c]

\protect
\stopmodule

\endinput

