%D \module
%D   [      file=t-blackblue,
%D        version=2007.07.17, 
%D          title=\CONTEXT\ Style File,
%D       subtitle=Presentation Module blackblue,
%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{blackblue} 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 blackblue}

\startmodule[blackblue]

\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{\textheight}
\define\NormalWidth{.476\textwidth}
\define\PictureFrameHeight{\textheight}
\define\PictureFrameWidth{.476\textwidth}

%D The page layout:

\setuplayout [width=fit,
              margin=0cm,
              height=fit,
              header=3.2cm, 
              footer=.5cm, 
              topspace=.6cm, 
              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,
    y=12mm]

\define[1]\Slidetitle{\page\setlayer[slidetitle]%
     {\framed[corner=round,background=color,backgroundcolor=a,frame=off,width=\textwidth,height=2.1cm,offset=0pt,top=\vss,bottom=\vss]{\switchtobodyfont[\Titlesize]\color[b]{#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[corner=round,background=color,backgroundcolor=a,frame=off,width=\textwidth,height=.75\textheight,top=\vss,bottom=\vss,align=middle]{\switchtobodyfont[\Titlesize]\color[b]{\getvariable{taspresent}{title}}\switchtobodyfont[\Normalsize]\blank[line]\color[b]{\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 [b]                [s=.9]
\definecolor [c] 	        [s=0]
\definecolor [a]                [r=.2, g=.2, b=.72]
\definecolor [Item]             [r=.2, g=.2, b=.75]

%D We let Metapost calculate the background:

\startuseMPgraphic{slide} 
StartPage ;
path p[] ;
numeric a; a=.5cm ;
fill Page withcolor \MPcolor{b} ;
path Main ;
z1 = ulcorner Page shifted (0,-a) ;
z2 = urcorner Page shifted (0,-a) ;
z3 = llcorner Page shifted (0,a) ;
z4 = lrcorner Page shifted (0,a) ;
z5 = 1/2[ulcorner Page,urcorner Page] ;
z6 = 1/2[z1,z2] ;
z7 = 1/2[llcorner Page,lrcorner Page] ;
z8 = 1/2[z3,z4] ;
p[1] = ulcorner Page -- urcorner Page -- z2 -- z1 -- cycle ;
p[2] = ulcorner Page -- z5 -- z6 -- z1 -- cycle ;
p[3] = llcorner Page -- lrcorner Page -- z4 -- z3 -- cycle ;
p[4] = llcorner Page -- z7 -- z8 -- z3 -- cycle ;
fill p[1] withcolor \MPcolor{a} ;
fill p[2] withcolor \MPcolor{c} ;
fill p[3] withcolor \MPcolor{c} ;
fill p[4] withcolor \MPcolor{a} ;
draw \sometxt{\framed[frame=off,offset=0pt,width=.5\textwidth,height=.5cm,align=left,top=\vss,bottom=\vss,strut=no]{\ix\color[b]{\currentdate \quad}}} shifted (1cm,y1) ;
draw \sometxt{\framed[frame=off,offset=0pt,width=.5\textwidth,height=.5cm,align=right,top=\vss,bottom=\vss,strut=no]{\ix\color[b]{\quad \folio\ of \lastpage}}} shifted (x5,y1) ;
draw \sometxt{\framed[frame=off,offset=0pt,width=.5\textwidth,height=.5cm,align=left,top=\vss,bottom=\vss,strut=no]{\ix\color[b]{\getvariable{taspresent}{author}\quad}}} shifted (1cm,0) ;
draw \sometxt{\framed[frame=off,offset=0pt,width=.5\textwidth,height=.5cm,align=right,top=\vss,bottom=\vss,strut=no]{\ix\color[b]{\quad \getvariable{taspresent}{title}}}} shifted (x5,0) ;
StopPage ;
\stopuseMPgraphic 

%D We define these backgrounds as overlays:

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

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

%D These are shortcuts to switch backgrounds:

\define\lecback{\setuplayout[header=3.2cm]\setupbackgrounds[page][background={lecbackground,bottom,slidetitle}]}
\define\titback{\setuplayout[header=.5cm]\setupbackgrounds[page][background=lecbackground]}
\define\picback{\setuplayout[header=.5cm]\setupbackgrounds[page][background={lecbackground,bottom}]}
\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=a]

\protect
\stopmodule

\endinput

