% > TstripABC
%---------------------------------- Procedure Definitions ------------------
/smallfont { /Helvetica-Bold findfont 7 scalefont } def
/bigfont { /Helvetica-Bold findfont 11 scalefont } def
/drawgrid  % draws the border and grid lines for the 6 x 11 box strip
% Generally, ABC strips have the following PostScript dimensions (in points)
%  -------------   -----------------   -----------------------
%  | 54| 54| 54|   | 54| 54| 54| 54|   | 54| 54| 54|   100   |  height = 81 pt
%  -------------   -----------------   -----------------------
%               54pt gap            54pt gap                    length = 640 pt
{0 0 moveto .5 setlinewidth 0 setgray

% Draw grid for first 4 rows as black-on-white
54 0 moveto
2 { 0 52 rlineto 54 -52 rmoveto } repeat
108 0 rmoveto                 % ABC gap between function keys F2 and F3
3 { 0 52 rlineto 54 -52 rmoveto } repeat
108 0 rmoveto                 % ABC gap between function keys F6 and F7
3 { 0 52 rlineto 54 -52 rmoveto } repeat
0 0 moveto                    % Do the horizontal lines
5{ 162 0 rlineto 54 0 rmoveto
   216 0 rlineto 54 0 rmoveto
   262 0 rlineto -748 13 rmoveto }repeat
stroke

% black-fill the 3 areas of top two lines
newpath
0 52 moveto 0 26 rlineto 162 0 rlineto 0 -26 rlineto closepath fill 
216 52 moveto 0 26 rlineto 216 0 rlineto 0 -26 rlineto closepath fill
486 52 moveto 0 26 rlineto 262 0 rlineto 0 -26 rlineto closepath fill

newpath 1 setgray        % Draw grid for top 2 rows as white-on-black
54 52 moveto
2 { 0 26 rlineto 54 -26 rmoveto } repeat
108 0 rmoveto
3 { 0 26 rlineto 54 -26 rmoveto } repeat
108 0 rmoveto
3 { 0 26 rlineto 54 -26 rmoveto } repeat
0 65 moveto 162 0 rlineto
54 0 rmoveto 216 0 rlineto
54 0 rmoveto 262 0 rlineto
stroke

newpath 1 setlinewidth                % Thicken-up outline boxes
1 setgray 648 52 moveto 0 26 rlineto  % and line between
stroke newpath
0 setgray 648 0 moveto 0 52 rlineto   % row headings and legends
0 0 moveto 0 78 rlineto 162 0 rlineto 0 -78 rlineto closepath stroke
216 0 moveto 0 78 rlineto 216 0 rlineto 0 -78 rlineto closepath stroke
486 0 moveto 0 78 rlineto 262 0 rlineto 0 -78 rlineto closepath stroke
0 0 moveto } def

/pbox   % Expects 11 strings on the stack.
% Each string is printed in the centre of each legend box.
% The leftmost legend box is larger and serves as the row heading.
% Assumes that 'currentpoint' is bottom left corner of the correct line.
{ smallfont setfont              % set function key description font
648 0 rmoveto                    % move up to right hand end of this line
3{ -53 4 rmoveto                 % correct position for this font within box
 currentpoint /ypos exch def /xpos exch def      % remember where we are
 dup stringwidth pop 52 exch sub 2 div 0 rmoveto % compute whitespace & move
 show                                            % print the string
 xpos ypos moveto -1 -4 rmoveto  % move to origin of this box
 } repeat
-54 0 rmoveto                    % same again for other groups of keys
4{ -53 4 rmoveto currentpoint /ypos exch def /xpos exch def
dup stringwidth pop 52 exch sub 2 div 0 rmoveto show
xpos ypos moveto -1 -4 rmoveto } repeat
-54 0 rmoveto
3{ -53 4 rmoveto currentpoint /ypos exch def /xpos exch def
dup stringwidth pop 52 exch sub 2 div 0 rmoveto show
xpos ypos moveto -1 -4 rmoveto } repeat
% Now do the heading legend for this row
648 ypos moveto 1 -1 rmoveto bigfont setfont
dup stringwidth pop 98 exch sub 2 div 0 rmoveto % compute whitespace & move
show
% Lastly, move up to next row
0 ypos moveto 0 9 rmoveto
} def
%---------------------------------------- prog starts here -----------------
550 50 translate 90 rotate 0 0 moveto
6 {        % 6 TWIN rulers to a page of A4
newpath
drawgrid
0 setgray  % Black fonts for the first 4 rows
% Bottom row 
(Function Key)  % Heading
(Goto Line) (Command Line) (Load File) (Save File) (Find String)
(Global Replace) (Mark Place) (Marked Copy) (Print Text) (Old Text)
pbox
% Second Row
(+ Shift)       % Heading
(Show Newlines) (Insert / Over) (Insert File) (New Margins)
(Language Exit) (Set Mode) (Clear Marks) (Marked Move)
(Marked Delete) (Clear Text) pbox
% Third Row
(+ Control)     % Heading
(Toggle Wndow) (Expand Wndow) (Close Window) (Next Line)
(Mod2 Structs) (Enter Char) (Format) (Send Mail) (Change LF-CR)
(Task Status) pbox
% Fourth Row
(+ Cntrl & Shift)  % Heading
(Connect) () (Load via *path) (Append to file) () (Pop buffer) (Push Buffer)
(Read Mail) (Auto Bottom) (Task End) pbox

1 setgray  % Change to white fonts for top two lines

% Fifth Row
(Find & Replace)  % Heading
(New Line) (Found Section) (Found String) (Most Items) (Many Items)
(Start Replace) (NOT Item) (Any Character) (Alpha-numeric) (Digit)
pbox 

% Sixth Row
(+ Shift)       % Heading
(Start Set) (End Set) (Sub Range) (Control) (Set Top Bit) (Exactly)
(Toggle Case) () () () pbox

% Move across the page a bit for the next one
0 80 translate } repeat

showpage
