%==============================================================================
%
% HAPFyma -- style file for use with HA-prosper.
%
% Created by: Laurent Jacques
%             http://www.fyma.ucl.ac.be/~ljacques
%             Institute of Theoretical Physics
%             Universiti catholique de Louvain, Belgium
%
% Copyright (c) 2003-2004 Hendri Adriaens. All rights reserved.
%
% This program may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.2
% of this license or (at your option) any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.2 or later is part of all distributions of LaTeX
% version 1999/12/01 or later.
%
% This program consists of the files listed in files.txt present in this package.
%
%==============================================================================
% Changelog:
%
% V.1.1:
%  * Adapting the code to the definition of \HAP@hltocentry and
%  \HAP@twidth
%  * Adapting code to definition of \HAP@tsectionm
%  * Adding parbox in the slide title to cut very long titles. This
%  uses the definition of the new length \FymaMaxTitleLength which is
%  adapted to the slide format and to the presence of toc.
%  * Removing the filled rectangle surrounding selected toc entriy and
%  replacing it by a simple red coloring of the text.
%  * Removing \dblue from \myitem to allow gray coloring when items are
%  deactived
%  * Adding missing gradient (in comparison with the first PPRFyma)
%  * Raising the previous parbox for tsection to obtain a well placed
%  horizontal rule.
%  * Placing a parbox in \HAP@tline for long material (like in the
%  Aggie style). This avoids them to exceed the toc width on slide.
%
% V.1.0: intial release added to HA-prosper 4.1

\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{HAPFyma}[2004/05/16]
\typeout{Fyma style for HA-prosper}
\typeout{(c) 2003-2004 Laurent Jacques, FYMA/UCL, Belgium}
\typeout{Package version: 1.1}
\typeout{ }

\ifHAP@portrait
  \PackageError{HAPFyma}{This template does not support portrait slides}%
  {Sorry, no additional help}%
\fi%

% Controlling the a4paper possibility by defining the condition
% \ifFymaAFourPaper.
% User has just to write \FymaAFour in his preamble
% to obtain the A4 support, otherwise, the us letter
% format is used.
\newif\ifFymaAFourPaper
\def\FymaAFour{\FymaAFourPapertrue}
\def\FymaNotAFour{\FymaAFourPaperfalse}

% Color definitions
\newrgbcolor{ddblue}{0.06 0.25 0.41}
\newrgbcolor{HAP@textc}{0.06 0.25 0.44}
\newrgbcolor{dblue}{0.14 0.34 0.55}
\newrgbcolor{lblue}{0.24 0.45 0.70}
\newrgbcolor{llblue}{0.43 0.61 0.84}
\newrgbcolor{lllblue}{0.88 0.95 1.00}
\newrgbcolor{llllblue}{0.98 0.99 1.00}
\newrgbcolor{HAP@framecolor}{0.06 0.25 0.41}

% Highlighting definitions
\newrgbcolor{HAP@hcolor}{0.14 0.34 0.55}  % Highlight frame color in TOC
\newrgbcolor{HAP@htcolor}{1 0.15 0.24} % Highlight text color in TOC

% Font definitions
\FontTitle{\usefont{T1}{phv}{b}{n}\fontsize{12.4pt}{12pt}\selectfont\dblue}%
  {\usefont{T1}{phv}{b}{n}\fontsize{12.4pt}{12pt}\selectfont\dblue}
\FontText{\usefont{T1}{phv}{m}{n}\fontsize{10pt}{10pt}\selectfont\HAP@textc}%
  {\usefont{T1}{phv}{m}{n}\fontsize{10pt}{10pt}\selectfont\HAP@textc}
\FontLeftFoot{\@fontTextColor\fontsize{4pt}{4pt}\selectfont}%
  {\@fontTextColor\fontsize{4pt}{4pt}\selectfont}
\FontRightFoot{\@fontTextColor\fontsize{4pt}{4pt}\selectfont}%
  {\@fontTextColor\fontsize{4pt}{4pt}\selectfont}

% General function to create the complete border set of the FYMA
% style. Used by TitleSlide, NormalSlide, PartSlide, etc...
\RequirePackage{pst-grad}
\newcommand{\MakeFymaMainGradient}{%
\ifFymaAFourPaper%
\psframe[linestyle=none, fillstyle=gradient,
  gradbegin=lllblue,gradend=white,gradmidpoint=0](-1.37,-0.77)(11.97,8.47)%
\else
\psframe[linestyle=none, fillstyle=gradient,
  gradbegin=lllblue,gradend=white,gradmidpoint=0](-1.37,-0.77)(11.125,8.47)%
\fi
}

\newcommand{\MakeFymaFrame}{%
\ifFymaAFourPaper%
% Top line
\psframe[linestyle=none,fillstyle=solid,linewidth=2pt,
fillcolor=lblue](-1.5,8.5)(12.1,8.4)%
% Top left cross
\psframe[linestyle=none,fillstyle=solid,linewidth=2pt,
fillcolor=lblue](-1.4,8.6)(-1.3,8.25)%
% Top right cross
\psframe[linestyle=none,fillstyle=solid,linewidth=2pt,
fillcolor=lblue](11.9,8.6)(12.0,8.25)%
% Bottom line
\psframe[linestyle=none,fillstyle=solid,linewidth=2pt,
fillcolor=lblue](-1.5,-0.8)(12.1,-0.7)%
% Bottom left cross
\psframe[linestyle=none,fillstyle=solid,linewidth=2pt,
fillcolor=lblue](-1.4,-0.9)(-1.3,-0.55)%
% Bottom right cross
\psframe[linestyle=none,fillstyle=solid,linewidth=2pt,
fillcolor=lblue](11.9,-0.9)(12,-0.55)%
\HAP@PutLF{tl}{-1.22,-.9}%
\HAP@PutRF{tr}{11.7,-.9}%
\else %%% of \ifFymaAFourPaper
% Top line
\psframe[linestyle=none,fillstyle=solid,linewidth=2pt,
fillcolor=lblue](-1.5,8.5)(11.25,8.4)%
% Top left cross
\psframe[linestyle=none,fillstyle=solid,linewidth=2pt,
fillcolor=lblue](-1.4,8.6)(-1.3,8.25)%
% Top right cross
\psframe[linestyle=none,fillstyle=solid,linewidth=2pt,
fillcolor=lblue](11.05,8.6)(11.15,8.25)%
% Bottom line
\psframe[linestyle=none,fillstyle=solid,linewidth=2pt,
fillcolor=lblue](-1.5,-0.8)(11.25,-0.7)%
% Bottom left cross
\psframe[linestyle=none,fillstyle=solid,linewidth=2pt,
fillcolor=lblue](-1.4,-0.9)(-1.3,-0.55)%
% Bottom right cross
\psframe[linestyle=none,fillstyle=solid,linewidth=2pt,
fillcolor=lblue](11.05,-0.9)(11.15,-0.55)%
\HAP@PutLF{tl}{-1.22,-.9}%
\HAP@PutRF{tr}{10.85,-.9}%
\fi%
}

\newcommand{\TitleSlide}[1]{%
\MakeFymaMainGradient%
\MakeFymaFrame%
{#1}}%

\newcommand{\NormalSlide}[1]{%
\MakeFymaMainGradient%
\ifHAP@toc%
% Vertical left band in very light blue
\psframe[linestyle=none, fillstyle=gradient,
  gradbegin=white,gradend=lllblue,gradmidpoint=0](-1.4,8.5)(0.8,-0.8)%
% The TOC
\rput[lt](-1.27,6.55){\begin{minipage}[t]{2cm}\HAP@toc\end{minipage}}%
\fi%
\MakeFymaFrame%
{#1}}%

\newcommand{\WideSlide}[1]{%
\MakeFymaMainGradient%
\MakeFymaFrame%
{#1}}%

\newcommand{\PartSlide}[1]{%
% Drawing four bands before the borders
\ifFymaAFourPaper
\psframe[linestyle=none,fillstyle=solid,linewidth=2pt,
fillcolor=llllblue](-1.4,8.5)(12,5.9)%
\psframe[linestyle=none,fillstyle=solid,linewidth=2pt,
fillcolor=llllblue](-1.4,-0.8)(12,2.8)%
\psframe[linestyle=none,fillstyle=solid,linewidth=2pt,
fillcolor=llllblue](-1.4,8.5)(1.7,-0.8)%
\psframe[linestyle=none,fillstyle=solid,linewidth=2pt,
fillcolor=llllblue](8.9,8.5)(12,-0.8)%
% Target around title
% Top line
\psframe[linestyle=none,fillstyle=solid,linewidth=2pt,
fillcolor=lblue](1.5,6)(9.1,5.9)%
% Top left cross
\psframe[linestyle=none,fillstyle=solid,linewidth=2pt,
fillcolor=lblue](1.6,6.1)(1.7,5.75)%
% Top right cross
\psframe[linestyle=none,fillstyle=solid,linewidth=2pt,
fillcolor=lblue](8.9,6.1)(9.0,5.75)%
% Bottom line
\psframe[linestyle=none,fillstyle=solid,linewidth=2pt,
fillcolor=lblue](1.5,2.7)(9.1,2.8)%
% Bottom left cross
\psframe[linestyle=none,fillstyle=solid,linewidth=2pt,
fillcolor=lblue](1.6,2.6)(1.7,2.95)%
% Bottom right cross
\psframe[linestyle=none,fillstyle=solid,linewidth=2pt,
fillcolor=lblue](8.9,2.6)(9,2.95)%
\else %%% of \ifFymaAFourPaper
\psframe[linestyle=none,fillstyle=solid,linewidth=2pt,
fillcolor=llllblue](-1.4,8.5)(11.25,5.9)%
\psframe[linestyle=none,fillstyle=solid,linewidth=2pt,
fillcolor=llllblue](-1.4,-0.8)(11.25,2.8)%
\psframe[linestyle=none,fillstyle=solid,linewidth=2pt,
fillcolor=llllblue](-1.4,8.5)(1.7,-0.8)%
\psframe[linestyle=none,fillstyle=solid,linewidth=2pt,
fillcolor=llllblue](8.4,8.5)(11.25,-0.8)%
% Target around title
% Top line
\psframe[linestyle=none,fillstyle=solid,linewidth=2pt,
fillcolor=lblue](1.5,6)(8.6,5.9)%
% Top left cross
\psframe[linestyle=none,fillstyle=solid,linewidth=2pt,
fillcolor=lblue](1.6,6.1)(1.7,5.75)%
% Top right cross
\psframe[linestyle=none,fillstyle=solid,linewidth=2pt,
fillcolor=lblue](8.4,6.1)(8.5,5.75)%
% Bottom line
\psframe[linestyle=none,fillstyle=solid,linewidth=2pt,
fillcolor=lblue](1.5,2.7)(8.6,2.8)%
% Bottom left cross
\psframe[linestyle=none,fillstyle=solid,linewidth=2pt,
fillcolor=lblue](1.6,2.6)(1.7,2.95)%
% Bottom right cross
\psframe[linestyle=none,fillstyle=solid,linewidth=2pt,
fillcolor=lblue](8.4,2.6)(8.5,2.95)%
\fi%
\MakeFymaFrame%
{#1}}%

%% Embedding Title Slide
\newcommand{\HAPR@titleSlide}{
\ifFymaAFourPaper
\NewSlideStyle[12.3cm]{t}{5.4,2.9}{TitleSlide}%
\else
\NewSlideStyle[12.3cm]{t}{4.9,2.9}{TitleSlide}%
\fi
}

%% Embedding NormalSlide
\newcommand{\HAPR@normalSlide}{
\ifHAP@toc
\ifFymaAFourPaper
\NewSlideStyle[10cm]{tl}{1.2,3.6}{NormalSlide}
\else
\NewSlideStyle[9.5cm]{tl}{1.2,3.6}{NormalSlide}
\fi
\else
\ifFymaAFourPaper
\NewSlideStyle[12.8cm]{tl}{-1.1,3.6}{NormalSlide}
\else
\NewSlideStyle[11.8cm]{tl}{-1.1,3.6}{NormalSlide}
\fi
\fi}%

%% Embedding WideSlide
\newcommand{\HAPR@wideSlide}{
\ifFymaAFourPaper
\NewSlideStyle[12.3cm]{tl}{-1,3.6}{WideSlide}
\else
\NewSlideStyle[11.8cm]{tl}{-1.2,3.6}{WideSlide}
\fi
}

%% Redefining wideslide environment to redefine \slidetitle
\AtBeginDocument{%
  \def\wideslide{\@ifnextchar[\HAP@wideslide{\HAP@wideslide[]}}%
  \def\HAP@wideslide[#1]#2{%
    \def\slidetitle##1{%
      \rput[lt](-1.2,4.5){%
        \settowidth{\FymaTitleLength}{\fontTitle{##1}}%
        \addtolength{\FymaTitleLength}{0.2cm}%
        \psframe[linestyle=none,fillstyle=solid,linewidth=2pt,%
        fillcolor=lblue](-0.05,-0.2)(\FymaTitleLength,-0.25)%
        {\ddblue \fontTitle{##1}}%
        \ \\[-2mm]%
      }%
    }%
    \HAPR@wideSlide
    \begin{slide}[#1]{#2}%
  }%
  \def\endwideslide{\end{slide}\HAPR@normalSlide}%
}

%% Embedding Part Slide
\newcommand{\HAPR@partSlide}{
\ifFymaAFourPaper
\NewSlideStyle[12.3cm]{tl}{-1.1,2.5}{PartSlide}%
\else %%% of \ifFymaAFourPaper
\NewSlideStyle[11.8cm]{tl}{-1.1,2.5}{PartSlide}%
\fi
}
\HAPsetup{template=partslide}

% Slide title definition
\newlength{\FymaTitleLength}
\newlength{\FymaMaxTitleLength}
\newcommand{\slidetitle}[1]{%
  \ifHAP@toc
    \ifFymaAFourPaper
    \setlength{\FymaMaxTitleLength}{10.5cm}
    \else
    \setlength{\FymaMaxTitleLength}{9.5cm}
    \fi
    \rput[lt](1,4.5){%
      \settowidth{\FymaTitleLength}{\fontTitle{#1}}
      \ifdim \FymaTitleLength > \FymaMaxTitleLength
      \setlength{\FymaTitleLength}{\FymaMaxTitleLength}%
      \fi
      \addtolength{\FymaTitleLength}{0.2cm}%
      \psframe[linestyle=none,fillstyle=solid,linewidth=2pt,%
      fillcolor=lblue](-0.05,-0.2)(\FymaTitleLength,-0.25)%
      {\ddblue \fontTitle{\parbox[b]{\FymaMaxTitleLength}{#1}}}%
      \ \\[-2mm]%
  }%
  \else
    \ifFymaAFourPaper
    \setlength{\FymaMaxTitleLength}{12.7cm}
    \else
    \setlength{\FymaMaxTitleLength}{11.7cm}
    \fi
    \rput[lt](-1.1,4.5){%
      \settowidth{\FymaTitleLength}{\fontTitle{#1}}%
      \ifdim \FymaTitleLength > \FymaMaxTitleLength
      \setlength{\FymaTitleLength}{\FymaMaxTitleLength}%
      \fi
      \addtolength{\FymaTitleLength}{0.2cm}%
      \psframe[linestyle=none,fillstyle=solid,linewidth=2pt,%
      fillcolor=lblue](-0.05,-0.2)(\FymaTitleLength,-0.25)%
      {\ddblue \fontTitle{\parbox[b]{\FymaMaxTitleLength}{#1}}}%
      \ \\[-2mm]%
    }%
  \fi
}

% List item definitions
\myitem{1}{\raisebox{1pt}{\fontsize{7pt}{7pt}\ensuremath{\bullet}}}
\myitem{2}{\raisebox{1pt}{\fontsize{7pt}{7pt}\ensuremath{\circ}}}
\myitem{3}{\raisebox{1pt}{\fontsize{5pt}{5pt}\ensuremath{\circ}}}

% Style of table of contents entries
\newcommand{\HAP@tline}[1]{\ensuremath{\bullet}\,%
  \parbox[t]{1.7cm}{\raggedright#1}}
\newcommand{\HAP@tsectionm}{%
  \psline[linecolor=dblue,linewidth=.25pt](-.05,-.05)(2,-.05)%
}
\def\HAP@hltocentry{\parbox[b]{\HAP@twidth}{\raggedright{\HAP@htcolor\HAP@toctext}}}
\newcommand{\HAP@tsectionskip}{2em}
\newcommand{\HAP@titemskip}{0em}

\endinput