%% poligraf.sty generic macros
%% Copyright (C) 1996, 2001 Janusz Marian Nowacki. Public domain.
%% [Polish:]                        | [English:]
% ,,Mi/edzy \TeX-em a drukarni/a''  | ``Between \TeX{} and the printing house''
% wersja 2.0, kwiecie/n 2001 r.     | version 2.0, April 2001
%---
% Cel: obs/luga strony dokumentu    | Purpose: preparation of pages for
% dla cel/ow drukarskich, separacje | prepress, color separation, cropmarks,
% barwne, pasery, ,,lustro''.       | color and gray scale bars, mirror print.
%---
% Author: Janusz Marian Nowacki
%         86-300 Grudzi/adz
%         ul. /Sniadeckich 82/46
%         tel. +48 +56 46-218-37
%         Poland
%         e-mail: j.nowacki@gust.org.pl
%% Wsp/o/lpraca i komentarze:        | Cooperation and comments:
%%        BOP s.c. & Staszek Wawrykiewicz
%
%------------------------------------------------------------------
\catcode`\@=11
%
\newdimen\bigpoint \bigpoint 1pt
\newdimen\Voffsetdim \Voffsetdim\voffset \advance\Voffsetdim by 1in
\newcount\Voffset \Voffset\Voffsetdim \divide\Voffset by \bigpoint
\newdimen\Hoffsetdim \Hoffsetdim\hoffset \advance\Hoffsetdim by 1in
\newcount\Hoffset \Hoffset\Hoffsetdim \divide\Hoffset by \bigpoint
\newcount\overprintblack \overprintblack=1
%
\def\cropmarkdistance #1{%
        \special{!userdict begin /cropmarkdistance #1 def end}}
\def\cropmarksize #1{%
        \special{!userdict begin /cropmarksize #1 def end}}
\def\barsize #1{%
        \special{!userdict begin /barsize #1 def end}}
\def\nocolorbars{%
        \special{!userdict begin /colorbars 0 def end}}
\def\onlycolorbars{%
        \special{!userdict begin /colorbars 3 def end}}
\def\onlycolorsteps{%
        \special{!userdict begin /colorbars 2 def end}}
\def\mirror{%
        \special{!userdict begin /mirror 1 def end}}
\def\xoffset #1{%
        \special{!userdict begin /xoffset #1 def end}}
\def\yoffset #1{%
        \special{!userdict begin /yoffset #1 def end}}
\def\labeloff{%
        \special{!userdict begin /marglabel 0 def end}}
%
\def\CYAN   {1 0 0 0}
\def\MAGENTA{0 1 0 0}
\def\YELLOW {0 0 1 0}
\def\BLACK  {0 0 0 1}
\def\sepcolor{}
\def\NoOverPrintBlack{\overprintblack=0}
%
\def\Separate #1{%
  \input cmyk-hax
  \edef\projectcolor{#1}%
  \ifx\projectcolor\CYAN
    \def\sepcolor{\projectCMYK\cyan}
    \special{!userdict begin /color_sep 0 def /setsep 1 def end}
    \ifnum\overprintblack>0 \delblacktrue \fi
  \else \ifx\projectcolor\MAGENTA
    \def\sepcolor{\projectCMYK\magenta}
    \special{!userdict begin /color_sep 1 def /setsep 2 def end}
    \ifnum\overprintblack>0 \delblacktrue \fi
  \else \ifx\projectcolor\YELLOW
    \def\sepcolor{\projectCMYK\yellow}
    \special{!userdict begin /color_sep 2 def /setsep 3 def end}
    \ifnum\overprintblack>0 \delblacktrue \fi
  \else \ifx\projectcolor\BLACK
    \def\sepcolor{\projectCMYK\black}
    \special{!userdict begin /color_sep 3 def /setsep 4 def end}
  \fi \fi \fi \fi
}
%
\def\add@makeheadline#1{%
  \let\oriheadline\makeheadline%
  \def\makeheadline{#1\oriheadline}%
  }
\def\add@begindvi#1{%
  \def\PoligrafHook{#1}%
  \def\@begindvi{%
   \PoligrafHook%
   \unvbox \@begindvibox%
   \gdef\@begindvi{\PoligrafHook}%
  }}
%
\ifx\documentclass\@undefined
 \add@makeheadline{\sepcolor} % for Plain
\else
 \add@begindvi{\sepcolor}     % for LaTeX
\fi
%
\catcode`\@=12
%
\special{header=crops.pro}
%
\endinput
