[comp.sys.amiga] Printer Device Control

andy@cbmvax.UUCP (04/29/87)

Remember our recent discussion on what the printer.device should
be expected to do, and what an application program should be expected
to do ?  (Thought you would)  This program is the result.
(BTW, thanks for the advice, Carolyn)

Basically, once you fire it up it hangs around, waiting for anyone
to do a DUMPRPORT.  It then fires up a requester, and lets you
play with the values being passed in the IORequest block.

How to use:
(from CLI)
run control

this fires it up. It opens the printer.device, and installs itself.

To stop it, either send its process a ^C (using the break command)
or execute it again.

(From Workbench)
give it an Icon.  Double click on its icon.  To stop it, double click
on its icon again.

How it works:
The control program does a SetFunction on the printer.device's BeginIO
and Expunge entry points.  It then checks each IORequest block sent
to the printer.device.  If it finds a DUMPRPORT, it brings up a
window filled with the parameters being passed to the printer.device.
(Parameters are: CMap (pointer to the color map), Mode (your viewmodes),
SrcX, SrcY, SrcWidth, SrcHeight, Destination Columns, Destination Rows,
and the Special Flag (bits from right to left= Density 4, Density 3,
Density 2, Density 1, Aspect, Centering, FracCols, FracRows, FullRows,
FullCols, MilRows, and MilCols))
By using the mouse and keyboard you can play with the paramters
to your hearts content.

Now, some words of warning...it is very possible to pass bad flags,
numbers, etc to the printer.device.  No error checking is done.
(wouldn't want to limit the user :-)  )  So you can crash your
machine, or send the printer device into an infinite loop, or...
(If you want to make it less fun, add the error checking)

Warning #2:  This program takes memory.  Some programs on the
edge may not like this.  Especially as I've disabled the Expunge
of the printer.device while the control program is in operation,
for safety.  Some programs are accustomed to doing an Expunge after
printing (Deluxe Paint II springs to mind).  When the printer.device
refuses to go away, the calling application may get upset.

Warning #3:  The control window comes up on the front screen.
This might get funny on some programs (like DP II) if you fool
with the gadgets too much.  If you plan to adjust dpaint
pictures a lot, you might modify the program to bring the
window up on the workbench screen.

Last thing...note carefully the techniques for unwinding the SetFunction,
and the use of SetFunction on a device.  This can be used for
many other abuses of the system.  Be careful, though...most devices
run as tasks, which means that any code running as part of that task
can't use DOS functions.

This posting will be in 2 parts...first the uuencoded .ld file.
(please check the line lengths before uudecoding;  maybe we'll
 catch the problems that way.  
Lengths are: 
10903 for control.uue (after this README and trailing linefeed are removed)
and 7892 for control.ld.
)

------------------------CUT HERE--------------------------------------------
begin 644 control.ld
M   #\P         -          P   "#    :P   98   !D    "    D  
M        /          @    2P   !P        #Z0   (,CSP   !PCP   
M "0CR    "@L>0    0CS@    23R4ZN_MHH0$JL *QG  #V80 !NI'(("P 
MK.6((# ($.6(2.< ,$7Y    K$?Y    +"! <  0&$(P"  FR" Y    )"!Y
M    *$/P"  ,(0 @4LC_^D(I  $2&&=<# $ (&?V# $ "6?P)LH, 0 B9Q04
MP1(89T(, 0 @9P04P6#R0AI@U!(89S , 0 B9_(, 0 J9B 2& P! $YG!@P!
M &YF!'(*8 X, 0!%9P8, 0!E9@)R&Q3!8,Q"$D*3(#P    HD(M&@.2(3-\,
M $AY    +"\ 3KD   !,(\     03KD   !<(\     4(\     83KD     
M<  N>0   !Q.=6$  ,9A  "P(\     @+P!"IR1 ("H )&<0+'D    (($ B
M*   3J[_@B(J "!G*"0\   #[4ZN_^(CP    ! CP    !0CP    !AG"N6(
M($ I:  ( *1.N0    !P & $("\ !"YY    '"\ +'D    $(#D    (9P8B
M0$ZN_F)*N0   "!G#DZN_WPB>0   "!.KOZ&(!].=4CG 08N/  #@ <L>  $
M3J[_E$S?8(!P9&"P0>P 7$ZN_H!![ !<3J[^C$YU0_H $G  3J[]V"/     
M"&?"3G5D;W,N;&EB<F%R>0       ^P    8     0   ?8   &R   !I@  
M 9@   &*   !:@   60   %>   !/@   2P   $<   !#@   0@   #\    
M[@   -X   !D    7@   $P   !&    &@    X    (     @    (    "
M   !%    7P    !    "0   0(    !    "0   /8        #\@   ^H 
M  !K "$  0               /_______________P                  
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M                                                            
M                                      /R   #Z0   99(YR X("\ 
M%"(O !AT 21\    X"9\    Q"/    !!DZY     $AY     $ZY    ("A 
MN/P  %B/9Q)(>!  +PQ.N0   $A0CV   21.N0   ?Y*@&<82'D    ,3KD 
M  %\2'@ %$ZY   !A%"/0J=.N0   " B0"A)(^D "@   -Q"ITZY    (") 
M(WP    D  HDN0   1XO/      O//___^(O$DZ3(\    #,+SP    :+SS_
M___N+Q).DR/     U$ZY   "5D_O "!@  "62'@0 $ZY    -"\Y    S"\\
M____XB\23I,CP    - O.0   -0O//___^XO$DZ3(\    #8('P     L?D 
M  #03^\ '&8  ! @?    !JQ^0   -AG,B\Y    T"\\____XB\23I,O.0  
M -@O//___^XO$DZ32'D    P3KD   %\3^\ '& **7D   #<  IT $J"9@#_
M:$ZY    $$S?' 1.=4CG,  D+P ,2KD   $&9PQ(> /M2'D   !B8 I(> /N
M2'D   !D3KD     )@!0CTJ#9QHO DZY   ![EB/+P O B\#3KD    P3^\ 
M#$JY   !!F8,2'@ ^DZY    ;%B/+P-.N0   !Q8CTS?  Q.=2!O  1P & "
M4H!*&&;Z3G5"ITAY   !"D*G2'D   ""3KD   #@2H!/[P 09P1P 6 T$_P 
M!    .Q".0   /)".0   /-"N0   /1(>0   .1.N0   & C_    .0   $8
M< !8CTYU2'D   #D3KD   !T2'D   $*3KD   $ 4(].=4CG.#PD;P @> %T
M "9\    R"A\    R QJ  L '&8  B0O*@ D2'D   "22'D     3I,O*@ H
M2'D   "82'D    *3I-P # J "PO $AY    GDAY    %$Z3<  P*@ N+P!(
M>0   *)(>0   !Y.DW  ,"H ,"\ 2'D   "F2'D    H3I-P # J #(O $AY
M    JDAY    ,DZ3+RH -$AY    KDAY    /$Z3+RH .$AY    LDAY    
M1DZ3=@!/[P!@<  P*@ \<@$4 ^6AP(%G(B(#( '"_  L2$# _  L2$!"0-* 
M('P   7: '  @!@,8" B R !POP +$A P/P +$A 0D#2@"!\   %V@)P_W\8
M#%*#< RP@VZF0J=(>0   +9.N0   10H@%"/9@)X "!4(^@ /    68@>0  
M 68P*  4 D  #S/    !=DAY   !2$ZY    *"9 MOP  %B/9@9X &   *!(
M>0  "-HO"TZY    /$*G+PM(>0  !'I.N0   %1/[P 48   >G !(&L 5A(H
M  _CH"\ 3KD    T) !P 2!K %82*  /XZ# @EB/9U!@/B!"("@ %') LH!F
M*"I"(&T '"\++PIP # H "8O $ZY   $O"@ +P).N0   )Q/[P 08 HO DZY
M    G%B/+RL 5DZY    B"0 6(]FLDJ$9H0@"V<2+PM.N0   !0O"TZY    
M %"/2I1G"B\43KD   "P6(]V %*##(,  "<0;?9,WSP<3G5(YR P(B\ $"1O
M !0D+P 8)GP   70< *P@68&< !@  #N< &P@68  *1(>0    !.DR5  "1(
M>0    I.DR5  "A(>0   !1.DS5  "Q(>0   !Y.DS5  "Y(>0   "A.DS5 
M #!(>0   #).DS5  #)(>0   #Q.DR5  #1(>0   $9.DR5  #A":@ \= !/
M[P @( (B ,#\ "Q(0<+\ "Q(04)!T($@?   !=H(,  '" UG"G(!$ +AH=-J
M #Q2@G ,L()NS&  _U)P ["!;CIP"K"!;31"IR\"( %R_M"!<@? @2( P/P 
M+$A!POP +$A!0D'0@2!\   $>DAP" !.N0   %1/[P ,< %,WPP$3G5(YSP@
M(&\ &'8!> IZ "1(8   8@P" 'AF"'@0>@!@  !4# ( +68&>@!V_V!&# ( 
M,&4(# ( .6,   X, @!!93(, @!&8BPB!2 $3KD   ! *@ , @ P91 , @ Y
M8@IR !("<#"2@& (<@ 2 G#)TH#:@10:9IPB R %3KD   ! 3-\$/$YU   #
M[     <    "   $S@  !%0   &T   !5@   ,H   !@    4    #     #
M   #R@   \0   .V   #L    Y@   ,H   #%@   P0   +N   "V    L( 
M  *L   "F@   H8   )D   "6    DP   )(   "/    C8   (P   "*@  
M B0   (*   " @   <P   &>   !D@   88   %B   !4    4    $P   !
M*    10   $(    ^    /(   #B    Q    *X   "8    D    (    !:
M    *    !P    0     0    H   2D     0    L   26     0    L 
M  2.     @    H   1>   $;     $    *   $>     (    +   #_@  
M!<     !    "P   ^X    !    !P   H     !    "@   FH    !    
M"@   EX    !    "@   D(    !    "@   A     !    "0   >(    !
M    "0   =@    !    "0   <(    !    "0   :0    !    "@   7( 
M   "    "@   -P   0:     0    H    6     0        !J     0  
M  H   !$     0    H    B    %@    4   ,N   %/    QP   4P   #
M"@  !20   +T   %&    MX   4,   "R   !0    *R   $]    J    3H
M   #^   !;8   -@   #@@  !68   /F    !     0   "T   !(@   )X 
M  $.     0    L   /0     0    H   .>     P    H    N    =   
M (@    "    !P  !AX   9.         _(   /J    9%!25"U#3TY44D],
M $5R<F]R(2!0<FEN=&5R(&EN(%5S90H  %!25"U#3TY44D], $5R<F]R(2!#
M86XG="!E>&ET(&YO=RX@4')I;G1E<B!696-T;W)S($-H86YG960@(0H *@!#
M3TXZ,3 O,3 O,S8P+S0P+T5R<F]R(%=I;F1O=P!P<FEN=&5R+F1E=FEC90  
M,'@E;'@ ,'@E;'@ )6QD "5L9  E;&0 )6QD "5L9  E;&0 :6YT=6ET:6]N
M+FQI8G)A<GD                                                 
M                                                            
M                                                            
M       * 4  H  !    0   $ 8   @6         7@                 
M      !0<FEN=&5R($-O;G1R;VP@5C$N,         /L     0    ,   %B
M     0    4   %:         _(   /I    "$CG__XO"4ZY   "<EB/3-]_
M_R!Y    S$[0< !.=0     #[     $    "    "     $    #    %   
M      /R   #Z@   D                                          
M                                                            
M                                                            
M                                                          !1
M    40 *    "@    #_____ 0, !0   *             5    %0 +    
M"P    #_____ 0( !0   ,0            U    -0 +    "P    #_____
M 0, !0   .@            1    $0 +    "P    #_____ 0, !0   0P 
M             %  !P (                                    "@  
M  H !P (                                    %    &0 !P (    
M                                '@   &X !P (                
M                    *    '@ !P (                            
M        ,@   (( !P (                                    /   
M (P !P (                                    1@   )8 !P (    
M                             0,  /_.           "9     !#36%P
M.@ ! P  _\X           )^     $UO9&4Z  $#  #_S@           I@ 
M    4W)C6#H  0,  /_.           "L@    !3<F-9.@ ! P  _\X     
M      +,     %-R8U<Z  $#  #_S@           N8     4W)C2#H  0, 
M /_.           #      !$0V]L.@ ! P  _\X           ,:     $12
M;W<Z  $#                 S0     34,   $#                 TP 
M    35(   $#                 V0     1D,   $#                
M WP     1E(   $#                 Y0     1E(   $#            
M     ZP     1D,   $#                 \0     0T4   $#        
M         ]P     05,   $#                 _0     1#$   $#    
M            ! P     1#(   $#                !"0     1#,   $#
M  #_T           !#P     4W!E8SH@1#0   $#     @          !%H 
M    3TL   $#     @          !'(     0T%.0T5,         #P % !0
M  H    !  0   "T         E         !,  #        !'H /  > %  
M"@    $ !    +0        ":@        %4  0        $I@ \ "@ 4  *
M     0 $    M         *$         7@ !0        32 #P ,@!0  H 
M   !  0   "T         IX        !G  &        !/X /  \ %  "@  
M  $ !    +0        "N         '   <        %*@ \ $8 4  *    
M 0 $    M         +2         >0 "         56 #P 4 !0  H    !
M  0   "T         NP        ""  )        !8( / !: %  "@    $ 
M!    +0        #!@        (L  H        %K@$" &X $  *   ! 0 !
M   !(         ,@            #         7: /  ;@ 0  H   $!  $ 
M  $@         S@            -        !@8 W@!N !  "@   0$  0  
M 2         #4             X        &,@#, &X $  *   ! 0 !   !
M(         -H            #P        9> +H ;@ 0  H   $!  $   $@
M         X             0        !HH J !N !  "@   0$  0   2  
M       #F            !$        &M@"6 &X $  *   ! 0 !   !(   
M      .P            $@        ;B (0 ;@ 0  H   $!  $   $@    
M     \@            3        !PX <@!N !  "@   0$  0   2      
M   #X            !0        '.@!@ &X $  *   ! 0 !   !(       
M  /X            %0        =F $X ;@ 0  H   $!  $   $@        
M!!             6        !Y( / !N !  "@   0$  0   2         $
M*            !<        'O@$  (P %  *    !0 !    V         1&
M             0        ?J *  C  T  H    %  $   #\        !%X 
M           "       ! 0     4        "'X       $!      H     
M   (D   "$(  0$               B@   (5JD@,3DX-R!#;VUM;V1O<F4 
M $)Y($%N9'D@1FEN:V5L  !0<FEN=&5R($1R:79E<B!#;VYT<F]L        
M      "T !X 4@        AJ                       *    9     $ 
M  CX   (N           06)O=70       /L    >P    4   CL   (Z   
M",H   AZ   (=@  "&8   AB   (3@  "#    @H   (%@  " 0   ?\   '
MZ@  !]@   ?0   'O@  !ZP   >D   'D@  !X    =X   '9@  !U0   =,
M   '.@  !R@   <@   '#@  !OP   ;T   &X@  !M    ;(   &M@  !J0 
M  :<   &B@  !G@   9P   &7@  !DP   9$   &,@  !B    88   &!@  
M!?0   7L   %V@  !=    7(   %P   !:X   6D   %G   !90   6"   %
M>   !7    5H   %5@  !4P   5$   %/   !2H   4@   %&   !1    3^
M   $]   !.P   3D   $T@  !,@   3    $N   !*8   2<   $E   !(P 
M  1J   $4@  !#0   0<   $!    ^P   /4   #O    Z0   .,   #=   
M UP   -$   #+    Q(   +X   "W@   L0   *J   "D    G8   )<   "
M,    BP   (,   ""    >@   'D   !Q    <    &@   !G    7P   %X
M   !6    50   $T   !,    2@   $$    X    +P        #\@   ^D 
M       #\@   ^D    \#((  /__;A@R04)!2$&"PB !2$$P"8#",@!"0$A 
M3G4@ 4) 2$!(04)!(D)T#]*!T8"SP&X$D(E205'*__).=2\") #$P2!") !(
M0L3!2$' P=""2$!"0-' ( @D'TYU+P(D 2( 89@D'TYU+P(D 2( 88P@ 20?
M3G4O B0!; )$@B( < !*@6P$1(%&@"! 80#_;C0(9P)$@"0?3G4O B! <  D
M 6P$1()&@"((; 1$@4: ($!A /]() AG D2!( $D'TYU  !(YP Z)F\ %"!O
M !A#[P <1?H $BQY    !$ZN_?9,WUP 3G46P$YU   #\@   ^D        #
M\@   ^D    @2.<@ BQY    "$SO  8 #$ZN_^),WT $3G4  "\.+'D    (
M(B\ "$ZN_]PL7TYU2.<P BQY    "$SO  X $$ZN_]!,WT ,3G4  "\.+'D 
M   (3J[_RBQ?3G4O#BQY    "$ZN_\0L7TYU+PXL>0    @B+P (3J[_.BQ?
M3G4   /L    !@    $    &    (    #8   !0    8    '         #
M\@   ^D   !++PXL>0    1.KO]\+%].=2\.+'D    $3J[_=BQ?3G4O#BQY
M    !")O  A.KO[:+%].=2\.+'D    $("\ "$ZN_L(L7TYU+PXL>0    0B
M;P (("\ #$ZN_KPL7TYU+PXL>0    0B;P (3J[^GBQ?3G4O#BQY    !")O
M  A.KOZ8+%].=2\.+'D    $(&\ "$ZN_HPL7TYU+PXL>0    0B;P (3J[^
MABQ?3G4O#BQY    !")O  A.KOYB+%].=2\.+'D    $(F\ ""!O  P@+P 0
M3J[^7"Q?3G4O#BQY    !"!O  A,[P(!  PB+P 43J[^1"Q?3G4  "\.+'D 
M   $(F\ "$ZN_CXL7TYU+PXL>0    0B;P (("\ #$ZN_=@L7TYU   #[   
M  X    !    !    !0    D    .    $P   !D    >    (P   "@    
MM    ,@   #D   !!    1@        #\@   ^D    <+PXL>0   ,@@;P (
M3J[_RBQ?3G4O#BQY    R"!O  A.KO^X+%].=2\.+'D   #((&\ "$ZN_S0L
M7TYU+PXL>0   ,A,[P,   A.KO[X+%].=0  2.< (BQY    R$SO!P  #$ZN
M_C),WT0 3G4      ^P    %     P    0    8    +    $    !:    
1     _(   /J         _(%
 
end
-- 
andy finkel		{ihnp4|seismo|allegra}!cbmvax!andy 
Commodore/Amiga		 /or/ pyramid!amiga!andy }

"Do not meddle with the affairs of wizards, for it makes them soggy and hard 
to light."

Any expressed opinions are mine; but feel free to share.
I disclaim all responsibilities, all shapes, all sizes, all colors.

andy@cbmvax.UUCP (04/29/87)

(I need a path to the amiga sources group that works.  That's
 why this is here.  Promise, I won't post another source until
 I figure out a working path...)

(oh, yes, I'm probably going to get comments on my gadget.c file...
 yes, it can easily be done programatically, but I tend to zap
 out lists of gadgets using EMACS MLISP macros when I'm in
 a hurry.  Whatever you're used to, I guess)

(These sources were compiled on Greenhill's C.  You'll probably
 have to fiddle a little bit to make it compile on Manx, and
 to make it compile quietly on Lattice)

Remember our recent discussion on what the printer.device should
be expected to do, and what an application program should be expected
to do ?  (Thought you would)  This program is the result.
(BTW, thanks for the advice, Carolyn)

Basically, once you fire it up it hangs around, waiting for anyone
to do a DUMPRPORT.  It then fires up a requester, and lets you
play with the values being passed in the IORequest block.

How to use:
(from CLI)
run control

this fires it up. It opens the printer.device, and installs itself.

To stop it, either send its process a ^C (using the break command)
or execute it again.

(From Workbench)
give it an Icon.  Double click on its icon.  To stop it, double click
on its icon again.

How it works:
The control program does a SetFunction on the printer.device's BeginIO
and Expunge entry points.  It then checks each IORequest block sent
to the printer.device.  If it finds a DUMPRPORT, it brings up a
window filled with the parameters being passed to the printer.device.
(Parameters are: CMap (pointer to the color map), Mode (your viewmodes),
SrcX, SrcY, SrcWidth, SrcHeight, Destination Columns, Destination Rows,
and the Special Flag (bits from right to left= Density 4, Density 3,
Density 2, Density 1, Aspect, Centering, FracCols, FracRows, FullRows,
FullCols, MilRows, and MilCols))
By using the mouse and keyboard you can play with the paramters
to your hearts content.

Now, some words of warning...it is very possible to pass bad flags,
numbers, etc to the printer.device.  No error checking is done.
(wouldn't want to limit the user :-)  )  So you can crash your
machine, or send the printer device into an infinite loop, or...
(If you want to make it less fun, add the error checking)

Warning #2:  This program takes memory.  Some programs on the
edge may not like this.  Especially as I've disabled the Expunge
of the printer.device while the control program is in operation,
for safety.  Some programs are accustomed to doing an Expunge after
printing (Deluxe Paint II springs to mind).  When the printer.device
refuses to go away, the calling application may get upset.

Warning #3:  The control window comes up on the front screen.
This might get funny on some programs (like DP II) if you fool
with the gadgets too much.  If you plan to adjust dpaint
pictures a lot, you might modify the program to bring the
window up on the workbench screen.

Last thing...note carefully the techniques for unwinding the SetFunction,
and the use of SetFunction on a device.  This can be used for
many other abuses of the system.  Be careful, though...most devices
run as tasks, which means that any code running as part of that task
can't use DOS functions.

This posting will be in 2 parts...first the uuencoded .ld file.
(please check the line lengths before uudecoding;  maybe we'll
 catch the problems that way.  
Lengths are: 
10903 for control.uue (after this README and trailing linefeed are removed)
and 7892 for control.ld.
)

------------------------CUT HERE--------------------------------------------
MAKEFILE=	Makefile
MAKEMETA=	/usr/commodore/amiga/V/tools/makemeta
SUBSYSNAME=	control

MYLIBS=		${LIBDIR}/debug.lib
STARTUP=	${LIBDIR}/startup.obj

CFILES=		control.c gadgets.c
AFILES=		ctrl.asm

OFILES=		control.obj ctrl.obj gadgets.obj

all:		${SUBSYSNAME}.ld

.INCLUDE=${MAKEMETA}
SYMBOLOPT=
------------------------CUT HERE--------------------------------------------
/*********************************************************************/
/*                                                                   */
/*                     Copyright (c) 1987                            */
/*                    Commodore-Amiga, Inc.                          */
/*                    All rights reserved.                           */
/*                                                                   */
/*								     */
/*	Unlimited non-comercial use of this program is given,  	     */
/*	provided this notice is left intact.			     */
/*			andy finkel				     */
/*								     */
/*********************************************************************/


#include "exec/types.h" 
#include "exec/memory.h" 
#include "exec/io.h"
#include "exec/libraries.h"
#include "exec/devices.h"
#include "libraries/dos.h"
#include "devices/printer.h"
#include "intuition/intuition.h"
#include "intuition/intuitionbase.h"
 
#define LVOBeginIO   DEV_BEGINIO
#define LVOExpunge   LIB_EXPUNGE

#define TASKNAME	"PRT-CONTROL"

#define OK 1
#define CANCEL 2
#define NUMBER1 3
#define NUMBER8 10

#define BLUE 0 
#define WHITE 1 
#define BLACK 2 
#define RED 3 

extern struct Task *FindTask();
extern struct Library *OpenLibrary();
extern struct Window *OpenWindow();
extern ULONG SysBase;

extern VOID aBeginIO();  /* The assembler entry */
extern VOID cBeginIO();
extern VOID aExpunge();

extern LONG convert();
extern VOID cputs();

extern struct Menu menus[];
extern struct Gadget CancelGadget;
extern struct Gadget bgadget[];
extern struct Gadget sGadget[];
extern char buffer1[];
extern char buffer2[];
extern char buffer3[];
extern char buffer4[];
extern char buffer5[];
extern char buffer6[];
extern char buffer7[];
extern char buffer8[];

struct IntuitionBase *IntuitionBase=NULL;

LONG  OldBeginIO, NewBeginIO, OldExpunge, NewExpunge;
char *OldName=NULL;;
struct Device *PrtDevice=NULL;
struct MsgPort replyMsgPort;
int WB;

union printerIO {
struct IOStdReq ios;
struct IODRPReq iodrp;
struct IOPrtCmdReq iopc;
} pIO;

struct NewWindow nw = {
        0, 10,        /* starting position (left,top) */
        320,160,        /* width, height */
        BLUE,WHITE,     /* detailpen, blockpen */
         /* idcmp flags */
        GADGETUP,
        /* window gadget flags */
        WINDOWDEPTH|WINDOWDRAG|SMART_REFRESH|ACTIVATE,
        &CancelGadget,  /* pointer to 1st user gadget */
        NULL,           /* pointer to user check */
        "Printer Control V1.0", /* title */
        NULL,           /* pointer to window screen */
        NULL,           /* pointer to super bitmap */
        0,0,  		/* min width, height */
        0,0,        	/* max width, height */
        NULL};

main(argc,argv)
int argc;
char *argv[];
{
    struct Task *task;
    LONG exitStatus=TRUE,file;

    WB=argc;
    Forbid();

    if (task = FindTask(TASKNAME))Signal(task, SIGBREAKF_CTRL_C);
    else {
	if(pOpen()) {
	    cputs("Error! Printer in Use\n");
	    exit(20);
	}
	OldName = (task = FindTask(0) )->tc_Node.ln_Name;
	FindTask(0)->tc_Node.ln_Name = TASKNAME;

   	PrtDevice = (struct Device *)pIO.ios.io_Device;
   	OldBeginIO = SetFunction(PrtDevice, LVOBeginIO, aBeginIO);
	OldExpunge = SetFunction(PrtDevice, LVOExpunge, aExpunge);
	pClose();
	while (exitStatus) {
	    Wait(SIGBREAKF_CTRL_C);
	    NewBeginIO=SetFunction(PrtDevice, LVOBeginIO, OldBeginIO);
	    NewExpunge=SetFunction(PrtDevice, LVOExpunge, OldExpunge);
	    if((NewBeginIO != (LONG)aBeginIO)||(NewExpunge != (LONG)aExpunge)) {
		/* someone else has replaced the vectors ! */
		/* we cannot exit safely now, until the vectors are back */
		SetFunction(PrtDevice, LVOBeginIO, NewBeginIO); /* new ones in */
		SetFunction(PrtDevice, LVOExpunge, NewExpunge); /* new ones in */
		cputs("Error! Can't exit now. Printer Vectors Changed !\n");
	    }
	    else {
	        task->tc_Node.ln_Name = OldName; /* reset the name */
	        exitStatus = FALSE;
	    }
	}
    }
    Permit();
}

VOID
cputs(s)
char *s;
{
LONG file;
	    	
    if(WB)file=Open("*",MODE_OLDFILE);
    else file=Open("CON:10/10/360/40/Error Window",MODE_NEWFILE);
    if(file) Write(file,s,strlen(s));
    if(!WB)Delay(250); /* wait if Workbench */
    Close(file);
}

int
strlen(s)
char *s;
{
   int i = 0;
   while(*s++) i++;
   return(i);
}

int
pOpen()
{
    /* open the printer device */
    if (OpenDevice("printer.device", 0, &pIO, 0))return(1);	

    /* set up the message port in the I/O request */
    replyMsgPort.mp_Node.ln_Type = NT_MSGPORT;
    replyMsgPort.mp_Flags = 0;
    replyMsgPort.mp_SigBit = 0;
    replyMsgPort.mp_SigTask = 0;
    AddPort(&replyMsgPort);
    pIO.ios.io_Message.mn_ReplyPort = &replyMsgPort;
    return(0);
}

pClose()
{
    RemPort(&replyMsgPort);
    CloseDevice(&pIO);
}



/* REMEMBER, THIS CODE RUNS AS PART OF THE PRINTER TASK */
VOID cBeginIO(ior)
union printerIO *ior;
{
struct Window *window;
struct IntuiMessage *message;
struct Gadget *address;

int i,exitStatus=TRUE;
ULONG WakeUpBit=0;

if(ior->ios.io_Command == PRD_DUMPRPORT) {
    sprintf(buffer1,"0x%lx",ior->iodrp.io_ColorMap); /* fill the buffers */
    sprintf(buffer2,"0x%lx",ior->iodrp.io_Modes);
    sprintf(buffer3,"%ld",ior->iodrp.io_SrcX);
    sprintf(buffer4,"%ld",ior->iodrp.io_SrcY);
    sprintf(buffer5,"%ld",ior->iodrp.io_SrcWidth);
    sprintf(buffer6,"%ld",ior->iodrp.io_SrcHeight);
    sprintf(buffer7,"%ld",ior->iodrp.io_DestCols);
    sprintf(buffer8,"%ld",ior->iodrp.io_DestRows);

    for(i=0; i<12; i++) {
	if((ior->iodrp.io_Special)&(1<<i))bgadget[i].Flags |= SELECTED;
	else bgadget[i].Flags &= ~SELECTED;
    }
    if(!(IntuitionBase=
	(struct IntuitionBase *)OpenLibrary("intuition.library",0)))
		exitStatus=0;
    nw.Screen=IntuitionBase->FirstScreen;
    nw.Type = (USHORT)(((struct Screen *)nw.Screen)->Flags & SCREENTYPE);
    if(!(window=OpenWindow(&nw)))exitStatus=0;
    else {
        SetMenuStrip(window, &menus[0]);
        ActivateGadget(&sGadget[0],window,NULL);
    }
    while (exitStatus) {
        WakeUpBit= Wait((1<<window->UserPort->mp_SigBit));
        if(WakeUpBit & (1<<window->UserPort->mp_SigBit)) {
            while(message=(struct IntuiMessage *)GetMsg(window->UserPort)) {
                switch(message->Class) {
                    case GADGETUP:
			address=message->IAddress;
			exitStatus=DoGadget(address->GadgetID,ior,window);
                        ReplyMsg(message);
                        break;
                   default:
                        ReplyMsg(message);
		}
	    }
	}
    }
    if(window) {
	CloseWindow(window);
	ClearMenuStrip(window);
    }
    if(IntuitionBase)CloseLibrary(IntuitionBase);
    for(i=0; i<10000; i++); /* for dpaint */
}
}

DoGadget(id,ior,window)
LONG id;
union printerIO *ior;
struct Window *window;
{

int i;

    if(id == CANCEL) return(0);
    if(id == OK) {
	ior->iodrp.io_ColorMap = (struct ColorMap *)convert(buffer1);
	ior->iodrp.io_Modes = convert(buffer2);
	ior->iodrp.io_SrcX = convert(buffer3);
	ior->iodrp.io_SrcY = convert(buffer4);
	ior->iodrp.io_SrcWidth = convert(buffer5);
	ior->iodrp.io_SrcHeight = convert(buffer6);
	ior->iodrp.io_DestCols = convert(buffer7);
	ior->iodrp.io_DestRows = convert(buffer8);
	ior->iodrp.io_Special = 0;
        for(i=0; i<12; i++) {
	    if(bgadget[i].Flags&SELECTED)ior->iodrp.io_Special += (1<<i);
	}
	return(0); /* and exit */
    }
     if( (id>=NUMBER1) && (id<=NUMBER8)) { /* activate next string gadget */
	ActivateGadget(&sGadget[(id-NUMBER1+1)&7],window,NULL);
    }
    return(TRUE); /* keep going */
}

LONG
convert(buffer)
UBYTE *buffer;
{
UBYTE *point=buffer,c;
LONG sign=1,mult=10,value=0;	/* assume decimal */

while( (c= *point++)) {
     if(c=='x') {
	mult=16; /* oops, hex, start again */
	value=0;
     }
     else if(c=='-') {
	value=0; /* start again */
	sign = -1;
     }
     else if( ((c>='0') && (c <= '9')) || ((c>='A') && (c <= 'F'))) {
	    value *= mult;
	    value += ( (c>='0') && (c <= '9')) ? c-'0' : c - 'A' + 10;
     }
}
return(value*sign);
}
------------------------CUT HERE--------------------------------------------
*   cmda.asm  --- assembler interface for BeginIO fooling around

   INCLUDE   'exec/types.i'
   INCLUDE	'my-macros.i'

   XREF   _OldBeginIO
   XREF   _cBeginIO
   XDEF   _aBeginIO
   XDEF   _aExpunge

   CODE

_aBeginIO:
   movem.l d0-d7/a0-a6,-(SP)         ;save registers
   move.l  a1,-(SP)            ;push ptr to io request
   jsr     _cBeginIO
   ADDQ.L  #4,SP
   movem.l (SP)+,d0-d7/a0-a6         ;restore registers
   move.l  _OldBeginIO,a0      ;continue to real BeginIO
   jmp     (a0)

_aExpunge:
   MOVEQ   #0,D0 ;not this baby! 
   rts		

   END

  

------------------------CUT HERE--------------------------------------------
/*********************************************************************/
/*                                                                   */
/*                     Copyright (c) 1987                            */
/*                    Commodore-Amiga, Inc.                          */
/*                    All rights reserved.                           */
/*                                                                   */
/*                                                                   */
/*      Unlimited non-comercial use of this program is given,        */
/*      provided this notice is left intact.                         */
/*                      andy finkel                                  */
/*                                                                   */
/*********************************************************************/

#include "exec/types.h"
#include "intuition/intuition.h"

#define OK 1
#define CANCEL 2
#define NUMBER1 3
#define NUMBER2 4
#define NUMBER3 5
#define NUMBER4 6
#define NUMBER5 7
#define NUMBER6 8
#define NUMBER7 9
#define NUMBER8 10

#define BNUMBER0 12
#define BNUMBER1 13
#define BNUMBER2 14
#define BNUMBER3 15
#define BNUMBER4 16
#define BNUMBER5 17
#define BNUMBER6 18
#define BNUMBER7 19
#define BNUMBER8 20
#define BNUMBER9 21
#define BNUMBER10 22
#define BNUMBER11 23

#define BLUE 0 
#define WHITE 1 
#define BLACK 2 
#define RED 3 


#define INPUTWIDTH 80
#define INPUTHEIGHT 10
#define OKWIDTH 20
#define OKHEIGHT 10
#define CANCELWIDTH 52
#define CANCELHEIGHT 10
#define BITWIDTH 16
#define BITHEIGHT 10

char buffer1[10];
char buffer2[10];
char buffer3[10];
char buffer4[10];
char buffer5[10];
char buffer6[10];
char buffer7[10];
char buffer8[10];
char ubuffer1[10];
char ubuffer2[10];
char ubuffer3[10];
char ubuffer4[10];
char ubuffer5[10];
char ubuffer6[10];
char ubuffer7[10];
char ubuffer8[10];

SHORT Inputxys[] = { /* String input gadget xy pairs */
        0,0,
        INPUTWIDTH+1,0,
        INPUTWIDTH+1,INPUTHEIGHT,
        0,INPUTHEIGHT,
        0,0
};

struct Border InputBorder = { /* border for String input gadget */
        -1,-1,                          /* left,top */
        WHITE,RED,JAM1, /* front,back,drawmode */
        5,                                              /* # of xy pairs */
        Inputxys,                                /* array of xy pairs */
        NULL                      /* ptr to another border */
};

SHORT Okxys[] = { /* OK gadget xy pairs */
        0,0,
        OKWIDTH+1,0,
        OKWIDTH+1,OKHEIGHT+1,
        0,OKHEIGHT+1,
        0,0
};

struct Border OkBorder = {      /* border for OK gadget */
        -1,-1,                  /* left,top */
        WHITE,BLACK,JAM1,       /* front,back,drawmode */
        5,                      /* # of xy pairs */
        Okxys,                  /* array of xy pairs */
        NULL                    /* ptr to another border */
};

SHORT Cancelxys[] = { /* CANCAL gadget xy pairs */
        0,0,
        CANCELWIDTH+1,0,
        CANCELWIDTH+1,CANCELHEIGHT+1,
        0,CANCELHEIGHT+1,
        0,0
};

struct Border CancelBorder = {  /* border for CANCEL gadget */
        -1,-1,                  /* left,top */
        WHITE,RED,JAM1,         /* front,back,drawmode */
        5,                      /* # of xy pairs */
        Cancelxys,              /* array of xy pairs */
        NULL                    /* ptr to another border */
};

SHORT Bitxys[] = { /* bit gadget xy pairs */
        0,0,
        BITWIDTH+1,0,
        BITWIDTH+1,BITHEIGHT+1,
        0,BITHEIGHT+1,
        0,0
};

struct Border BitBorder = {  /* border for bit gadget */
        -1,-1,                  /* left,top */
        WHITE,RED,JAM1,         /* front,back,drawmode */
        5,                      /* # of xy pairs */
        Bitxys,              /* array of xy pairs */
        NULL                    /* ptr to another border */
};

struct StringInfo       field1 = {
        buffer1,     /* buffer */
        ubuffer1,    /* undo buffer */
        7,              /* char posn in buffer */
        8,	        /* max # of chars */
};

struct StringInfo       field2 = {
        buffer2,     /* buffer */
        buffer2,    /* undo buffer */
        7,              /* char posn in buffer */
        8,	        /* max # of chars */
};
struct StringInfo       field3 = {
        buffer3,     /* buffer */
        ubuffer3,    /* undo buffer */
        7,              /* char posn in buffer */
        8,	        /* max # of chars */
};
struct StringInfo       field4 = {
        buffer4,     /* buffer */
        ubuffer4,    /* undo buffer */
        7,              /* char posn in buffer */
        8,	        /* max # of chars */
};
struct StringInfo       field5 = {
        buffer5,     /* buffer */
        ubuffer5,    /* undo buffer */
        7,              /* char posn in buffer */
        8,	        /* max # of chars */
};
struct StringInfo       field6 = {
        buffer6,     /* buffer */
        ubuffer6,    /* undo buffer */
        7,              /* char posn in buffer */
        8,	        /* max # of chars */
};
struct StringInfo       field7 = {
        buffer7,     /* buffer */
        ubuffer7,    /* undo buffer */
        7,              /* char posn in buffer */
        8,	        /* max # of chars */
};
struct StringInfo       field8 = {
        buffer8,     /* buffer */
        ubuffer8,    /* undo buffer */
        7,              /* char posn in buffer */
        8,	        /* max # of chars */
};

struct IntuiText text1 = {
	WHITE,RED,JAM1,-50,0,0,"CMap:",NULL};
struct IntuiText text2 = {
	WHITE,RED,JAM1,-50,0,0,"Mode:",NULL};
struct IntuiText text3 = {
	WHITE,RED,JAM1,-50,0,0,"SrcX:",NULL};
struct IntuiText text4 = {
	WHITE,RED,JAM1,-50,0,0,"SrcY:",NULL};
struct IntuiText text5 = {
	WHITE,RED,JAM1,-50,0,0,"SrcW:",NULL};
struct IntuiText text6 = {
	WHITE,RED,JAM1,-50,0,0,"SrcH:",NULL};
struct IntuiText text7 = {
	WHITE,RED,JAM1,-50,0,0,"DCol:",NULL};
struct IntuiText text8 = {
	WHITE,RED,JAM1,-50,0,0,"DRow:",NULL};

struct IntuiText btext0 = {
	WHITE,RED,JAM1,0,0,0,"MC",NULL};
struct IntuiText btext1 = {
	WHITE,RED,JAM1,0,0,0,"MR",NULL};
struct IntuiText btext2 = {
	WHITE,RED,JAM1,0,0,0,"FC",NULL};
struct IntuiText btext3 = {
	WHITE,RED,JAM1,0,0,0,"FR",NULL};
struct IntuiText btext4 = {
	WHITE,RED,JAM1,0,0,0,"FR",NULL};
struct IntuiText btext5 = {
	WHITE,RED,JAM1,0,0,0,"FC",NULL};
struct IntuiText btext6 = {
	WHITE,RED,JAM1,0,0,0,"CE",NULL};
struct IntuiText btext7 = {
	WHITE,RED,JAM1,0,0,0,"AS",NULL};
struct IntuiText btext8 = {
	WHITE,RED,JAM1,0,0,0,"D1",NULL};
struct IntuiText btext9 = {
	WHITE,RED,JAM1,0,0,0,"D2",NULL};
struct IntuiText btext10 = {
	WHITE,RED,JAM1,0,0,0,"D3",NULL};
struct IntuiText btext11 = {
	WHITE,RED,JAM1,-48,0,0,"Spec: D4",NULL};

struct IntuiText OKText = {
	WHITE,RED,JAM1,2,0,0,"OK",NULL};
struct IntuiText CancelText = {
	WHITE,RED,JAM1,2,0,0,"CANCEL",NULL};

struct Gadget sGadget[] = {    /* the input gadget */
{
        NULL,                   	/* ptr to next gadget */
        60,20,INPUTWIDTH,INPUTHEIGHT,   /* left,top,width,height */
        GADGHCOMP,     			/* Gadet_Flags */
        RELVERIFY,              	/* Activation Flag */
        STRGADGET,    			/* gadget type */
        &InputBorder,         		/* gadget render */
        NULL,                   	/* select render */
        &text1,                 	/* text for input prompt */
        0,                      	/* mutual exclude */
        &field1,	       	 	/* special info */
        NUMBER1,                   	/* ID */
        NULL                    	/* UserData */
},
{
        &sGadget[0],                   	/* ptr to next gadget */
        60,30,INPUTWIDTH,INPUTHEIGHT,   /* left,top,width,height */
        GADGHCOMP,			/* Gadet_Flags */
        RELVERIFY,              	/* Activation Flag */
        STRGADGET,    			/* gadget type */
        &InputBorder,         		/* gadget render */
        NULL,                   	/* select render */
        &text2,                 	/* text for input prompt */
        0,                      	/* mutual exclude */
        &field2,	        	/* special info */
        NUMBER2,                   	/* ID */
        NULL                    	/* UserData */
},
{
        &sGadget[1],                   	/* ptr to next gadget */
        60,40,INPUTWIDTH,INPUTHEIGHT,   /* left,top,width,height */
        GADGHCOMP,     			/* GadetFlags */
        RELVERIFY,              	/* Activation Flag */
        STRGADGET,    			/* gadget type */
        &InputBorder,         		/* gadget render */
        NULL,                   	/* select render */
        &text3,                 	/* text for input prompt */
        0,                      	/* mutual exclude */
        &field3,	        	/* special info */
        NUMBER3,                   	/* ID */
        NULL                    	/* UserData */
},
{
        &sGadget[2],                   	/* ptr to next gadget */
        60,50,INPUTWIDTH,INPUTHEIGHT,   /* left,top,width,height */
        GADGHCOMP,     			/* Gadget Flags */
        RELVERIFY,              	/* Activation Flag */
        STRGADGET,    			/* gadget type */
        &InputBorder,         		/* gadget render */
        NULL,                   	/* select render */
        &text4,                 	/* text for input prompt */
        0,                      	/* mutual exclude */
        &field4,	        	/* special info */
        NUMBER4,                   	/* ID */
        NULL                    	/* UserData */
},
{
        &sGadget[3],                   	/* ptr to next gadget */
        60,60,INPUTWIDTH,INPUTHEIGHT,   /* left,top,width,height */
        GADGHCOMP,     			/* Gadget Flags */
        RELVERIFY,              	/* Activation Flag */
        STRGADGET,    			/* gadget type */
        &InputBorder,         		/* gadget render */
        NULL,                   	/* select render */
        &text5,                 	/* text for input prompt */
        0,                   	   	/* mutual exclude */
        &field5,	        	/* special info */
        NUMBER5,                   	/* ID */
        NULL                    	/* UserData */
},
{
        &sGadget[4],                   	/* ptr to next gadget */
        60,70,INPUTWIDTH,INPUTHEIGHT,   /* left,top,width,height */
        GADGHCOMP,     			/* Gadget Flags */
        RELVERIFY,              	/* Activation Flag */
        STRGADGET,    			/* gadget type */
        &InputBorder,         		/* gadget render */
        NULL,                   	/* select render */
        &text6,                 	/* text for input prompt */
        0,                      	/* mutual exclude */
        &field6,	        	/* special info */
        NUMBER6,                   	/* ID */
        NULL                    	/* UserData */
},
{
        &sGadget[5],                   	/* ptr to next gadget */
        60,80,INPUTWIDTH,INPUTHEIGHT,   /* left,top,width,height */
        GADGHCOMP,     			/* Gadget Flags */
        RELVERIFY,             	 	/* Activation Flag */
        STRGADGET,    			/* gadget type */
        &InputBorder,         		/* gadget render */
        NULL,                   	/* select render */
        &text7,                 	/* text for input prompt */
        0,                      	/* mutual exclude */
        &field7,	        	/* special info */
        NUMBER7,                   	/* ID */
        NULL                    	/* UserData */
},
{
        &sGadget[6],                   	/* ptr to next gadget */
        60,90,INPUTWIDTH,INPUTHEIGHT,   /* left,top,width,height */
        GADGHCOMP,     			/* Gadget Flags */
        RELVERIFY,              	/* Activation Flag */
        STRGADGET,    			/* gadget type */
        &InputBorder,         		/* gadget render */
        NULL,                   	/* select render */
        &text8,                 	/* text for input prompt */
        0,                      	/* mutual exclude */
        &field8,	        	/* special info */
        NUMBER8,                   	/* ID */
        NULL                    	/* UserData */
}
};

struct Gadget bgadget[] = {    		/* the bit gadgets */
{
        &sGadget[7],                    /* ptr to next gadget */
        258,110,BITWIDTH,BITHEIGHT,     /* left,top,width,height */
        GADGHCOMP,            		/* Gadget Flags */
        RELVERIFY|TOGGLESELECT,    	/* Activation Flag */
        BOOLGADGET,    			/* gadget type */
        &BitBorder,         		/* gadget render */
        NULL,                   	/* select render */
        &btext0,                 	/* text for input prompt */
        0,                      	/* mutual exclude */
        NULL,	        		/* special info */
        BNUMBER0,                   	/* ID */
        NULL                    	/* UserData */
},
{
        &bgadget[0],                   	/* ptr to next gadget */
        240,110,BITWIDTH,BITHEIGHT,     /* left,top,width,height */
        GADGHCOMP,            		/* Gadget Flags */
        RELVERIFY|TOGGLESELECT,    	/* Activation Flag */
        BOOLGADGET,    			/* gadget type */
        &BitBorder,         		/* gadget render */
        NULL,                   	/* select render */
        &btext1,                 	/* text for input prompt */
        0,                      	/* mutual exclude */
        NULL,	        		/* special info */
        BNUMBER1,                   	/* ID */
        NULL                    	/* UserData */
},
{
        &bgadget[1],                    /* ptr to next gadget */
        222,110,BITWIDTH,BITHEIGHT,     /* left,top,width,height */
        GADGHCOMP,            		/* Gadget Flags */
        RELVERIFY|TOGGLESELECT,    	/* Activation Flag */
        BOOLGADGET,    			/* gadget type */
        &BitBorder,         		/* gadget render */
        NULL,                   	/* select render */
        &btext2,                 	/* text for input prompt */
        0,                      	/* mutual exclude */
        NULL,	        		/* special info */
        BNUMBER2,                   	/* ID */
        NULL                    	/* UserData */
},
{
        &bgadget[2],                    /* ptr to next gadget */
        204,110,BITWIDTH,BITHEIGHT,     /* left,top,width,height */
        GADGHCOMP,            		/* Gadget Flags */
        RELVERIFY|TOGGLESELECT,    	/* Activation Flag */
        BOOLGADGET,    			/* gadget type */
        &BitBorder,         		/* gadget render */
        NULL,                   	/* select render */
        &btext3,                 	/* text for input prompt */
        0,                      	/* mutual exclude */
        NULL,	        		/* special info */
        BNUMBER3,                   	/* ID */
        NULL                    	/* UserData */
},
{
        &bgadget[3],                   	/* ptr to next gadget */
        186,110,BITWIDTH,BITHEIGHT,     /* left,top,width,height */
        GADGHCOMP,            		/* Gadget Flags */
        RELVERIFY|TOGGLESELECT,    	/* Activation Flag */
        BOOLGADGET,    			/* gadget type */
        &BitBorder,         		/* gadget render */
        NULL,                   	/* select render */
        &btext4,                 	/* text for input prompt */
        0,                      	/* mutual exclude */
        NULL,	        		/* special info */
        BNUMBER4,                   	/* ID */
        NULL                    	/* UserData */
},
{
        &bgadget[4],                   	/* ptr to next gadget */
        168,110,BITWIDTH,BITHEIGHT,     /* left,top,width,height */
        GADGHCOMP,            		/* Gadget Flags */
        RELVERIFY|TOGGLESELECT,    	/* Activation Flag */
        BOOLGADGET,    			/* gadget type */
        &BitBorder,         		/* gadget render */
        NULL,                   	/* select render */
        &btext5,                 	/* text for input prompt */
        0,                      	/* mutual exclude */
        NULL,	        		/* special info */
        BNUMBER5,                   	/* ID */
        NULL                    	/* UserData */
},
{
        &bgadget[5],                   	/* ptr to next gadget */
        150,110,BITWIDTH,BITHEIGHT,     /* left,top,width,height */
        GADGHCOMP,            		/* Gadget Flags */
        RELVERIFY|TOGGLESELECT,    	/* Activation Flag */
        BOOLGADGET,    			/* gadget type */
        &BitBorder,         		/* gadget render */
        NULL,                   	/* select render */
        &btext6,                 	/* text for input prompt */
        0,                      	/* mutual exclude */
        NULL,	        		/* special info */
        BNUMBER6,                   	/* ID */
        NULL                    	/* UserData */
},
{
        &bgadget[6],                   	/* ptr to next gadget */
        132,110,BITWIDTH,BITHEIGHT,     /* left,top,width,height */
        GADGHCOMP,            		/* Gadget Fllags */
        RELVERIFY|TOGGLESELECT,    	/* Activation Flag */
        BOOLGADGET,    			/* gadget type */
        &BitBorder,         		/* gadget render */
        NULL,                   	/* select render */
        &btext7,                 	/* text for input prompt */
        0,                      	/* mutual exclude */
        NULL,	        		/* special info */
        BNUMBER7,                   	/* ID */
        NULL                    	/* UserData */
},
{
        &bgadget[7],                   	/* ptr to next gadget */
        114,110,BITWIDTH,BITHEIGHT,     /* left,top,width,height */
        GADGHCOMP,            		/* Gadget Fllags */
        RELVERIFY|TOGGLESELECT,    	/* Activation Flag */
        BOOLGADGET,    			/* gadget type */
        &BitBorder,         		/* gadget render */
        NULL,                   	/* select render */
        &btext8,                 	/* text for input prompt */
        0,                      	/* mutual exclude */
        NULL,	        		/* special info */
        BNUMBER8,                   	/* ID */
        NULL                    	/* UserData */
},
{
        &bgadget[8],                   	/* ptr to next gadget */
        96,110,BITWIDTH,BITHEIGHT,     	/* left,top,width,height */
        GADGHCOMP,            		/* Gadget Fllags */
        RELVERIFY|TOGGLESELECT,    	/* Activation Flag */
        BOOLGADGET,    			/* gadget type */
        &BitBorder,         		/* gadget render */
        NULL,                   	/* select render */
        &btext9,                 	/* text for input prompt */
        0,                      	/* mutual exclude */
        NULL,	        		/* special info */
        BNUMBER9,                   	/* ID */
        NULL                    	/* UserData */
},
{ 
        &bgadget[9],                   	/* ptr to next gadget */
        78,110,BITWIDTH,BITHEIGHT,     	/* left,top,width,height */
        GADGHCOMP,            		/* Gadget Fllags */
        RELVERIFY|TOGGLESELECT,    	/* Activation Flag */
        BOOLGADGET,    			/* gadget type */
        &BitBorder,         		/* gadget render */
        NULL,                   	/* select render */
        &btext10,                 	/* text for input prompt */
        0,                      	/* mutual exclude */
        NULL,	        		/* special info */
        BNUMBER10,                   	/* ID */
        NULL                    	/* UserData */
},
{
        &bgadget[10],                   /* ptr to next gadget */
        60,110,BITWIDTH,BITHEIGHT,     	/* left,top,width,height */
        GADGHCOMP,            		/* Gadget Fllags */
        RELVERIFY|TOGGLESELECT,    	/* Activation Flag */
        BOOLGADGET,    			/* gadget type */
        &BitBorder,         		/* gadget render */
        NULL,                   	/* select render */
        &btext11,                 	/* text for input prompt */
        0,                      	/* mutual exclude */
        NULL,	        		/* special info */
        BNUMBER11,                   	/* ID */
        NULL                    	/* UserData */
}
};


struct Gadget OKGadget = {
        &bgadget[11]
        256,140,OKWIDTH,OKHEIGHT, 	/* left,top,width,height */
        GADGHCOMP,              	/* Gadget Flags */
        RELVERIFY|ENDGADGET,    	/* Activation flag */
        BOOLGADGET,   			/* gadget type */
        &OkBorder,              	/* gadget render */
        NULL,                   	/* select render */
        &OKText,
        0,                      	/* mutual exclude */
        NULL,                   	/* special info */
        OK,                     	/* ID */
        NULL                    	/* UserData */
};

struct Gadget CancelGadget = {
        &OKGadget,
        160,140,CANCELWIDTH,CANCELHEIGHT, 	/* left,top,width,height */
        GADGHCOMP,              		/* Gadget Flags */
        RELVERIFY|ENDGADGET,    		/* Activation flag */
        BOOLGADGET,   				/* gadget type */
        &CancelBorder,              		/* gadget render */
        NULL,                   		/* select render */
        &CancelText
        0,                      		/* mutual exclude */
        NULL,                   		/* special info */
        CANCEL,                 		/* ID */
        NULL                    		/* UserData */
};

struct IntuiText projectext[] = {
  {
    BLUE, WHITE, JAM2,  	/* FrontPen, BackPen, DrawMode */
    0, 20,               	/* LeftEdge, TopEdge */
    NULL,               	/* ITextFont */
    "\251 1987 Commodore",  	/* IText */
    NULL        		/* NextText */
  },
  {
    BLUE, WHITE, JAM2,  	/* FrontPen, BackPen, DrawMode */
    0, 10,               	/* LeftEdge, TopEdge */
    NULL,               	/* ITextFont */
    "By Andy Finkel",   	/* IText */
    &projectext[0]      	/* NextText */
  }
  {
    BLUE, WHITE, JAM2,  	/* FrontPen, BackPen, DrawMode */
    0, 0,               	/* LeftEdge, TopEdge */
    NULL,               	/* ITextFont */
    "Printer Driver Control",   /* IText */
    &projectext[1]      	/* NextText */
  }
};

struct MenuItem projectitems[] = {
  { 
    NULL,           		/* next item */
    0, 0, 180, 30,      	/* LeftEdge, TopEdge, Width, Height */
    ITEMENABLED | ITEMTEXT | HIGHCOMP,
    0,                  	/* mutual exclude */
    (APTR)&projectext[2],	/* ItemFill */
    NULL,               	/* SelectFill */
    NULL,               	/* Command */
    NULL,               	/* SubItem */
    NULL                	/* NextSelect */
  }
};

struct Menu menus[] = {
  {
    NULL                /* next menu */
    10+0, 0, 100, 0,    /* LeftEdge, TopEdge, Width, Height */
    MENUENABLED,        /* flags */
    "About",          	/* name */
    projectitems        /* first item */
  },
};

-- 
andy finkel		{ihnp4|seismo|allegra}!cbmvax!andy 
Commodore/Amiga		 /or/ pyramid!amiga!andy }

"Do not meddle with the affairs of wizards, for it makes them soggy and hard 
to light."

Any expressed opinions are mine; but feel free to share.
I disclaim all responsibilities, all shapes, all sizes, all colors.