%% sidebars -- (sidebars.sty) style file
%% A style package for the talk class
%% Author: Martin Wiebusch
%%
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% 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.3 or later is part of all distributions of LaTeX
%% version 2003/12/01 or later.

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{sidebars}

\newif\if@compress\@compressfalse
\DeclareOption{compress}{\@compresstrue}

\ProcessOptions\relax

\@slidesize{6in}{4.5in}

\newcommand{\backgroundcolor}[1]{\definecolor{sb@bg}{rgb}{#1}}
\newcommand{\sidebarcolor}[1]{\definecolor{sb@sb}{rgb}{#1}}
\newcommand{\highlightcolor}[1]{\definecolor{sb@hl}{rgb}{#1}}
\newcommand{\titlecolor}[1]{\definecolor{sb@title}{rgb}{#1}}
\newcommand{\sidebartitlecolor}[1]{\definecolor{sb@sbt}{rgb}{#1}}

\backgroundcolor{1,1,1}
\sidebarcolor{0.85,0.85,0.85}
\highlightcolor{0,0,0.7}
\titlecolor{0,0,0.7}
\sidebartitlecolor{0,0,0.7}

\@newslidestyle{normal}{%
  \renewcommand{\@makeslide}{%
    \begin{pgfscope}
      \color{sb@bg}
      \pgfrect[fill]{\pgfpoint\z@\z@}{\pgfpoint\slidewidth\slideheight}%
      \color{sb@sb}%
      \pgfrect[fill]{\pgfpoint{5in}\z@}{\pgfpoint{1in}\slideheight}%
      \@ifscreen{}{%
        \color{black}%
        \pgfrect[stroke]{\pgfpoint\z@\z@}{\pgfpoint\slidewidth\slideheight}%
      }%
    \end{pgfscope}
    %
    \pgfputat{\pgfpoint{5.1in}{4.3in}}{%
      \pgfbox[left,top]{%
        \begin{minipage}[t][4.2in]{0.8in}%
          \sffamily\tiny%
          {\centering\tiny\sffamily\textcolor{sb@sbt}{\@shorttitle}\par%
           \vspace{1em}\@shortauthor\par\vspace{2em}}%
          {\parskip=0.8em\@tableofcontents}%
          {\vfill\hspace*{\fill}p. \theslidelabel\hspace*{\fill}}%
        \end{minipage}%
      }%
    }%
    \pgfputat{\pgfpoint{0.2in}{4.3in}}{%
      \pgfbox[left,top]{%
        \begin{minipage}[t][4.1in]{4.6in}%
          \sffamily{\color{sb@title}\LARGE\@slidetitle\par}%
          \vspace*{1.5em plus 1fill}%
          \parskip=1.5ex plus0.5ex minus0.5ex\@slidebody\par%
          \vspace*{0pt plus 1fill}%
        \end{minipage}%
      }%
    }%
  }%
  \renewcommand{\@maketocsection}[3]{%
    \raggedright\noindent%
    \@ifcurrentsection{##1}{%
      \@ifcurrentsubsection{0}{\textcolor{sb@hl}{##2}\par}%
                              {##2\par}%
    }{##2\par}%
  }%
  \renewcommand{\@maketocsubsection}[4]{%
    \raggedright\noindent%
    \@ifcurrentsection{##1}{%
      \@ifcurrentsubsection{##2}{%
        {\leftskip=1.5em\textcolor{sb@hl}{##3}\par}%
      }{%
        {\leftskip=1.5em ##3\par}%
      }%
    }{%
      \if@compress\else{\leftskip=1.5em ##3\par}\fi
    }%
  }%
}

\@newslidestyle{plain}{%
  \renewcommand{\@makeslidebackground}{%
    \begin{pgfscope}
      \color{sb@bg}
      \pgfrect[fill]{\pgfpoint\z@\z@}{\pgfpoint\slidewidth\slideheight}%
      \@ifscreen{}{%
        \color{black}%
        \pgfrect[stroke]{\pgfpoint\z@\z@}{\pgfpoint\slidewidth\slideheight}%
      }%
    \end{pgfscope}
  }%
  \renewcommand{\@makeslidecontent}{\vspace*{\fill}\@slidebody\vspace*{\fill}}%
}

\@newslidestyle{outline}{%
  \renewcommand{\@makeslidebackground}{%
    \begin{pgfscope}
      \color{sb@bg}
      \pgfrect[fill]{\pgfpoint\z@\z@}{\pgfpoint\slidewidth\slideheight}%
      \color{sb@sb}
      \pgfrect[fill]{\pgfpoint\z@\z@}{\pgfpoint{0.5in}\slideheight}%
      \pgfrect[fill]{\pgfpoint{5.5in}\z@}{\pgfpoint{0.5in}\slideheight}%
      \@ifscreen{}{%
        \color{black}%
        \pgfrect[stroke]{\pgfpoint\z@\z@}{\pgfpoint\slidewidth\slideheight}%
      }%
    \end{pgfscope}%
  }%
  \renewcommand{\@makeslidecontent}{%
    \vspace{0.2in}%
    \hspace{0.7in}%
    \begin{minipage}[b][4.1in][t]{4.6in}%
      \sffamily%
      {\centering\LARGE\color{sb@title}\@slidetitle\par}%
      \vspace*{1.5em plus 1fill}\@slidebody\par%
      \vspace*{0pt plus 1fill}%
    \end{minipage}%
  }%
}

\renewcommand{\maketitle}{%
  \sffamily%
  {\centering%
    {\color{sb@sbt}\LARGE\@title\par}\vspace{3em}%
    {\large\@author\par}\vspace{1.5em}%
    {\large\@date\par}
  }%
}
\renewcommand{\tableofcontents}[1][0.0-99.99]{%
  \bgroup\parskip=0.4em\hangafter=1%
  \def\@maketocsection##1##2##3{%
    \@ifinrange{##1}{0}{#1}{{
      \hangindent=2.5em%
      \hspace{2em}\makebox[\z@][r]{##1.}\hspace{0.5em}##3\par%
    }}{}%
  }
  \def\@maketocsubsection##1##2##3##4{%
    \@ifinrange{##1}{##2}{#1}{{%
      \hangindent=3.5em
      \hspace{2.5em}\makebox[\z@][l]{$\bullet$}\hspace{1em}##3\par%
    }}{}%
  }
  \@tableofcontents
  \egroup
}

\@ifnotes{%
  \addtolength{\textwidth}{1in}
  \addtolength{\oddsidemargin}{-0.5in}
}{}

\setlength{\parindent}{\z@}
\slidestyle{normal}
\sloppy