\ProvidesPackage{beamerthemeprogressbar}[2007/06/21]

% Beamer theme by Sylvain Bouveret <sylvain[dot]bouveret[aT]cert[DoT]fr>
% aug. 2009 version 0.4
%
% based on the LaTeX-Beamer package :
% Copyright 2003 by Till Tantau <tantau@users.sourceforge.net>
%
% This program can be redistributed and/or modified under the terms
% of the GNU Public License, version 2.

\RequirePackage{tikz}
\RequirePackage{bibunits}

\makeatletter
\def\progressbar@headline{none}%
\def\progressbar@frametitle{picture-section}%
\def\progressbar@imagename{images/tree04}%
\def\progressbar@titlepage{picture}%
\define@key{progressbar}{headline}[none]{%
  \def\progressbar@headline{#1}%
}
\define@key{progressbar}{frametitle}[picture]{%
  \def\progressbar@frametitle{#1}%
}
\define@key{progressbar}{imagename}{%
  \def\progressbar@imagename{#1}%
  \pgfdeclareimage[width=0.12\textwidth,interpolate=true]{headlineimage}{\progressbar@imagename}
}
\define@key{progressbar}{titlepage}[picture]{%
  \def\progressbar@titlepage{#1}%
}

\def\progressbaroptions#1{\setkeys{progressbar}{#1}}

\def\insertintermediateframenumber{\inserttotalframenumber}

\usecolortheme{progressbar}
\useinnertheme{progressbar}
\usefonttheme{progressbar}
\useoutertheme{progressbar}

\setbeamertemplate{navigation symbols}{}

\AtBeginDocument{%
  \typeout{..................................................................}
  \typeout{You are using the progressbar beamer theme (Sylvain B.)}
  \typeout{Version: 0.4. Aug. 2009.}
  \typeout{..................................................................}
}

\renewcommand{\appendix}[1][0void0]
{
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
  % This piece of code is supposed to introduce a bias in the
  % number of slides
  \makeatletter
  \immediate\write\@auxout{\string\@writefile{nav}%
    {\noexpand\headcommand{\noexpand\def\noexpand\insertintermediateframenumber{\the\c@framenumber}}}}
  \renewcommand{\insertintermediateframenumber}{\inserttotalframenumber}
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
  
  \def\tmparg{#1}
  \def\tmpargref{0void0}
  \ifx\tmparg\tmpargref\else
  \begin{frame}[plain]
    \vfill
    \begin{center}
      \usebeamerfont{title}\usebeamercolor{title}{\color{fg}\ #1\ }
    \end{center}
    \vfill
  \end{frame}
  \fi
  \makeatother
}
