% This is the inner theme file of the AAU sidebar theme.
% Copyright (c) 2010-2013 by Jesper Kjær Nielsen <jkn@es.aau.dk>
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.
%
% You can find the GNU General Public License at <http://www.gnu.org/licenses/>.

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{beamerinnerthemeAAUsidebar}[2013/05/26 v1.3.0 The AAU Sidebar Beamer Theme]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Theme options and definitions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%theme options
\DeclareOptionBeamer{left}{\def\beamer@sidebarside{left}}
\DeclareOptionBeamer{right}{\def\beamer@sidebarside{right}}
\ExecuteOptionsBeamer{right}
\ProcessOptionsBeamer

\def\beamer@lefttext{left} %used for comparison below
\newlength{\beamer@plainpagewidth}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%beamer specific options
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\mode<presentation>%refers to the first four modes (beamer,handout,second and trans). That is, to all modes except the article mode
{
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  %templates
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  %title page
  \setbeamertemplate{title page}{%
    \ifx\beamer@sidebarside\beamer@lefttext% sidebar on the left
      \setlength{\beamer@plainpagewidth}{\textwidth+\beamer@leftsidebar}%
      \hskip-\beamer@leftsidebar%
    \else% sidebar on the right
      \setlength{\beamer@plainpagewidth}{\textwidth+\beamer@rightsidebar}%
    \fi%
    \begin{minipage}[c][\textheight][c]{\beamer@plainpagewidth}
      \vfill
      \centering
      {\usebeamerfont{title}\usebeamercolor[fg]{title}\inserttitle}

      {\usebeamerfont{subtitle}\usebeamercolor[fg]{subtitle}\small\insertsubtitle}\vspace*{\baselineskip}

      \begin{beamercolorbox}[wd=\beamer@plainpagewidth,center,sep=\baselineskip]{frametitle}%
        {\usebeamerfont{date}31 octobre 2024}\vspace*{\baselineskip}
        
        {\usebeamerfont{author}\insertauthor}\vspace*{\baselineskip}
        
        {\usebeamerfont{institute}\insertinstitute}
      \end{beamercolorbox}\vspace*{\baselineskip}
      
      {\inserttitlegraphic}\vspace*{\baselineskip}
    \end{minipage}
  }
 
  %final page
  \defbeamertemplate{final page}{text}[1]{%
    \ifx\beamer@sidebarside\beamer@lefttext% sidebar on the left
      \setlength{\beamer@plainpagewidth}{\textwidth+\beamer@leftsidebar}%
      \hskip-\beamer@leftsidebar%
    \else% sidebar on the right
      \setlength{\beamer@plainpagewidth}{\textwidth+\beamer@rightsidebar}%
    \fi%
    \begin{minipage}[c][\textheight][c]{\beamer@plainpagewidth}
      \centering
      \vfill
      \begin{beamercolorbox}[wd=\textwidth,center,sep=2\baselineskip]{frametitle}
        #1
      \end{beamercolorbox}
      \vfill
      {\inserttitlegraphic}\vspace*{\baselineskip}
    \end{minipage}
  }
  \newcommand{\finalpage}[1]{%
    \setbeamertemplate{final page}[text]{#1}
    \usebeamertemplate{final page}
  }
  
  % add the aau waves to the background
  \newcommand{\aauwavesbg}{%
    \setbeamertemplate{background}{
        \hspace{-2cm}\vspace{5cm}\includegraphics[scale=0.4]{AAUgraphics/background.png}
      \tikz[overlay] \fill[fill opacity=0,fill=white] (0,0) rectangle (-\paperwidth,\paperheight);
    }
  }
  
  % use numbers instead of a picture for the references
  \setbeamertemplate{bibliography item}[text]
  
  %part page
  \AtBeginPart{\frame[plain]{\partpage}} %adds a plain part page as defined below
  \defbeamertemplate*{part page}{sidebar theme}{%
    \ifx\beamer@sidebarside\beamer@lefttext% sidebar on the left
      \setlength{\beamer@plainpagewidth}{\textwidth+\beamer@leftsidebar}%
      \hskip-\beamer@leftsidebar%
    \else% sidebar on the right
      \setlength{\beamer@plainpagewidth}{\textwidth+\beamer@rightsidebar}%
    \fi%
    \begin{minipage}[c][\textheight][c]{\beamer@plainpagewidth}
      \centering
      {\usebeamerfont{title}\usebeamercolor[fg]{author}{Part \Roman{part}}}\vspace*{\baselineskip}

      {\usebeamerfont{title}\usebeamercolor[fg]{title}{\insertpart}}
    \end{minipage}
  }

}%end of beamer specific options

\mode<all>
