%%
%%% Author          1997  Werner Fink   <werner@suse.de>
%%% Copyright  (c)  1997  SuSE GmbH  Nuernberg, Germany.
%%
%%  Based on `susemac.sty' v 1.30 1997/10/14
%%  Some modifications by Rolf Niepraschk <niepraschk@ptb.de>, 2000/10/29
%%
%%  keystroke.sty 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, or (at your option)
%%  any later version.
%%
%%  keystroke.sty 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.
%%
%%  You should have received a copy of the GNU General Public License
%%  along with keystroke.sty; see the file COPYING; if not, write to
%%  the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
%%  Boston, MA 02111-1307 USA.
%%

%   Please send corrections and enhancements 
%   to Rolf Niepraschk <niepraschk@ptb.de>.

%   Changes:
%   v1.3, 2001/10/27; Loading the graphics package only if needed. 
%                     All unknown options are options for `graphics'. 
%   v1.4, 2001/12/14; New and corrected definitions for spanish.
%   v1.5, 2003/08/15; Fix a bug with the global option "english". 
%                     New optin "ngerman". RN

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{keystroke}[2003/08/15 v1.5 3D keystrokes (SuSE GmbH/RN)]

\@ifpackageloaded{graphics}{}{%
  \RequirePackage{graphics}
  %\RequirePackage{graphicx}
}

\newcommand*{\Enter}{}
\newcommand*{\Del}{}
\newcommand*{\Ins}{}
\newcommand*{\Esc}{}
\newcommand*{\Shift}{}
\newcommand*{\Ctrl}{}
\newcommand*{\Home}{}
\newcommand*{\End}{}
\newcommand*{\PgUp}{}
\newcommand*{\PgDown}{}
\newcommand*{\PrtSc}{}
\newcommand*{\Scroll}{}
\newcommand*{\Break}{}


\DeclareOption{english}{%
  \def\Enter{\keystroke{Enter}}
  \def\Del{\keystroke{Del}}
  \def\Ins{\keystroke{Ins}}
  \def\Esc{\keystroke{Esc}}
  \def\Shift{\keystroke{Shift $\Uparrow$}}
  \def\Ctrl{\keystroke{Ctrl}}
  \def\Home{\keystroke{Home}}
  \def\End{\keystroke{End}}
  \def\PgUp{\keystroke{Page $\uparrow$}}
  \def\PgDown{\keystroke{Page $\downarrow$}}
  \def\PrtSc{\keystroke{PrtSc}}
  \def\Scroll{\keystroke{Scroll}}
  \def\Break{\keystroke{Break}}
}

\DeclareOption{american}{\ExecuteOptions{english}}

\DeclareOption{german}{%
  \def\Del{\keystroke{Entf}}
  \def\Ins{\keystroke{Einfg}}
  \def\Esc{\keystroke{Esc}}
  \def\Shift{\keystroke{$\Uparrow$~~}}
  \def\Ctrl{\keystroke{Strg}}
  \def\Home{\keystroke{Pos1}}
  \def\End{\keystroke{Ende}}
  \def\PgUp{\keystroke{Bild $\uparrow$}}
  \def\PgDown{\keystroke{Bild $\downarrow$}}
  \def\PrtSc{\keystroke{Druck}}
  \def\Scroll{\keystroke{Rollen}}
  \def\Break{\keystroke{Pause}}
}

\DeclareOption{germanb}{%
  \typeout{******Please use `german' instead of `germanb'******}%
  \ExecuteOptions{german}
}

\DeclareOption{ngerman}{%
  \ExecuteOptions{german}
}
   
\DeclareOption{french}{%
  \def\Enter{\keystroke{Entr\'ee}}
  \def\Del{\keystroke{Suppr}}
  %\def\Ins{\keystroke{???}}
  \def\End{\keystroke{Fin}}
  \def\PgUp{\keystroke{Pagina $\uparrow$}}
  \def\PgDown{\keystroke{Pagina $\downarrow$}}
}

\DeclareOption{francais}{%
  \typeout{******Please use `french' instead of `francais'*****}%
  \ExecuteOptions{french}
}

% Contributed by Arndt Mehlhorn <mehlhorn@Techno-Sol.com>
\DeclareOption{spanish}{%
  \def\Enter{\keystroke{Enter}} 
  \def\Esc{\keystroke{Esc}}
  \def\Del{\keystroke{Supr}}
  \def\Ins{\keystroke{Insert}}
  \def\End{\keystroke{Fin}}
  \def\PgUp{\keystroke{Re P\'ag}}
  \def\PgDown{\keystroke{Av P\'ag}}
  \def\PrtSc{\keystroke{Impr Pant}}
  \def\Scroll{\keystroke{Bloq Despl}}
  \def\Break{\keystroke{Pausa}}
  \def\End{\keystroke{Fin}}
  \def\Home{\keystroke{Inicio}}
}

\DeclareOption*{%
  \PassOptionsToPackage{\CurrentOption}{graphics}%
}

\ExecuteOptions{english}

\ProcessOptions\relax

\newcommand*{\suse@tab}{%
  \raisebox{-.5ex}{\shortstack{\reflectbox{\suse@@tab}\\[-1ex]\suse@@tab}}%
}
\newcommand*{\suse@@tab}{%
  {{\makebox[2em]{\small\rightarrowfill}}}%
}

\newcommand*{\Spacebar}{\keystroke{\hspace{3.5em}}}
\newcommand*{\Return}{\keystroke{$\hookleftarrow$}}
\newcommand*{\BSpace}{\keystroke{\reflectbox{$\longmapsto$}}}
%\newcommand*{\Tab}{\keystroke{$\longmapsto$}}
\newcommand*{\Tab}{\keystroke{\suse@tab}}
\newcommand*{\Alt}{\keystroke{Alt}}
\newcommand*{\AltGr}{\keystroke{AltGr}}
\newcommand*{\NumLock}{\keystroke{Num}}
\newcommand*{\UArrow}{\keystroke{$\,\uparrow\!$}}
\newcommand*{\DArrow}{\keystroke{$\,\downarrow\!$}}
\newcommand*{\LArrow}{\keystroke{$\leftarrow$}}
\newcommand*{\RArrow}{\keystroke{$\rightarrow$}}

%%
\newbox\suse@key
\newbox\keystroke@left
\newbox\keystroke@right
\newbox\keystroke@middle 
\setbox\keystroke@left  =\hbox{\includegraphics{keystroke_left}}
\setbox\keystroke@middle=\hbox{\includegraphics{keystroke_middle}}
\setbox\keystroke@right =\hbox{\includegraphics{keystroke_right}}
%
\def\suse@keystr@ke#1{\ %
  \ifvmode\leavevmode\fi{\obeyspaces%
  \global\setbox\suse@key=\hbox{{\keystroke@font\strut#1}}%
  \@tempdima=0.35ex%
  \advance\@tempdima by \dp\suse@key%
  \@tempdimb=\wd\suse@key%
  \@tempdimc=\ht\suse@key%
  \ifdim\@tempdimb<\@tempdimc\@tempdimb=\@tempdimc\fi
  \advance\@tempdimc by 1.16ex%
  \lower\@tempdima\hbox{\resizebox*{!}{\@tempdimc}{\copy\keystroke@left}}%     
  \ignorespaces%
  \hbox to 0pt{\unhbox\suse@key\hss}%    
  \ignorespaces%
  \lower\@tempdima\hbox to \@tempdimb{\hss%
    \resizebox*{\@tempdimb}{\@tempdimc}{\copy\keystroke@middle}}%
  \ignorespaces%
  \lower\@tempdima\hbox{\resizebox*{!}{\@tempdimc}{\copy\keystroke@right}}%    
}\ }
%
\DeclareRobustCommand*\keystroke{\suse@keystr@ke}

\newcommand*\keystroke@font{\normalfont\sffamily\footnotesize}

%%

\endinput