1
0
mirror of https://github.com/pdewacht/brlaser synced 2024-12-26 15:38:20 +01:00

Merge remote-tracking branch 'xc-racer99/master'

This commit is contained in:
Peter De Wachter 2017-10-14 21:40:58 +02:00
commit 69cc0bfcc7
4 changed files with 17 additions and 7 deletions

View File

@ -33,7 +33,6 @@ Filter application/vnd.cups-raster 33 rastertobrlaser
// The 1200dpi mode is weird: we need to send 1200x1200dpi raster
// data, but Brother only advertises 1200x600dpi. I wonder what
// is going on there.
Resolution k 1 0 0 0 "300dpi/300 DPI"
*Resolution k 1 0 0 0 "600dpi/600 DPI"
Resolution k 1 0 0 0 "1200dpi/1200HQ"
@ -87,6 +86,7 @@ Option "brlaserEconomode/Toner save mode" Boolean AnySetup 10
Attribute "NickName" "" "Brother DCP-7030, using @PACKAGE@ v@VERSION@"
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP;MDL:DCP-7030;CLS:PRINTER;"
PCFileName "br7030.ppd"
Resolution k 1 0 0 0 "300dpi/300 DPI"
}
{
@ -94,6 +94,7 @@ Option "brlaserEconomode/Toner save mode" Boolean AnySetup 10
Attribute "NickName" "" "Brother DCP-7055, using @PACKAGE@ v@VERSION@"
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP;MDL:DCP-7055;CLS:PRINTER;CID:Brother Laser Type1;"
PCFileName "br7055.ppd"
Resolution k 1 0 0 0 "300dpi/300 DPI"
}
{
@ -109,4 +110,5 @@ Option "brlaserEconomode/Toner save mode" Boolean AnySetup 10
Attribute "NickName" "" "Brother DCP-7065DN, using @PACKAGE@ v@VERSION@"
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP;MDL:DCP-7065DN;CLS:PRINTER;CID:Brother Laser Type1;"
PCFileName "br7065dn.ppd"
Duplex rotated
}

View File

@ -73,10 +73,16 @@ void job::write_page_header() {
fprintf(out_, "@PJL SET PAGEPROTECT = AUTO\n");
fprintf(out_, "@PJL SET ORIENTATION = PORTRAIT\n");
fprintf(out_, "@PJL ENTER LANGUAGE = PCL\n");
fputs("\033E", out_);
fprintf(out_, "\033&l%dX", std::max(1, page_params_.num_copies));
if (page_params_.duplex) {
fputs("\033&l2S", out_);
}
}
void job::encode_page(const page_params &page_params,
int num_copies,
int lines,
int linesize,
nextline_fn nextline) {
@ -95,8 +101,6 @@ void job::encode_page(const page_params &page_params,
block.add_line(encode_line(line));
std::swap(line, reference);
fputs("\033E", out_);
fprintf(out_, "\033&l%dX", std::max(1, num_copies));
fputs("\033*b1030m", out_);
for (int i = 1; i < lines && nextline(line.data()); ++i) {

View File

@ -23,14 +23,18 @@
#include <string>
struct page_params {
int num_copies;
int resolution;
bool duplex;
bool economode;
std::string sourcetray;
std::string mediatype;
std::string papersize;
bool operator==(const page_params &o) const {
return resolution == o.resolution
return num_copies == o.num_copies
&& resolution == o.resolution
&& duplex == o.duplex
&& economode == o.economode
&& sourcetray == o.sourcetray
&& mediatype == o.mediatype
@ -46,7 +50,6 @@ class job {
~job();
void encode_page(const page_params &params,
int num_copies,
int lines,
int linesize,
nextline_fn nextline);

View File

@ -107,9 +107,11 @@ page_params build_page_params() {
};
page_params p = { };
p.num_copies = header.NumCopies;
p.resolution = header.HWResolution[0];
p.economode = header.cupsInteger[10];
p.mediatype = header.MediaType;
p.duplex = header.Duplex;
if (header.MediaPosition < sources.size())
p.sourcetray = sources[header.MediaPosition];
@ -182,7 +184,6 @@ int main(int argc, char *argv[]) {
dump_page_header(header);
}
job.encode_page(build_page_params(),
header.NumCopies,
header.cupsHeight,
header.cupsBytesPerLine,
next_line);