summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/progressbar
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/progressbar')
-rw-r--r--Master/texmf-dist/tex/latex/progressbar/progressbar.sty176
1 files changed, 176 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/progressbar/progressbar.sty b/Master/texmf-dist/tex/latex/progressbar/progressbar.sty
new file mode 100644
index 00000000000..ac50bf87f4a
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/progressbar/progressbar.sty
@@ -0,0 +1,176 @@
+
+% ProgressBar
+%
+% kindly supported by mrunix-forum: http://www.mrunix.de/
+%
+%% progressbar.sty
+%% Copyright 2010 Marcel Jira
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3c
+% 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.3c or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+% This work has the LPPL maintenance status `maintained'.
+%
+% The Current Maintainer of this work is Marcel Jira.
+%
+% This work consists of the files progressbar.sty and progressbar.tex.
+%
+\NeedsTeXFormat{LaTeX2e}%
+%
+\ProvidesPackage{progressbar}[2010/10/02 v1.0b: progressbar]%
+%
+\newcommand{\progressbarpackagename}{progressbar}%
+\newcommand{\progressbar@PackageWarning}[1]{\PackageWarning{\progressbarpackagename}{#1}}%
+\newcommand{\progressbar@LoadFile@IfExist}[1]{%
+ \IfFileExists{#1.sty}{%
+ \RequirePackage{#1}%
+ }{%
+ \progressbar@PackageWarning{The package #1 does not exist\MessageBreak%
+ but it is required by \progressbarname}%
+ }%
+}%
+%
+\progressbar@LoadFile@IfExist{calc}%
+\progressbar@LoadFile@IfExist{tikz}%
+\progressbar@LoadFile@IfExist{kvoptions}%
+\progressbar@LoadFile@IfExist{kvsetkeys}%
+%
+% Define lengths for later use
+\newlength{\BarWidth}%
+\newlength{\BarWidthCenter}%
+\newlength{\BarHeight}%
+\newlength{\BarHeightCenter}%
+\newlength{\BarBorderWidth}%
+\newlength{\BarRoundedCorners}%
+% This length will be used for the realisation of the progressbars
+\newlength{\BarPartWidth}%
+% And the ticks
+\newlength{\BarSubDivisionsWidthANU}%
+\newlength{\BarSubDivisionsWidthBNU}%
+\newlength{\BarSubDivisionsWidthCNU}%
+%
+% All user-variables
+\def\progressbar@keylist{borderwidth,heighta,roundnessa,heightr,roundnessr,width,linecolor,emptycolor,filledcolor,tickswidth,ticksheight,tickscolor,subdivisions}%
+% Keys corresponding to the user-variables
+\def\progressbar@defaultvaluelist{0.8pt,0pt,0pt,1,0.15,6em,black,black!10,black!60,0.4pt,0.33,black,10}%
+\newcounter{progressbar@counter}%
+%
+% KeyVal-Options
+% Define default-Keyval-Options for this package
+\setcounter{progressbar@counter}{0}%
+\@for\progressbar@value:=\progressbar@defaultvaluelist\do{%
+ \stepcounter{progressbar@counter}%
+ \expandafter\edef\csname progressbar@value\the\value{progressbar@counter}\endcsname{\progressbar@value}%
+}%
+\setcounter{progressbar@counter}{0}%
+\@for\progressbar@key:=\progressbar@keylist\do{%
+ \stepcounter{progressbar@counter}%
+ \expandafter\DeclareStringOption\expandafter[\csname progressbar@value\the\value{progressbar@counter}\endcsname]{\progressbar@key}%
+}%
+\ProcessKeyvalOptions*%
+% Change Keyval family and prefix
+\SetupKeyvalOptions{family=progressbarlocal,prefix=progressbarlocal@}%
+% Define Keyval-Options that are used in the macro
+\@for\progressbar@key:=\progressbar@keylist\do{%
+ \DeclareStringOption{\progressbar@key}%
+}%
+\def\progressbar@lastheighta{false}%
+\def\progressbar@lastroundnessa{false}%
+\def\progressbarlocal@lastroundnessa{false}%
+\def\progressbar@true{true}%
+\AddToKeyvalOption{progressbar}{heightr}{%
+ \def\progressbar@lastheighta{false}%
+}%
+\AddToKeyvalOption{progressbar}{heighta}{%
+ \def\progressbar@lastheighta{true}%
+}%
+\AddToKeyvalOption{progressbar}{roundnessr}{%
+ \def\progressbar@lastroundnessa{false}%
+}%
+\AddToKeyvalOption{progressbar}{roundnessa}{%
+ \def\progressbar@lastroundnessa{true}%
+}%
+\newcommand{\setBarHeightCenter}{\setlength{\BarHeightCenter}{\BarHeight - \BarBorderWidth}}%
+\newcommand{\setBarWidthCenter}{\setlength{\BarWidthCenter}{\BarWidth - \BarBorderWidth}}%
+\AddToKeyvalOption{progressbarlocal}{heightr}{%
+ \setlength{\BarHeight}{\heightof{I} * \real{\progressbarlocal@heightr}}%
+ \kvsetkeys{progressbarlocal}{heighta=\BarHeight}%
+}%
+\AddToKeyvalOption{progressbarlocal}{roundnessr}{%
+ \def\progressbarlocal@lastroundnessa{false}%
+}%
+\AddToKeyvalOption{progressbarlocal}{heighta}{%
+ \setlength{\BarHeight}{\progressbarlocal@heighta}%
+ \setBarHeightCenter%
+}%
+\AddToKeyvalOption{progressbarlocal}{width}{%
+ \setlength{\BarWidth}{\progressbarlocal@width}%
+ \setBarWidthCenter%
+}%
+\AddToKeyvalOption{progressbarlocal}{roundnessa}{%
+ \def\progressbarlocal@lastroundnessa{true}%
+ \setlength{\BarRoundedCorners}{\progressbarlocal@roundnessa}%
+}%
+\AddToKeyvalOption{progressbarlocal}{borderwidth}{%
+ \setlength{\BarBorderWidth}{\progressbarlocal@borderwidth}%
+ \setBarHeightCenter%
+ \setBarWidthCenter%
+}%
+% Macor to change Options
+\newcommand{\progressbarchange}[1]{%
+ \kvsetkeys{progressbar}{#1}%
+}%
+%
+% The actual realisation of the progressbar
+\newcommand{\progressbar}[2][]{%
+ % Get the global keys in the local keys
+ \@for\progressbar@key:=\progressbar@keylist\do{%
+ \@expandtwoargs\kvsetkeys{progressbarlocal}{\progressbar@key=\csname progressbar@\progressbar@key\endcsname}%
+ }%
+ \ifx\progressbar@lastheighta\progressbar@true%
+ \kvsetkeys{progressbarlocal}{heighta=\progressbar@heighta}%
+ \else%
+ \kvsetkeys{progressbarlocal}{heightr=\progressbar@heightr}%
+ \fi%
+ \ifx\progressbar@lastroundnessa\progressbar@true%
+ \kvsetkeys{progressbarlocal}{roundnessa=\progressbar@roundnessa}%
+ \else%
+ \kvsetkeys{progressbarlocal}{roundnessr=\progressbar@roundnessr}%
+ \fi%
+ % Now get the optional user input keys
+ \kvsetkeys{progressbarlocal}{#1}%
+ % Make a correct roundndess, if roundnessr was defined
+ \ifx\progressbarlocal@lastroundnessa\progressbar@true%
+ \else%
+ \setlength{\BarRoundedCorners}{\BarHeightCenter * \real{\progressbarlocal@roundnessr}}%
+ \fi%
+ % BarSubDivision
+ \setlength{\BarSubDivisionsWidthANU}{\BarWidthCenter / \progressbarlocal@subdivisions}%
+ \setlength{\BarSubDivisionsWidthBNU}{\BarSubDivisionsWidthANU * 2}%
+ \setlength{\BarSubDivisionsWidthCNU}{\BarWidthCenter - \BarSubDivisionsWidthANU}%
+ % The filled part of the bar is calculated and set
+ \setlength{\BarPartWidth}{\BarWidthCenter * \real{#2}}%
+ % Now let's draw a bar ;)
+ \begin{tikzpicture}%
+ \coordinate (Begin) at (0,0);%
+ \coordinate (End) at (\BarWidthCenter,\BarHeightCenter);%
+ \coordinate (Part) at (\BarPartWidth,\BarHeightCenter);%
+ % Rounded Corners
+ \draw[rounded corners=\BarRoundedCorners,line width=\BarBorderWidth,color=\progressbarlocal@linecolor] (Begin) rectangle (End);%
+ \clip[rounded corners=\BarRoundedCorners] (Begin) rectangle (End);%
+ % Fill the bar
+ \fill[fill=\progressbarlocal@emptycolor] (Begin) rectangle (End);%
+ % the full part
+ \fill[fill=\progressbarlocal@filledcolor] (Begin) rectangle (Part);%
+ % Ticks
+ \foreach \x in {\strip@pt\BarSubDivisionsWidthANU,\strip@pt\BarSubDivisionsWidthBNU,...,\strip@pt\BarSubDivisionsWidthCNU}%
+ \draw[draw=\progressbarlocal@tickscolor,line width=\progressbarlocal@tickswidth] (\x pt,0) -- (\x pt,\BarHeightCenter*\progressbarlocal@ticksheight);%
+ % Rounded Corners again
+ \draw[rounded corners=\BarRoundedCorners,line width=\BarBorderWidth,color=\progressbarlocal@linecolor] (Begin) rectangle (End);%
+ \end{tikzpicture}%
+}% \ No newline at end of file