%D \module
%D   [      file=t-doubleshade,
%D        version=2007.07.17, 
%D          title=\CONTEXT\ Style File,
%D       subtitle=Presentation Module doubleshade,
%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{doubleshade} style for the presentation
%D module. It is loaded at runtime. 

\writestatus{loading}{module doubleshade}

\startmodule[doubleshade]

\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; textcolor is white:

\setupcolors[state=start,textcolor=white]

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

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

%D The page layout:

\setuplayout [width=fit,
              leftmargin=1.5cm,
	      rightmargin=0cm,
              leftmargindistance=.7cm,
              rightmargindistance=0pt,
              height=fit, 
              header=0pt, 
              footer=5pt, 
              topspace=.8cm, 
              backspace=3.5cm,
	      cutspace=2.7cm,
              bottomspace=0cm,
              bottom=0pt,
              location=singlesided]

%D The macro for typesetting the Slidetitle:

\define[1]\Slidetitle{\page\framed[frame=off,offset=0pt,height=1.1cm,width=\textwidth,align=middle]{\switchtobodyfont[\Titlesize]\color[c]{#1}}\blank[0.5cm]}

%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
\midaligned{\switchtobodyfont[\Titlesize]\color[c]{\getvariable{taspresent}{title}}}
\blank[2*line]
\midaligned{\color[c]{\getvariable{taspresent}{author}}}
\blank[3*line]
\midaligned{\color[c]{\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 [Item]            [r=1,g=1,b=1]
\definecolor [a]               [r=0,g=0,b=1]
\definecolor [c]               [r=.63,g=.8,b=1]
\definecolor [b]               [r=0,g=0,b=0.05]

%D We let Metapost calculate the background:

\startuseMPgraphic{LinearShade}
StartPage ;
path p[] ;
p[1] := ulcorner Page -- llcorner Page -- llcorner Page shifted (4cm,0) -- ulcorner Page shifted (4cm,0) -- cycle ;
circular_shade(p[1],0,\MPcolor{a},\MPcolor{b}) ;
numeric a; a = 2*NOfPages-1 ;
numeric c; c = PaperHeight/a ;
for i = 1 step 2 until a:
	p[i] := unitsquare xyscaled (0.5cm,0.5cm) ;
	fill p[i] shifted (0.75cm,c*i) withcolor \MPcolor{a} ;
	if i=(2*PageNumber-3):
		fill p[i] shifted (0.75cm,c*i) withcolor \MPcolor{c} ;
	fi ;
endfor ;
p[3] := ulcorner Field[Text][Text] -- urcorner Page -- lrcorner Page -- llcorner Field[Text][Text] -- cycle ;
p[3] := p[3] enlarged (.4cm,.4cm) ;
linear_shade(p[3],6,\MPcolor{a},\MPcolor{b}) ;
StopPage ;
\stopuseMPgraphic

%D We define these backgrounds as overlays:

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

%D These are shortcuts to switch backgrounds:

\define\lecback{\setupbackgrounds[page][background=lecbackground]}
\define\titback{\setupbackgrounds[page][background=lecbackground]}
\define\picback{\setupbackgrounds[page][background=lecbackground]}
\define\noback{\setupbackgrounds[page][background=lecbackground]}

\setupbackgrounds[page][background=lecbackground] 

%D The symbol for the first level of itemizations. 

\definesymbol[1][\useMPgraphic{ItSquare}]
\setupitemize[1][inmargin]

\protect
\stopmodule

\endinput

