
%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 


\newenvironment<>{description}[1]{%
  \begin{actionenv}#2%
      \def\insertblocktitle{#1}%
      \par%
      \mode<presentation>{%
        \setbeamercolor{block title}{fg=white,bg=gray}
       \setbeamercolor{block body}{fg=black,bg=gray!30}
       % \setbeamercolor{itemize item}{fg=orange!20!black}
       % \setbeamertemplate{itemize item}[triangle]
       \setbeamerfont{block title}{family=\sffamily, series=\bfseries}
       \setbeamerfont{block body}{family=\ttfamily}
     }%
      \usebeamertemplate{block begin}}
    {\par\usebeamertemplate{block end}\end{actionenv}}

\newenvironment<>{task}[1]{%
  \begin{actionenv}#2%
      \def\insertblocktitle{#1}%
      \par%
      \mode<presentation>{%
        \setbeamercolor{block title}{fg=black,bg=cyan!40}
       \setbeamercolor{block body}{fg=black,bg=cyan!20}
       % \setbeamercolor{itemize item}{fg=orange!20!black}
       % \setbeamertemplate{itemize item}[triangle]
       \setbeamerfont{block title}{series=\bfseries}
       % \setbeamerfont{block body}{family=\ttfamily}
     }%
      \usebeamertemplate{block begin}}
    {\par\usebeamertemplate{block end}\end{actionenv}}

\newenvironment<>{summary}[1]{%
  \begin{actionenv}#2%
      \def\insertblocktitle{#1}%
      \par%
      \mode<presentation>{%
        \setbeamercolor{block title}{fg=black,bg=blue!40}
       \setbeamercolor{block body}{fg=black,bg=blue!20}
       % \setbeamercolor{itemize item}{fg=orange!20!black}
       % \setbeamertemplate{itemize item}[triangle]
       \setbeamerfont{block title}{series=\bfseries}
       % \setbeamerfont{block body}{family=\ttfamily}
     }%
      \usebeamertemplate{block begin}}
    {\par\usebeamertemplate{block end}\end{actionenv}}
%%%%%%%%%%%%%%%%%%% PROGRESSBAR %%%%%%%%%%%%%%%%%%%%%%%%%%
 
\definecolor{pbblue}{HTML}{0A75A8}% filling color for the progress bar
\definecolor{pbgray}{HTML}{575757}% background color for the progress bar
\definecolor{pbgreen}{HTML}{57EE57}% green color for the progress bar

\newcounter{slideminutes}
\newcounter{minutes}
\newcounter{totalminutes}
\setcounter{totalminutes}{0}
\setcounter{totalminutes}{105}

\makeatletter
\def\progressbar@progressbar{} % the progress bar
\newcount\progressbar@tmpcounta% auxiliary counter
\newcount\progressbar@tmpcountb% auxiliary counter
\newcount\progressbar@tmpcountc% auxiliary counter
\newdimen\progressbar@pbht %progressbar height
\newdimen\progressbar@pbwd %progressbar width
\newdimen\progressbar@pbwda %progressbar width
\newdimen\progressbar@tmpdim % auxiliary dimension
\newdimen\progressbar@tmpdima % auxiliary dimension

\progressbar@pbwd=\linewidth
\progressbar@pbht=1.5ex



% the progress bar
\def\progressbar@progressbar{%

    % \progressbar@tmpcounta=\insertframenumber
    % \progressbar@tmpcountb=\inserttotalframenumber
    \progressbar@tmpcounta=\theminutes
    \progressbar@tmpcountb=\thetotalminutes
    \progressbar@tmpcountc=\theslideminutes

    \progressbar@tmpdim=\progressbar@pbwd
    \divide\progressbar@tmpdim by \progressbar@tmpcountb
    \multiply\progressbar@tmpdim by \progressbar@tmpcounta

    \progressbar@tmpdima=\progressbar@pbwd
    \divide\progressbar@tmpdima by \progressbar@tmpcountb
    \multiply\progressbar@tmpdima by \progressbar@tmpcountc

  \begin{tikzpicture}[rounded corners=2pt,very thin]

    \shade[top color=pbgray!20,bottom color=pbgray!20,middle color=pbgray!50]
      (0pt, 0pt) rectangle ++ (\progressbar@pbwd, \progressbar@pbht);

      \shade[draw=pbblue,top color=pbblue!50,bottom color=pbblue!50,middle color=pbblue] %
        (0pt, 0pt) rectangle ++ (\progressbar@tmpdim, \progressbar@pbht);

      \shade[draw=pbblue,top color=pbblue!50,bottom color=pbblue!50,middle color=pbgreen] %
        (\progressbar@tmpdim, 0) rectangle ++ (\progressbar@tmpdima, \progressbar@pbht);

        \draw[color=normal text.fg!50]  
        (0pt, 0pt) rectangle (\progressbar@pbwd, \progressbar@pbht) 
        node[pos=0.5,color=normal text.fg] {\textnormal{\theminutes /
            \thetotalminutes~ min done | the next \theslideminutes~ min will
          be on }
        };

  \end{tikzpicture}%
}

\addtobeamertemplate{headline}{}
{%
  \begin{beamercolorbox}[wd=\paperwidth,ht=4ex,center,dp=1ex]{white}%
    \progressbar@progressbar%
  \end{beamercolorbox}%
}
