home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 5 / FreshFish_July-August1994.bin / bbs / dev / rkrm.lha / RKRM / Printer / epsonx / density.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-09-03  |  2.6 KB  |  66 lines

  1. /*
  2.  * Copyright (c) 1992 Commodore-Amiga, Inc.
  3.  * 
  4.  * This example is provided in electronic form by Commodore-Amiga, Inc. for 
  5.  * use with the "Amiga ROM Kernel Reference Manual: Devices", 3rd Edition, 
  6.  * published by Addison-Wesley (ISBN 0-201-56775-X).
  7.  * 
  8.  * The "Amiga ROM Kernel Reference Manual: Devices" contains additional 
  9.  * information on the correct usage of the techniques and operating system 
  10.  * functions presented in these examples.  The source and executable code 
  11.  * of these examples may only be distributed in free electronic form, via 
  12.  * bulletin board or as part of a fully non-commercial and freely 
  13.  * redistributable diskette.  Both the source and executable code (including 
  14.  * comments) must be included, without modification, in any copy.  This 
  15.  * example may not be published in printed form or distributed with any
  16.  * commercial product.  However, the programming techniques and support
  17.  * routines set forth in these examples may be used in the development
  18.  * of original executable software products for Commodore Amiga computers.
  19.  * 
  20.  * All other rights reserved.
  21.  * 
  22.  * This example is provided "as-is" and is subject to change; no
  23.  * warranties are made.  All use is at your own risk. No liability or
  24.  * responsibility is assumed.
  25.  *
  26.  *****************************************************************************
  27.  *
  28.  *
  29.  *       Density module for EpsonX driver.
  30.  */
  31.  
  32. #include <exec/types.h>
  33. #include "devices/printer.h"
  34. #include "devices/prtbase.h"
  35.  
  36. SetDensity(density_code)
  37. ULONG density_code;
  38. {
  39.         extern struct PrinterData *PD;
  40.         extern struct PrinterExtendedData *PED;
  41.  
  42.         /* SPECIAL_DENSITY     0    1    2    3    4    5    6    7 */
  43.         static int XDPI[8] = {120, 120, 120, 240, 120, 240, 240, 240};
  44.         static int YDPI[8] = {72, 72, 144, 72, 216, 144, 216, 216};
  45.         static char codes[8] = {'L', 'L', 'L', 'Z', 'L', 'Z', 'Z', 'Z'};
  46.  
  47.         PED->ped_MaxColumns =
  48.                 PD->pd_Preferences.PaperSize == W_TRACTOR ? 136 : 80;
  49.         density_code /= SPECIAL_DENSITY1;
  50.         /* default is 80 chars (8.0 in.), W_TRACTOR is 136 chars (13.6 in.) */
  51.         PED->ped_MaxXDots =
  52.                 (XDPI[density_code] * PED->ped_MaxColumns) / 10;
  53.         PED->ped_XDotsInch = XDPI[density_code];
  54.         PED->ped_YDotsInch = YDPI[density_code];
  55.         if ((PED->ped_YDotsInch = YDPI[density_code]) == 216) {
  56.                 PED->ped_NumRows = 24;
  57.         }
  58.         else if (PED->ped_YDotsInch == 144) {
  59.                 PED->ped_NumRows = 16;
  60.         }
  61.         else {
  62.                 PED->ped_NumRows = 8;
  63.         }
  64.         return((int)codes[density_code]);
  65. }
  66.