% 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.

\newdimen\beamer@debiansidebarwidth
\newdimen\beamer@headheight
\usebeamerfont{frametitle}
\beamer@debiansidebarwidth=2.5\baselineskip
\beamer@headheight=2.5\baselineskip
\reset@font

\def\beamer@lefttext{left}

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

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


\mode<presentation>

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

  \setbeamercolor*{frametitle}{parent=debiansidebar}

  \defbeamertemplate*{frametitle}{debiansidebar 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}{debiansidebar theme}
  {%
    \begin{beamercolorbox}[wd=\paperwidth]{frametitle}
      \ifx\beamer@debiansidebarside\beamer@lefttext%
      \else%
        \hfill%
      \fi%
      \ifdim\beamer@debiansidebarwidth>0pt%  
        \usebeamercolor[bg]{logo}%
        \vrule width\beamer@debiansidebarwidth height \beamer@headheight%
        \hskip-\beamer@debiansidebarwidth%
        \hbox to \beamer@debiansidebarwidth{\hss\vbox to
          \beamer@headheight{\vss\hbox{\color{fg}\insertlogo}\vss}\hss}%
      \else%
        \vrule width0pt height \beamer@headheight%  
      \fi%
    \end{beamercolorbox}
  }
\fi


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

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

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

\defbeamertemplate*{subsection in debiansidebar}{debiansidebar theme}
{%
  \beamer@debiansidebarformat{5pt}{subsection in debiansidebar}{\insertsubsectionhead}%
}

\defbeamertemplate*{subsection in debiansidebar shaded}{debiansidebar theme}
{%
  \beamer@debiansidebarformat{5pt}{subsection in debiansidebar shaded}{\insertsubsectionhead}%
}

\defbeamertemplate*{subsubsection in debiansidebar}{debiansidebar theme}
{%
  \beamer@debiansidebarformat{7pt}{subsubsection in debiansidebar}{\insertsubsubsectionhead}%
}

\defbeamertemplate*{subsubsection in debiansidebar shaded}{debiansidebar theme}
{%
  \beamer@debiansidebarformat{7pt}{subsubsection in debiansidebar shaded}{\insertsubsubsectionhead}%
}


\ifdim\beamer@debiansidebarwidth>0pt

                                % debiansidebar
  \setbeamersize{debiansidebar width \beamer@debiansidebarside=\beamer@debiansidebarwidth}
  \defbeamertemplate*{debiansidebar \beamer@debiansidebarside}{debiansidebar theme}
  {
    \beamer@tempdim=\beamer@debiansidebarwidth%
    \advance\beamer@tempdim by -6pt%
    {\usebeamerfont{title in debiansidebar}%
      \vskip0em%
      \hskip3pt%
      \usebeamercolor[fg]{title in debiansidebar}%
      \includegraphics[width=5cm]{openlogo-crop.pdf}%
      \insertshorttitle[width=\beamer@tempdim,center,respectlinebreaks]\par%
      \vskip0.5em%
    }%
    {%
      \hskip3pt%
      \usebeamercolor[fg]{author in debiansidebar}%
      \usebeamerfont{author in debiansidebar}%
      \insertshortauthor[width=\beamer@tempdim,center,respectlinebreaks]\par%
      \vskip0.5em%
    }%
    \insertverticalnavigation{\beamer@debiansidebarwidth}%
    \vfill
    \ifx\beamer@debiansidebarside\beamer@lefttext%
    \else%
      \usebeamercolor{normal text}%
      \llap{\usebeamertemplate***{navigation symbols}\hskip0.1cm}%
      \vskip2pt%
    \fi%
  }%
  
  \ifx\beamer@debiansidebarside\beamer@lefttext%
    \defbeamertemplate*{debiansidebar right}{debiansidebar 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>
