\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{cover}[2005/11/03 CD/DVD Cover for Lehmanns]
%
% 2005/11/03 Template for House of Audio: Front&Back 125x125, Overprint 3
%
\RequirePackage[T1]{fontenc}
\RequirePackage[latin1]{inputenc}
\RequirePackage{lmodern,ragged2e}
\RequirePackage{graphicx,color}
\RequirePackage{typearea}
\RequirePackage{pstricks}

\pagestyle{empty}

\newif\ifborder
\newif\ifcropmarks %\cropmarkstrue
\newif\iffrontonly
\newif\ifweb
\newcommand\IfWeb[2]{%
\ifweb#1\else#2\fi%
}

% \Status command for output style option
% 0: normal output for PDF (front and back cover, CMYK colors)
% 1: front and back cover, in CMYK colors with border lines as draft
% 2: front cover only, in CMYK colors for PDF
% 3: front cover only, in RGB colors for conversion to bitmaps (black box)
\@ifundefined{Status}{\chardef\Status=0}{}
\ifcase\Status
    \webfalse
    \borderfalse
    \frontonlyfalse
\or
    \webfalse
    \bordertrue
    \frontonlyfalse
\or
    \webfalse
    \borderfalse
    \frontonlytrue
\or
    \typeout{WEB}
    \webtrue
    \borderfalse
    \frontonlytrue
\fi

\iffrontonly
\borderfalse
\paperwidth 125mm
\paperheight 125mm
\areaset{125mm}{125mm}
\else
\paperwidth 262mm
\paperheight 137mm
\areaset{256mm}{131mm}
\addtolength\topmargin{1mm}
\fi

\psset{unit=1mm,linewidth=0mm,linestyle=none,dimen=middle}


\def\@isbn{0-00000-000-0}
\newcommand\isbn[1]{\def\@isbn{#1}}
\def\@hoaid{}
\newcommand\hoaid[1]{\def\@hoaid{#1}}
\newcommand\qq{/\kern-.1em/}

\def\linetwo{\\\hspace*{1em}}
\newcommand{\group}[1]{\language=255#1\par\vfill}
\newcommand{\AlleGruppen}{%
 \group{As\TeX{} (French)}%
 \group{Cervan\TeX{} (Spanish)}%
 \group{CSTUG \linetwo (Czech/Slovak)}%
 \group{C\TeX{} (Chinese)}%
 \group{CyrTUG (Russian)}%
 \group{DANTE (German)}%
 \group{DK-TUG (Danish)}%
 \group{Estonian User Group}%
 \group{$\varepsilon\phi\tau$ (Greek)}%
 \group{GuIT (Italian)}%
 \group{GUST (Polish)}%
 \group{GUTenberg (French)}%
 \group{GUTpt (Portuguese)}%
 \group{Ís\TeX{} (Icelandic)}%
 \group{ITALIC (Irish)}%
 \group{KTUG (Korean)}%
 \group{Lietuvos \TeX'o Vartotoj\k{u} Grup\.e \linetwo (Lithuanian)}%
 \group{Ma\TeX{} (Hungarian)}%
 \group{Nordic \TeX{} Group \linetwo (Scandinavian)}%
 \group{NTG (Dutch)}%
 \group{\TeX{}CeH (Slovenian)}%
 \group{\TeX\,M\'exico}%
 \group{Tirant lo \TeX{} (Catalan)}%
 \group{TUG (international)}%
 \group{TUGIndia}%
 \group{TUG-Philippines}%
 \group{UK\,TUG}%
 Vi\^{e}tTUG (Vietnamese)%
}

\renewcommand\familydefault\sfdefault

\AtBeginDocument{\noindent}
\newcommand\cover[4]{% #1: Web Color #2: Print color in PSTricks syntax
\IfWeb{\newrgbcolor{back}{#1}}{\newcmykcolor{back}{#2}}%
\iffrontonly
\begin{pspicture*}(0,0)(125,125)
\psframe[fillstyle=solid,fillcolor=back](0,0)(125,125)
\psframe[fillstyle=solid,fillcolor=white](0,0)(125,10)
\psframe[fillstyle=solid,fillcolor=white](0,0)(30,125)
\else
\begin{pspicture}(-3,-3)(253,128)
\psframe[fillstyle=solid,fillcolor=back](-3,-3)(253,128)
\psframe[fillstyle=solid,fillcolor=white](-3,-3)(253,10)
\psframe[fillstyle=solid,fillcolor=white](125,-3)(155,128)
\psframe[fillstyle=solid,fillcolor=white](-3,-3)(30,128)
\ifcropmarks
  \rput(0,-3){\psline[linestyle=solid,linewidth=.1mm](0,0)(0,-3)}
  \rput(125,-3){\psline[linestyle=solid,linewidth=.1mm](0,0)(0,-3)}
  \rput(250,-3){\psline[linestyle=solid,linewidth=.1mm](0,0)(0,-3)}
  \rput(0,128){\psline[linestyle=solid,linewidth=.1mm](0,0)(0,3)}
  \rput(125,128){\psline[linestyle=solid,linewidth=.1mm](0,0)(0,3)}
  \rput(250,128){\psline[linestyle=solid,linewidth=.1mm](0,0)(0,3)}
  \rput(-3,0){\psline[linestyle=solid,linewidth=.1mm](0,0)(-3,0)}
  \rput(-3,125){\psline[linestyle=solid,linewidth=.1mm](0,0)(-3,0)}
  \rput(253,0){\psline[linestyle=solid,linewidth=.1mm](0,0)(3,0)}
  \rput(253,125){\psline[linestyle=solid,linewidth=.1mm](0,0)(3,0)}
\fi
\rput[bl](125,0){%
\begin{pspicture}(0,0)(125,125) % Front page
\fi%
  \ifborder
    \psline[linestyle=solid,linecolor=white,linewidth=.1mm](0,0)(125,0)(125,125)(0,125)(0,0)
  \fi
  %\rput(15,5){\includegraphics[width=26mm]{logofbg1}}
#3
\iffrontonly
\end{pspicture*}
\else
\end{pspicture}
}

\rput[bl](0,0){%
\begin{pspicture}(0,0)(125,125)
%\rput(15,5){\includegraphics[width=26mm]{logofbg1}}
\def\citysep{\,$\cdot$\,}
\rput(77,5){\parbox{91mm}{\fontsize{7}{9}\selectfont\centering%
  % used to be lehmann's addr
}}
%\rput[br](123,10.5){\fontsize{5}{5}\selectfont\@hoaid}
\rput[t](15,122){%
\begin{minipage}[s][116mm]{26mm}%
\color{black}\raggedright\scriptsize\linespread{1.2}%
    \AlleGruppen
\end{minipage}%
}

\ifborder
\psline[linestyle=solid,linecolor=white,linewidth=.1mm](0,0)(125,0)(125,125)(0,125)(0,0)
\fi

#4
\end{pspicture}
}
\end{pspicture}
\fi
}
