\ProvidesClass{beamerthementnu2017}[2017/05/31]

% - Rydde opp i koden

\mode<presentation>

% Requirement
\RequirePackage{helvet}
\RequirePackage[absolute,overlay]{textpos}

% Options
\DeclareOptionBeamer*{\PassOptionsToPackage{\CurrentOption}{beamerinnerthementnu2017}}
\DeclareOptionBeamer*{\PassOptionsToPackage{\CurrentOption}{beamerouterthementnu2017}}
\DeclareOptionBeamer*{\PassOptionsToPackage{\CurrentOption}{beamercolorthementnu2017}}
\DeclareOptionBeamer{style}{\def\beamer@ntnu@style{#1}}
\DeclareOptionBeamer{language}{\def\beamer@ntnu@language{#1}}
\DeclareOptionBeamer{city}{\def\beamer@ntnu@city{#1}}

% Set default options
\ExecuteOptionsBeamer{style=ntnu}
\ExecuteOptionsBeamer{language=bm}
\ExecuteOptionsBeamer{city=none}

% Handle a wish for a smaller title
\newif\if@smalltitle
\@smalltitlefalse
\DeclareOptionBeamer{smalltitle}{\@smalltitletrue}

\ProcessOptionsBeamer

% Done with options, load the subthemes
\useinnertheme{ntnu2017}
\useoutertheme{ntnu2017}
\usecolortheme{ntnu2017}

% Fonts
\if@smalltitle
  \setbeamerfont{title}{size=\large}
  \setbeamerfont{subtitle}{size=\large}
\else
  \setbeamerfont{title}{size=\huge}
  \setbeamerfont{subtitle}{size=\Large}
\fi
\setbeamerfont{title}{series=\bfseries}
\setbeamerfont{subtitle}{series=\mdseries}
\setbeamerfont{author}{size=\normalsize}
\setbeamerfont{date}{size=\normalsize}
\setbeamerfont{institute}{size=\normalsize}
\setbeamerfont{frametitle}{size=\large, series=\bfseries}
\setbeamerfont{framesubtitle}{size=\normalsize}
\setbeamerfont{pagenumber}{size=\tiny,series=\bfseries}

\ExplSyntaxOn
\str_case_x:nnF {\aspect} {
  {169} {
    \setbeamerfont{footline}{size=\scriptsize}
  }
}
{ % Otherwise: 43, we should assume, but let's catch all
  \setbeamerfont{footline}{size=\tiny}
}
\ExplSyntaxOff

% Turn off navigation symbols
\setbeamertemplate{navigation symbols}{}


% Do some fancy redefining of the title page to get a different footline
% and background.
\def\titlestyle{title\beamer@ntnu@style}
\makeatletter
\def\ps@navigation@titlepage{%
    \setbeamertemplate{footline}[\titlestyle]
    \setbeamertemplate{background}[\titlestyle]
  \@nameuse{ps@navigation}}
\addtobeamertemplate{title page}{\thispagestyle{navigation@titlepage}}{}
\makeatother


% Command to print a title page. The standard beamer method is now
% preferred, this is kept for backwards compatibility only.

\newcommand{\ntnutitlepage}{%
    \begin{frame}%
      \titlepage%
    \end{frame}%
}

\mode<all>
