mirror of
https://github.com/pdewacht/brlaser
synced 2025-04-07 05:06:45 +02:00
Move num_copies to only the header
It's not needed to be at the beginning of every page and messes up duplex printing if it is
This commit is contained in:
parent
03bb366e75
commit
5c5118edc1
@ -73,10 +73,12 @@ void job::write_page_header() {
|
|||||||
fprintf(out_, "@PJL SET PAGEPROTECT = AUTO\n");
|
fprintf(out_, "@PJL SET PAGEPROTECT = AUTO\n");
|
||||||
fprintf(out_, "@PJL SET ORIENTATION = PORTRAIT\n");
|
fprintf(out_, "@PJL SET ORIENTATION = PORTRAIT\n");
|
||||||
fprintf(out_, "@PJL ENTER LANGUAGE = PCL\n");
|
fprintf(out_, "@PJL ENTER LANGUAGE = PCL\n");
|
||||||
|
|
||||||
|
fputs("\033E", out_);
|
||||||
|
fprintf(out_, "\033&l%dX", std::max(1, page_params_.num_copies));
|
||||||
}
|
}
|
||||||
|
|
||||||
void job::encode_page(const page_params &page_params,
|
void job::encode_page(const page_params &page_params,
|
||||||
int num_copies,
|
|
||||||
int lines,
|
int lines,
|
||||||
int linesize,
|
int linesize,
|
||||||
nextline_fn nextline) {
|
nextline_fn nextline) {
|
||||||
@ -95,8 +97,6 @@ void job::encode_page(const page_params &page_params,
|
|||||||
block.add_line(encode_line(line));
|
block.add_line(encode_line(line));
|
||||||
std::swap(line, reference);
|
std::swap(line, reference);
|
||||||
|
|
||||||
fputs("\033E", out_);
|
|
||||||
fprintf(out_, "\033&l%dX", std::max(1, num_copies));
|
|
||||||
fputs("\033*b1030m", out_);
|
fputs("\033*b1030m", out_);
|
||||||
|
|
||||||
for (int i = 1; i < lines && nextline(line.data()); ++i) {
|
for (int i = 1; i < lines && nextline(line.data()); ++i) {
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
struct page_params {
|
struct page_params {
|
||||||
|
int num_copies;
|
||||||
int resolution;
|
int resolution;
|
||||||
bool economode;
|
bool economode;
|
||||||
std::string sourcetray;
|
std::string sourcetray;
|
||||||
@ -30,7 +31,8 @@ struct page_params {
|
|||||||
std::string papersize;
|
std::string papersize;
|
||||||
|
|
||||||
bool operator==(const page_params &o) const {
|
bool operator==(const page_params &o) const {
|
||||||
return resolution == o.resolution
|
return num_copies == o.num_copies
|
||||||
|
&& resolution == o.resolution
|
||||||
&& economode == o.economode
|
&& economode == o.economode
|
||||||
&& sourcetray == o.sourcetray
|
&& sourcetray == o.sourcetray
|
||||||
&& mediatype == o.mediatype
|
&& mediatype == o.mediatype
|
||||||
@ -46,7 +48,6 @@ class job {
|
|||||||
~job();
|
~job();
|
||||||
|
|
||||||
void encode_page(const page_params ¶ms,
|
void encode_page(const page_params ¶ms,
|
||||||
int num_copies,
|
|
||||||
int lines,
|
int lines,
|
||||||
int linesize,
|
int linesize,
|
||||||
nextline_fn nextline);
|
nextline_fn nextline);
|
||||||
|
@ -107,6 +107,7 @@ page_params build_page_params() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
page_params p = { };
|
page_params p = { };
|
||||||
|
p.num_copies = header.NumCopies;
|
||||||
p.resolution = header.HWResolution[0];
|
p.resolution = header.HWResolution[0];
|
||||||
p.economode = header.cupsInteger[10];
|
p.economode = header.cupsInteger[10];
|
||||||
p.mediatype = header.MediaType;
|
p.mediatype = header.MediaType;
|
||||||
@ -182,7 +183,6 @@ int main(int argc, char *argv[]) {
|
|||||||
dump_page_header(header);
|
dump_page_header(header);
|
||||||
}
|
}
|
||||||
job.encode_page(build_page_params(),
|
job.encode_page(build_page_params(),
|
||||||
header.NumCopies,
|
|
||||||
header.cupsHeight,
|
header.cupsHeight,
|
||||||
header.cupsBytesPerLine,
|
header.cupsBytesPerLine,
|
||||||
next_line);
|
next_line);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user