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

\writestatus{simpleslides}{loading Shaded style}

\startmodule[simpleslides-s-Shaded]

\unprotect

%D The page layout:

\setuplayout [width=fit,
              margin=1.5cm,
              leftmargindistance=0pt,
              rightmargindistance=0pt,
              height=fit,
              header=0pt,
              footer=0pt,
              topspace=.8cm,
              backspace=1.5cm,
              bottomspace=1cm,
              bottom=1cm,
              location=singlesided]

%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 This module has three color schemes, blue, green and bluered.

\startsetups simpleslides:setups:bluered
\definecolor [simpleslides:textcolor]         [white]
\definecolor [simpleslides:interactioncolor]  [b=.2]
\definecolor [simpleslides:contrastcolor]     [b=.8]
\definecolor [simpleslides:itemize:color]     [s=1]
\definecolor [simpleslides:backgroundcolor]    [r=0.5,g=0,b=0]
\definecolor [simpleslides:variantcolor]       [r=0,g=0,b=0.5]
\stopsetups

\startsetups simpleslides:setups:blue
\definecolor [simpleslides:textcolor]         [white]
\definecolor [simpleslides:interactioncolor]  [b=.2]
\definecolor [simpleslides:contrastcolor]     [r=.72,g=.77,b=.94]
\definecolor [simpleslides:itemize:color]     [s=1]
\definecolor [simpleslides:backgroundcolor]    [r=0,g=0,b=1]
\definecolor [simpleslides:variantcolor]       [r=0,g=0,b=0.05]
\stopsetups

\startsetups simpleslides:setups:green
\definecolor [simpleslides:textcolor]         [white]
\definecolor [simpleslides:interactioncolor]  [s=.2]
\definecolor [simpleslides:contrastcolor]     [s=.5]
\definecolor [simpleslides:itemize:color]     [s=1]
\definecolor [simpleslides:backgroundcolor]    [r=0,g=.8,b=0]
\definecolor [simpleslides:variantcolor]       [r=0,g=0.05,b=0]
\stopsetups

%D Now we choose the scheme that the user asked for

\setups{simpleslides:setups:blue}
\setups{simpleslides:setups:\moduleparameter{simpleslides}{color}}

\setupcolors[textcolor={simpleslides:textcolor}]

\setupTitle[color=white]

%D This module shades the background in a gradient. We use \METAPOST\ to draw
%D the background.


\startuseMPgraphic{simpleslides:MP:ornament}
StartPage ;
save p ; path p[] ;
save a ;
if NOfPages <= 15:
       a = 0.7cm ;
elseif NOfPages <= 30:
       a = 0.45cm ;
else :
       a = 0.25cm ;
fi ;
save factor ; numeric factor ;
factor = (TextWidth - a)/(NOfPages - 1) ;
linear_shade(Page, 6,
              \MPcolor{simpleslides:backgroundcolor},
              \MPcolor{simpleslides:variantcolor}) ;
if RealPageNumber >1:
       for i = 1 upto NOfPages :
               p[i] = unitcircle scaled a shifted (BackSpace + (i-1)*factor, (2cm - a)/2) ;
               if i = RealPageNumber :
%                      p[i] := p[i] zscaled (1.2,1.5) ;
                       pickup pencircle scaled 5pt ;
                       drawfill p[i] withcolor \MPcolor{simpleslides:variantcolor} ;
               else :
                       circular_shade(p[i],2,\MPcolor{simpleslides:backgroundcolor},
       \MPcolor{simpleslides:variantcolor}) ;
               fi
       endfor ;
fi ;
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 The symbol for the first level of itemizations.

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

% %D The \quotation{Shaded} style uses \CONTEXT's interactionbar:
%
% \setupsubpagenumber[way=bytext,state=start]
%
% \setupinteraction
%   [page=yes,
%    color=simpleslides:interactioncolor,
%    contrastcolor=simpleslides:contrastcolor,
%    menu=on,
%    state=start]
%
% %\setupinteractionbar
% %\startinteractionmenu[bottom]
% \setupbottomtexts[XXX{\interactionbar[state=start,alternative=e,width=8cm,height=0.2cm,step=small,frame=on]}YYY]
% %\stopinteractionmenu

%\setupbottomtexts[\useMPgraphic{shaded:counter}]

\protect
\stopmodule

\endinput
