% Copyright 2007 by Till Tantau
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Public License.
%
% See the file doc/licenses/LICENSE for more details.

% Modified by Stephen Wattam 28-06-11.
\ProvidesPackageRCS $Header: beamerouterthemeinfolab21.sty,v 1.0 2011/06/28 09:11:41 swattam $


\newdimen\beamer@sidebarwidth
\newdimen\beamer@headheight
\usebeamerfont{frametitle}
\beamer@sidebarwidth=3.74\baselineskip
\beamer@headheight=2.0\baselineskip
\reset@font

\def\beamer@lefttext{left}

\DeclareOptionBeamer{hideothersubsections}[]{\beamer@nav@subsectionstyle{show/show/hide}}
\DeclareOptionBeamer{hideallsubsections}[]{\beamer@nav@subsectionstyle{hide}}

\DeclareOptionBeamer{width}{\beamer@sidebarwidth=#1}
\DeclareOptionBeamer{height}{\beamer@headheight=#1}
\DeclareOptionBeamer{left}{\def\beamer@sidebarside{left}}
\DeclareOptionBeamer{right}{\def\beamer@sidebarside{right}}
\ExecuteOptionsBeamer{left}
\ProcessOptionsBeamer


\mode<presentation>


% Add the install path for the image
\graphicspath{{/usr/share/infolab21beamer/images/}}

%use the green stripe image if possible, else the one from the ppt
\usebackgroundtemplate{\includegraphics[width=\paperwidth]{ilabbg2.png}}
\DeclareOptionBeamer{useorangestripe}[]{
% Use the same bg image as in the ppt
\usebackgroundtemplate{\includegraphics[width=\paperwidth]{ilabbg1.png}}
}

% disable navigation, since it messes up the bg image
\setbeamertemplate{navigation symbols}{}




\ifdim\beamer@headheight>0pt
% if head height is 0pt, use default frame title

  \setbeamercolor*{frametitle}{parent=sidebar}

  \defbeamertemplate*{frametitle}{sidebar theme}
  {%
    \nointerlineskip%
    \vskip-\beamer@headheight%
    \vbox to \beamer@headheight{%
      \vfil
      \leftskip=-\beamer@leftmargin%
      \advance\leftskip by0.3cm%
      \rightskip=-\beamer@rightmargin%
      \advance\rightskip by0.3cm plus1fil%
      {\usebeamercolor[fg]{frametitle}\usebeamerfont{frametitle}\insertframetitle\par}%
      {\usebeamercolor[fg]{framesubtitle}\usebeamerfont{framesubtitle}\insertframesubtitle\par}%
      \vbox{}%
      \vskip-1em%
      \vfil
    }%
  }

  \defbeamertemplate*{headline}{sidebar theme}
  {%
    \begin{beamercolorbox}[wd=\paperwidth]{frametitle}
      \ifx\beamer@sidebarside\beamer@lefttext%
      \else%
        \hfill%
      \fi%
      \ifdim\beamer@sidebarwidth>0pt%  
	%\usebeamercolor[bg]{logo}%
	%\vrule width\beamer@sidebarwidth height \beamer@headheight%
	\vrule width0pt height \beamer@headheight%  
	\hskip-\beamer@sidebarwidth%
	%\hbox to \beamer@sidebarwidth{\hss\vbox to
	  %\beamer@headheight{\vss\hbox{\color{fg}\insertlogo}\vss}\hss}%
      \else%
	\vrule width0pt height \beamer@headheight%  
      \fi%
    \end{beamercolorbox}
  }
\fi


\def\beamer@sidebarformat#1#2#3{%
  \begin{beamercolorbox}[wd=\beamer@sidebarwidth,leftskip=#1,rightskip=1ex plus1fil,vmode]{#2}
    \vbox{}%
    #3\par%
    \vbox{}%
    \vskip-1.5ex%
  \end{beamercolorbox}
}

\defbeamertemplate*{section in sidebar}{sidebar theme}
{%
  \vbox{%
    \vskip1ex%
    \beamer@sidebarformat{3pt}{section in sidebar}{\insertsectionhead}%
  }%
}

\defbeamertemplate*{section in sidebar shaded}{sidebar theme}
{%
  \vbox{%
    \vskip1ex%
    \beamer@sidebarformat{3pt}{section in sidebar shaded}{\insertsectionhead}%
  }%
}

\defbeamertemplate*{subsection in sidebar}{sidebar theme}
{%
  \beamer@sidebarformat{5pt}{subsection in sidebar}{\insertsubsectionhead}%
}

\defbeamertemplate*{subsection in sidebar shaded}{sidebar theme}
{%
  \beamer@sidebarformat{5pt}{subsection in sidebar shaded}{\insertsubsectionhead}%
}

\defbeamertemplate*{subsubsection in sidebar}{sidebar theme}
{%
  \beamer@sidebarformat{7pt}{subsubsection in sidebar}{\insertsubsubsectionhead}%
}

\defbeamertemplate*{subsubsection in sidebar shaded}{sidebar theme}
{%
  \beamer@sidebarformat{7pt}{subsubsection in sidebar shaded}{\insertsubsubsectionhead}%
}


\ifdim\beamer@sidebarwidth>0pt

                                % Sidebar
  \setbeamersize{sidebar width \beamer@sidebarside=\beamer@sidebarwidth}
  \defbeamertemplate*{sidebar \beamer@sidebarside}{sidebar theme}
  {
    %\vskip\beamer@headheight 
    \beamer@tempdim=\beamer@sidebarwidth%
    \advance\beamer@tempdim by -6pt%
    {\usebeamerfont{title in sidebar}%
      \vskip1.5em%
      \hskip3pt%
      \usebeamercolor[fg]{title in sidebar}%
      \insertshorttitle[width=\beamer@tempdim,center,respectlinebreaks]\par%
      \vskip1.25em%
    }%
    {%
      \hskip3pt%
      \usebeamercolor[fg]{author in sidebar}%
      \usebeamerfont{author in sidebar}%
      \insertshortauthor[width=\beamer@tempdim,center,respectlinebreaks]\par%
      \vskip1.25em%
    }%
    \insertverticalnavigation{\beamer@sidebarwidth}%
    \vfill
    \ifx\beamer@sidebarside\beamer@lefttext%
    \else%
      \usebeamercolor{normal text}%
      \llap{\usebeamertemplate***{navigation symbols}\hskip0.1cm}%
      \vskip2pt%
    \fi%
  }%
  
  \ifx\beamer@sidebarside\beamer@lefttext%
    \defbeamertemplate*{sidebar right}{sidebar theme}
    {%
      \vfill%
      \llap{\usebeamertemplate***{navigation symbols}\hskip0.1cm}%
      \vskip2pt
    }
  \fi
                                % Margins
  \setbeamersize{text margin left=0.5cm,text margin right=0.5cm}
\fi

\mode
<all>
