% Outer style file for the BEAMER FLIP THEME 212
% Copyright 2012 by Flip Tanedo
% This file may be distributed and/or modified
% 	1. under the LaTeX Project Public License and/or
% 	2. under the GNU Public License.
%
% Based on: beamerouterthemesplit by Till Tantau


\mode<presentation>

% Watermark
\DeclareOptionBeamer{watermark}{\def\beamer@Flip@watermark{#1}}
\ExecuteOptionsBeamer{watermark=} % Default value is empty


\newif\ifbeamer@Flip@bigpagenumber
\beamer@Flip@bigpagenumberfalse
\DeclareOptionBeamer{bigpagenumber}{\beamer@Flip@bigpagenumbertrue}


\def\beamer@Flip@truetext{true} % Kludge for true/false so I can use ifx

\DeclareOptionBeamer{topline}[true]{\def\beamer@Flip@topline{#1}}
\ExecuteOptionsBeamer{topline=false} % Default



% \ExecuteOptionsBeamer{topline=} % Default value is empty


\ProcessOptionsBeamer


\usepackage{tikz}	% For fancy decorations


% I should fix these up to be more robust against color changes
\setbeamercolor{section in head/foot}{parent=footerlike}
\setbeamercolor{subsection in head/foot}{parent=footerlike}
\setbeamercolor{author in head/foot}{parent=footerlike}
\setbeamercolor{title in head/foot}{parent=footerlike}


% \setbeamercolor{author in head/foot}{parent=section in head/foot}
% \setbeamercolor{title in head/foot}{parent=subsection in head/foot}

%\setbeamercolor{topbar}{parent=crimsontown}
\setbeamercolor{topbar}{parent=bluetown}




\usesectionheadtemplate
  {\hfill\insertsectionhead}
  {\hfill\color{fg!50!bg}\insertsectionhead}


%%%%%%%%%%%%%%%%%%
% The footer bar %
%%%%%%%%%%%%%%%%%%

\defbeamertemplate*{footline}{Flip theme}
{%
  \leavevmode% 
% OBSERVATION: the "%" symbols inside hbox are all very important here.
% The \hbox enviroment will insert spaces whenever there's whitespace
% Adding a % at the END of each line ensures that any hard returns aren't
% interpreted as white space. This allows the color boxes to be flush against
% one another. If a faint white line appears one could probably do something like
% hspace{-1px} and add an additional pixel-or-two wide beamercolorbox.	

\hbox{%
\begin{beamercolorbox}[wd=.4\paperwidth,ht=2.5ex,dp=1.125ex,leftskip=.3cm, rightskip=.3cm plus1fil]{author in head/foot}%
	\usebeamerfont{author in head/foot}\insertshortauthor  \end{beamercolorbox}%
%
\begin{beamercolorbox}[wd=.6\paperwidth,ht=2.5ex,dp=1.125ex,leftskip=.3cm,rightskip=.3cm plus1fil]{title in head/foot}%
    \usebeamerfont{title in head/foot}{\textit \insertshorttitle}%
    \hskip2ex plus1fill%
		% \insertpagenumber\,/\,\insertpresentationendpage %% Want FRAME, not SLIDE number
		\insertframenumber/\inserttotalframenumber
 \end{beamercolorbox}%
}%

% This is a complete kludge for the faint white line which appears
% between the beamer color boxes above. (It doesnt appear in presentation mode
% but sometimes looks funny when the pdfs are viewed in a window)
\begin{tikzpicture}[overlay]
	\usebeamercolor[bg]{author in head/foot}
	\draw[thick] (0,3.625ex) -- (\paperwidth,3.625ex);
	\draw (.4\paperwidth,0) -- (.4\paperwidth,3.625ex);
	\draw[thick] (0,0) -- (\paperwidth,0);
\end{tikzpicture}



\ifbeamer@Flip@bigpagenumber
	\begin{tikzpicture}[overlay]
	\usebeamercolor[bg]{author in head/foot}
	\draw[fill] (\paperwidth-5ex,3.625ex) circle (6ex);
	\usebeamercolor[fg]{author in head/foot}
	\draw[fill] (\paperwidth-5ex,3.625ex) circle (5ex);
	\usebeamercolor[bg]{author in head/foot}
	\node at (\paperwidth-5ex,4ex) {\small$^\text{\insertframenumber}/_\text{\inserttotalframenumber}$};
	\end{tikzpicture}
\fi
}



\defbeamertemplate*{frametitle}{Flip theme}[1][left]
{
% \ifbeamercolorempty[bg]{frametitle}{}{\nointerlineskip}%
\@tempdima=\textwidth%
\advance\@tempdima by\beamer@leftmargin%
\advance\@tempdima by\beamer@rightmargin%

\vbox{}\vskip-3.5ex%
%
\begin{beamercolorbox}[sep=0.3cm,#1,wd=\the\@tempdima]{titlelike}
	\usebeamerfont{frametitle}%
	\vbox{}\vskip-1ex%
	\if@tempswa\else\csname beamer@fte#1\endcsname\fi%
	% \strut{\bf\insertframetitle}\strut\par% 					%% Include the \bf
	\strut{\insertframetitle}\strut\par%
	{%
  		\ifx\insertframesubtitle\@empty%
  		\else
			{\usebeamerfont{framesubtitle}
			 \usebeamercolor[fg]{framesubtitle}
			\insertframesubtitle\strut\par}%
  		\fi
 	}%
	%
  	\vskip-1ex%
  	\if@tempswa\else\vskip-.3cm\fi% set inside beamercolorbox... evil here...
\end{beamercolorbox}%
%%

% \def\beamer@fteright{\vskip0.35cm\advance\leftskip by 1.7cm\advance\rightskip by1.7cm}
}




% Sidebar right is important: anything placed here will be
% visible *behind* the main text. This is where to put any
% interesting watermarks.
%
% 
\defbeamertemplate*{sidebar right}{Flip theme}
{
% \llap{\includegraphics[width=50px]{footdecoration}}
% \llap{\includegraphics[width=\paperwidth,height=\paperheight]{upperleft_watermark_transp}}
%
% THIS WOULD BE A NICE WAY TO PUT THE PARTICLE BUBBLE CHAMBER BG
% ... make a png of the background with TRANSPARENT BG
% ... then put the image here (use \hfill to get it on the left)
% Now one can FURTHER apply a slight gradient in the BG
%
% 
% % Top Line 
\ifx\beamer@Flip@topline\beamer@Flip@truetext
	\begin{tikzpicture}[overlay]
	\usebeamercolor[fg]{titlelike}	% alternately, topbarlike would be a good beamercolor
%	\usebeamercolor[fg]{topbarlike}	% alternately, topbarlike would be a good beamercolor
	\draw[fill] (-\paperwidth,0) rectangle (0,-3pt);
	\end{tikzpicture}
\fi
%
% 
  \vskip.2\beamer@leftmargin%
   %\llap{\insertlogo\hskip.5\beamer@leftmargin}%
   \llap{\insertlogo\hskip.08\beamer@leftmargin}%
    \vfill%
  \if \beamer@Flip@watermark\@empty
	% This is kind of a kludge since if I put anything in here, I automatically get errors
	% Somehow LaTeX wants to read the \else part!
	\else%
	\llap{\includegraphics[width=\paperwidth,height=\paperheight]{\beamer@Flip@watermark}}
  \fi
}



\mode<all>
\endinput


