%% This is file `beamerinnerthemeTUDa.sty' version 2.07 (2020/01/28),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
%%
%%  Copyright (C) 2018--2019 by Marei Peischl <marei@peitex.de>
%%
%% ============================================================================
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3c
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%% http://www.latex-project.org/lppl.txt
%% and version 1.3c or later is part of all distributions of LaTeX
%% version 2008/05/04 or later.
%%
%% This work has the LPPL maintenance status `maintained'.
%%
%% The Current Maintainers of this work are
%%   Marei Peischl <tuda-ci@peitex.de>
%%   Markus Lazanowski <latex@ce.tu-darmstadt.de>
%%
%% The development respository can be found at
%% https://github.com/tudace/tuda_latex_templates
%% Please use the issue tracker for feedback!
%%
%% ============================================================================
%%
\def\fileversion{2.07}
\def\filedate{2020/01/28}
%% This is file `beamerinnerthemeTUDa.sty' version 1.11 (2019/10/15),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
%%
%%  Copyright (C) 2018--2019 by Marei Peischl <marei@peitex.de>
%%
%% ============================================================================
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3c
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%% http://www.latex-project.org/lppl.txt
%% and version 1.3c or later is part of all distributions of LaTeX
%% version 2008/05/04 or later.
%%
%% This work has the LPPL maintenance status `maintained'.
%%
%% The Current Maintainers of this work are
%%   Marei Peischl <tuda-ci@peitex.de>
%%   Markus Lazanowski <latex@ce.tu-darmstadt.de>
%%
%% The development respository can be found at
%% https://github.com/tudace/tuda_latex_templates
%% Please use the issue tracker for feedback!
%%
%% ============================================================================
%%
\def\fileversion{1.11}
\def\filedate{2019/10/15}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{beamerinnerthemeTUDa}
 [\filedate\space\fileversion]

\RequirePackage{l3keys2e}

\mode<presentation>

\RequirePackage{trimclip}


\ExplSyntaxOn
\keys_define:nn {TUDa/beamer/inner} {
	authorontitle .bool_gset:N = \g_TUDa_authorontitle_bool,
	authorontitle .initial:n = false,
	authorontitle .default:n = true
}
\ProcessKeysOptions{TUDa/beamer/inner}

\box_new:N \l_TUDa_titlegraphic_box


\RenewDocumentCommand{\titlegraphic}{sm}{
	\IfBooleanTF{#1}{
		\def\inserttitlegraphic{
			\hbox_set:Nn \l_TUDa_titlegraphic_box {\raisebox{\depth}{#2}}
			\box_resize_to_wd:Nn \l_TUDa_titlegraphic_box {\width}
			\dim_compare:nTF {\box_ht:N \l_TUDa_titlegraphic_box - \l_TUDa_titlegraphic_ht_dim > \c_zero_dim}
			{
				\dim_set:Nn \l_tmpa_dim {.5\box_ht:N \l_TUDa_titlegraphic_box - .5\l_TUDa_titlegraphic_ht_dim}
				\clipbox{0pt~\dim_eval:n{\l_tmpa_dim}~0pt~\dim_eval:n{\l_tmpa_dim}}{\box_use:N \l_TUDa_titlegraphic_box}
			}{
				\box_resize_to_ht:Nn \l_TUDa_titlegraphic_box {\l_TUDa_titlegraphic_ht_dim}
				\dim_set:Nn \l_tmpa_dim {(\box_wd:N \l_TUDa_titlegraphic_box - \width) / 2}
				\clipbox{\dim_eval:n{\l_tmpa_dim}~0pt~\dim_eval:n{\l_tmpa_dim}~0pt}{\box_use:N \l_TUDa_titlegraphic_box}
			}
		}
	}{
		\def\inserttitlegraphic{#2}
	}
}


\box_new:N \l_TUDa_titlehead_box

\dim_new:N \l_TUDa_titlegraphic_ht_dim
\dim_new:N \l_TUDa_titlegraphic_wd_dim

\defbeamertemplate*{title~ page}{TUDa}[1][]
{
	\nointerlineskip
	\vspace{\dim_eval:n {-\c_TUDa_largerule_dim}}
	\hbox_set:Nn \l_TUDa_titlehead_box {
	\parbox{\dimexpr\TUDa@beamer@linewidth+2\TUDa@beamer@extraindent}{%
	\begin{beamercolorbox}[
		wd=\linewidth,
		sep=\TUDa@beamer@logosep,
	]{title}
	\raggedright
	\usebeamerfont{title}
	\skip_horizontal:n {1ex}
	\strut\parbox[t]{\dimexpr\linewidth- \wd\TUDa@logobox-2ex\relax}{
		\inserttitle
		\par
	}
	\hspace{\fill}\raisebox{\dimexpr-\height+\ht\strutbox\relax}{\usebox\TUDa@logobox}
	\ifx\insertsubtitle\@empty
	\else
	\par\vspace{\c_TUDa_largerule_dim}
	\skip_horizontal:n {1ex}\parbox[t]{\dimexpr\linewidth- \wd\TUDa@logobox-2ex\relax}{
		\usebeamerfont{subtitle}\insertsubtitle
	}
	\fi
	\end{beamercolorbox}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% bool if authorontrile
\bool_if:NT \g_TUDa_authorontitle_bool {
\par\nointerlineskip
\begin{beamercolorbox}[
	wd=\linewidth,ht=\c_TUDa_smallrule_dim,dp=\z@]{smallrule}
\end{beamercolorbox}
\par\nointerlineskip
	\begin{beamercolorbox}[
	wd=\linewidth,
	sep=\c_TUDa_largerule_dim,
	]{title}
	\raggedright
	\skip_horizontal:n {1ex}
	\parbox[t]{\dimexpr\linewidth-2ex\relax}{
		\ifx\insertauthor\@empty
		\else
		\usebeamercolor[fg]{author}\usebeamerfont{author}\insertauthor\par
		\fi
		\ifx\insertauthor\@empty
		\else
		\usebeamercolor[fg]{institute}\usebeamerfont{institute}\insertinstitute
		\fi
	}
\end{beamercolorbox}
}
	}
	}
	\box_use:N \l_TUDa_titlehead_box
\nointerlineskip\begin{beamercolorbox}[
	wd=\dimexpr\TUDa@beamer@linewidth+2\TUDa@beamer@extraindent,ht=\c_TUDa_smallrule_dim,dp=\z@]{smallrule}
	\end{beamercolorbox}
	\dim_set:Nn \l_TUDa_titlegraphic_ht_dim {\textheight-\box_ht:N\l_TUDa_titlehead_box-\box_dp:N \l_TUDa_titlehead_box
	+\c_TUDa_largerule_dim-.5\c_TUDa_rulesep_dim-\c_TUDa_smallrule_dim}
	\let\height\l_TUDa_titlegraphic_ht_dim
	\dim_set:Nn \l_TUDa_titlegraphic_wd_dim{\TUDa@beamer@linewidth+2\TUDa@beamer@extraindent}
	\let\width\l_TUDa_titlegraphic_wd_dim
	\nointerlineskip
	\begin{beamercolorbox}[wd=\width,center]{titlegraphic}
	\raisebox{-\c_TUDa_largerule_dim}[\dim_eval:n {\height-\c_TUDa_largerule_dim}][0pt]{\inserttitlegraphic}
	\end{beamercolorbox}
}


\ExplSyntaxOff
% Blocks


\defbeamertemplate*{block begin}{TUDa}
{
	\par\vskip\medskipamount%
	\begin{beamercolorbox}[ wd=\dimexpr\linewidth+2\TUDa@beamer@extraindent,sep=.5pt,
		leftskip=\dimexpr\ifdim\TUDa@beamer@extraindent>\z@\TUDa@beamer@extraindent-\beamer@colbox@sep\else\z@\fi]{block title}
	\ifx\insertblocktitle\@empty
	\else
	\begin{beamercolorbox}[colsep=.75ex,
		 wd=\dimexpr\linewidth-1pt\relax]{block title}
		\usebeamerfont*{block title}\insertblocktitle%
	\end{beamercolorbox}%
	\ifbeamercolorempty[bg]{block title}
	{}
	{\ifbeamercolorempty[bg]{block body}{}{\par\nointerlineskip\vskip-0.5pt}}%
	\leavevmode
	\fi
	\begin{beamercolorbox}[colsep=.75ex,vmode, wd=\dimexpr\linewidth-1pt\relax]{block body}%
		\usebeamerfont{block body}%
		\ifbeamercolorempty[bg]{block body}{\vskip-.25ex}{\vskip-.75ex}\vbox{}%
	}

\defbeamertemplate*{block end}{TUDa}
	{\end{beamercolorbox}\end{beamercolorbox}\vskip\smallskipamount}

\defbeamertemplate*{block alerted begin}{TUDa}
{
	\par\vskip\medskipamount%
	\begin{beamercolorbox}[
		wd=\dimexpr\linewidth+2\TUDa@beamer@extraindent,
		sep=1.5pt,
		leftskip=\dimexpr\ifdim\TUDa@beamer@extraindent>\z@\TUDa@beamer@extraindent-\beamer@colbox@sep\else\z@\fi,
	]{block frame alerted}
	\ifx\insertblocktitle\@empty
	\else
	\begin{beamercolorbox}[wd={\dimexpr\linewidth-3pt},colsep=.75ex]{block title alerted}
		\usebeamerfont*{block title alerted}\insertblocktitle%
	\end{beamercolorbox}%
	\vskip1.5pt\par\nointerlineskip
	\fi
	\leavevmode
	\usebeamerfont{block body alerted}%
	\begin{beamercolorbox}[wd={\dimexpr\linewidth-3pt},colsep=.75ex]{block body alerted}%
	}

\defbeamertemplate*{block alerted end}{TUDa}
	{\end{beamercolorbox}\end{beamercolorbox}\vskip\smallskipamount}


\defbeamertemplate*{block example begin}{TUDa}
{
	\par\vskip\medskipamount%
	\begin{beamercolorbox}[
		wd=\dimexpr\linewidth+2\TUDa@beamer@extraindent,
		sep=1.5pt,
		leftskip=\dimexpr\ifdim\TUDa@beamer@extraindent>\z@\TUDa@beamer@extraindent-\beamer@colbox@sep\else\z@\fi,
		]{block frame example}
	\ifx\insertblocktitle\@empty
	\else
	\begin{beamercolorbox}[wd={\dimexpr\linewidth-3pt},colsep=.75ex]{block title example}
		\usebeamerfont*{block title example}\insertblocktitle%
	\end{beamercolorbox}%
\vskip1.5pt\par\nointerlineskip
	\fi
	\leavevmode
	\usebeamerfont{block body example}%
	\begin{beamercolorbox}[wd={\dimexpr\linewidth-3pt},colsep=.75ex]{block body example}%
	}
\defbeamertemplate*{block example end}{TUDa}
	{\end{beamercolorbox}\end{beamercolorbox}\vskip\smallskipamount}

%Itemize Items
\defbeamertemplate*{itemize item}{TUDa}{\usebeamerfont*{itemize item}\raise\dimexpr.4\ht\strutbox-.4ex\hbox{\rule{.8ex}{.8ex}}}
\defbeamertemplate*{itemize subitem}{TUDa}{\usebeamerfont*{itemize item}\setlength{\fboxsep}{\z@}\setlength{\fboxrule}{1pt}\raise\dimexpr.4\ht\strutbox-.2ex-\fboxrule\hbox{\fbox{\color{bg}\rule{.4ex}{.4ex}}}}
\defbeamertemplate*{itemize subsubitem}{TUDa}{\usebeamerfont*{itemize subitem}\hbox{--}}

\mode<all>

\endinput

