updated on Wed Jan 25 12:16:47 UTC 2012
[aur-mirror.git] / lm1100 / a4_page.patch
blob53f36d627d5c16156c0443cb96504b25c10267ba
1 diff -pru a/LexmarkProtocol300c.cc b/LexmarkProtocol300c.cc
2 --- a/LexmarkProtocol300c.cc 2006-07-02 17:04:36.000000000 +0400
3 +++ b/LexmarkProtocol300c.cc 2006-06-25 12:47:32.000000000 +0400
4 @@ -59,6 +59,9 @@ Rect LexmarkProtocol300c::getPageSize(in
5 if(pageType == LETTER_PAGE)
6 //300x300 dpi 8 1/2 x 11 inch page
7 return Rect(0,0,2550,3300);
8 + if(pageType == A4_PAGE)
9 + //300x300 dpi 8.3 x 11.7 inch page
10 + return Rect(0,0,2490,3510);
12 die("Bad page type %d",pageType);
13 return Rect();
14 diff -pru a/LexmarkProtocolBW.cc b/LexmarkProtocolBW.cc
15 --- a/LexmarkProtocolBW.cc 2006-07-02 17:04:36.000000000 +0400
16 +++ b/LexmarkProtocolBW.cc 2006-07-02 17:01:11.000000000 +0400
17 @@ -58,6 +58,9 @@ Rect LexmarkProtocolBW::getPageSize(int
18 if(pageType == LETTER_PAGE)
19 //300x300 dpi 8 1/2 x 11 inch page
20 return Rect(0,0,2550,3300);
21 + if(pageType == A4_PAGE)
22 + //300x300 dpi 8.3 x 11.7 inch page
23 + return Rect(0,0,2490,3510);
25 die("Bad page type %d",pageType);
26 return Rect();
27 diff -pru a/PrinterProtocol.h b/PrinterProtocol.h
28 --- a/PrinterProtocol.h 2000-11-21 11:06:22.000000000 +0300
29 +++ b/PrinterProtocol.h 2006-06-24 12:40:50.000000000 +0400
30 @@ -2,5 +2,6 @@
31 #define _PRINTER_PROTOCOL_H
33 #define LETTER_PAGE 1
34 +#define A4_PAGE 2
36 #endif
37 diff -pru a/main.cc b/main.cc
38 --- a/main.cc 2000-11-21 11:06:22.000000000 +0300
39 +++ b/main.cc 2006-06-24 13:33:39.000000000 +0400
40 @@ -34,18 +34,19 @@ Foundation, Inc., 59 Temple Place - Suit
42 #define SPONGE_BUF 512000
44 -static void print(FILE *fp, SpongeWriter *sp, bool blackwhite, int brightness);
45 +static void print(FILE *fp, SpongeWriter *sp, bool blackwhite, int brightness, int pagesize);
48 int main(int argc, char *argv[])
50 - if(argc < 2 || argc >5)
51 + if(argc < 2 || argc >7)
53 die("Usage: %s [-bw] [-b value] <ppm/pbm raw file|->\n -bw black and white cartridge printing\n -b brightness value 0-255 defaults to 255. Less brightness = more ink\n",argv[0]);
56 bool blackwhite = false;
57 int brightness = 255;
58 + int pagesize = LETTER_PAGE;
59 int file_index = 0;
61 while(++file_index < argc -1)
62 @@ -54,6 +55,14 @@ int main(int argc, char *argv[])
63 blackwhite = true;
64 else if(strcmp(argv[file_index],"-b") == 0)
65 brightness = atoi(argv[++file_index]);
66 + else if(strcmp(argv[file_index++],"-p") == 0){
67 + if(strcmp(argv[file_index],"letter") == 0)
68 + pagesize = LETTER_PAGE;
69 + else if(strcmp(argv[file_index],"a4") == 0)
70 + pagesize = A4_PAGE;
71 + else
72 + die("Invalid page size `%s`\n",argv[++file_index]);
73 + }
76 SpongeWriter sp(SPONGE_BUF,1);
77 @@ -67,7 +76,7 @@ int main(int argc, char *argv[])
78 if(fd == NULL)
79 die("Couldn't open %s for reading\n",argv[file_index]);
81 - print(fd,&sp,blackwhite,brightness);
82 + print(fd,&sp,blackwhite,brightness,pagesize);
84 else {
85 // reading from stdin, accept as many images that are sent
86 @@ -78,12 +87,12 @@ int main(int argc, char *argv[])
87 break;
88 ungetc(c,stdin);
90 - print(stdin,&sp,blackwhite,brightness);
91 + print(stdin,&sp,blackwhite,brightness,pagesize);
96 -void print(FILE *fd,SpongeWriter *sp,bool blackwhite, int brightness)
97 +void print(FILE *fd,SpongeWriter *sp,bool blackwhite, int brightness, int pagesize)
99 Reader r(fd,false);
100 char buffer[255];
101 @@ -105,7 +114,7 @@ void print(FILE *fd,SpongeWriter *sp,boo
102 p = new LexmarkProtocol300c(sp);
104 //get the page size
105 - Rect pageSize = p->getPageSize(LETTER_PAGE);
106 + Rect pageSize = p->getPageSize(pagesize);
108 Head h(&m,p, &pageSize);