home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / cprog / newprt10.zip / NEWPRINT.CPP < prev    next >
C/C++ Source or Header  |  1992-02-17  |  2KB  |  88 lines

  1. /*(C) Copyright Roger Bedell - Sylvan Ascent 1990 - 92. All rights reserved.*/
  2. //second try at a printer handler
  3. //This one will only print in 180X180 for 24 pin,
  4. //300dpi for lazerjets
  5. //tbd for 9 pin dot matrix
  6. //uses dithering for PCX files
  7. //re Steve Rimmers book "Bit mapped graphics"
  8.  
  9. //associated files are graffile.cpp and hpp which have
  10. //the object definition of the graphics file
  11. //and grafprnt.cpp and hpp which define the graphics
  12. //printer objects for the various printer types
  13.  
  14.  
  15. #include "time.h"
  16. #include "stdlib.h"
  17. #include "stdio.h"
  18. #include "string.h"
  19. #include "io.h"
  20. #include "grafprnt.hpp"
  21. #include "graffile.hpp"
  22. #include "mem.h"
  23. #include "conio.h"
  24.  
  25. main (int argc, char * argv[])
  26. {
  27.     if(argc < 2)
  28.     {
  29. #ifdef STANDALONE
  30.         printf("Usage: newprint filename printer_type.\n");
  31.         printf("Filename must have .pcx extension eg. map.pcx\n");
  32.         printf("Printer_type can be one of: EP24 for 24 pin epson\n");
  33.         printf("HP300 for lazerjet at 300dpi\n");
  34. #endif
  35.         exit(0);
  36.     }
  37. #ifdef STANDALONE
  38.     printf("Program (c) Copyright 1991 Roger Bedell.\n");
  39. #endif
  40.  
  41.     if(strcmp("EP24", argv[2]) == 0 || strcmp("ep24", argv[2]) == 0)
  42.     {
  43.         graphics_printer::set_printer_type(1);
  44.     }
  45.     else if(strcmp("HP300", argv[2]) == 0 || strcmp("hp300", argv[2]) == 0)
  46.     {
  47.         graphics_printer::set_printer_type(2);
  48.     }
  49.     else
  50.     {
  51. #ifdef STANDALONE
  52.         printf("Must select EP24 or HP300 as second parameter.\n");
  53. #endif
  54.         exit (0);
  55.     }
  56.     pcx_graphics_file test_file(argv[1]);
  57.     test_file . print_file();
  58.     return 0;
  59. }
  60.  
  61.  
  62. //generic error routine
  63. int error_message(char *message, int fatal_or_nonfatal)
  64. {
  65. #ifdef STANDALONE
  66.     printf(message);
  67. #endif
  68.     return 0;
  69. }
  70.  
  71.  
  72. int check_for_user_input(void); //external function for allowing user abort
  73.  
  74. //DOS check for input routine
  75. //checks for a user abort of printing
  76. int check_for_user_input(void)
  77. {
  78.     if(kbhit())
  79.     {
  80.         return 1;
  81.     }
  82.     else
  83.     {
  84.         return 0;
  85.     }
  86. }
  87.  
  88.