%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Copyright 2011 by Fiandrino Claudio
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Public License.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\mode<presentation>

% String used between the current page and the total page count.
\def\beamer@torinoth@pageofpages{of}
\DeclareOptionBeamer{pageofpages}{\def\beamer@torinoth@pageofpages{#1}}

% Show a line below the frame title.
\DeclareOptionBeamer{titleline}[true]{\def\beamer@torinoth@titleline{#1}}

\ExecuteOptionsBeamer{titleline=false}
\ProcessOptionsBeamer

% Lengths
\newlength{\headerheight}
\setlength{\headerheight}{.05\paperheight}
\newlength{\beamer@torinoth@line}
\setlength{\beamer@torinoth@line}{.03\paperheight}
\newlength{\beamer@torinoth@box}
\setlength{\beamer@torinoth@box}{.01\paperheight}

% Footer
\defbeamertemplate*{footline}{torinoth theme}
{
  \leavevmode%
  % First line.
  \hbox{%
  \begin{beamercolorbox}[wd=\paperwidth,ht=\beamer@torinoth@line,dp=0pt]{}%
  \end{beamercolorbox}%
  } %
  % Page number.
  \hbox{%
  \begin{beamercolorbox}[wd=.85\paperwidth,ht=0ex,dp=0ex]{}%
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.075\paperwidth,ht=.2ex,dp=0ex,center,rounded=true,shadow=true,draw]{frame number}%
    \usebeamerfont{frame number}\insertframenumber{} \beamer@torinoth@pageofpages{} \inserttotalframenumber{}%
  \end{beamercolorbox}%
  } %
  % Second line.
  \hbox{%
  \begin{beamercolorbox}[wd=.2\paperwidth,ht=\beamer@torinoth@box,dp=0pt]{}%
  \end{beamercolorbox}%
  \def\beamer@torinoth@separator{-}%
  \begin{beamercolorbox}[wd=.6\paperwidth,ht=\beamer@torinoth@box,dp=0pt,center,rounded=true,shadow=true]{footerbox}%
    \usebeamerfont{footnote}\insertauthor{} \beamer@torinoth@separator{} \inserttitle % Here is inserted author-title: manage different cases
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.2\paperwidth,ht=\beamer@torinoth@box,dp=0pt]{}%
  \end{beamercolorbox}%
  } %
  % Third line.
  \hbox{%
  \begin{beamercolorbox}[wd=\paperwidth,ht=\beamer@torinoth@line,dp=0pt,left]{}%
  \insertslidenavigationsymbol
  \end{beamercolorbox}%
  } %
  
}

% Header
\defbeamertemplate*{headline}{torinoth theme}
{

  % Insert modality to manage navigation bars
  % Insert modality to manage a logo put on the right up side

  \leavevmode%
  \hbox{%
  \begin{beamercolorbox}[wd=\paperwidth,ht=\headerheight,dp=0pt]{page header}%
  \end{beamercolorbox}%
  }%
  \vskip0pt%
  \hbox{%
  \begin{beamercolorbox}[wd=\paperwidth,ht=\beamer@torinoth@line]{second header}%
  \end{beamercolorbox}%
  } %
  \vskip0pt%
}

\defbeamertemplate*{frametitle}{torinoth theme}[1][left]
{
  \ifbeamercolorempty[bg]{frametitle}{}{\nointerlineskip}%
  \@tempdima=\textwidth%
  \advance\@tempdima by\beamer@leftmargin%
  \advance\@tempdima by\beamer@rightmargin%
  \vbox{}\vskip-.5\beamer@leftmargin%
  \begin{beamercolorbox}[sep=\beamer@leftmargin,#1,wd=\the\@tempdima]{}
    \usebeamerfont{frametitle}\usebeamercolor[bg]{framesubtitle}%
    \vbox{}\vskip0ex%
    \if@tempswa\else\csname beamer@fte#1\endcsname\fi%
    \strut\insertframetitle\strut\par%
    {%
      \ifx\insertframesubtitle\@empty%
      \else%
      {\usebeamerfont{framesubtitle}\usebeamercolor[bg]{framesubtitle}\insertframesubtitle\strut\par}%
      \fi
    }%
    \vskip-1ex%
    \if@tempswa\else\vskip-\beamer@leftmargin\fi
  \end{beamercolorbox}%
  \def\beamer@torinoth@truetext{true}%
  \ifx\beamer@torinoth@titleline\beamer@torinoth@truetext%
    \vskip-.5\beamer@leftmargin%
    \begin{beamercolorbox}[wd=\textwidth,ht=.1ex,dp=0ex]{titleline}%
    \end{beamercolorbox}%
  \fi
}

% Frame title continuations, default

\defbeamertemplate*{frametitle continuation}{torinoth theme}{(\insertcontinuationcount)}


\mode
<all>
