% panelexample.tex,v 1.3 2003/05/16 09:33:56 hansfn Exp
%  
% TeXPower bundle - dynamic online presentations with LaTeX
% Copyright (C) 1999-2002 Stephan Lehmke
% 
% This program is free software; you can redistribute it and/or
% modify it under the terms of the GNU General Public License
% as published by the Free Software Foundation; either version 2
% of the License, or (at your option) any later version.
% 
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.
%
%------------------------------------------------------------------------------
% File: panelexample.tex
%
% Example for the panel facilities of TeXPower.
% 
% This file can be compiled with pdfLaTeX or (standard) LaTeX. When
% using standard LaTeX, the dvi file produced should  
% be converted to pdf afterwards (using dvips+distill/ps2pdf or
% dvipdf, for instance). 
%
% The resulting pdf file is meant for presenting `interactively' with
% Adobe Acrobat Reader.  
%
%------------------------------------------------------------------------------
% Author: Stephan Lehmke <Stephan.Lehmke@cs.uni-dortmund.de>
%
% v0.1 Nov 14, 2000: First version for the pre-alpha release of TeXPower.
%
% v0.2 May 02, 2003: English version.
%

%------------------------------------------------------------------------------
% Enable all color emphasis and highlighting options. Use white
% background and slifonts. 

\PassOptionsToPackage{coloremph,colormath,colorhighlight,whitebackground}
{texpower}

% Input the generic preamble.

\input{__TPpble}

\usepackage{tpslifonts}

\hypersetup{pdftitle={texpower panel example}}

%------------------------------------------------------------------------------
% Settings individual for this example.

\renewcommand{\buttonsep}{2pt}
\renewcommand{\buttonshadowhshift}{1pt}
\renewcommand{\buttonshadowvshift}{-1pt}

\usepackage{graphicx}

\newcounter{typed}

\makeatletter
\newcommand{\storehead}[3]
{%
  \global\let\@typed=\empty
  \setcounter{typed}{0}%
  \def\@typeto{#2}%
  \let\type@next=\@typeit
  \type@next#3\@nil
  \global\let#1=\@typed
}

\newcommand{\@typeit}[1]
{%
  \ifx\@nil#1
   \else
    \stepcounter{typed}%
    \ifthenelse{\value{typed}>\@typeto}
    {\let\type@next=\@gobbletail}
    {\g@addto@macro\@typed{#1}}%
    \expandafter\type@next
  \fi
}

\long\def\@gobbletail#1\@nil{}

\newcounter{i}

\newsavebox\logobox
\newsavebox\hookbox

\savebox\logobox
{%
  \includegraphics[width=\strip@pt\paperwidth truept]{unido-kopf}%
}

\makeatother

\savebox\hookbox
{%
  \includegraphics[width=1cm]{unihaken-color}%
}

\mklength{\slidetopmargin}{\ht\logobox*\ratio{1cm}{\semcm}}

\savebox\logobox
{%
  \raisebox{-.5\height}[.5\height-2ex][0pt]
  {\rlap{\usebox{\logobox}}}%
}

\newlength{\buttonwidth}

\newcommand{\mybutton}[2]
{\raisebox{\depth}{\makebox[\buttonwidth][l]{\button[\buttonwidth]{#1}{#2}}}}

\slidesonlyfalse\notestrue\noxcomment

\begin{document}

\pageDuration{0.01}

\begingroup
\loop
 \ifnum\value{i}<76
  \stepcounter{i}%
  \storehead{\partialtext}{\value{i}}
  {%
    Panels\space automatically\space adapt\space to\space the\space
    size\space of\space their\space contents.\par
    They\space can\space be\space placed
  }%
  \DeclarePanel{left}
  {%
    \leavevmode\scriptsize
    \mbox{\usebox{\logobox}}
  
    {\bfseries Stephan Lehmke
      
      Lehr\-stuhl Informatik~I}
    
    \vfill
  
    \nointerlineskip
    \rule{\linewidth}{\fboxrule}
    
    \nointerlineskip\kern1ex
    \partialtext
    
    \nointerlineskip\kern1ex
    \rule{\linewidth}{\fboxrule}
    
    \vfill
  
    \ifthenelse{\lengthtest{\linewidth>2cm}}
    {\setlength{\buttonwidth}{.5\linewidth-.5ex}}
    {\setlength{\buttonwidth}{\linewidth}}%
    %
    \lineskip1ex\relax
    %
    \mybutton{\Acrobatmenu{FirstPage}}{Start}\hfill
    \mybutton{\Acrobatmenu{LastPage}}{End}\hfill
    \mybutton{\Acrobatmenu{PrevPage}}{Prev}\hfill
    \mybutton{\Acrobatmenu{NextPage}}{Next}

    \mbox{\usebox{\hookbox}}
  }%

  \backgroundstyle{plain}

  \mklength{\slideleftmargin}{\leftpanelwidth*\ratio{1cm}{\semcm}+.5cm}
  \setlength{\slidewidth}{\paperwidth-\slideleftmargin-\sliderightmargin}

  \begin{slide}
    \makeslidetitle{\TeX Power Example: panels}
  \end{slide}

\repeat
\endgroup

\DeclarePanel*{left}{}
\setcounter{i}{0}

\setlength{\buttonwidth}{1.5cm}

\DeclarePanel*{bottom}
{%
  \leavevmode\scriptsize\smash{\usebox{\hookbox}}\hfill%
  \mybutton{\Acrobatmenu{FirstPage}}{Start}~%
  \mybutton{\Acrobatmenu{LastPage}}{End}~%
  \mybutton{\Acrobatmenu{PrevPage}}{Prev}~%
  \mybutton{\Acrobatmenu{NextPage}}{Next}%
}

\mklength{\slidebottommargin}{\bottompanelheight*\ratio{1cm}{\semcm}+.5cm}

\begingroup
\loop
 \ifnum\value{i}<24
  \stepcounter{i}%
  \storehead{\partialtext}{\value{i}}
  {%
    on\space any\space side\space of\space the\space page.
  }%
  \DeclarePanel{top}
  {%
    \leavevmode\scriptsize\parskip0pt\relax
    \mbox{\usebox{\logobox}}
    
    \medskip
  
    \parbox[t]{\widthof{\bfseries Lehrstuhl Informatik~I}}
    {\bfseries Stephan Lehmke\\ Lehrstuhl Informatik~I}\quad
    \parbox[t]{\linewidth-\widthof{\bfseries Lehrstuhl Informatik~I}-3cm}
    {%
      Panels\space automatically\space adapt\space to\space the\space
      size\space of\space their\space contents.\par
      They\space can\space be\space placed
      \partialtext
    }
  }%

  \backgroundstyle{plain}

  \mklength{\slidetopmargin}{\toppanelheight*\ratio{1cm}{\semcm}+.5cm}
  \setlength{\slideheight}{\paperheight-\slidetopmargin-\slidebottommargin}

  \begin{slide}
    \small\makeslidetitle{\TeX Power Example: panels}
  \end{slide}

\repeat
\endgroup

\DeclarePanel*{top}{}
\setlength{\slideheight}{\paperheight-\slidetopmargin-\slidebottommargin}

\setcounter{i}{0}

\makeatletter
\savebox\logobox
{%
  \raisebox{-.5\height}[.5\height-1.5ex][0pt]
  {\llap{\includegraphics[width=\strip@pt\paperwidth truept-1cm]{unido-kopf}}}%
}
\makeatother

\mklength{\slidetopmargin}{\ht\logobox*\ratio{1cm}{\semcm}}

\begingroup
\loop
 \ifnum\value{i}<146
  \stepcounter{i}%
  \storehead{\partialtext}{\value{i}}
  {%
    Normally,\space automatic\space line\space breaks\space are\space
    not\space needed\space inside\space panels,\space but\space
    it\space is\space nice\space that\space the\space size\space
    automatically\space adapts\space to\space the\space size\space
    of\space logos,\space buttons\space etc. 
  }%
  \DeclarePanel{right}
  {%
    \leavevmode\scriptsize
    \hspace*{\fill}\mbox{\usebox{\logobox}}\hspace*{-1.5ex}
    
    \vspace*{\ht\logobox}
    \medskip
  
    {\bfseries Stephan Lehmke
      
      Lehr\-stuhl Informatik~I}
    
    \vfill
  
    \nointerlineskip
    \rule{\linewidth}{\fboxrule}
    
    \nointerlineskip\kern1ex
    Panels\space automatically\space adapt\space to\space the\space
    size\space of\space their\space contents.\par
    They\space can\space be\space placed on\space any\space side\space
    of\space the\space page. 

    \partialtext
  }%

  \backgroundstyle[hpanels=false]{plain}

  \mklength{\sliderightmargin}{\rightpanelwidth*\ratio{1cm}{\semcm}+.5cm}
  \setlength{\slidewidth}{\paperwidth-\slideleftmargin-\sliderightmargin}

  \begin{slide}
    \makeslidetitle{\TeX Power Example: panels}
  \end{slide}

\repeat
\endgroup

\hypersetup{pdfpageduration={}}


\end{document}
