\ProvidesPackage{beamerbaseframecomponents}[2004/01/10 ver 1.20]
\NeedsTeXFormat{LaTeX2e}[1995/12/01]

% Copyright 2003 by Till Tantau <tantau@users.sourceforge.net>.
%
% This program can be redistributed and/or modified under the terms
% of the GNU Public License, version 2.



\mode<presentation>

%
% Setting the left and right margin
%
%
\beamer@leftmargin=1cm
\beamer@rightmargin=1cm

\def\beamersetleftmargin#1{%
  \beamer@leftmargin=#1\relax%
  % Reset left margin now
  \beamer@tempdim=\beamer@leftmargin%
  \advance\beamer@tempdim by\beamer@leftsidebar%
  \geometry{left=\the\beamer@tempdim}%
}

\def\beamersetrightmargin#1{%
  \beamer@rightmargin=#1\relax%
  % Reset right margin now
  \beamer@tempdim=\beamer@rightmargin%
  \advance\beamer@tempdim by\beamer@rightsidebar%
  \geometry{right=\the\beamer@tempdim}%
}


\mode
<article>
{
  \def\beamersetleftmargin#1{}
  \def\beamersetrightmargin#1{}
}

  

%
%
% Sidebars
%
%

\long\def\useleftsidebartemplate#1#2{% #1 = size, #2 = text
  \beamer@leftsidebar=#1\relax%
  % Reset left margin now
  \beamer@tempdim=\beamer@leftmargin%
  \advance\beamer@tempdim by\beamer@leftsidebar%
  \geometry{left=\the\beamer@tempdim}%
  \gdef\beamer@leftsidebartemplate{%
    \vbox to \sidebarheight{%
      #2\vfil%
    }%
  }}
\useleftsidebartemplate{0cm}{}
  
\long\def\userightsidebartemplate#1#2{% #1 = size, #2 = text
  \beamer@rightsidebar=#1\relax%
  % Reset right margin now
  \beamer@tempdim=\beamer@rightmargin%
  \advance\beamer@tempdim by\beamer@rightsidebar%
  \geometry{right=\the\beamer@tempdim}%
  \gdef\beamer@rightsidebartemplate{%
    \vbox to \sidebarheight{%
      #2\vfil%
    }%
  }}
\userightsidebartemplate{0cm}{}
  
\def\useleftsidebarbackgroundtemplate#1{
  \def\beamer@leftsidebarbackground{%
    \vbox to \sidebarheight{%
      #1\vss%
    }}}
\useleftsidebarbackgroundtemplate{}

% Sets the background of the side bar to a monotone color
\def\useleftsidebarcolortemplate#1{
  \useleftsidebarbackgroundtemplate{#1\vrule height\paperheight width\beamer@leftsidebar}}

% Sets the background of the side bar to a vertical shading ranging
% between the parameter colors.
\def\useleftsidebarverticalshadingtemplate#1#2{%
  \pgfdeclareverticalshading{beamer@leftsidebar}{\beamer@leftsidebar}{color(0cm)=(#1); color(\paperheight)=(#2)}%
  \useleftsidebarbackgroundtemplate{\pgfuseshading{beamer@leftsidebar}}}

% Sets the background of the side bar to a horizontal shading ranging
% between the parameter colors.
\def\useleftsidebarhorizontalshadingtemplate#1#2{%
  \pgfdeclarehorizontalshading{beamer@leftsidebar}{\textheight}{color(0cm)=(#1); color(\beamer@leftsidebar)=(#2)}%
  \useleftsidebarbackgroundtemplate{\pgfuseshading{beamer@leftsidebar}}}


\def\userightsidebarbackgroundtemplate#1{
  \gdef\beamer@rightsidebarbackground{%
    \vbox to \sidebarheight{%
      #1\vss%
    }}}
\userightsidebarbackgroundtemplate{}

% Sets the background of the side bar to a monotone color
% Usage: usesidebarcolortemplate{\color{red}}
\def\userightsidebarcolortemplate#1{
  \userightsidebarbackgroundtemplate{#1\vrule height\paperheight width\beamer@rightsidebar}}

% Sets the background of the side bar to a vertical shading ranging
% between the parameter colors.
\def\userightsidebarverticalshadingtemplate#1#2{%
  \pgfdeclareverticalshading{beamer@rightsidebar}{\beamer@rightsidebar}{color(0cm)=(#1); color(\paperheight)=(#2)}%
  \userightsidebarbackgroundtemplate{\pgfuseshading{beamer@rightsidebar}}}

% Sets the background of the side bar to a horizontal shading ranging
% between the parameter colors.
\def\userightsidebarhorizontalshadingtemplate#1#2{%
  \pgfdeclarehorizontalshading{beamer@rightsidebar}{\textheight}{color(0cm)=(#1); color(\beamer@rightsidebar)=(#2)}%
  \userightsidebarbackgroundtemplate{\pgfuseshading{beamer@rightsidebar}}}


%
%
% Background management
%
%
\mode
<all>
{
  \long\def\usebackgroundtemplate#1{%
    \gdef\beamer@backgroundtemplate{#1}}
}


%
%
% Head lines and foot lines
%
%

\let\@mkboth\@gobbletwo
\def\ps@navigation{
  \def\@oddhead{%
    \setbox\beamer@tempbox=\hbox{\normalcolor{\beamer@backgroundtemplate}\hyper@pagetransition\hyper@pageduration}%
    \beamer@tempdim=\ht\beamer@tempbox%
    \setbox\beamer@tempbox=\hbox{\lower\beamer@tempdim\hbox{\box\beamer@tempbox}}%
    \wd\beamer@tempbox=0pt\ht\beamer@tempbox=0pt\dp\beamer@tempbox=0pt%
    \vbox{\hbox{\hskip-\Gm@lmargin\box\beamer@tempbox}%
      \hbox{%
        {%
          \setbox\beamer@tempbox=\hbox{\hskip-\Gm@lmargin%
            {\setbox\beamer@tempbox=\hbox{\normalcolor\beamer@leftsidebarbackground}%
              \wd\beamer@tempbox=0pt\ht\beamer@tempbox=0pt\dp\beamer@tempbox=0pt%
              \box\beamer@tempbox}%
            \beamer@leftsidebartemplate}%
          \beamer@tempdim=\ht\beamer@tempbox%
          \setbox\beamer@tempbox=\hbox{{\lower\beamer@tempdim\hbox{\box\beamer@tempbox}}}%
          \wd\beamer@tempbox=0pt\ht\beamer@tempbox=0pt\dp\beamer@tempbox=0pt%
          \box\beamer@tempbox%
        }%        
        {% print right sidebar first, since it should be overwritten by headline
          \setbox\beamer@tempbox=\hbox{\hskip\textwidth\hskip\beamer@rightmargin%
            {\setbox\beamer@tempbox=\hbox{\normalcolor\beamer@rightsidebarbackground}%
              \wd\beamer@tempbox=0pt\ht\beamer@tempbox=0pt\dp\beamer@tempbox=0pt%
              \box\beamer@tempbox}%
            \beamer@rightsidebartemplate}%
          \beamer@tempdim=\ht\beamer@tempbox%
          \setbox\beamer@tempbox=\hbox{{\lower\beamer@tempdim\hbox{\box\beamer@tempbox}}}%
          \wd\beamer@tempbox=0pt\ht\beamer@tempbox=0pt\dp\beamer@tempbox=0pt%
          \box\beamer@tempbox%
        }%
        \normalcolor\beamer@headtemplate\hfil%
      }%
      \hfil}}
  \def\@oddfoot{\normalcolor\beamer@foottemplate\hypertarget{Navigation\the\c@page}{}\hfil}
  \let\@evenhead\@oddhead
  \let\@evenfoot\@oddfoot}
\pagestyle{navigation}

%
% Patch empty page style, so that transitions and navigation still works
%
\def\ps@empty{%
  \let\@mkboth\@gobbletwo%
  \def\@oddhead{\setbox\beamer@tempbox=\hbox{{\beamer@backgroundtemplate}\hyper@pagetransition\hyper@pageduration}%
    \beamer@tempdim=\ht\beamer@tempbox%
    \setbox\beamer@tempbox=\hbox{\lower\beamer@tempdim\hbox{\box\beamer@tempbox}}%
    \wd\beamer@tempbox=0pt\ht\beamer@tempbox=0pt\dp\beamer@tempbox=0pt%
    \vbox{\hbox{\hskip-\Gm@lmargin\raise\headheight\box\beamer@tempbox}\hfil}}
  \def\@oddfoot{\hypertarget{Navigation\the\c@page}{}\hfil}
  \let\@evenhead\@oddhead\let\@evenfoot\@oddfoot}

\def\beamer@calculateheadfoot{%
  \setbox\beamer@tempbox=\hbox{\beamer@foottemplate}%
  \footheight=\ht\beamer@tempbox%
  \advance\footheight by \dp\beamer@tempbox%
  \advance\footheight by 4pt%
  \setbox\beamer@tempbox=\hbox{\beamer@headtemplate}%
  \headheight=\ht\beamer@tempbox%
  \headdp=\dp\beamer@tempbox%
  \advance\headheight by\headdp%
  \sidebarheight=\paperheight%
  \advance\sidebarheight by-\headheight%
  \advance\sidebarheight by\headdp%
  \advance\sidebarheight by-\footheight%
  \advance\sidebarheight by 4pt%
  \footskip=\footheight%
  \textheight=\paperheight%
  \advance\textheight by-\footheight%
  \advance\textheight by-\headheight%
  \@colht\textheight%
  \@colroom\textheight%
  \vsize\textheight%  
  }

\long\def\usefoottemplate#1{%
  \gdef\beamer@foottemplate{\offinterlineskip\reset@font\def\\{,}#1}}
\def\insertpagenumber{\thepage}

\long\def\useheadtemplate#1{%
  \gdef\beamer@headtemplate{\offinterlineskip\reset@font#1}}%

\def\insertvrule#1#2{%
  \hbox{\color{#2}\hskip-\Gm@lmargin\vrule width \paperwidth
    height #1\hskip-\Gm@rmargin}}


%
%
% Columns
%
%
\define@key{beamer@col}{onlytextwidth}[true]{%
  \def\beamer@colentrycode{\hbox to\textwidth\bgroup\ignorespaces}%
  \def\beamer@colexitcode{\unskip\egroup}}
\define@key{beamer@col}{totalwidth}{%
  \def\beamer@colentrycode{\hbox to#1\bgroup\ignorespaces}%
  \def\beamer@colexitcode{\unskip\egroup}}
\define@key{beamer@col}{c}[true]{\def\beamer@colalign{c}}
\define@key{beamer@col}{t}[true]{\def\beamer@colalign{t}}
\define@key{beamer@col}{b}[true]{\def\beamer@colalign{b}}

\newenvironment<>{columns}[1][]{%
  \begin{actionenv}#2%
  \def\beamer@colentrycode{%
    \hbox to\textwidth\bgroup%
    \leavevmode%
    \hskip-\beamer@leftmargin%
    \nobreak%
    \beamer@tempdim=\textwidth%
    \advance\beamer@tempdim by\beamer@leftmargin%
    \advance\beamer@tempdim by\beamer@rightmargin%
    \hbox to\beamer@tempdim\bgroup%
    \hbox{}\hfill\ignorespaces}%
  \def\beamer@colexitcode{\egroup%
    \nobreak%
    \hskip-\beamer@rightmargin\egroup}%
  \ifbeamer@centered\setkeys{beamer@col}{c}\else\setkeys{beamer@col}{t}\fi%
  \setkeys{beamer@col}{#1}%
  \par%
  \beamer@colentrycode%
  \def\beamer@colclose{}\ignorespaces}%
  {\beamer@colclose\def\beamer@colclose{}\beamer@colexitcode\end{actionenv}}%
  
\mode
<article>
{
  % do sth. more intelligent in the future
  \newenvironment<>{columns}[1][]{}{}
}




%
%
% Column command/environment
%
%

\mode
<all>
{
\def\beamer@columnname{column}
\def\column{%
  \ifx\@currenvir\beamer@columnname%
  \let\beamer@next=\beamer@columnenv%
  \else%
  \let\beamer@next=\beamer@columncom%
  \fi%
  \beamer@next}
}

\newenvironment<>{beamer@columnenv}[2][\beamer@colalign]{%
  \beamer@colclose\def\beamer@colclose{}%
  \begin{actionenv}#3%
  \begin{minipage}[#1]{#2}%
    \leavevmode\raggedright\ignorespaces}
  {\end{minipage}\hfill\end{actionenv}\@ignoretrue}
\let\endcolumn\endbeamer@columnenv

\newcommand<>\beamer@columncom[2][\beamer@colalign]{%
  \beamer@colclose%
  \def\beamer@colclose{\end{minipage}\hfill\end{actionenv}\ignorespaces}%
  \begin{actionenv}#3%
  \begin{minipage}[#1]{#2}%
    \leavevmode\raggedright\ignorespaces
}
  
   
\mode
<article>
{
  \newenvironment<>{beamer@columnenv}[2][]{}{}
  \newcommand<>{\beamer@columncom}[2][]{}
}

   

%
%
% Footnotes
%
%

\def\@makefntext#1{%
  \def\insertfootnotetext{#1}%
  \def\insertfootnotemark{\@makefnmark}%
  \footnotetemplate}
\def\usefootnotetemplate#1{%
  \gdef\footnotetemplate{#1}}

\usefootnotetemplate{
  \parindent 1em\noindent%
  \hbox to 1.8em{\hfil\insertfootnotemark}\insertfootnotetext}

\newbox\beamer@footins

\long\def\beamer@framefootnotetext#1{%
  \global\setbox\beamer@footins\vbox{%
    \unvbox\beamer@footins
    \reset@font\footnotesize
    \hsize\columnwidth
    \@parboxrestore
    \protected@edef\@currentlabel
         {\csname p@footnote\endcsname\@thefnmark}%
    \color@begingroup
      \@makefntext{%
        \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}%
    \color@endgroup}}

\let\@footnotetext=\beamer@framefootnotetext

\define@key{beamerfootnote}{frame}[true]{\let\beamer@footnotetext=\beamer@framefootnotetext\def\beamer@mpfn{footnote}\def\beamer@thempfn{\thefootnote}}

\renewcommand{\footnote}[1][]{%
  \let\beamer@footnotetext=\@footnotetext%
  \let\beamer@mpfn=\@mpfn%
  \let\beamer@thempfn=\thempfn%
  \let\beamer@kvorig=\KV@errx%
  \def\beamer@footarg{}%
  \def\KV@errx##1{\edef\beamer@footarg{\@tempa}}%
  \setkeys{beamerfootnote}{#1}%
  \let\KV@errx=\beamer@kvorig%
  \ifx\beamer@footarg\@empty%
    \def\beamer@next{\stepcounter\beamer@mpfn
      \protected@xdef\@thefnmark{\beamer@thempfn}%
      \@footnotemark\beamer@footnotetext}%
  \else%
    \def\beamer@next{%
      \begingroup
        \csname c@\beamer@mpfn\endcsname\beamer@footarg\relax
        \unrestored@protected@xdef\@thefnmark{\beamer@thempfn}%
      \endgroup
      \@footnotemark\beamer@footnotetext}%
  \fi%
  \beamer@next}

\mode
<article>
{
  \define@key{beamerfootnote}{frame}[true]{}

\let\beamer@origfootnote=\footnote
  \renewcommand\footnote[1][]{%
    \let\beamer@kvorig=\KV@errx%
    \def\beamer@footarg{}%
    \def\KV@errx##1{\edef\beamer@footarg{\@tempa}}%
    \setkeys{beamerfootnote}{#1}%
    \let\KV@errx=\beamer@kvorig%
    \ifx\beamer@footarg\@empty%
      \edef\beamer@next{\noexpand\beamer@origfootnote}%
    \else%
      \edef\beamer@next{\noexpand\beamer@origfootnote[\beamer@footarg]}%
    \fi%
    \beamer@next}
}


\mode
<all>

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: "~/texmf/tex/latex/beamer/examples/beamerexample1.tex"
%%% End: 
